fix(SW-360): scroll to first validation + remove unused translations
This commit is contained in:
@@ -79,6 +79,17 @@ export default function SignupForm({ link, subtitle, title }: SignUpFormProps) {
|
|||||||
signup.mutate({ ...data, language: lang })
|
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 (
|
return (
|
||||||
<section className={styles.formWrapper}>
|
<section className={styles.formWrapper}>
|
||||||
<Title as="h3">{title}</Title>
|
<Title as="h3">{title}</Title>
|
||||||
@@ -190,7 +201,7 @@ export default function SignupForm({ link, subtitle, title }: SignUpFormProps) {
|
|||||||
type="button"
|
type="button"
|
||||||
theme="base"
|
theme="base"
|
||||||
intent="primary"
|
intent="primary"
|
||||||
onClick={() => methods.trigger()}
|
onClick={handleValidation}
|
||||||
data-testid="trigger-validation"
|
data-testid="trigger-validation"
|
||||||
>
|
>
|
||||||
{signupButtonText}
|
{signupButtonText}
|
||||||
|
|||||||
@@ -406,7 +406,6 @@
|
|||||||
"Which room class suits you the best?": "Hvilken rumklasse passer bedst til dig",
|
"Which room class suits you the best?": "Hvilken rumklasse passer bedst til dig",
|
||||||
"Year": "År",
|
"Year": "År",
|
||||||
"Yes": "Ja",
|
"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, discard changes": "Ja, kasser ændringer",
|
||||||
"Yes, remove my card": "Ja, fjern mit kort",
|
"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.",
|
"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.",
|
||||||
|
|||||||
@@ -405,7 +405,6 @@
|
|||||||
"Which room class suits you the best?": "Welche Zimmerklasse passt am besten zu Ihnen?",
|
"Which room class suits you the best?": "Welche Zimmerklasse passt am besten zu Ihnen?",
|
||||||
"Year": "Jahr",
|
"Year": "Jahr",
|
||||||
"Yes": "Ja",
|
"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, discard changes": "Ja, Änderungen verwerfen",
|
||||||
"Yes, remove my card": "Ja, meine Karte entfernen",
|
"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.",
|
"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.",
|
||||||
|
|||||||
@@ -406,7 +406,6 @@
|
|||||||
"Which room class suits you the best?": "Mikä huoneluokka sopii sinulle parhaiten?",
|
"Which room class suits you the best?": "Mikä huoneluokka sopii sinulle parhaiten?",
|
||||||
"Year": "Vuosi",
|
"Year": "Vuosi",
|
||||||
"Yes": "Kyllä",
|
"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, discard changes": "Kyllä, hylkää muutokset",
|
||||||
"Yes, remove my card": "Kyllä, poista korttini",
|
"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.",
|
"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.",
|
||||||
|
|||||||
@@ -403,7 +403,6 @@
|
|||||||
"Which room class suits you the best?": "Hvilken romklasse passer deg best?",
|
"Which room class suits you the best?": "Hvilken romklasse passer deg best?",
|
||||||
"Year": "År",
|
"Year": "År",
|
||||||
"Yes": "Ja",
|
"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, discard changes": "Ja, forkast endringer",
|
||||||
"Yes, remove my card": "Ja, fjern kortet mitt",
|
"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.",
|
"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.",
|
||||||
|
|||||||
@@ -403,7 +403,6 @@
|
|||||||
"Which room class suits you the best?": "Vilken rumsklass passar dig bäst?",
|
"Which room class suits you the best?": "Vilken rumsklass passar dig bäst?",
|
||||||
"Year": "År",
|
"Year": "År",
|
||||||
"Yes": "Ja",
|
"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, discard changes": "Ja, ignorera ändringar",
|
||||||
"Yes, remove my card": "Ja, ta bort mitt kort",
|
"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.",
|
"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.",
|
||||||
|
|||||||
Reference in New Issue
Block a user