Skip to content

Commit c2be2fd

Browse files
authored
feat: Make German mandatory for HuH in Funnel (#959)
## What was done? - German must now be selected by HuH during registration funnel - Added translations for error message
1 parent 2b77fe8 commit c2be2fd

File tree

8 files changed

+34
-12
lines changed

8 files changed

+34
-12
lines changed

src/lang/ar.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@
475475
"titlePupil": "ما هي اللغات التي تتحدث بها في المنزل؟",
476476
"titleStudent": "ما هي اللغات التي تتحدثينها بطلاقة؟",
477477
"descriptionPupil": "نحاول أن نجمعك مع متطوعون يتحدثون لغات متطوعون .",
478-
"descriptionStudent": "نحاول أن نجمعك مع تلاميذ يتحدثون لغات متشابهة."
478+
"descriptionStudent": "نحاول أن نجمعك مع تلاميذ يتحدثون لغات متشابهة.",
479+
"germanRequiredError": "لكي يعمل الدعم بشكل صحيح، فإن اللغة الألمانية مطلوبة كلغة مشتركة. يرجى اختيار اللغة الألمانية."
479480
},
480481
"bookAppointment": {
481482
"title": "مقابلة تعارف",

src/lang/de.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@
572572
"titlePupil": "Welche Sprachen sprichst du zu Hause?",
573573
"titleStudent": "Welche Sprachen sprichst du fließend?",
574574
"descriptionPupil": "Wir versuchen, dich mit Helfer:innen zusammenzubringen, die ähnliche Sprachen sprechen.",
575-
"descriptionStudent": "Wir versuchen, dich mit Schüler:innen zusammenzubringen, die ähnliche Sprachen sprechen."
575+
"descriptionStudent": "Wir versuchen, dich mit Schüler:innen zusammenzubringen, die ähnliche Sprachen sprechen.",
576+
"germanRequiredError": "Damit die Unterstützung gut funktioniert, ist Deutsch als gemeinsame Sprache erforderlich. Bitte wähle Deutsch aus."
576577
},
577578
"bookAppointment": {
578579
"title": "Kennenlern-Gespräch",

src/lang/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@
475475
"titlePupil": "What languages do you speak at home?",
476476
"titleStudent": "Which languages do you speak fluently?",
477477
"descriptionPupil": "We try to bring you together with volunteers who speak similar languages.",
478-
"descriptionStudent": "We try to bring you together with pupils who speak similar languages."
478+
"descriptionStudent": "We try to bring you together with pupils who speak similar languages.",
479+
"germanRequiredError": "For the support to work properly, German is required as the common language. Please select German."
479480
},
480481
"bookAppointment": {
481482
"title": "Introductory Meeting",

src/lang/ru.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@
475475
"titlePupil": "На каких языках вы говорите дома?",
476476
"titleStudent": "Какими языками вы владеете свободно?",
477477
"descriptionPupil": "Мы стараемся объединить вас с помощниками, говорящими на похожих языках.",
478-
"descriptionStudent": "Мы стараемся объединить вас со студентами, говорящими на похожих языках."
478+
"descriptionStudent": "Мы стараемся объединить вас со студентами, говорящими на похожих языках.",
479+
"germanRequiredError": "Чтобы поддержка работала корректно, необходим немецкий язык как общий язык. Пожалуйста, выберите немецкий."
479480
},
480481
"bookAppointment": {
481482
"title": "Знакомство",

src/lang/tr.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@
475475
"titlePupil": "Evde hangi dilleri konuşuyorsunuz?",
476476
"titleStudent": "Hangi dilleri akıcı bir şekilde konuşabiliyorsunuz?",
477477
"descriptionPupil": "Sizi benzer dilleri konuşan yardımcılarla bir araya getirmeye çalışıyoruz.",
478-
"descriptionStudent": "Sizi benzer dilleri konuşan öğrencilerle bir araya getirmeye çalışıyoruz."
478+
"descriptionStudent": "Sizi benzer dilleri konuşan öğrencilerle bir araya getirmeye çalışıyoruz.",
479+
"germanRequiredError": "Desteğin düzgün çalışabilmesi için ortak dil olarak Almanca gereklidir. Lütfen Almanca’yı seçin."
479480
},
480481
"bookAppointment": {
481482
"title": "Tanışma Görüşmesi",

src/lang/uk.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@
475475
"titlePupil": "Якими мовами ви розмовляєте вдома?",
476476
"titleStudent": "Якими мовами ви вільно володієте?",
477477
"descriptionPupil": "Ми намагаємося звести вас з помічниками, які розмовляють схожими мовами.",
478-
"descriptionStudent": "Ми намагаємося звести вас зі студентами, які розмовляють схожими мовами."
478+
"descriptionStudent": "Ми намагаємося звести вас зі студентами, які розмовляють схожими мовами.",
479+
"germanRequiredError": "Щоб підтримка працювала належним чином, потрібна німецька мова як спільна мова. Будь ласка, виберіть німецьку."
479480
},
480481
"bookAppointment": {
481482
"title": "Зустріч-ознайомлення",

src/pages/registration/RegistrationStep.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface _RegistrationStepProps {
1212
isNextDisabled?: boolean;
1313
isBackDisabled?: boolean;
1414
className?: string;
15+
reasonNextDisabled?: string;
1516
}
1617

1718
export type RegistrationStepProps = Omit<_RegistrationStepProps, 'children'>;
@@ -46,7 +47,7 @@ export const RegistrationStepDescription = ({ className, variant = 'body-lg', ch
4647
);
4748
};
4849

49-
export const RegistrationStep = ({ onBack, onNext, isBackDisabled, isNextDisabled, className, children }: _RegistrationStepProps) => {
50+
export const RegistrationStep = ({ onBack, onNext, isBackDisabled, isNextDisabled, className, reasonNextDisabled, children }: _RegistrationStepProps) => {
5051
const handleOnSubmit = (event: React.FormEvent<HTMLFormElement>) => {
5152
event.preventDefault();
5253
if (!isNextDisabled && onNext) {
@@ -81,6 +82,7 @@ export const RegistrationStep = ({ onBack, onNext, isBackDisabled, isNextDisable
8182
</Button>
8283
<Button
8384
disabled={isNextDisabled}
85+
reasonDisabled={reasonNextDisabled}
8486
variant="ghost"
8587
className={cn(
8688
'size-[70px] rounded-full border border-transparent md:hover:border-primary transition-colors duration-300 ease-in-out px-0',

src/pages/registration/UserLanguages.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { useTranslation } from 'react-i18next';
2-
import { OptionalBadge, RegistrationStep, RegistrationStepDescription, RegistrationStepProps, RegistrationStepTitle } from './RegistrationStep';
2+
import { RegistrationStep, RegistrationStepDescription, RegistrationStepProps, RegistrationStepTitle } from './RegistrationStep';
33
import { useRegistrationForm } from './useRegistrationForm';
44
import { LanguageSelector } from '@/components/LanguageSelector';
55
import { Language } from '@/gql/graphql';
6-
import { Typography } from '@/components/Typography';
76
import { usePageTitle } from '@/hooks/usePageTitle';
7+
import { Typography } from '@/components/Typography';
8+
import { cn } from '@/lib/Tailwind';
89

910
interface UserLanguagesProps extends RegistrationStepProps {}
1011

@@ -17,11 +18,16 @@ export const UserLanguages = ({ onBack, onNext }: UserLanguagesProps) => {
1718
onFormChange({ languages: values });
1819
};
1920

20-
const isNextDisabled = form.userType === 'pupil' ? form.languages.length === 0 : false;
21+
const isNextDisabled = form.userType === 'pupil' ? form.languages.length === 0 : !form.languages.includes(Language.Deutsch);
2122

2223
return (
23-
<RegistrationStep className="px-0" onBack={onBack} onNext={onNext} isNextDisabled={isNextDisabled}>
24-
{form.userType === 'student' && <OptionalBadge />}
24+
<RegistrationStep
25+
className="px-0"
26+
onBack={onBack}
27+
onNext={onNext}
28+
isNextDisabled={isNextDisabled}
29+
reasonNextDisabled={isNextDisabled ? t('registration.steps.languages.germanRequiredError') : undefined}
30+
>
2531
<RegistrationStepTitle className="mb-3">
2632
{t(form.userType === 'pupil' ? 'registration.steps.languages.titlePupil' : 'registration.steps.languages.titleStudent')}
2733
</RegistrationStepTitle>
@@ -47,6 +53,14 @@ export const UserLanguages = ({ onBack, onNext }: UserLanguagesProps) => {
4753
setValue={onChange}
4854
/>
4955
</div>
56+
<Typography
57+
variant="sm"
58+
className={cn('text-destructive px-1 min-h-5 leading-1 mt-4 text-center', {
59+
invisible: !form.languages.length || form.languages.includes(Language.Deutsch),
60+
})}
61+
>
62+
{t('registration.steps.languages.germanRequiredError')}
63+
</Typography>
5064
</RegistrationStep>
5165
);
5266
};

0 commit comments

Comments
 (0)