From f621e508115dacdb54a9d7df08d3e4cfb9928096 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Thu, 20 Jun 2024 11:55:17 +0530 Subject: [PATCH 1/7] Issue #PS-793 feat: Added UI for mark as dropout and remove learner from cohort functionality and added translations for it --- public/locales/en/common.json | 2 + public/locales/hi/common.json | 2 + public/locales/mr/common.json | 2 + public/locales/or/common.json | 4 +- src/components/BottomDrawer.tsx | 29 +++++++ src/components/CohortLearnerList.tsx | 3 +- src/components/DropOutModal.tsx | 61 ++++++++----- src/components/LearnersList.tsx | 124 ++++++++++++++++++++------- 8 files changed, 170 insertions(+), 57 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index a676842f..8ae4488d 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -54,6 +54,7 @@ "FROM_TO_DATE": "From - To dates", "REMOVE": "Remove", "MARK_DROP_OUT": "Mark as Drop Out", + "UNMARK_DROP_OUT": "Unmark as Drop Out", "SOMETHING_WENT_WRONG": "Something went wrong", "NO_GO_BACK":"No, go back", "YES":"Yes", @@ -66,6 +67,7 @@ "REASON_FOR_DROPOUT":"Reason for Dropout", "SURE_LOGOUT" :"Are you sure you want to Logout?", "SURE_UPDATE" :"Are you sure you want to update this attendance?", + "SURE_REMOVE" : "Are you sure you want to remove this learner?", "SURE_CLOSE":"Are you sure you want to close?", "LEARNER_LIST":"Learners List", "FILTERS":"Filters", diff --git a/public/locales/hi/common.json b/public/locales/hi/common.json index 6e5ba72e..58da4151 100644 --- a/public/locales/hi/common.json +++ b/public/locales/hi/common.json @@ -54,6 +54,7 @@ "FROM_TO_DATE": "से - दिनांक तक", "REMOVE": "हटाएं", "MARK_DROP_OUT": "ड्रॉप आउट के रूप में चिह्नित करें", + "UNMARK_DROP_OUT": "ड्रॉप आउट के रूप में हटाएं", "SOMETHING_WENT_WRONG": "कुछ गलत हो गया", "YES": "हाँ", "NO_GO_BACK": "नहीं, वापस जाएँ", @@ -66,6 +67,7 @@ "REASON_FOR_DROPOUT": "ड्रॉपआउट का कारण", "SURE_LOGOUT": "क्या आप वाकई लोगआउट करना चाहते हैं?", "SURE_UPDATE": "क्या आप इस उपस्थिति को अपडेट करना चाहते हैं?", + "SURE_REMOVE" : "क्या आप वाकई इस शिक्षार्थी को हटाना चाहते हैं?", "SURE_CLOSE": "क्या आप वाकई बंद करना चाहते हैं?", "LEARNER_LIST": "अभियांत्रिकी सूची", "FILTERS": "फिल्टर्स", diff --git a/public/locales/mr/common.json b/public/locales/mr/common.json index bcd3c419..ff8445c7 100644 --- a/public/locales/mr/common.json +++ b/public/locales/mr/common.json @@ -54,6 +54,7 @@ "FROM_TO_DATE": "पासून - पर्यंत तारीख", "REMOVE": "काढून टाका", "MARK_DROP_OUT": "ड्रॉप आउट म्हणून चिन्हांकित करा", + "UNMARK_DROP_OUT": "ड्रॉप आउट म्हणून काढून टाका", "SOMETHING_WENT_WRONG": "काहीतरी चूक झाली", "NO_GO_BACK": "नाही, परत जा", "YES": "होय", @@ -66,6 +67,7 @@ "REASON_FOR_DROPOUT": "बाहेर पडण्याचे कारण", "SURE_LOGOUT": "तुम्हाला खाते बंद करायचं आहे का?", "SURE_UPDATE": "तुम्हाला ही उपस्थिती अपडेट करायची आहे का?", + "SURE_REMOVE" : "आपण खरोखरच या विद्यार्थ्याला काढून टाकू इच्छिता का?", "SURE_CLOSE": "तुम्हाला हे बंद करायचं आहे का?", "LEARNER_LIST": "शिक्षार्थ्यांची यादी", "FILTERS": "फिल्टर्स", diff --git a/public/locales/or/common.json b/public/locales/or/common.json index 4b34f4c5..4bedf72e 100644 --- a/public/locales/or/common.json +++ b/public/locales/or/common.json @@ -54,7 +54,9 @@ "FROM_TO_DATE": "ରୁ/ଠାରୁ - କୁ ତାରିଖଗୁଡ଼ିକ", "REMOVE": "ହଟାନ୍ତୁ", "MARK_DROP_OUT": "ଡ୍ରପ୍ ଆଉଟ୍ ରୁପରେ ଚିହ୍ନିତ କରନ୍ତୁ", - "SOMETHING_WENT_WRONG": "କିଛି ଭୁଲ ହେଇଗଲା।" + "UNMARK_DROP_OUT": " ଡ୍ରପ୍ ଆଉଟ୍ ଭାବରେ ଅପସାରଣ କରନ୍ତୁ", + "SOMETHING_WENT_WRONG": "କିଛି ଭୁଲ ହେଇଗଲା।", + "SURE_REMOVE" : "ଆପଣ ନିଶ୍ଚିତ ଏହି ଶିକ୍ଷାର୍ଥୀକୁ ହଟାଇବାକୁ ଚାହୁଁଛନ୍ତି କି?" }, "LOGIN_PAGE": { "USERNAME": "ଉପଯୋଗକର୍ତା ନାମ", diff --git a/src/components/BottomDrawer.tsx b/src/components/BottomDrawer.tsx index f711450c..54e55652 100644 --- a/src/components/BottomDrawer.tsx +++ b/src/components/BottomDrawer.tsx @@ -10,6 +10,7 @@ import ListItemIcon from '@mui/material/ListItemIcon'; import ListItemText from '@mui/material/ListItemText'; import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'next-i18next'; +import { Typography } from '@mui/material'; type Anchor = 'bottom'; @@ -25,6 +26,7 @@ interface BottomDrawerProps { name: string; }[]; listItemClick: (event: React.MouseEvent, name: string) => void; + isDropout: boolean; } export default function BottomDrawer({ @@ -32,6 +34,7 @@ export default function BottomDrawer({ state, optionList, listItemClick, + isDropout, }: BottomDrawerProps) { const { t } = useTranslation(); const theme = useTheme(); @@ -53,6 +56,32 @@ export default function BottomDrawer({ > + {isDropout ? ( + + + {t('COMMON.REASON_FOR_DROPOUT')}{' '} + + + {t('COMMON.REASON_FOR_DROPOUT')} + {' '} + {/* TODO: Add reason dynamically from api */} + + ) : null} {optionList.map(({ label, icon, name }, index) => ( diff --git a/src/components/CohortLearnerList.tsx b/src/components/CohortLearnerList.tsx index 42111ec1..36cba55f 100644 --- a/src/components/CohortLearnerList.tsx +++ b/src/components/CohortLearnerList.tsx @@ -15,7 +15,8 @@ const CohortLearnerList = () => { const [userData, setUserData] = React.useState<{}[]>(); const { t } = useTranslation(); // const classId = localStorage.getItem('classId'); - const classId = '18e800d0-11c4-4a8c-af97-8f9811976ed6'; // TODO: get userId as a prop or from localStorage dynamically + // const classId = '18e800d0-11c4-4a8c-af97-8f9811976ed6'; // TODO: get userId as a prop or from localStorage dynamically + const classId = 'd159ca3d-0c3c-4317-a431-924ba59d451c'; // TODO: get userId as a prop or from localStorage dynamically useEffect(() => { const getCohortMemberList = async () => { diff --git a/src/components/DropOutModal.tsx b/src/components/DropOutModal.tsx index e4c2bcd6..16e14006 100644 --- a/src/components/DropOutModal.tsx +++ b/src/components/DropOutModal.tsx @@ -13,18 +13,24 @@ import { SelectChangeEvent, Typography, } from '@mui/material'; -import { Theme, useTheme } from '@mui/material/styles'; +import { useTheme } from '@mui/material/styles'; import CloseIcon from '@mui/icons-material/Close'; import { useTranslation } from 'next-i18next'; +import { dropoutReasons } from '../../app.config'; interface DropOutModalProps { open: boolean; - onClose: (confirmed: boolean) => void; + onClose: (confirmed: boolean, reason?: string) => void; } function DropOutModal({ open, onClose }: DropOutModalProps) { + const [selectedReason, setSelectedReason] = React.useState(''); + const [isDisabled, setIsDisabled] = React.useState(true); + + const { t } = useTranslation(); + const theme = useTheme(); const style = { position: 'absolute', @@ -40,7 +46,19 @@ function DropOutModal({ open, onClose }: DropOutModalProps) { }, }; - const theme = useTheme(); + const handleSelection = (event: SelectChangeEvent) => { + setSelectedReason(event.target.value); + setIsDisabled(false) + }; + + const handleMarkDropout = () => { + onClose(true, selectedReason); + console.log('Dropout api called') + setIsDisabled(true) + // console.log('!!!!!!!!!!!!!!!!!!!!!!!!', selectedReason) + // call dropout api here + }; + return ( @@ -88,25 +106,23 @@ function DropOutModal({ open, onClose }: DropOutModalProps) { labelId="demo-multiple-name-label" id="demo-multiple-name" input={} + onChange={handleSelection} > - - Unable to cope with studies {/* come from API */} - - - Family responsibilities {/* come from API */} - + {dropoutReasons?.map((reason) => ( + + {reason.label + .replace(/_/g, ' ') + .toLowerCase() + .replace(/^\w/, (c) => c.toUpperCase())} + + ))} @@ -118,7 +134,8 @@ function DropOutModal({ open, onClose }: DropOutModalProps) { className="w-100" sx={{ boxShadow: 'none' }} variant="contained" - onClick={() => onClose(true)} + onClick={handleMarkDropout} + disabled={isDisabled} > {t('COMMON.MARK_DROP_OUT')} diff --git a/src/components/LearnersList.tsx b/src/components/LearnersList.tsx index 6af7f764..6c9f699a 100644 --- a/src/components/LearnersList.tsx +++ b/src/components/LearnersList.tsx @@ -6,19 +6,28 @@ import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline'; // import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord'; import MoreVertIcon from '@mui/icons-material/MoreVert'; import NoAccountsIcon from '@mui/icons-material/NoAccounts'; -import React from 'react'; +import React, { useEffect } from 'react'; // import Woman2Icon from '@mui/icons-material/Woman2'; import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'next-i18next'; import { LearnerListProps } from '@/utils/Interfaces'; +import ConfirmationModal from './ConfirmationModal'; type Anchor = 'bottom'; -const LearnersList: React.FC = ({learnerName, isDropout, enrollmentId}) => { +const LearnersList: React.FC = ({ + learnerName, + isDropout, + enrollmentId, +}) => { const [state, setState] = React.useState({ bottom: false, }); + // useEffect(()=>{ + + // },[handleRemoveLearnerFromCohort, ]) //TODO: refresh page on mark/unmark dropout and remove learner + const toggleDrawer = (anchor: Anchor, open: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { @@ -34,14 +43,44 @@ const LearnersList: React.FC = ({learnerName, isDropout, enrol }; const theme = useTheme(); const { t } = useTranslation(); - const [showModal, setShowModal] = React.useState(false); + const [showModal, setShowModal] = React.useState(false); + const [confirmationModalOpen, setConfirmationModalOpen] = + React.useState(false); const listItemClick = (event: React.MouseEvent, name: string) => { if (name === 'mark-drop-out') { setShowModal(true); + } else if (name === 'unmark-drop-out') { + // call api to unmark as dropout + } + else { + setConfirmationModalOpen(true); } }; + const handleAction = () => { + // handleRemoveLearnerFromCohort(); + //Close all modals + //add toast messages on success and failure + console.log( + 'handleRemoveLearnerFromCohort api call' + ); + setConfirmationModalOpen(false); + handleCloseBottomDrawer() + }; + + const handleCloseModel = () => { + setConfirmationModalOpen(false); + }; + + const handleCloseBottomDrawer = () => { + setState({ ...state, bottom: false }); + }; + + const handleDroppedOutLabelClick = () =>{ + console.log('handleDroppedOutLabelClick') + } + return ( <> = ({learnerName, isDropout, enrol */} {learnerName} @@ -84,39 +127,43 @@ const LearnersList: React.FC = ({learnerName, isDropout, enrol 19 y/o */} {isDropout ? ( - - Dropped Out - - - ) : ( + + Dropped Out + + + ) : ( <> - - {/* */} - - {enrollmentId} - - - )} + + {enrollmentId} + + + )} @@ -133,11 +180,11 @@ const LearnersList: React.FC = ({learnerName, isDropout, enrol listItemClick={listItemClick} optionList={[ { - label: t('COMMON.MARK_DROP_OUT'), + label: isDropout ? t('COMMON.UNMARK_DROP_OUT') : t('COMMON.MARK_DROP_OUT'), icon: ( ), - name: 'mark-drop-out', + name: isDropout ? 'unmark-drop-out' : 'mark-drop-out' }, { label: t('COMMON.REMOVE_FROM_CENTER'), @@ -147,9 +194,20 @@ const LearnersList: React.FC = ({learnerName, isDropout, enrol name: 'remove-from-center', }, ]} + isDropout={isDropout} /> setShowModal(false)} /> + ); }; From 6ad0b30ce6cc91894ecfcdee5b5f711aa9a13191 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Thu, 20 Jun 2024 14:54:06 +0530 Subject: [PATCH 2/7] Updated PR to resolved comment: Create generic bottom drawer component --- src/components/BottomDrawer.tsx | 44 +++++----------------------- src/components/CohortLearnerList.tsx | 34 +++++++++++++++++---- src/components/LearnersList.tsx | 36 +++++++++++++++++++++-- 3 files changed, 71 insertions(+), 43 deletions(-) diff --git a/src/components/BottomDrawer.tsx b/src/components/BottomDrawer.tsx index 54e55652..14190f29 100644 --- a/src/components/BottomDrawer.tsx +++ b/src/components/BottomDrawer.tsx @@ -1,16 +1,12 @@ import * as React from 'react'; - import Box from '@mui/material/Box'; import Drawer from '@mui/material/Drawer'; -import DropOutModal from './DropOutModal'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemButton from '@mui/material/ListItemButton'; import ListItemIcon from '@mui/material/ListItemIcon'; import ListItemText from '@mui/material/ListItemText'; import { useTheme } from '@mui/material/styles'; -import { useTranslation } from 'next-i18next'; -import { Typography } from '@mui/material'; type Anchor = 'bottom'; @@ -26,17 +22,16 @@ interface BottomDrawerProps { name: string; }[]; listItemClick: (event: React.MouseEvent, name: string) => void; - isDropout: boolean; + renderCustomContent?: () => React.ReactNode; } -export default function BottomDrawer({ +const BottomDrawer: React.FC = ({ toggleDrawer, state, optionList, listItemClick, - isDropout, -}: BottomDrawerProps) { - const { t } = useTranslation(); + renderCustomContent +}) => { const theme = useTheme(); const list = (anchor: Anchor) => ( @@ -56,32 +51,7 @@ export default function BottomDrawer({ > - {isDropout ? ( - - - {t('COMMON.REASON_FOR_DROPOUT')}{' '} - - - {t('COMMON.REASON_FOR_DROPOUT')} - {' '} - {/* TODO: Add reason dynamically from api */} - - ) : null} + {renderCustomContent && renderCustomContent()} {/* render custom content if provided */} {optionList.map(({ label, icon, name }, index) => ( @@ -110,4 +80,6 @@ export default function BottomDrawer({ ); -} +}; + +export default BottomDrawer; diff --git a/src/components/CohortLearnerList.tsx b/src/components/CohortLearnerList.tsx index 36cba55f..bc2be8e9 100644 --- a/src/components/CohortLearnerList.tsx +++ b/src/components/CohortLearnerList.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import { getMyCohortMemberList } from '@/services/MyClassDetailsService'; import { capitalizeEachWord, @@ -9,15 +9,23 @@ import LearnersList from '@/components/LearnersList'; import { limit } from '@/utils/app.constant'; import { showToastMessage } from './Toastify'; import { useTranslation } from 'next-i18next'; +import { Box, Typography } from '@mui/material'; const CohortLearnerList = () => { const [loading, setLoading] = React.useState(false); const [userData, setUserData] = React.useState<{}[]>(); + const [classId, setClassId] = React.useState(''); const { t } = useTranslation(); - // const classId = localStorage.getItem('classId'); - // const classId = '18e800d0-11c4-4a8c-af97-8f9811976ed6'; // TODO: get userId as a prop or from localStorage dynamically - const classId = 'd159ca3d-0c3c-4317-a431-924ba59d451c'; // TODO: get userId as a prop or from localStorage dynamically + useEffect(() => { + if (typeof window !== 'undefined' && window.localStorage) { + const cohortId = localStorage.getItem('classId'); + if (cohortId) { + setClassId(cohortId); + } + } + }, []); + useEffect(() => { const getCohortMemberList = async () => { setLoading(true); @@ -55,7 +63,7 @@ const CohortLearnerList = () => { } }; getCohortMemberList(); - }, [classId]); + }, [classId != ""]); return (
@@ -70,6 +78,22 @@ const CohortLearnerList = () => { /> ); })} + { userData == undefined || userData.length == 0 ? + + + {t('COMMON.NO_DATA_FOUND')} + + + : null}
); }; diff --git a/src/components/LearnersList.tsx b/src/components/LearnersList.tsx index 6c9f699a..b6feb96a 100644 --- a/src/components/LearnersList.tsx +++ b/src/components/LearnersList.tsx @@ -1,5 +1,5 @@ import BottomDrawer from './BottomDrawer'; -import { Box } from '@mui/material'; +import { Box, Typography } from '@mui/material'; import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; import DropOutModal from './DropOutModal'; import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline'; @@ -81,6 +81,38 @@ const LearnersList: React.FC = ({ console.log('handleDroppedOutLabelClick') } + const renderCustomContent = () => { + if (isDropout) { + return ( + + + {t('COMMON.REASON_FOR_DROPOUT')} + + + {t('COMMON.REASON_FOR_DROPOUT')} + + {/* TODO: Add reason dynamically from api */} + + ); + } + return null; + }; + return ( <> = ({ name: 'remove-from-center', }, ]} - isDropout={isDropout} + renderCustomContent={renderCustomContent} /> setShowModal(false)} /> From b213e08888e996789c06fcfe532cc3bb7004c135 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Thu, 20 Jun 2024 15:02:09 +0530 Subject: [PATCH 3/7] Updated PR with more specific prop type --- src/components/CohortLearnerList.tsx | 47 +++++++++++++++------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/components/CohortLearnerList.tsx b/src/components/CohortLearnerList.tsx index bc2be8e9..3365d3c9 100644 --- a/src/components/CohortLearnerList.tsx +++ b/src/components/CohortLearnerList.tsx @@ -11,9 +11,17 @@ import { showToastMessage } from './Toastify'; import { useTranslation } from 'next-i18next'; import { Box, Typography } from '@mui/material'; +interface UserData { + name: string; + userId: string; + memberStatus: string; + cohortMembershipId: string; + enrollmentNumber: string; +} + const CohortLearnerList = () => { const [loading, setLoading] = React.useState(false); - const [userData, setUserData] = React.useState<{}[]>(); + const [userData, setUserData] = React.useState(); const [classId, setClassId] = React.useState(''); const { t } = useTranslation(); @@ -24,8 +32,8 @@ const CohortLearnerList = () => { setClassId(cohortId); } } - }, []); - + }, []); + useEffect(() => { const getCohortMemberList = async () => { setLoading(true); @@ -63,23 +71,22 @@ const CohortLearnerList = () => { } }; getCohortMemberList(); - }, [classId != ""]); + }, [classId != '']); return (
- { - userData?.map((userData: any) => { - return ( - - ); - })} - { userData == undefined || userData.length == 0 ? - { + return ( + + ); + })} + {userData == undefined || userData.length == 0 ? ( + { alignItems: 'center', }} > - + {t('COMMON.NO_DATA_FOUND')} - : null} + ) : null}
); }; From 95d9a6f7c91b47b76cbfb8b3fcb575eb6634cdd8 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Thu, 20 Jun 2024 15:06:35 +0530 Subject: [PATCH 4/7] Optimised code as per code rabbit comments --- src/components/BottomDrawer.tsx | 2 +- src/components/CohortLearnerList.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/BottomDrawer.tsx b/src/components/BottomDrawer.tsx index 14190f29..7be2f8f4 100644 --- a/src/components/BottomDrawer.tsx +++ b/src/components/BottomDrawer.tsx @@ -51,7 +51,7 @@ const BottomDrawer: React.FC = ({ >
- {renderCustomContent && renderCustomContent()} {/* render custom content if provided */} + {renderCustomContent?.()} {optionList.map(({ label, icon, name }, index) => ( diff --git a/src/components/CohortLearnerList.tsx b/src/components/CohortLearnerList.tsx index 3365d3c9..1fbf320f 100644 --- a/src/components/CohortLearnerList.tsx +++ b/src/components/CohortLearnerList.tsx @@ -85,7 +85,7 @@ const CohortLearnerList = () => { /> ); })} - {userData == undefined || userData.length == 0 ? ( + {!userData?.length && ( { {t('COMMON.NO_DATA_FOUND')} - ) : null} + )} ); }; From c1a4e04cf1eac94c8f8f0edd4ec7a74de61d8358 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Thu, 20 Jun 2024 15:35:24 +0530 Subject: [PATCH 5/7] Updated PR with dynamic class Id from pathname --- src/components/CohortLearnerList.tsx | 19 +++++-------------- src/pages/centers/[cohortId].tsx | 2 +- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/components/CohortLearnerList.tsx b/src/components/CohortLearnerList.tsx index 1fbf320f..914ed36d 100644 --- a/src/components/CohortLearnerList.tsx +++ b/src/components/CohortLearnerList.tsx @@ -19,28 +19,19 @@ interface UserData { enrollmentNumber: string; } -const CohortLearnerList = () => { +const CohortLearnerList = (cohortId: any) => { const [loading, setLoading] = React.useState(false); const [userData, setUserData] = React.useState(); - const [classId, setClassId] = React.useState(''); - const { t } = useTranslation(); - useEffect(() => { - if (typeof window !== 'undefined' && window.localStorage) { - const cohortId = localStorage.getItem('classId'); - if (cohortId) { - setClassId(cohortId); - } - } - }, []); + const { t } = useTranslation(); useEffect(() => { const getCohortMemberList = async () => { setLoading(true); try { - if (classId) { + if (cohortId) { const page = 0; - const filters = { cohortId: classId }; + const filters = cohortId; const response = await getMyCohortMemberList({ limit, page, @@ -71,7 +62,7 @@ const CohortLearnerList = () => { } }; getCohortMemberList(); - }, [classId != '']); + }, [cohortId]); return (
diff --git a/src/pages/centers/[cohortId].tsx b/src/pages/centers/[cohortId].tsx index 5c1dd9c5..69c85242 100644 --- a/src/pages/centers/[cohortId].tsx +++ b/src/pages/centers/[cohortId].tsx @@ -128,7 +128,7 @@ const TeachingCenterDetails = () => { /> - + )} From 95a2e4d868992327fd49d39275c04544bda40e13 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Thu, 20 Jun 2024 16:17:09 +0530 Subject: [PATCH 6/7] Issue updated PR by resolving comments --- src/components/CohortLearnerList.tsx | 14 +++++++------- src/components/DropOutModal.tsx | 8 ++++---- src/services/MyClassDetailsService.ts | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/CohortLearnerList.tsx b/src/components/CohortLearnerList.tsx index 914ed36d..dd2844fe 100644 --- a/src/components/CohortLearnerList.tsx +++ b/src/components/CohortLearnerList.tsx @@ -11,7 +11,7 @@ import { showToastMessage } from './Toastify'; import { useTranslation } from 'next-i18next'; import { Box, Typography } from '@mui/material'; -interface UserData { +interface UserDataProps { name: string; userId: string; memberStatus: string; @@ -21,7 +21,7 @@ interface UserData { const CohortLearnerList = (cohortId: any) => { const [loading, setLoading] = React.useState(false); - const [userData, setUserData] = React.useState(); + const [userData, setUserData] = React.useState(); const { t } = useTranslation(); @@ -66,13 +66,13 @@ const CohortLearnerList = (cohortId: any) => { return (
- {userData?.map((userData: any) => { + {userData?.map((data: any) => { return ( ); })} diff --git a/src/components/DropOutModal.tsx b/src/components/DropOutModal.tsx index 16e14006..ad19c1d9 100644 --- a/src/components/DropOutModal.tsx +++ b/src/components/DropOutModal.tsx @@ -26,7 +26,7 @@ interface DropOutModalProps { function DropOutModal({ open, onClose }: DropOutModalProps) { const [selectedReason, setSelectedReason] = React.useState(''); - const [isDisabled, setIsDisabled] = React.useState(true); + const [isButtonDisabled, setIsButtonDisabled] = React.useState(true); const { t } = useTranslation(); @@ -48,13 +48,13 @@ function DropOutModal({ open, onClose }: DropOutModalProps) { const handleSelection = (event: SelectChangeEvent) => { setSelectedReason(event.target.value); - setIsDisabled(false) + setIsButtonDisabled(false) }; const handleMarkDropout = () => { onClose(true, selectedReason); console.log('Dropout api called') - setIsDisabled(true) + setIsButtonDisabled(true) // console.log('!!!!!!!!!!!!!!!!!!!!!!!!', selectedReason) // call dropout api here }; @@ -135,7 +135,7 @@ function DropOutModal({ open, onClose }: DropOutModalProps) { sx={{ boxShadow: 'none' }} variant="contained" onClick={handleMarkDropout} - disabled={isDisabled} + disabled={isButtonDisabled} > {t('COMMON.MARK_DROP_OUT')} diff --git a/src/services/MyClassDetailsService.ts b/src/services/MyClassDetailsService.ts index a5adaaaf..61254c55 100644 --- a/src/services/MyClassDetailsService.ts +++ b/src/services/MyClassDetailsService.ts @@ -29,7 +29,7 @@ export const getMyCohortMemberList = async ({ // memberStatus, // statusReason // }: updateCohortMemberStatusParams): Promise => { -// const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/cohortmember/update/${userId}`; +// const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/cohortmember/update/${membershipId}`; // try { // const response = await put(apiUrl, { // memberStatus, From 6700dd120b16cd0e331d92f13a053cba1efe123d Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Thu, 20 Jun 2024 16:17:41 +0530 Subject: [PATCH 7/7] Issue #000 chore: Uncommeted forgot password logic --- src/pages/login.tsx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/pages/login.tsx b/src/pages/login.tsx index 58ce9153..1fab8946 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -26,6 +26,7 @@ import { useTranslation } from 'next-i18next'; import { telemetryFactory } from '@/utils/telemetry'; import { logEvent } from '@/utils/googleAnalytics'; import { showToastMessage } from '@/components/Toastify'; +import Link from '@mui/material/Link'; const LoginPage = () => { const { t } = useTranslation(); @@ -323,16 +324,16 @@ const LoginPage = () => { { - // - // - // {t('LOGIN_PAGE.FORGOT_PASSWORD')} - // - // + + + {t('LOGIN_PAGE.FORGOT_PASSWORD')} + + }