Skip to content

Commit

Permalink
Merge pull request #76 from Rushikesh-Sonawane99/release-1.0.0
Browse files Browse the repository at this point in the history
Issue #PS-1275 chore: Fixed subject I teach field issue on FL profile
  • Loading branch information
itsvick authored Aug 2, 2024
2 parents 612b685 + 80158c5 commit 993ff7c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/components/LearnerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const LearnerModal = ({
>
{item?.label
? t(
`FIELDS.${item.label.toUpperCase()}`,
`FORM.${item.label.toUpperCase()}`,
item.label
)
: item.label}
Expand Down
8 changes: 4 additions & 4 deletions src/pages/centers/[cohortId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,22 @@ 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);
const stateId = state?.fieldId || '';
// setStateId(stateId);

const blockField = cohortData?.customField.find(
(field: any) => field.label === 'Block'
(field: any) => field.label === 'BLOCKS'
);
setBlockCode(blockField?.code);
// setBlockId(blockField.fieldId);
Expand Down Expand Up @@ -249,7 +249,7 @@ const TeachingCenterDetails = () => {
/>
<Box m={'1rem 1rem 0.5rem'} display={'column'} gap={'5px'}>
<Typography textAlign={'left'} fontSize={'22px'}>
{cohortDetails?.name}
{toPascalCase(cohortDetails?.name)}
</Typography>
{cohortDetails?.centerType && (
<Typography textAlign={'left'} fontSize={'22px'}>
Expand Down
32 changes: 21 additions & 11 deletions src/pages/user-profile/[userId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import withAccessControl from '@/utils/hoc/withAccessControl';
import { getFormRead } from '@/services/CreateUserService';
import { FormContext, FormContextType, Role } from '@/utils/app.constant';
import manageUserStore from '@/store/manageUserStore';
import useStore from '@/store/store';
// import useStore from '@/store/store';
import AddFacilitatorModal from '@/components/AddFacilitator';

interface UserData {
Expand All @@ -41,10 +41,10 @@ const TeacherProfile = () => {
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<any>();

const [userData, setUserData] = useState<any | null>(null);
Expand All @@ -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<string | null>(null);
const [userRole, setUserRole] = React.useState<string | null>(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);
};
Expand Down Expand Up @@ -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'
Expand All @@ -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];

Expand Down Expand Up @@ -522,7 +532,7 @@ const TeacherProfile = () => {
// },
}}
>
{userRole == Role.TEAM_LEADER && userId !== selfUserId ? (
{userRole === Role.TEAM_LEADER && userId !== selfUserId ? (
<Button
className="min-width-md-20"
sx={{
Expand Down Expand Up @@ -592,7 +602,7 @@ const TeacherProfile = () => {
>
<Grid container spacing={4}>
{filteredSortedForView?.map((item, index) => {
if (item.order === 5) {
if (String(item.order) === '7') {
return (
<Grid item xs={12}>
<Typography
Expand Down Expand Up @@ -620,12 +630,12 @@ const TeacherProfile = () => {
key={index}
size="small"
variant={
mainSubjects?.includes(subject)
mutualSubjects?.includes(subject)
? 'contained'
: 'outlined'
}
sx={{
backgroundColor: mainSubjects?.includes(
backgroundColor: mutualSubjects?.includes(
subject
)
? theme.palette.info.contrastText
Expand Down

0 comments on commit 993ff7c

Please sign in to comment.