Skip to content

Commit

Permalink
Issue #PS-000 feat: Fixed lint issues and cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
itsvick committed Jul 29, 2024
1 parent fe72675 commit c104587
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 90 deletions.
6 changes: 3 additions & 3 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
"MY_PROFILE": "My Profile",
"VIEW_MORE": "View More",
"VIEW_LESS": "View Less",
"DATA_RANAGE": "Data Range",
"DATA_RANGE": "Data Range",
"LEARNER_DETAILS": "Learner Details",
"VIEW_DAY_WISE": "View Day-Wise",
"SUBMITTED_ON": "Submitted On",
Expand Down Expand Up @@ -265,8 +265,8 @@
"STEP_2": "Use the calendar to view day-wise attendance of learners",
"STEP_3": "Check daily attendance percentage for each Center",
"STEP_4": "Mark each day’s attendance of learners",
"STEP_5": "Check Center attendance over the last 7 days",
"STEP_6": "View learners with low attendance in the past 7 days",
"STEP_5": "Check Center attendance over the last {{numberOfDays}} days",
"STEP_6": "View learners with low attendance in the past {{numberOfDays}} days",
"PREVIOUS": "Previous",
"NEXT": "Next",
"SKIP": "Skip",
Expand Down
6 changes: 3 additions & 3 deletions public/locales/hi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
"MY_PROFILE": "मेरी प्रोफ़ाइल",
"VIEW_MORE": "अधिक देखें",
"VIEW_LESS": "कम देखें",
"DATA_RANAGE": "डेटा रेंज़",
"DATA_RANGE": "डेटा रेंज़",
"LEARNER_DETAILS": "विद्यार्थी विवरण",
"VIEW_DAY_WISE": "दिन-वार देखें",
"SUBMITTED_ON": "प्रस्तुत किया गया",
Expand Down Expand Up @@ -243,8 +243,8 @@
"STEP_2": "शिक्षार्थियों की दिन-वार उपस्थिति देखने के लिए कैलेंडर का उपयोग करें",
"STEP_3": "प्रत्येक केंद्र के लिए दैनिक उपस्थिति प्रतिशत की जाँच करें",
"STEP_4": "शिक्षार्थियों की प्रत्येक दिन की उपस्थिति को चिह्नित करें",
"STEP_5": "पिछले 7 दिनों में केंद्र की उपस्थिति की जाँच करें",
"STEP_6": "पिछले 7 दिनों में कम उपस्थिति वाले शिक्षार्थियों को देखें",
"STEP_5": "पिछले {{numberOfDays}} दिनों में केंद्र की उपस्थिति की जाँच करें",
"STEP_6": "पिछले {{numberOfDays}} दिनों में कम उपस्थिति वाले शिक्षार्थियों को देखें",
"PREVIOUS": "पिछला",
"NEXT": "अगला",
"SKIP": "छोड़ें",
Expand Down
6 changes: 3 additions & 3 deletions public/locales/mr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"MY_PROFILE": "माझी प्रोफाइल",
"VIEW_MORE": "अधिक पाहा",
"VIEW_LESS": "कमी करा",
"DATA_RANAGE": "डेटा श्रेणी",
"DATA_RANGE": "डेटा श्रेणी",
"LEARNER_DETAILS": "विद्यार्थी तपशील",
"VIEW_DAY_WISE": "दिवस-निहाय पहा",
"SUBMITTED_ON": "सादर केले",
Expand Down Expand Up @@ -243,8 +243,8 @@
"STEP_2": "शिक्षार्थ्यांची दिवसवार उपस्थिती पाहण्यासाठी कॅलेंडर वापरा",
"STEP_3": "प्रत्येक केंद्रासाठी दैनंदिन उपस्थिती टक्केवारी तपासा",
"STEP_4": "शिक्षार्थ्यांची प्रत्येक दिवसाची उपस्थिती चिन्हांकित करा",
"STEP_5": "शेवटच्या 7 दिवसांत केंद्राची उपस्थिती तपासा",
"STEP_6": "शेवटच्या 7 दिवसांत कमी उपस्थिती असलेले शिक्षार्थी पहा",
"STEP_5": "शेवटच्या {{numberOfDays}} दिवसांत केंद्राची उपस्थिती तपासा",
"STEP_6": "शेवटच्या {{numberOfDays}} दिवसांत कमी उपस्थिती असलेले शिक्षार्थी पहा",
"PREVIOUS": "मागील",
"NEXT": "पुढे",
"SKIP": "वगळा",
Expand Down
2 changes: 1 addition & 1 deletion public/locales/or/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"MY_PROFILE": "ମୋ ପ୍ରୋଫାଇଲ",
"VIEW_MORE": "ଅଧିକ ଦେଖନ୍ତୁ",
"VIEW_LESS": "କମ୍ ଦେଖନ୍ତୁ",
"DATA_RANAGE": "ଡାଟା ରେଞ୍ଜ",
"DATA_RANGE": "ଡାଟା ରେଞ୍ଜ",
"LEARNER_DETAILS": "ଶିକ୍ଷାର୍ଥୀ ବିବରଣୀ",
"VIEW_DAY_WISE": "ଦିନ-ଅନୁସାରେ ବିବରଣୀ ଦେଖନ୍ତୁ",
"SUBMITTED_ON": "ସବ୍ମିଟ୍/ଦାଖଲ କରାଯାଇଛି",
Expand Down
23 changes: 12 additions & 11 deletions src/components/CohortSelectionSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import {
SelectChangeEvent,
Typography,
} from '@mui/material';
import React, { useEffect } from 'react';
import { usePathname, useRouter } from 'next/navigation';
import React, { useEffect } from 'react';

import Loader from './Loader';
import ReactGA from 'react-ga4';
import { getCohortList } from '@/services/CohortServices';
import useStore from '@/store/store';
import { cohort } from '@/utils/Interfaces';
import { cohortHierarchy } from '@/utils/app.constant';
import { getCohortList } from '@/services/CohortServices';
import { showToastMessage } from './Toastify';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'next-i18next';
import useStore from '@/store/store';
import ReactGA from 'react-ga4';
import Loader from './Loader';
import { showToastMessage } from './Toastify';

interface CohortSelectionSectionProps {
classId: string;
Expand Down Expand Up @@ -109,15 +109,14 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
const extractNamesAndCohortTypes = (
data: ChildData[]
): NameTypePair[] => {
let nameTypePairs: NameTypePair[] = [];

const nameTypePairs: NameTypePair[] = [];
const recursiveExtract = (items: ChildData[]) => {
items.forEach((item) => {
const cohortType =
item?.customField?.find(
(field) => field.label === 'TYPE_OF_COHORT'
)?.value || 'Unknown';
if (item?.cohortId && item && item?.name) {
if (item?.cohortId && item?.name) {
nameTypePairs.push({
cohortId: item?.cohortId,
name: item?.name,
Expand All @@ -133,7 +132,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
return nameTypePairs;
};

if (response && response?.length > 0) {
if (response?.length > 0) {
const nameTypePairs = extractNamesAndCohortTypes(response);
setCohorts(nameTypePairs);
}
Expand Down Expand Up @@ -292,6 +291,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
fontWeight: '500',
fontSize: '14px',
color: '#4D4639',
textTransform: 'capitalize'
}}
>
{cohort.name}
Expand Down Expand Up @@ -350,9 +350,10 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
fontWeight: '500',
fontSize: '14px',
color: '#4D4639',
textTransform: 'capitalize'
}}
>
{cohort.name}
{cohort?.name}
</MenuItem>
))
) : (
Expand Down
4 changes: 1 addition & 3 deletions src/components/LearnerAttendanceStatsListView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Grid, Stack, Typography, useMediaQuery } from '@mui/material';
import { Box, Grid, Stack, Typography } from '@mui/material';
import React, { useState } from 'react';
import { Status, names } from '@/utils/app.constant';
import { UserData, updateCustomField } from '@/utils/Interfaces';
Expand Down Expand Up @@ -144,7 +144,6 @@ const StudentsStatsList: React.FC<StudentsStatsListProps> = ({
</Link>
</Grid>
{memberStatus === Status.DROPOUT ? (
<>
<Grid item xs={6}>
<Grid container>
<Grid xs={6}>
Expand Down Expand Up @@ -173,7 +172,6 @@ const StudentsStatsList: React.FC<StudentsStatsListProps> = ({
</Grid>
<DropoutLabel />
</Grid>
</>
) : (
<>
<Grid item xs={3}>
Expand Down
36 changes: 16 additions & 20 deletions src/pages/centers/index.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,39 @@
import { getCohortList } from '@/services/CohortServices';
import { accessGranted, toPascalCase } from '@/utils/Helper';
import { cohort } from '@/utils/Interfaces';
import {
Box,
Button,
FormControl,
Grid,
InputAdornment,
MenuItem,
Select,
Tab,
Tabs,
TextField,
} from '@mui/material';
import React, { useEffect, useState } from 'react';
import FilterModalCenter from '../blocks/components/FilterModalCenter';
import { accessGranted, toPascalCase } from '@/utils/Helper';
import { cohort, cohortAttendancePercentParam } from '@/utils/Interfaces';
import { cohortList, getCohortList } from '@/services/CohortServices';

import AddIcon from '@mui/icons-material/Add';
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
import CreateCenterModal from '@/components/center/CreateCenterModal';
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
import Header from '@/components/Header';
import Image from 'next/image';
import Loader from '@/components/Loader';
import ManageUser from '@/components/ManageUser';
import { Role } from '@/utils/app.constant';
import SearchIcon from '@mui/icons-material/Search';
import SmartDisplayOutlinedIcon from '@mui/icons-material/SmartDisplayOutlined';
import { accessControl } from '../../../app.config';
import building from '../../assets/images/apartment.png';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { setTimeout } from 'timers';
import { showToastMessage } from '@/components/Toastify';
import { useRouter } from 'next/router';
import CreateCenterModal from '@/components/center/CreateCenterModal';
import teamLeadStore from '@/store/mangageTLStore';
import useStore from '@/store/store';
import { Role } from '@/utils/app.constant';
import { ArrowDropDown, Search } from '@mui/icons-material';
import AddIcon from '@mui/icons-material/Add';
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
import SmartDisplayOutlinedIcon from '@mui/icons-material/SmartDisplayOutlined';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'next-i18next';
import { ArrowDropDown, Search } from '@mui/icons-material';
import teamLeadStore from '@/store/mangageTLStore';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import Image from 'next/image';
import { useRouter } from 'next/router';
import { setTimeout } from 'timers';
import { accessControl } from '../../../app.config';
import building from '../../assets/images/apartment.png';

const TeachingCenters = () => {
const [loading, setLoading] = useState(false);
Expand Down
73 changes: 31 additions & 42 deletions src/pages/dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,53 @@
'use client';

import {
AttendancePercentageProps,
cohort,
cohortAttendancePercentParam,
cohortMemberList,
} from '../utils/Interfaces';
import { Box, Button, Grid, Stack, Typography } from '@mui/material';
import { CircularProgressbar, buildStyles } from 'react-circular-progressbar';
import { format, isAfter, isValid, parse, startOfDay } from 'date-fns';
import React, { useEffect } from 'react';
import { accessControl, lowLearnerAttendanceLimit } from './../../app.config';
import { CircularProgressbar, buildStyles } from 'react-circular-progressbar';
import {
classesMissedAttendancePercentList,
getAllCenterAttendance,
getCohortAttendance,
} from '../services/AttendanceService';
import { format, isAfter, isValid, parse, startOfDay } from 'date-fns';
import {
formatSelectedDate,
getTodayDate,
shortDateFormat,
toPascalCase,
} from '../utils/Helper';
import {
AttendancePercentageProps,
cohort,
cohortAttendancePercentParam,
cohortMemberList,
} from '../utils/Interfaces';
import { accessControl, lowLearnerAttendanceLimit } from './../../app.config';


import ArrowForwardSharpIcon from '@mui/icons-material/ArrowForwardSharp';
import AttendanceComparison from '@/components/AttendanceComparison';
import CohortSelectionSection from '@/components/CohortSelectionSection';
import Divider from '@mui/material/Divider';
import GuideTour from '@/components/GuideTour';
import Header from '../components/Header';
import Image from 'next/image';
import Link from 'next/link';
import Loader from '../components/Loader';
import MarkBulkAttendance from '@/components/MarkBulkAttendance';
import OverviewCard from '@/components/OverviewCard';
import ReactGA from 'react-ga4';
import { showToastMessage } from '@/components/Toastify';
import WeekCalender from '@/components/WeekCalender';
import { calculatePercentage } from '@/utils/attendanceStats';
import calendar from '../assets/images/calendar.svg';
import { getMyCohortMemberList } from '@/services/MyClassDetailsService';
import { calculatePercentage } from '@/utils/attendanceStats';
import { logEvent } from '@/utils/googleAnalytics';
import { modifyAttendanceLimit } from '../../app.config';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { showToastMessage } from '@/components/Toastify';
import { useCohortList } from '@/services/queries';
import useDeterminePathColor from '../hooks/useDeterminePathColor';
import { useRouter } from 'next/navigation';
import withAccessControl from '@/utils/hoc/withAccessControl';
import ArrowForwardSharpIcon from '@mui/icons-material/ArrowForwardSharp';
import Divider from '@mui/material/Divider';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'next-i18next';
import withAccessControl from '@/utils/hoc/withAccessControl';
import AttendanceComparison from '@/components/AttendanceComparison';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import Image from 'next/image';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import ReactGA from 'react-ga4';
import { modifyAttendanceLimit } from '../../app.config';
import calendar from '../assets/images/calendar.svg';
import Header from '../components/Header';
import Loader from '../components/Loader';
import useDeterminePathColor from '../hooks/useDeterminePathColor';

// import { Role } from '@/utils/app.constant';
// import { accessControl } from '../../app.config';
Expand Down Expand Up @@ -97,7 +95,6 @@ const Dashboard: React.FC<DashboardProps> = () => {
const formattedSevenDaysAgo = shortDateFormat(sevenDaysAgo);
const [userId, setUserId] = React.useState<string | null>(null);
const [blockName, setBlockName] = React.useState<string>('');


useEffect(() => {
setIsClient(true);
Expand Down Expand Up @@ -142,10 +139,6 @@ const Dashboard: React.FC<DashboardProps> = () => {
}
}, []);

const limit = 0;
const page = 0;
const filters = { userId: userId || '' };

//API for getting student list
useEffect(() => {
const getCohortMemberList = async () => {
Expand Down Expand Up @@ -238,8 +231,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
};
const res = await getCohortAttendance(cohortAttendanceData);
const response = res?.data?.result;
const contextData =
response?.contextId && response?.contextId[classId];
const contextData = response?.contextId?.[classId];
if (contextData?.present_percentage) {
const presentPercent = contextData?.present_percentage;
setCohortPresentPercentage(presentPercent);
Expand Down Expand Up @@ -290,10 +282,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
console.log('Fetched data:', results);

const nameIDAttendanceArray = results
.filter(
(result) =>
!result?.error && result?.data && result?.data?.contextId
)
.filter((result) => !result?.error && result?.data?.contextId)
.map((result) => {
const cohortId = result?.cohortId;
const contextData = result?.data?.contextId[cohortId] || {};
Expand Down Expand Up @@ -572,7 +561,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
<WeekCalender
showDetailsHandle={showDetailsHandle}
data={percentageAttendanceData}
disableDays={classId === 'all' ? true : false}
disableDays={classId === 'all'}
classId={classId}
/>
</Box>
Expand Down Expand Up @@ -893,9 +882,9 @@ const Dashboard: React.FC<DashboardProps> = () => {
</Box>
</Box>
</Box>
<Box p={2}>
<AttendanceComparison />
</Box>
<Box p={2}>
<AttendanceComparison />
</Box>
{/* <Box sx={{ background: '#fff' }}>
<Typography
textAlign={'left'}
Expand Down
10 changes: 8 additions & 2 deletions src/utils/app.constant.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-unused-vars */
export const limit: number = 300;
export const refetchInterval: number = 5 * 60 * 1000;
export const gcTime: number = 10 * 60 * 1000;
export const refetchInterval: number = 5 * 60 * 1000; // 5 min
export const gcTime: number = 10 * 60 * 1000; // 10 Min
export const names = [
'name',
'age',
Expand Down Expand Up @@ -51,6 +52,11 @@ export enum FormContextType {
TEAM_LEADER = 'TEAMLEADER',
}

export enum CenterType {
REGULAR = 'REGULAR',
REMOTE = 'REMOTE'
}

export enum RoleId {
STUDENT = '493c04e2-a9db-47f2-b304-503da358d5f4',
TEACHER = '3bde0028-6900-4900-9d05-eeb608843718',
Expand Down
Loading

0 comments on commit c104587

Please sign in to comment.