From 825d9878a02a60ecb140bb216993b7d5c5df58b9 Mon Sep 17 00:00:00 2001 From: vivek kasture Date: Fri, 14 Jun 2024 15:02:53 +0530 Subject: [PATCH] Issue #PS-390 fix: Hide the forgot password link --- src/pages/login.tsx | 83 +++++++++++++++++++----------------- src/utils/attendanceStats.ts | 4 ++ 2 files changed, 49 insertions(+), 38 deletions(-) diff --git a/src/pages/login.tsx b/src/pages/login.tsx index 69dd2b99..bcd2c728 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -94,12 +94,14 @@ const LoginPage = () => { setPassword(value); }; - const handleClickShowPassword = () => {setShowPassword((show) => !show); - logEvent({ - action: 'show-password-icon-clicked', - category: 'Login Page', - label: 'Show Password', - })}; + const handleClickShowPassword = () => { + setShowPassword((show) => !show); + logEvent({ + action: 'show-password-icon-clicked', + category: 'Login Page', + label: 'Show Password', + }); + }; const handleMouseDownPassword = ( event: React.MouseEvent @@ -145,25 +147,25 @@ const LoginPage = () => { setShowToastMessage(false); const telemetryInteract = { context: { - env: "sign-in", + env: 'sign-in', cdata: [], }, edata: { - id: "login-success", - type: "CLICK", - subtype: "", - pageid: "sign-in", + id: 'login-success', + type: 'CLICK', + subtype: '', + pageid: 'sign-in', uid: localStorage.getItem('userId') || 'Anonymous', - + studentid: localStorage.getItem('userId'), - - userName: "userName", - - grade: "grade", - - medium: "medium", - - board: "board", + + userName: 'userName', + + grade: 'grade', + + medium: 'medium', + + board: 'board', }, }; telemetryFactory.interact(telemetryInteract); @@ -189,7 +191,9 @@ const LoginPage = () => { if (typeof window !== 'undefined' && window.localStorage) { localStorage.setItem('preferredLanguage', newLocale); setLanguage(event.target.value); - ReactGA.event("select-language-login-page", { selectedLanguage: event.target.value}); + ReactGA.event('select-language-login-page', { + selectedLanguage: event.target.value, + }); router.push('/login', undefined, { locale: newLocale }); } }; @@ -357,16 +361,18 @@ const LoginPage = () => { /> - - - {t('LOGIN_PAGE.FORGOT_PASSWORD')} - - + { + // + // + // {t('LOGIN_PAGE.FORGOT_PASSWORD')} + // + // + } setRememberMe(e.target.checked)} @@ -378,13 +384,14 @@ const LoginPage = () => { color: theme.palette.warning['300'], }} className="fw-400" - onClick={() => {setRememberMe(!rememberMe) - logEvent({ - action: 'remember-me-button-clicked', - category: 'Login Page', - label: `Remember Me ${rememberMe ? 'Checked' : 'Unchecked'}`, - }) - }} + onClick={() => { + setRememberMe(!rememberMe); + logEvent({ + action: 'remember-me-button-clicked', + category: 'Login Page', + label: `Remember Me ${rememberMe ? 'Checked' : 'Unchecked'}`, + }); + }} > {t('LOGIN_PAGE.REMEMBER_ME')} diff --git a/src/utils/attendanceStats.ts b/src/utils/attendanceStats.ts index d56fbb77..3b541442 100644 --- a/src/utils/attendanceStats.ts +++ b/src/utils/attendanceStats.ts @@ -20,6 +20,10 @@ const getPresentStudentCount = async ( const response = await attendanceInPercentageStatusList(attendanceRequest); const attendanceDates = response?.data?.result?.attendanceDate; const presentStudents: any = {}; + + if (!attendanceDates) { + return presentStudents; + } for (const date of Object.keys(attendanceDates)) { const attendance = attendanceDates[date]; const present = attendance.present || 0;