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 a tick box and text to new registration #1735

Closed
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
3 changes: 2 additions & 1 deletion 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 мин за подобрите платформа на подкрепи.бг"
}
3 changes: 2 additions & 1 deletion 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 mins to help us improve podkrepi.bg"
}
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
27 changes: 27 additions & 0 deletions src/components/common/form/HelpUsImproveField.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<CheckboxField
name={name}
label={
<Typography variant="body2">
{t('validation:help-us-improve')}{' '}
{/* <ExternalLink href={routes.helpUsImprove}>
{t('validation:help-us-improve')}
</ExternalLink> */}
</Typography>
}
/>
)
}
3 changes: 2 additions & 1 deletion src/gql/user-registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export type IndividualRegisterFormData = {
confirmPassword: string
terms: boolean
gdpr: boolean
newsletter?: boolean
newsletter?: boolean,
helpUsImprove?: boolean,
}

export type CorporateRegisterFormData = IndividualRegisterFormData & {
Expand Down
Loading