diff --git a/.env b/.env index 2d9004de..beec282d 100644 --- a/.env +++ b/.env @@ -1,4 +1,5 @@ NEXT_PUBLIC_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/user/v1 +# NEXT_PUBLIC_BASE_URL=https://backend.prathamdigital.org/user/v1 NEXT_PUBLIC_EVENT_BASE_URL=http://3.109.46.84:4000/event/v1 NEXT_PUBLIC_TELEMETRY_URL=https://qa.prathamteacherapp.tekdinext.com NEXT_PUBLIC_MEASUREMENT_ID= G-GNMQZ8Z65Z diff --git a/src/components/LearnerModal.tsx b/src/components/LearnerModal.tsx index 275793cc..fc44cf7c 100644 --- a/src/components/LearnerModal.tsx +++ b/src/components/LearnerModal.tsx @@ -148,7 +148,7 @@ const LearnerModal = ({ > {item?.label ? t( - `FIELDS.${item.label.toUpperCase()}`, + `FORM.${item.label.toUpperCase()}`, item.label ) : item.label} diff --git a/src/pages/centers/[cohortId].tsx b/src/pages/centers/[cohortId].tsx index 0f1625e3..d5ff3146 100644 --- a/src/pages/centers/[cohortId].tsx +++ b/src/pages/centers/[cohortId].tsx @@ -133,14 +133,14 @@ const TeachingCenterDetails = () => { if (cohortData?.customField?.length) { const district = cohortData.customField.find( - (item: CustomField) => item.label === 'District' + (item: CustomField) => item.label === 'DISTRICTS' ); const districtCode = district?.code || ''; setDistrictCode(districtCode); const districtId = district?.fieldId || ''; // setDistrictId(districtId); const state = cohortData.customField.find( - (item: CustomField) => item.label === 'State' + (item: CustomField) => item.label === 'STATES' ); const stateCode = state?.code || ''; setStateCode(stateCode); @@ -148,7 +148,7 @@ const TeachingCenterDetails = () => { // setStateId(stateId); const blockField = cohortData?.customField.find( - (field: any) => field.label === 'Block' + (field: any) => field.label === 'BLOCKS' ); setBlockCode(blockField?.code); // setBlockId(blockField.fieldId); @@ -249,7 +249,7 @@ const TeachingCenterDetails = () => { /> - {cohortDetails?.name} + {toPascalCase(cohortDetails?.name)} {cohortDetails?.centerType && ( diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index 4cf4b858..c3c9b01a 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -48,6 +48,7 @@ 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'; interface DashboardProps {} @@ -86,7 +87,7 @@ const Dashboard: React.FC = () => { const formattedSevenDaysAgo = shortDateFormat(sevenDaysAgo); const [userId, setUserId] = React.useState(null); const [blockName, setBlockName] = React.useState(''); - + const role = localStorage.getItem('role'); useEffect(() => { setIsClient(true); const calculateDateRange = () => { @@ -873,9 +874,11 @@ const Dashboard: React.FC = () => { - - - + {role === Role.TEAM_LEADER && ( + + + + )} {/* { const { t } = useTranslation(); const router = useRouter(); const { userId }: any = router.query; - const store = useStore(); - const userRole = store.userRole; + // const store = useStore(); + // const userRole = store?.userRole; const userStore = manageUserStore(); - const selfUserId = localStorage.getItem('userId'); + const theme = useTheme(); const [userData, setUserData] = useState(null); @@ -63,7 +63,17 @@ const TeacherProfile = () => { const [userFormData, setUserFormData] = useState<{ [key: string]: any }>({}); const [openAddLearnerModal, setOpenAddLearnerModal] = React.useState(false); const [reload, setReload] = React.useState(false); + const [selfUserId, setSelfUserId] = React.useState(null); + const [userRole, setUserRole] = React.useState(null); + useEffect(() => { + if (typeof window !== 'undefined' && window.localStorage) { + const userId = localStorage.getItem('userId'); + setSelfUserId(userId); + const role = localStorage.getItem('role'); + setUserRole(role); + } + }, []); const handleReload = () => { setReload((prev) => !prev); }; @@ -275,7 +285,7 @@ const TeacherProfile = () => { // Find fields for "Subjects I Teach" and "My Main Subjects" const teachSubjectsField = customFieldsData?.find( - (field) => field.name === 'subject_taught' + (field) => field.name === 'subject_teach' ); const mainSubjectsField: any = customFieldsData?.find( (field) => field.name === 'main_subject' @@ -292,8 +302,8 @@ const TeacherProfile = () => { const mutualSubjects = teachSubjects?.filter((subject) => mainSubjects?.includes(subject) ); - const remainingSubjects = teachSubjects?.filter( - (subject) => !mainSubjects?.includes(subject) + const remainingSubjects = mainSubjects?.filter( + (subject) => !teachSubjects?.includes(subject) ); const orderedSubjects = [...mutualSubjects, ...remainingSubjects]; @@ -522,7 +532,7 @@ const TeacherProfile = () => { // }, }} > - {userRole == Role.TEAM_LEADER && userId !== selfUserId ? ( + {userRole === Role.TEAM_LEADER && userId !== selfUserId ? (