Skip to content

Commit

Permalink
Small fixes to timer
Browse files Browse the repository at this point in the history
  • Loading branch information
fongsean committed Sep 4, 2023
1 parent e5aa6fe commit 56c8035
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ function AutoSaveDialog(props: AutoSaveDialogProps) {

return (
<Dialog open={true}>
<DialogTitle variant="h5" sx={{ m: 2 }}>
Autosaving...
</DialogTitle>
<DialogTitle sx={{ m: 2 }}>Autosaving...</DialogTitle>
</Dialog>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const TokenTimer = memo(function TokenTimer() {

function checkRemainingTime() {
const remaining = calculateRemainingTime(tokenReceivedTimestamp, tokenExpirationTimeInSeconds);
if (!remaining) {
return null;
if (remaining === null) {
return;
}

if (remaining <= reminderTime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,16 @@ function TokenTimerDialog(props: TokenTimerDialogProps) {

return (
<Dialog open={open}>
<DialogTitle variant="h5">Heads up, you have 15 minutes left</DialogTitle>
<DialogTitle variant="h5">Session expiring soon</DialogTitle>
<DialogContent>
<DialogContentText variant="body1">
{
'You have 15 minutes left in your session. Do you want to save your progress so far as a draft? You would be unable to save your progress after the session expires.'
}
</DialogContentText>
<DialogContentText variant="body1">
You would be unable to save your progress after the session expires.
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>Cancel</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function TokenTimerIndicator(props: TokenTimerIndicatorProps) {

const isDesktop = useResponsive('up', 'lg');

if (!showRemainingTime || !timeLeft) {
if (!showRemainingTime || timeLeft === null) {
return null;
}

Expand All @@ -50,7 +50,7 @@ function getIndicatorText(isAutoSaving: boolean, timeLeft: number) {
return 'Autosaving...';
}

if (timeLeft < 0) {
if (timeLeft <= 0) {
return 'Session ended';
}

Expand Down

0 comments on commit 56c8035

Please sign in to comment.