-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display modal if registration time is expiring soon
- Loading branch information
1 parent
bb0e6f9
commit 723de00
Showing
10 changed files
with
174 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
{ | ||
"hour": "{{count}} hour", | ||
"hour_other": "{{count}} hours", | ||
"minute": "{{count}} minute", | ||
"minute_other": "{{count}} minutes", | ||
"reservationTimeExpiredModal": { | ||
"buttonTryAgain": "Try Again", | ||
"text": "Unfortunately, the Reservation time has expired.", | ||
"title": "Time’s Up." | ||
} | ||
}, | ||
"reservationTimeExpiringModal": { | ||
"buttonClose": "Close", | ||
"text": "The reservation is about to expire in {{count}} seconds", | ||
"text_other": "The reservation is about to expire in {{count}} seconds", | ||
"title": "The reservation period is ending" | ||
}, | ||
"second": "{{count}} second", | ||
"second_other": "{{count}} seconds", | ||
"timeLeft": "Time left to register" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
{ | ||
"hour": "{{count}} tunti", | ||
"hour_other": "{{count}} tuntia", | ||
"minute": "{{count}} minuutti", | ||
"minute_other": "{{count}} minuuttia", | ||
"reservationTimeExpiredModal": { | ||
"buttonTryAgain": "Yritä uudelleen", | ||
"text": "Valitettavasti varausaika on umpeutunut.", | ||
"title": "Varausaika on täynnä." | ||
} | ||
}, | ||
"reservationTimeExpiringModal": { | ||
"buttonClose": "Sulje", | ||
"text": "Varauksen aika on päättymässä {{count}} sekunnin päästä", | ||
"text_other": "Varauksen aika on päättymässä {{count}} sekunnin päästä", | ||
"title": "Varauksen aika on päättymässä" | ||
}, | ||
"second": "{{count}} sekunti", | ||
"second_other": "{{count}} sekuntia", | ||
"timeLeft": "Aikaa jäljellä ilmoittautumisen tekoon" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
{ | ||
"hour": "{{count}} timme", | ||
"hour_other": "{{count}} timmar", | ||
"minute": "{{count}} minut", | ||
"minute_other": "{{count}} minuter", | ||
"reservationTimeExpiredModal": { | ||
"buttonTryAgain": "Försök igen", | ||
"text": "Tyvärr har bokningstiden gått ut.", | ||
"title": "Tiden är ute." | ||
} | ||
}, | ||
"reservationTimeExpiringModal": { | ||
"buttonClose": "Stäng", | ||
"text": "Reservationen är på väg att löpa ut om {{count}} sekund", | ||
"text_other": "Reservationen är på väg att löpa ut om {{count}} sekunder", | ||
"title": "Reservationsperioden går ut" | ||
}, | ||
"second": "{{count}} sekund", | ||
"second_other": "{{count}} sekunder", | ||
"timeLeft": "Tid kvar att registrera sig" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/domain/signupGroup/modals/reservationTimeExpiringModal/ReservationTimeExpiringModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Dialog, IconInfoCircle } from 'hds-react'; | ||
import { useTranslation } from 'next-i18next'; | ||
import React from 'react'; | ||
|
||
import Button from '../../../../common/components/button/Button'; | ||
import styles from '../../../../common/components/dialog/dialog.module.scss'; | ||
|
||
export interface ReservationTimeExpiringModalProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
timeLeft: number | null; | ||
} | ||
|
||
const ReservationTimeExpiringModal: React.FC< | ||
ReservationTimeExpiringModalProps | ||
> = ({ isOpen, onClose, timeLeft }) => { | ||
const { t } = useTranslation(['reservation']); | ||
|
||
const handleClose = (event?: React.MouseEvent | React.KeyboardEvent) => { | ||
event?.preventDefault(); | ||
event?.stopPropagation(); | ||
|
||
onClose(); | ||
}; | ||
|
||
const id = 'reservation-time-expiring-modal'; | ||
const titleId = `${id}-title`; | ||
const descriptionId = `${id}-description`; | ||
|
||
return ( | ||
<Dialog | ||
id={id} | ||
aria-labelledby={titleId} | ||
aria-describedby={descriptionId} | ||
className={styles.dialog} | ||
isOpen={isOpen} | ||
variant="primary" | ||
> | ||
<Dialog.Header | ||
id={titleId} | ||
iconLeft={<IconInfoCircle aria-hidden={true} />} | ||
title={t('reservation:reservationTimeExpiringModal.title')} | ||
/> | ||
<Dialog.Content> | ||
<p id={descriptionId}> | ||
{t('reservation:reservationTimeExpiringModal.text', { | ||
count: timeLeft as number, | ||
})} | ||
</p> | ||
</Dialog.Content> | ||
<Dialog.ActionButtons> | ||
<Button onClick={handleClose} type="button" variant="primary"> | ||
{t('reservation:reservationTimeExpiringModal.buttonClose')} | ||
</Button> | ||
</Dialog.ActionButtons> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
export default ReservationTimeExpiringModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters