From 6579adaf6a2b1a9ba940d893e397772c356f1fda Mon Sep 17 00:00:00 2001 From: vivek kasture Date: Fri, 27 Sep 2024 13:56:42 +0530 Subject: [PATCH] Issue #PS-000 fix: Fixed reload issue on network reestablishment --- next.config.mjs | 1 + src/components/Schedule.tsx | 98 +++++++++++++++++-------------------- 2 files changed, 46 insertions(+), 53 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index aeea5020..38831a19 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -13,6 +13,7 @@ const nextConfig = { const pwaConfig = withPWA({ dest: 'public', + reloadOnOnline: false, }); export default pwaConfig(nextConfig); diff --git a/src/components/Schedule.tsx b/src/components/Schedule.tsx index 9fa54ce0..35faa03f 100644 --- a/src/components/Schedule.tsx +++ b/src/components/Schedule.tsx @@ -1,64 +1,56 @@ -import React, { useState } from 'react'; - +import React from 'react'; import { Box } from '@mui/material'; -import { ScheduleModalProps } from '../utils/Interfaces'; import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'react-i18next'; +import { ScheduleModalProps } from '../utils/Interfaces'; + +const sessionData = [ + { + key: 'PLANNED_SESSION', + title: 'CENTER_SESSION.PLANNED_SESSION', + description: 'CENTER_SESSION.FIXES_SUBJECTS', + }, + { + key: 'EXTRA_SESSION', + title: 'CENTER_SESSION.EXTRA_SESSION', + description: 'CENTER_SESSION.DOUBT_CLEARING', + }, +]; -const Schedule: React.FC = ({ - handleClick, - clickedBox, -}) => { +const Schedule: React.FC = ({ handleClick, clickedBox }) => { const theme = useTheme(); const { t } = useTranslation(); + const { primary, warning } = theme.palette; - return ( - <> - - handleClick?.('PLANNED_SESSION')} - > - - {t('CENTER_SESSION.PLANNED_SESSION')} - - {t('CENTER_SESSION.FIXES_SUBJECTS')} - - handleClick?.('EXTRA_SESSION')} - > - - {t('CENTER_SESSION.EXTRA_SESSION')} - - {t('CENTER_SESSION.DOUBT_CLEARING')} - + const renderSessionBox = (key: string, title: string, description: string) => ( + handleClick?.(key)} + > + + {t(title)} - + {t(description)} + + ); + + return ( + + {sessionData.map(({ key, title, description }) => renderSessionBox(key, title, description))} + ); };