Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit bac81fe

Browse files
committed
Adds loadingTexts to buttons with isLoading
- includes preliminary translations
1 parent 3bca3b8 commit bac81fe

12 files changed

Lines changed: 23 additions & 2 deletions

File tree

apps/ui/components/calendar/ReservationCalendarControls.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ const ReservationCalendarControls = <T extends Record<string, unknown>>({
664664
}}
665665
disabled={!isReservable}
666666
isLoading={isReserving}
667+
loadingText={t("reservationCalendar:makeReservationLoading")}
667668
data-test="reservation__button--submit"
668669
>
669670
{t("reservationCalendar:makeReservation")}

apps/ui/components/reservation-unit/QuickReservation.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ const QuickReservation = ({
705705
}
706706
}}
707707
isLoading={isReserving}
708+
loadingText={t("reservationCalendar:makeReservationLoading")}
708709
data-test="quick-reservation__button--submit"
709710
>
710711
{t("reservationCalendar:makeReservation")}

apps/ui/components/reservation/EditStep0.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ const EditStep0 = ({
492492
}}
493493
data-testid="reservation-edit__button--continue"
494494
isLoading={isLoading}
495+
loadingText={t("reservationCalendar:nextStepLoading")}
495496
>
496497
{t("reservationCalendar:nextStep")}
497498
</MediumButton>

apps/ui/components/reservation/EditStep1.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ const EditStep1 = ({
352352
disabled={isSubmitting}
353353
data-testid="reservation-edit__button--submit"
354354
isLoading={isSubmitting}
355+
loadingText={t("reservations:saveNewTimeLoading")}
355356
>
356357
{t("reservations:saveNewTime")}
357358
</MediumButton>

apps/ui/components/reservation/Step0.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ const Step0 = ({
198198
iconRight={<IconArrowRight aria-hidden />}
199199
data-test="reservation__button--update"
200200
isLoading={isSubmitting}
201+
loadingText={t("reservationCalendar:nextStepLoading")}
201202
>
202203
{t("reservationCalendar:nextStep")}
203204
</MediumButton>

apps/ui/components/reservation/Step1.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ const Step1 = ({
9191
}: Props): JSX.Element => {
9292
const { t } = useTranslation();
9393
const {
94-
formState: { isSubmitting, isSubmitted },
94+
formState: { isSubmitting },
9595
} = useFormContext();
96-
96+
const [isSubmitted, setIsSubmitted] = useState(false);
9797
const [areTermsSpaceAccepted, setAreTermsSpaceAccepted] = useState(false);
9898
const [areServiceSpecificTermsAccepted, setAreServiceSpecificTermsAccepted] =
9999
useState(false);
@@ -139,6 +139,7 @@ const Step1 = ({
139139
<Form
140140
onSubmit={(e) => {
141141
e.preventDefault();
142+
setIsSubmitted(true);
142143
if (areTermsSpaceAccepted && areServiceSpecificTermsAccepted) {
143144
handleSubmit();
144145
}
@@ -355,6 +356,9 @@ const Step1 = ({
355356
}
356357
data-test="reservation__button--update"
357358
isLoading={isSubmitting}
359+
loadingText={t(
360+
`reservationCalendar:${requiresHandling ? "nextStep" : "makeReservation"}Loading`
361+
)}
358362
disabled={!areTermsSpaceAccepted || !areServiceSpecificTermsAccepted}
359363
>
360364
{t(

apps/ui/public/locales/en/reservationCalendar.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"showView": "Show {{view}} view",
2121
"initialReservation": "Preliminary booking",
2222
"makeReservation": "Book",
23+
"makeReservationLoading": "Booking",
2324
"reserverInfo": "Booker’s information",
2425
"reservationInfo": "Booking details",
2526
"notification": {
@@ -71,6 +72,7 @@
7172
"step3": "Booking ready"
7273
},
7374
"nextStep": "Continue",
75+
"nextStepLoading": "Continuing",
7476
"reservationSummary": "Booking summary",
7577
"errors": {
7678
"bufferCollision": "The booking is too close to the previous or next booking. Please change the booking time.",

apps/ui/public/locales/en/reservations.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
"editReservationTime": "Change the booking time",
1818
"cancelEditReservationTime": "Stop editing",
1919
"saveNewTime": "Save the new time",
20+
"saveNewTimeLoadingText": "Saving the new time",
2021
"saveNewTimeSuccess": "Time of the booking has been changed",
2122
"cancelReservation": "Cancel booking",
2223
"cancelReservationCancellation": "Undo the cancelling",
2324
"cancelReservationAbbreviated": "Cancel",
2425
"cancelApplication": "Cancel application",
26+
"cancelLoadingText": "Cancelling",
2527
"cancelReservationBody": "You are about to cancel your booking.",
2628
"redoReservation": "Make a new booking",
2729
"upcomingReservations": "Upcoming",

apps/ui/public/locales/fi/reservationCalendar.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"showView": "Näytä {{view}}näkymä",
2121
"initialReservation": "Alustava varaus",
2222
"makeReservation": "Varaa",
23+
"makeReservationLoading": "Varataan",
2324
"reserverInfo": "Varaajan tiedot",
2425
"reservationInfo": "Varauksen tiedot",
2526
"notification": {
@@ -69,6 +70,7 @@
6970
"step3": "Varaus tehty"
7071
},
7172
"nextStep": "Jatka",
73+
"nextStepLoading": "Jatketaan",
7274
"reservationSummary": "Varauksen yhteenveto",
7375
"errors": {
7476
"bufferCollision": "Varaus on liian lähellä edellistä tai seuraavaa varausta. Muuta varauksen ajankohtaa.",

apps/ui/public/locales/fi/reservations.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
"editReservationTime": "Muuta varauksen aikaa",
1818
"cancelEditReservationTime": "Keskeytä muokkaus",
1919
"saveNewTime": "Tallenna uusi aika",
20+
"saveNewTimeLoadingText": "Tallennetaan uusi aika",
2021
"saveNewTimeSuccess": "Varauksen aika muutettu",
2122
"cancelReservation": "Peru varaus",
2223
"cancelReservationCancellation": "Keskeytä peruminen",
2324
"cancelReservationAbbreviated": "Peru",
2425
"cancelApplication": "Peru hakemus",
26+
"cancelLoadingText": "Perutaan",
2527
"cancelReservationBody": "Olet perumassa tekemääsi varausta.",
2628
"redoReservation": "Varaa uudelleen",
2729
"upcomingReservations": "Tulevat",

0 commit comments

Comments
 (0)