Skip to content

Commit

Permalink
Issue #PS-000 fix: Fixed reload issue on network reestablishment
Browse files Browse the repository at this point in the history
  • Loading branch information
itsvick committed Sep 27, 2024
1 parent a702bb0 commit 6579ada
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 53 deletions.
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const nextConfig = {

const pwaConfig = withPWA({
dest: 'public',
reloadOnOnline: false,
});

export default pwaConfig(nextConfig);
98 changes: 45 additions & 53 deletions src/components/Schedule.tsx
Original file line number Diff line number Diff line change
@@ -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<ScheduleModalProps> = ({
handleClick,
clickedBox,
}) => {
const Schedule: React.FC<ScheduleModalProps> = ({ handleClick, clickedBox }) => {
const theme = useTheme<any>();
const { t } = useTranslation();
const { primary, warning } = theme.palette;

return (
<>
<Box sx={{ padding: '10px 16px' }}>
<Box
sx={{
border: `2px solid ${clickedBox === 'PLANNED_SESSION' ? theme.palette.primary.main : theme.palette.action.active}`,
borderRadius: '8px',
padding: '15px',
mb: 2,
cursor: 'pointer',
}}
onClick={() => handleClick?.('PLANNED_SESSION')}
>
<Box
sx={{
fontSize: '16px',
fontWeight: '400',
color: theme?.palette?.warning['300'],
}}
>
{t('CENTER_SESSION.PLANNED_SESSION')}
</Box>
<Box>{t('CENTER_SESSION.FIXES_SUBJECTS')}</Box>
</Box>
<Box
sx={{
border: `2px solid ${clickedBox === 'EXTRA_SESSION' ? theme.palette.primary.main : theme.palette.action.active}`,
borderRadius: '8px',
padding: '15px',
mb: 2,
cursor: 'pointer',
}}
onClick={() => handleClick?.('EXTRA_SESSION')}
>
<Box
sx={{
fontSize: '16px',
fontWeight: '400',
color: theme?.palette?.warning['300'],
}}
>
{t('CENTER_SESSION.EXTRA_SESSION')}
</Box>
<Box>{t('CENTER_SESSION.DOUBT_CLEARING')}</Box>
</Box>
const renderSessionBox = (key: string, title: string, description: string) => (
<Box
key={key}
sx={{
border: `${clickedBox === key ? '2px' : '1px'} solid ${clickedBox === key ? primary.main : warning['700']}`,
borderRadius: '8px',
padding: '15px',
mb: 2,
cursor: 'pointer',
}}
onClick={() => handleClick?.(key)}
>
<Box
sx={{
fontSize: '16px',
fontWeight: '400',
color: warning['300'],
}}
>
{t(title)}
</Box>
</>
<Box>{t(description)}</Box>
</Box>
);

return (
<Box sx={{ padding: '10px 16px' }}>
{sessionData.map(({ key, title, description }) => renderSessionBox(key, title, description))}
</Box>
);
};

Expand Down

0 comments on commit 6579ada

Please sign in to comment.