Skip to content

Commit

Permalink
Merge branch 'release-1.0.0' of github.com:tekdi/teachers-app into re…
Browse files Browse the repository at this point in the history
…lease-1.0.0
  • Loading branch information
itsvick committed Sep 24, 2024
2 parents f002583 + 2fc3749 commit e0474a2
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 20 deletions.
34 changes: 24 additions & 10 deletions src/components/CohortSelectionSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
showFloatingLabel = false,
showDisabledDropDown = false,
}) => {
console.log("cohortsData",classId, cohortsData[0]?.cohortId)
console.log('cohortsData', classId, cohortsData[0]?.cohortId);
const router = useRouter();
const theme = useTheme<any>();
const queryClient = useQueryClient();
Expand Down Expand Up @@ -151,12 +151,14 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({

const cohortData = response[0];
let userDetailsResponse;
if(userId)
{
if (userId) {
userDetailsResponse = await getUserDetails(userId, true);
}
const blockObject = userDetailsResponse?.result?.userData?.customFields.find((item:any) => item?.label === 'BLOCKS');

const blockObject =
userDetailsResponse?.result?.userData?.customFields.find(
(item: any) => item?.label === 'BLOCKS'
);

if (cohortData?.customField?.length) {
const district = cohortData?.customField?.find(
(item: CustomField) => item?.label === 'DISTRICTS'
Expand Down Expand Up @@ -185,7 +187,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
setBlockId(blockObject?.fieldId);
}
}

if (response && response?.length > 0) {
const extractNamesAndCohortTypes = (
data: ChildData[]
Expand Down Expand Up @@ -368,19 +370,28 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
{cohortsData?.length > 1 ? (
<FormControl
className="drawer-select"
sx={{ m: 0, width: '100%' }}
sx={{
m: 0,
width: '100%',
'@media (max-width: 700px)': {
width: '50%',
},
}}
>
<Select
value={classId}
onChange={handleCohortSelection}
displayEmpty
inputProps={{ 'aria-label': 'Without label' }}
className="select-languages capitalize fs-14 fw-500 bg-white"
style={{
sx={{
borderRadius: '0.5rem',
color: theme.palette.warning['200'],
width: '100%',
marginBottom: '0rem',
'@media (max-width: 700px)': {
width: '50%',
},
}}
MenuProps={{
PaperProps: {
Expand Down Expand Up @@ -454,7 +465,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
<Select
labelId="center-select-label"
label={showFloatingLabel ? t('COMMON.CENTER') : ''}
value={classId? classId: cohortsData[0]?.cohortId}
value={classId ? classId : cohortsData[0]?.cohortId}
onChange={handleCohortSelection}
// displayEmpty
// style={{ borderRadius: '4px' }}
Expand All @@ -465,14 +476,17 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
? ''
: 'select-languages fs-14 fw-500 bg-white'
}
style={
sx={
showFloatingLabel
? { borderRadius: '4px' }
: {
borderRadius: '0.5rem',
color: theme.palette.warning['200'],
width: '100%',
marginBottom: '0rem',
'@media (max-width: 700px)': {
width: '50%',
},
}
}
>
Expand Down
40 changes: 30 additions & 10 deletions src/pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
const [extraSessions, setExtraSessions] = React.useState<Session[]>();
const [myCohortList, setMyCohortList] = React.useState<any>();
const [centralizedModal, setCentralizedModal] = useState(false);
const [showCentralisedModal, setShowCentralisedModal] = useState(false);
const [cohortType, setCohortType] = React.useState<string>();
const [medium, setMedium] = React.useState<string>();
const [grade, setGrade] = React.useState<string>();
Expand All @@ -124,8 +125,26 @@ const Dashboard: React.FC<DashboardProps> = () => {
const [eventDeleted, setEventDeleted] = React.useState(false);
const [eventUpdated, setEventUpdated] = React.useState(false);

useEffect(() => {
if (typeof window !== 'undefined' && window.localStorage) {
const skipResetPassword = localStorage.getItem('skipResetPassword');
const temporaryPassword = localStorage.getItem('temporaryPassword');

if (temporaryPassword === 'true' && skipResetPassword !== 'true') {
setShowCentralisedModal(true);
}
}
}, []);

const toggleDrawer = (newOpen: boolean) => () => {
setOpenDrawer(newOpen);
//open modal for reset
// const skipResetPassword = localStorage.getItem('skipResetPassword');
// const temporaryPassword = localStorage.getItem('temporaryPassword');

if (showCentralisedModal && !newOpen) {
setCentralizedModal(true);
}
};
const [selectedDays, setSelectedDays] = React.useState<any>([]);

Expand Down Expand Up @@ -702,15 +721,16 @@ const Dashboard: React.FC<DashboardProps> = () => {
setEventUpdated(true);
};

useEffect(() => {
if (typeof window !== 'undefined' && window.localStorage) {
const skipResetPassword = localStorage.getItem('skipResetPassword');
const temporaryPassword = localStorage.getItem('temporaryPassword');
if (temporaryPassword === 'true' && skipResetPassword !== 'true') {
setCentralizedModal(true);
}
}
}, []);
// useEffect(() => {
// if (typeof window !== 'undefined' && window.localStorage) {
// const skipResetPassword = localStorage.getItem('skipResetPassword');
// const temporaryPassword = localStorage.getItem('temporaryPassword');

// if (temporaryPassword === 'true' && skipResetPassword !== 'true') {
// setCentralizedModal(true);
// }
// }
// }, []);

const handlePrimaryButton = () => {
router.push(`/create-password`);
Expand Down Expand Up @@ -819,7 +839,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
</Box>

<Box
className="calenderTitle flex-center joyride-step-3 ps-md-ab right-md-20"
className="calenderTitle flex-center joyride-step-3 ps-md-ab right-md-20 top-md-185"
display={'flex'}
sx={{
cursor: 'pointer',
Expand Down
4 changes: 4 additions & 0 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,10 @@ main {
right: 20px;
}

.top-md-185{
top: 185px;
}

.mt-md-3 {
margin-top: 3px;
}
Expand Down

0 comments on commit e0474a2

Please sign in to comment.