fix(SW-360): scroll to first validation + remove unused translations

This commit is contained in:
Chuma McPhoy
2024-11-25 10:26:18 +01:00
parent 03db7cec16
commit 79f48adbf5
6 changed files with 12 additions and 6 deletions

View File

@@ -79,6 +79,17 @@ export default function SignupForm({ link, subtitle, title }: SignUpFormProps) {
signup.mutate({ ...data, language: lang })
}
async function handleValidation() {
const result = await methods.trigger()
if (!result) {
// Get first error field and focus on it.
const firstError = Object.keys(methods.formState.errors)[0]
if (firstError) {
methods.setFocus(firstError as keyof SignUpSchema)
}
}
}
return (
<section className={styles.formWrapper}>
<Title as="h3">{title}</Title>
@@ -190,7 +201,7 @@ export default function SignupForm({ link, subtitle, title }: SignUpFormProps) {
type="button"
theme="base"
intent="primary"
onClick={() => methods.trigger()}
onClick={handleValidation}
data-testid="trigger-validation"
>
{signupButtonText}

View File

@@ -406,7 +406,6 @@
"Which room class suits you the best?": "Hvilken rumklasse passer bedst til dig",
"Year": "År",
"Yes": "Ja",
"Yes, I accept the Terms and conditions for Scandic Friends and understand that Scandic will process my personal data in accordance with": "Ja, jeg accepterer vilkårene for Scandic Friends og forstår, at Scandic vil behandle mine personlige oplysninger i henhold til",
"Yes, discard changes": "Ja, kasser ændringer",
"Yes, remove my card": "Ja, fjern mit kort",
"You can always change your mind later and add breakfast at the hotel.": "Du kan altid ombestemme dig senere og tilføje morgenmad på hotellet.",

View File

@@ -405,7 +405,6 @@
"Which room class suits you the best?": "Welche Zimmerklasse passt am besten zu Ihnen?",
"Year": "Jahr",
"Yes": "Ja",
"Yes, I accept the Terms and conditions for Scandic Friends and understand that Scandic will process my personal data in accordance with": "Ja, ich akzeptiere die Geschäftsbedingungen für Scandic Friends und erkenne an, dass Scandic meine persönlichen Daten in Übereinstimmung mit",
"Yes, discard changes": "Ja, Änderungen verwerfen",
"Yes, remove my card": "Ja, meine Karte entfernen",
"You can always change your mind later and add breakfast at the hotel.": "Sie können es sich später jederzeit anders überlegen und das Frühstück im Hotel hinzufügen.",

View File

@@ -406,7 +406,6 @@
"Which room class suits you the best?": "Mikä huoneluokka sopii sinulle parhaiten?",
"Year": "Vuosi",
"Yes": "Kyllä",
"Yes, I accept the Terms and conditions for Scandic Friends and understand that Scandic will process my personal data in accordance with": "Kyllä, hyväksyn Scandic Friends -käyttöehdot ja ymmärrän, että Scandic käsittelee minun henkilötietoni asianmukaisesti",
"Yes, discard changes": "Kyllä, hylkää muutokset",
"Yes, remove my card": "Kyllä, poista korttini",
"You can always change your mind later and add breakfast at the hotel.": "Voit aina muuttaa mieltäsi myöhemmin ja lisätä aamiaisen hotelliin.",

View File

@@ -403,7 +403,6 @@
"Which room class suits you the best?": "Hvilken romklasse passer deg best?",
"Year": "År",
"Yes": "Ja",
"Yes, I accept the Terms and conditions for Scandic Friends and understand that Scandic will process my personal data in accordance with": "Ja, jeg aksepterer vilkårene for Scandic Friends og forstår at Scandic vil behandle mine personlige opplysninger i henhold til",
"Yes, discard changes": "Ja, forkast endringer",
"Yes, remove my card": "Ja, fjern kortet mitt",
"You can always change your mind later and add breakfast at the hotel.": "Du kan alltid ombestemme deg senere og legge til frokost på hotellet.",

View File

@@ -403,7 +403,6 @@
"Which room class suits you the best?": "Vilken rumsklass passar dig bäst?",
"Year": "År",
"Yes": "Ja",
"Yes, I accept the Terms and conditions for Scandic Friends and understand that Scandic will process my personal data in accordance with": "Ja, jag accepterar villkoren för Scandic Friends och förstår att Scandic kommer att bearbeta mina personliga uppgifter i enlighet med",
"Yes, discard changes": "Ja, ignorera ändringar",
"Yes, remove my card": "Ja, ta bort mitt kort",
"You can always change your mind later and add breakfast at the hotel.": "Du kan alltid ändra dig senare och lägga till frukost på hotellet.",