Skip to content
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
34 changes: 34 additions & 0 deletions apps/web/src/shared/components/auth/signup-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
FormMessage,
} from '@/shared/components/ui/form';
import { Input } from '@/shared/components/ui/input';
import { Checkbox } from '@/shared/components/ui/checkbox';
import { useTranslation } from '@dropit/i18n';

function getFormSchema(t: (key: string) => string) {
Expand All @@ -23,13 +24,17 @@ function getFormSchema(t: (key: string) => string) {
.string()
.min(6, { message: t('common.validation.passwordMinLength') }),
name: z.string().min(1, { message: t('common.validation.nameRequired') }),
dataConsent: z.boolean().refine((val) => val === true, {
message: t('signup.dataConsent.required'),
}),
});
}

type SignupFormData = {
email: string;
password: string;
name: string;
dataConsent: boolean;
};

interface SignupFormProps {
Expand Down Expand Up @@ -57,6 +62,7 @@ export function SignupForm({
email: '',
password: '',
name: '',
dataConsent: false,
},
});

Expand Down Expand Up @@ -139,6 +145,34 @@ export function SignupForm({
</FormItem>
)}
/>
<FormField
control={form.control}
name="dataConsent"
render={({ field }) => (
<FormItem className="flex flex-row items-start space-x-3 space-y-0">
<FormControl>
<Checkbox
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<div className="space-y-1 leading-none">
<FormLabel className="text-sm font-normal text-gray-700 cursor-pointer">
{t('signup.dataConsent.prefix')}{' '}
<a
href="/privacy"
className="text-purple-600 hover:text-purple-700 hover:underline font-medium"
target="_blank"
rel="noopener noreferrer"
>
{t('signup.dataConsent.linkText')}
</a>
</FormLabel>
<FormMessage />
</div>
</FormItem>
)}
/>
<Button
type="submit"
className="w-full"
Expand Down
Loading