diff --git a/frontend/app/(urls)/register/admin/page.tsx b/frontend/app/(urls)/register/admin/page.tsx new file mode 100644 index 0000000..2868bf2 --- /dev/null +++ b/frontend/app/(urls)/register/admin/page.tsx @@ -0,0 +1,7 @@ +import React from 'react' + +const page = () => { + return
page
+} + +export default page diff --git a/frontend/app/(urls)/register/components/ClientRegistrationForm.tsx b/frontend/app/(urls)/register/components/ClientRegistrationForm.tsx new file mode 100644 index 0000000..18f1f64 --- /dev/null +++ b/frontend/app/(urls)/register/components/ClientRegistrationForm.tsx @@ -0,0 +1,150 @@ +import React from 'react' +import Link from 'next/link' +import { useForm } from '@/app/hooks/useForm' +import Button from '@/components/ui/Button' +// import LoginButton from '@/app/components/ui/LoginButton' +import showToast from '@/components/ui/Toast' +import { useRouter } from 'next/navigation' +import { signIn } from 'next-auth/react' +import TextInput from '@/components/ui/TextInput' +import PhoneInput from '@/components/ui/PhoneInput' + +const validationRules = { + name: { required: true }, + surname: { required: true }, + phone_number: { + required: true, + minLength: 11, + }, + password: { required: true, minLength: 8 }, + privacy_accepted: { required: true }, +} + +export default function ClientRegistrationForm() { + const router = useRouter() + const { + values, + isVisible, + handleChange, + handleSubmit, + togglePasswordVisibility, + } = useForm( + { + name: '', + surname: '', + email: '', + phone_number: '', + password: '', + privacy_accepted: false, + }, + validationRules, + async (values) => { + try { + const result = await signIn('register-credentials', { + email: values.email, + password: values.password, + username: values.name, + phone_number: values.phone_number, + privacy_accepted: values.privacy_accepted.toString(), + redirect: false, + }) + + if (result?.error) { + showToast({ type: 'error', message: result.error }) + return + } + + showToast({ type: 'success', message: 'Регистрация успешна!' }) + router.push('/account') + } catch { + showToast({ type: 'error', message: 'Ошибка при регистрации' }) + } + } + ) + + return ( + <> +
+
+ + + + + + + + +
+ +
+ + +
+
+ )} + ) } diff --git a/frontend/public/fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf b/frontend/public/fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf new file mode 100644 index 0000000..43ed4f5 Binary files /dev/null and b/frontend/public/fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf differ diff --git a/frontend/public/fonts/Inter/Inter-VariableFont_opsz,wght.ttf b/frontend/public/fonts/Inter/Inter-VariableFont_opsz,wght.ttf new file mode 100644 index 0000000..e31b51e Binary files /dev/null and b/frontend/public/fonts/Inter/Inter-VariableFont_opsz,wght.ttf differ