From 17f70be58198d6ee202ba13145771b750dabd6c5 Mon Sep 17 00:00:00 2001 From: kdachev97 Date: Thu, 14 Mar 2024 11:28:47 +0200 Subject: [PATCH] add help us improve field to all registrations --- public/locales/bg/validation.json | 5 ++-- public/locales/en/validation.json | 5 ++-- .../auth/register/CorporateRegisterForm.tsx | 4 +++ .../client/auth/register/RegisterForm.tsx | 6 ++++- .../common/form/HelpUsImproveField.tsx | 27 +++++++++++++++++++ src/gql/user-registration.ts | 5 ++-- 6 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 src/components/common/form/HelpUsImproveField.tsx diff --git a/public/locales/bg/validation.json b/public/locales/bg/validation.json index 8e1bc2d71..81c5b546b 100644 --- a/public/locales/bg/validation.json +++ b/public/locales/bg/validation.json @@ -22,5 +22,6 @@ "legal-entity": "Юридическо лице", "unique-field-violation": "Полето `{1}` със тази стойност вече съществува в платформата.", "payment-reference": "Невалиден формат на кода за плащане", - "eik-invalid": "Невалидно ЕИК" -} + "eik-invalid": "Невалидно ЕИК", + "help-us-improve": "Искате ли да ни помогнете да подобрим платформата? Искаме да чуем вашето мнение? Отделете ни 30 мин за подобрите платформа на подкрепи.бг" +} \ No newline at end of file diff --git a/public/locales/en/validation.json b/public/locales/en/validation.json index bd0126637..cddcfae51 100644 --- a/public/locales/en/validation.json +++ b/public/locales/en/validation.json @@ -22,5 +22,6 @@ "newsletter": "Please give your consent", "unique-field-violation": "The field `{1}` with this value already exists in the platform.", "payment-reference": "Invalid payment code format", - "eik-invalid": "Invalid EIK" -} + "eik-invalid": "Invalid EIK", + "help-us-improve": "Do you want to help us improve the platform? We want to hear from you? Please spare 30 mins to help us improve podkrepi.bg" +} \ No newline at end of file diff --git a/src/components/client/auth/register/CorporateRegisterForm.tsx b/src/components/client/auth/register/CorporateRegisterForm.tsx index 35b1e2caa..bc7315fcd 100644 --- a/src/components/client/auth/register/CorporateRegisterForm.tsx +++ b/src/components/client/auth/register/CorporateRegisterForm.tsx @@ -14,6 +14,7 @@ import { AcceptNewsLetterField } from 'components/common/form/AcceptNewsletterFi import { AccountType } from 'gql/user-registration' import { validateEIK13, validateEIK9 } from 'components/common/validations/EIKValidator' import { CorporateRegisterFormData } from 'gql/user-registration' +import HelpUsImproveField from 'components/common/form/HelpUsImproveField' const validationSchema: yup.SchemaOf = yup .object() @@ -39,6 +40,7 @@ const validationSchema: yup.SchemaOf = yup terms: yup.bool().required().oneOf([true], 'validation:terms-of-use'), gdpr: yup.bool().required().oneOf([true], 'validation:terms-of-service'), newsletter: yup.bool().required().oneOf([true, false]), + helpUsImprove: yup.bool().required().oneOf([true, false]), }) export type RegisterFormProps = { @@ -59,6 +61,7 @@ export default function CorporateRegisterForm({ onSubmit, loading }: RegisterFor terms: false, gdpr: false, newsletter: false, + helpUsImprove: false, } return ( + diff --git a/src/components/client/auth/register/RegisterForm.tsx b/src/components/client/auth/register/RegisterForm.tsx index 5ee114f58..11d39b38d 100644 --- a/src/components/client/auth/register/RegisterForm.tsx +++ b/src/components/client/auth/register/RegisterForm.tsx @@ -13,6 +13,7 @@ import { AcceptNewsLetterField } from 'components/common/form/AcceptNewsletterFi import { AccountType } from 'gql/user-registration' import { IndividualRegisterFormData } from 'gql/user-registration' +import HelpUsImproveField from 'components/common/form/HelpUsImproveField' const validationSchema: yup.SchemaOf = yup .object() @@ -27,6 +28,7 @@ const validationSchema: yup.SchemaOf = yup terms: yup.bool().required().oneOf([true], 'validation:terms-of-use'), gdpr: yup.bool().required().oneOf([true], 'validation:terms-of-service'), newsletter: yup.bool().required().oneOf([true, false]), + helpUsImprove: yup.bool().required().oneOf([true, false]), }) export type RegisterFormProps = { @@ -45,6 +47,7 @@ export default function RegisterForm({ onSubmit, loading }: RegisterFormProps) { terms: false, gdpr: false, newsletter: false, + helpUsImprove: false, } return ( + @@ -92,4 +96,4 @@ export default function RegisterForm({ onSubmit, loading }: RegisterFormProps) { ) -} +} \ No newline at end of file diff --git a/src/components/common/form/HelpUsImproveField.tsx b/src/components/common/form/HelpUsImproveField.tsx new file mode 100644 index 000000000..2c83d77a2 --- /dev/null +++ b/src/components/common/form/HelpUsImproveField.tsx @@ -0,0 +1,27 @@ +import { useTranslation } from 'next-i18next' +import { Typography } from '@mui/material' + +// import { routes } from 'common/routes' +// import ExternalLink from 'components/common/ExternalLink' +import CheckboxField from 'components/common/form/CheckboxField' + +export type HelpUsImproveFieldProps = { + name: string +} + +export default function HelpUsImproveField({ name }: HelpUsImproveFieldProps) { + const { t } = useTranslation() + return ( + + {t('validation:help-us-improve')}{' '} + {/* + {t('validation:help-us-improve')} + */} + + } + /> + ) +} \ No newline at end of file diff --git a/src/gql/user-registration.ts b/src/gql/user-registration.ts index 5b93ce358..0d31a3415 100644 --- a/src/gql/user-registration.ts +++ b/src/gql/user-registration.ts @@ -12,10 +12,11 @@ export type IndividualRegisterFormData = { confirmPassword: string terms: boolean gdpr: boolean - newsletter?: boolean + newsletter?: boolean, + helpUsImprove?: boolean, } export type CorporateRegisterFormData = IndividualRegisterFormData & { companyName: string companyNumber: string -} +} \ No newline at end of file