Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add help us improve field to all registrations #1737

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions public/locales/bg/validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"legal-entity": "Юридическо лице",
"unique-field-violation": "Полето `{1}` със тази стойност вече съществува в платформата.",
"payment-reference": "Невалиден формат на кода за плащане",
"eik-invalid": "Невалидно ЕИК"
}
"eik-invalid": "Невалидно ЕИК",
"help-us-improve": "Искате ли да ни помогнете да подобрим платформата? Искаме да чуем Вашето мнение? Отделете ни 30 минути, за подобрите платформа на Подкрепи.бг"
}
5 changes: 3 additions & 2 deletions public/locales/en/validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 minutes to help us improve Podkrepi.bg"
}
4 changes: 4 additions & 0 deletions src/components/client/auth/register/CorporateRegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<CorporateRegisterFormData> = yup
.object()
Expand All @@ -39,6 +40,7 @@ const validationSchema: yup.SchemaOf<CorporateRegisterFormData> = 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 = {
Expand All @@ -59,6 +61,7 @@ export default function CorporateRegisterForm({ onSubmit, loading }: RegisterFor
terms: false,
gdpr: false,
newsletter: false,
helpUsImprove: false,
}
return (
<GenericForm
Expand Down Expand Up @@ -115,6 +118,7 @@ export default function CorporateRegisterForm({ onSubmit, loading }: RegisterFor
<AcceptTermsField name="terms" />
<AcceptPrivacyPolicyField name="gdpr" />
<AcceptNewsLetterField name="newsletter" />
<HelpUsImproveField name="helpUsImprove" />
</Grid>
<Grid item xs={12}>
<SubmitButton fullWidth label="auth:cta.register" loading={loading} />
Expand Down
4 changes: 4 additions & 0 deletions src/components/client/auth/register/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<IndividualRegisterFormData> = yup
.object()
Expand All @@ -27,6 +28,7 @@ const validationSchema: yup.SchemaOf<IndividualRegisterFormData> = 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 = {
Expand All @@ -45,6 +47,7 @@ export default function RegisterForm({ onSubmit, loading }: RegisterFormProps) {
terms: false,
gdpr: false,
newsletter: false,
helpUsImprove: false,
}
return (
<GenericForm
Expand Down Expand Up @@ -85,6 +88,7 @@ export default function RegisterForm({ onSubmit, loading }: RegisterFormProps) {
<AcceptTermsField name="terms" />
<AcceptPrivacyPolicyField name="gdpr" />
<AcceptNewsLetterField name="newsletter" />
<HelpUsImproveField name="helpUsImprove" />
</Grid>
<Grid item xs={12}>
<SubmitButton fullWidth label="auth:cta.register" loading={loading} />
Expand Down
18 changes: 18 additions & 0 deletions src/components/common/form/HelpUsImproveField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useTranslation } from 'next-i18next'
import { Typography } from '@mui/material'

import CheckboxField from 'components/common/form/CheckboxField'

export type HelpUsImproveFieldProps = {
name: string
}

export default function HelpUsImproveField({ name }: HelpUsImproveFieldProps) {
const { t } = useTranslation()
return (
<CheckboxField
name={name}
label={<Typography variant="body2">{t('validation:help-us-improve')} </Typography>}
/>
)
}
1 change: 1 addition & 0 deletions src/gql/user-registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type IndividualRegisterFormData = {
terms: boolean
gdpr: boolean
newsletter?: boolean
helpUsImprove?: boolean
}

export type CorporateRegisterFormData = IndividualRegisterFormData & {
Expand Down