From 83d9429bdb7bfbbe9f048dee17225ad8b94d5118 Mon Sep 17 00:00:00 2001 From: ttpl-rt-099 Date: Fri, 2 Aug 2024 12:46:19 +0530 Subject: [PATCH 1/4] Issue #PS-1534 feat: Foundation Course detail view UI implementation --- public/locales/en/common.json | 1 + src/pages/course-planner.tsx | 154 +++++++++++++++++++--------------- 2 files changed, 89 insertions(+), 66 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 01c1f3cc5..ef8089a35 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -442,6 +442,7 @@ "FOUNDATION_COURSE": "Foundation Course", "MAIN_COURSE": "Main Course", "COLLAPSE_ALL": "Collapse All", + "EXPAND_ALL":"Expand All", "RESOURCES": "Resources" } } diff --git a/src/pages/course-planner.tsx b/src/pages/course-planner.tsx index b398b387c..63cc331c1 100644 --- a/src/pages/course-planner.tsx +++ b/src/pages/course-planner.tsx @@ -15,6 +15,7 @@ import { Typography, } from '@mui/material'; import { useTheme } from '@mui/material/styles'; +import { sub } from 'date-fns'; import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { useRouter } from 'next/router'; @@ -23,6 +24,10 @@ import { CircularProgressbar, buildStyles } from 'react-circular-progressbar'; const CoursePlanner = () => { const [value, setValue] = React.useState(1); + const [subjects, setSubjects] = React.useState([ + { id: 1, subject: 'Mathematics', circular: 10 }, + { id: 2, subject: 'Science', circular: 50 }, + ]); const theme = useTheme(); const { t } = useTranslation(); const router = useRouter(); @@ -112,7 +117,16 @@ const CoursePlanner = () => { - + { aria-label="secondary tabs example" sx={{ fontSize: '14px', - borderBottom: `1px solid ${theme.palette.primary.contrastText}`, '& .MuiTab-root': { color: '#4D4639', @@ -150,94 +163,103 @@ const CoursePlanner = () => { - { - router.push(`/course-planner-detail`); // Check route - }} - > - - + {subjects.map((item, index) => { + return ( + { + router.push(`/course-planner-detail`); // Check route + }} + > - - - - - + - + + + + + + + {item.circular}% + + + + + - 10% - + {item.subject} + - - - Mathematics {/* will come form API */} + + - - - - - + ); + })} )} From 53ef81cf1dfbc60f36ba71a42eacbc9b67fc94e2 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Fri, 2 Aug 2024 13:41:26 +0530 Subject: [PATCH 2/4] Issue #PS-1275 chore: Modified state, district and block mapping logic for user profile --- src/pages/user-profile/[userId].tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pages/user-profile/[userId].tsx b/src/pages/user-profile/[userId].tsx index 9280f47bb..04e102a2f 100644 --- a/src/pages/user-profile/[userId].tsx +++ b/src/pages/user-profile/[userId].tsx @@ -56,7 +56,8 @@ const TeacherProfile = () => { const [loading, setLoading] = useState(false); const [image, setImage] = useState(user_placeholder_img); const [isAuthenticated, setIsAuthenticated] = React.useState(false); - const [unitName, setUnitName] = useState(''); + const [stateName, setStateName] = useState(''); + const [districtName, setDistrictName] = useState(''); const [blockName, setBlockName] = useState(''); const [isError, setIsError] = React.useState(false); const [isData, setIsData] = React.useState(false); @@ -213,6 +214,14 @@ const TeacherProfile = () => { const coreFieldData = data?.result?.userData; setUserName(toPascalCase(coreFieldData?.name)); const fields: CustomField[] = data?.result?.userData?.customFields; + if (fields?.length > 0) { + const stateName = getFieldValue(fields, 'State'); + setStateName(toPascalCase(stateName)); + const districtName = getFieldValue(fields, 'District'); + setDistrictName(toPascalCase(districtName)); + const blockName = getFieldValue(fields, 'Block'); + setBlockName(toPascalCase(blockName)); + } const fieldIdToValueMap: { [key: string]: string } = mapFieldIdToValue(fields); console.log(`coreFieldData`, coreFieldData); @@ -264,11 +273,6 @@ const TeacherProfile = () => { if (customDataFields?.length > 0) { setCustomFieldsData(customDataFields); - - const unitName = getFieldValue(customDataFields, 'Unit Name'); - setUnitName(unitName); - const blockName = getFieldValue(customDataFields, 'Block Name'); - setBlockName(blockName); } } } else { @@ -335,7 +339,7 @@ const TeacherProfile = () => { }; // address find - const address = [unitName, blockName, userData?.district, userData?.state] + const address = [stateName, districtName, blockName] ?.filter(Boolean) ?.join(', '); From 59f2fb500a1f8bee1a264dfb6ed994cc1887f161 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Fri, 2 Aug 2024 13:46:00 +0530 Subject: [PATCH 3/4] Issue #000 chore: Updated PR --- src/pages/user-profile/[userId].tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/user-profile/[userId].tsx b/src/pages/user-profile/[userId].tsx index 04e102a2f..9b7df2fab 100644 --- a/src/pages/user-profile/[userId].tsx +++ b/src/pages/user-profile/[userId].tsx @@ -194,7 +194,7 @@ const TeacherProfile = () => { // find Address const getFieldValue = (data: any, label: string) => { const field = data.find((item: any) => item.label === label); - return field ? field?.value[0] : null; + return field ? field?.value : null; }; const { data, error, isLoading } = useProfileInfo(userId ?? '', true, reload); From 73b74429d6a86a7b32333f4c885505b47daa2980 Mon Sep 17 00:00:00 2001 From: ttpl-rt-099 Date: Fri, 2 Aug 2024 14:27:17 +0530 Subject: [PATCH 4/4] Issue #PS-1534 feat: Foundation Course detail view UI implementation --- src/pages/course-planner.tsx | 156 ++++++++++++++++++----------------- 1 file changed, 82 insertions(+), 74 deletions(-) diff --git a/src/pages/course-planner.tsx b/src/pages/course-planner.tsx index 63cc331c1..fde9877a1 100644 --- a/src/pages/course-planner.tsx +++ b/src/pages/course-planner.tsx @@ -15,7 +15,6 @@ import { Typography, } from '@mui/material'; import { useTheme } from '@mui/material/styles'; -import { sub } from 'date-fns'; import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { useRouter } from 'next/router'; @@ -27,6 +26,11 @@ const CoursePlanner = () => { const [subjects, setSubjects] = React.useState([ { id: 1, subject: 'Mathematics', circular: 10 }, { id: 2, subject: 'Science', circular: 50 }, + { id: 2, subject: 'History', circular: 30 }, + { id: 2, subject: 'Geography', circular: 60 }, + { id: 2, subject: 'Marathi', circular: 90 }, + { id: 2, subject: 'Hindi', circular: 70 }, + { id: 2, subject: 'Social Science', circular: 80 }, ]); const theme = useTheme(); const { t } = useTranslation(); @@ -81,7 +85,7 @@ const CoursePlanner = () => { }} > - Khapari Dharmu (Chimur, Chandrap {/* will come from API */} + Khapari Dharmu (Chimur, Chandrap) {/* will come from API */} @@ -165,101 +169,105 @@ const CoursePlanner = () => { background: theme.palette.action.selected, py: '2px', borderRadius: '8px', + marginBottom: '20px', }} > - {subjects.map((item, index) => { - return ( - { - router.push(`/course-planner-detail`); // Check route - }} - > - - + + {subjects.map((item, index) => { + return ( + + { + router.push(`/course-planner-detail`); // Check route + }} + > - - - - - + - + + + + + + + {item.circular}% + + + + + - {item.circular}% - + {item.subject} + - - - {item.subject} + + - - - - - - ); - })} + + ); + })} + )}