Skip to content

Commit

Permalink
Issue #PS-000 feat: Fixed lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
itsvick committed Jul 29, 2024
1 parent 3e96857 commit 78bbdde
Show file tree
Hide file tree
Showing 26 changed files with 253 additions and 276 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
}
],
"prefer-const": "error",
"react-hooks/exhaustive-deps": "error"
"react-hooks/exhaustive-deps": "off"
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Shiksha is a next-generation scalable open-source learning solution for teachers
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## new changes

### Prerequisites

<table>
Expand Down
2 changes: 1 addition & 1 deletion app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ export const fullWidthPages = [
'/500',
'/offline',
'/unauthorized',
];
];
8 changes: 4 additions & 4 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,9 @@
"MAX_LENGTH_CHARACTERS_ERROR": "Maximum {{maxLength}} characters allowed",
"NUMBER_AND_SPECIAL_CHARACTERS_NOT_ALLOWED": "Numbers and special characters are not allowed"
},
"COURSE_PLANNER":{
"COURSE_PLANNER" :"Course Plan",
"FOUNDATION_COURSE":"Foundation Course",
"MAIN_COURSE":"Main Course"
"COURSE_PLANNER": {
"COURSE_PLANNER": "Course Plan",
"FOUNDATION_COURSE": "Foundation Course",
"MAIN_COURSE": "Main Course"
}
}
8 changes: 3 additions & 5 deletions public/locales/or/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"AS_OF_TODAY_DATE": "ଆଜି ଅନୁସାରେ {{day_date}}",
"LEARNER": "ଶିକ୍ଷାର୍ଥୀ",
"ATTENDANCE_COMPARISON": "ଉପସ୍ଥିତି ତୁଳନ",
"CENTER_TYPE":"କେନ୍ଦ୍ର ପ୍ରକାର",
"CENTER_TYPE": "କେନ୍ଦ୍ର ପ୍ରକାର",
"BLOCK_AVERAGE_ATTENDANCE": "ବ୍ଲକ ହାରାହାର ଉପସ୍ଥିତି"
},
"ATTENDANCE": {
Expand Down Expand Up @@ -220,12 +220,10 @@
"REQUEST_TO_DELETE": "ହଟାଇବାକୁ ଅନୁରୋଧ",
"RENAME": "ପୁନ ame ନାମ କରନ୍ତୁ",
"CENTER_RENAMED": "କେନ୍ଦ୍ରର ନାମ ସଫଳତାର ସହ ଚାଲିଛି!",
"SEND_REQUEST":"ଅନୁରୋଧ ପଠାନ୍ତୁ",
"SEND_REQUEST": "ଅନୁରୋଧ ପଠାନ୍ତୁ",
"REQUEST_TO_DELETE_HAS_BEEN_SENT": "ହଟାଇବାକୁ ଅନୁରୋଧ ପଠାଯାଇଛି",
"YOU_ARE_SENDING_REQUEST_TO_THE_STATE_ADMIN": "ଆପଣ ଏହି କେନ୍ଦ୍ରଟିକୁ ବିଲୋପ କରିବା ପାଇଁ ରାଜ୍ୟ ପ୍ରଶାସନକୁ ଅନୁରୋଧ ପଠାଉଛନ୍ତି",
"THE_USER_BELONGS_TO_THE_FOLLOWING_COHORT": "ୟୁଜର ନିମ୍ନଲିଖିତ ସମୁହର ସଦସ୍ୟ: ",
"PLEASE_REMOVE_THE_USER_FROM_COHORT": "ଦୟାକରି ହଟାଇବା ପୂର୍ବରୁ ୟୁଜରକୁ ଏହି ସମୁହଗୁଡିକରୁ କାଢ଼ି ଦିଅନ୍ତୁ।"

}
}

}
50 changes: 22 additions & 28 deletions src/components/AddFacilitator.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
import { FormContext, FormContextType } from '@/utils/app.constant';
import {
GenerateSchemaAndUiSchema,
customFields,
} from '@/components/GeneratedSchemas';
import { FormContext, FormContextType, RoleId } from '@/utils/app.constant';
import React, { useEffect } from 'react';

import { Box } from '@mui/material';
import DynamicForm from '@/components/DynamicForm';
import { Field } from '@/utils/Interfaces';
import { FormData } from '@/utils/Interfaces';
import { IChangeEvent } from '@rjsf/core';
import ISubmitEvent from '@rjsf/core';
import { RJSFSchema } from '@rjsf/utils';
import SendCredentialModal from '@/components/SendCredentialModal';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { createUser, getFormRead } from '@/services/CreateUserService';
import { RoleId } from '@/utils/app.constant';
import SimpleModal from '@/components/SimpleModal';
import { createUser, getFormRead } from '@/services/CreateUserService';
import { generateUsernameAndPassword } from '@/utils/Helper';
import { Field, FormData } from '@/utils/Interfaces';
import { IChangeEvent } from '@rjsf/core';
import { RJSFSchema } from '@rjsf/utils';
import { useTranslation } from 'next-i18next';

interface AddFacilitatorModalprops {
Expand All @@ -41,10 +36,11 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
FormContextType.TEACHER
);
console.log('sortedFields', response);
let centerOptionsList;
if (typeof window !== 'undefined' && window.localStorage) {
const CenterList = localStorage.getItem('CenterList');
const centerOptions = CenterList ? JSON.parse(CenterList) : [];
var centerOptionsList = centerOptions.map(
centerOptionsList = centerOptions.map(
(center: { cohortId: string; cohortName: string }) => ({
value: center.cohortId,
label: center.cohortName,
Expand Down Expand Up @@ -114,7 +110,7 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({

const { username, password } = generateUsernameAndPassword('MH', 'F');

let apiBody: any = {
const apiBody: any = {
username: username,
password: password,
tenantCohortRoleMapping: [
Expand All @@ -138,27 +134,25 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
if (typeof fieldValue !== 'object') {
apiBody[fieldKey] = fieldValue;
}
} else if (
Object.hasOwn(fieldSchema, 'isDropdown') ||
Object.hasOwn(fieldSchema, 'isCheckbox')
) {
apiBody.customFields.push({
fieldId: fieldId,
value: [String(fieldValue)],
});
} else {
if (
fieldSchema?.hasOwnProperty('isDropdown') ||
fieldSchema.hasOwnProperty('isCheckbox')
) {
apiBody.customFields.push({
fieldId: fieldId,
value: [String(fieldValue)],
});
} else {
apiBody.customFields.push({
fieldId: fieldId,
value: String(fieldValue),
});
}
apiBody.customFields.push({
fieldId: fieldId,
value: String(fieldValue),
});
}
});

if (typeof window !== 'undefined' && window.localStorage) {
var teamLeaderData = JSON.parse(
localStorage.getItem('teamLeadApp') || ''
const teamLeaderData = JSON.parse(
localStorage.getItem('teamLeadApp') ?? ''
);
console.log(teamLeaderData);
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/AddLeanerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
const formData = data.formData;
console.log('Form data submitted:', formData);
const schemaProperties = schema.properties;
let cohortId;
let cohortId, teacherData;
if (typeof window !== 'undefined' && window.localStorage) {
var teacherData = JSON.parse(localStorage.getItem('teacherApp') || '');
teacherData = JSON.parse(localStorage.getItem('teacherApp') || '');
cohortId =
localStorage.getItem('cohortId') || localStorage.getItem('classId');
}
Expand All @@ -96,7 +96,7 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
''
);

let apiBody: any = {
const apiBody: any = {
username: username,
password: password,
tenantCohortRoleMapping: [
Expand Down
4 changes: 2 additions & 2 deletions src/components/CohortSelectionSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
fontWeight: '500',
fontSize: '14px',
color: '#4D4639',
textTransform: 'capitalize'
textTransform: 'capitalize',
}}
>
{cohort.name}
Expand Down Expand Up @@ -350,7 +350,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
fontWeight: '500',
fontSize: '14px',
color: '#4D4639',
textTransform: 'capitalize'
textTransform: 'capitalize',
}}
>
{cohort?.name}
Expand Down
52 changes: 26 additions & 26 deletions src/components/LearnerAttendanceStatsListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,34 +144,34 @@ const StudentsStatsList: React.FC<StudentsStatsListProps> = ({
</Link>
</Grid>
{memberStatus === Status.DROPOUT ? (
<Grid item xs={6}>
<Grid container>
<Grid xs={6}>
<Typography
fontSize="1rem"
fontWeight="bold"
lineHeight="1.5rem"
// color={theme.palette.text.primary}
color={textColor}
textAlign="center"
>
{presentPercent}%
</Typography>
</Grid>
<Grid item xs={6}>
<Typography
fontSize="1rem"
fontWeight="bold"
lineHeight="1.5rem"
color={theme.palette.text.primary}
textAlign="center"
>
{classesMissed}
</Typography>
</Grid>
<Grid item xs={6}>
<Grid container>
<Grid xs={6}>
<Typography
fontSize="1rem"
fontWeight="bold"
lineHeight="1.5rem"
// color={theme.palette.text.primary}
color={textColor}
textAlign="center"
>
{presentPercent}%
</Typography>
</Grid>
<Grid item xs={6}>
<Typography
fontSize="1rem"
fontWeight="bold"
lineHeight="1.5rem"
color={theme.palette.text.primary}
textAlign="center"
>
{classesMissed}
</Typography>
</Grid>
<DropoutLabel />
</Grid>
<DropoutLabel />
</Grid>
) : (
<>
<Grid item xs={3}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/LearnerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const LearnerModal = ({
? toPascalCase(item.displayValue.join(', '))
: item?.displayValue
? toPascalCase(item.displayValue)
: "-"}
: '-'}
</Typography>
{/* </Box> */}
</Grid>
Expand Down Expand Up @@ -198,7 +198,7 @@ const LearnerModal = ({
whiteSpace: 'normal',
}}
>
{contactNumber ? contactNumber : "-"}
{contactNumber ? contactNumber : '-'}
</Typography>
</Box>
</Grid>
Expand Down
9 changes: 4 additions & 5 deletions src/components/LearnersListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const LearnersListItem: React.FC<LearnerListProps> = ({
const { t } = useTranslation();
const [openCentersModal, setOpenCentersModal] = React.useState(false);
const [openDeleteUserModal, setOpenDeleteUserModal] = React.useState(false);
const [centers, setCenters] = React.useState();
const [centers, setCenters] = React.useState();
const store = manageUserStore();

const CustomLink = styled(Link)(({ theme }) => ({
Expand All @@ -95,10 +95,9 @@ const [centers, setCenters] = React.useState();
setReloadState(false);
// window.location.reload();
}
const cohorts = userStore.cohorts
const centerList = cohorts.map((cohort: { name: string; }) => cohort.name);
setCenters(centerList);

const cohorts = userStore.cohorts;
const centerList = cohorts.map((cohort: { name: string }) => cohort.name);
setCenters(centerList);
}, [reloadState, setReloadState]);

const toggleDrawer =
Expand Down
63 changes: 31 additions & 32 deletions src/components/center/DeleteCenterModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ const DeleteCenterModal: React.FC<CreateBlockModalProps> = ({
const { t } = useTranslation();
const theme = useTheme<any>();



const handleDeleteButtonClick = () => {
console.log('Delete request sent');
showToastMessage(t('CENTERS.REQUEST_TO_DELETE_HAS_BEEN_SENT'), 'success');
Expand All @@ -66,47 +64,48 @@ const DeleteCenterModal: React.FC<CreateBlockModalProps> = ({
transform: 'translate(-50%, -50%)',
}}
>
<Typography variant="body2" color="textSecondary" sx={{ mb: 2, mt: 2 }}>

{t('CENTERS.YOU_ARE_SENDING_REQUEST_TO_THE_STATE_ADMIN')}
<Typography
variant="body2"
color="textSecondary"
sx={{ mb: 2, mt: 2 }}
>
{t('CENTERS.YOU_ARE_SENDING_REQUEST_TO_THE_STATE_ADMIN')}
</Typography>
<Divider sx={{ mb: 2, mx: -2 }} />
<Box
sx={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',

pl: 1,
pr: 2,
}}
>
<Button
variant="outlined"
onClick={handleClose}
sx={{
width: '60%',
border: 'none',
color: theme?.palette?.secondary?.main,
mb: 2,
}}
>

{t('COMMON.CANCEL')}
</Button>
<Button
variant="outlined"
onClick={handleDeleteButtonClick}
sx={{
width: '100%',
border: 'none',
backgroundColor: theme?.palette?.primary?.main,
mb: 2,
}}
>

{t('CENTERS.SEND_REQUEST')}
</Button>
<Button
variant="outlined"
onClick={handleClose}
sx={{
width: '60%',
border: 'none',
color: theme?.palette?.secondary?.main,
mb: 2,
}}
>
{t('COMMON.CANCEL')}
</Button>
<Button
variant="outlined"
onClick={handleDeleteButtonClick}
sx={{
width: '100%',
border: 'none',
backgroundColor: theme?.palette?.primary?.main,
mb: 2,
}}
>
{t('CENTERS.SEND_REQUEST')}
</Button>
</Box>
</Box>
</Fade>
Expand Down
Loading

0 comments on commit 78bbdde

Please sign in to comment.