'use client'; import { toast } from '@/components/hooks/use-toast'; import { Button } from '@/components/ui/button'; import { Checkbox } from '@/components/ui/checkbox'; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; import { InputOTP, InputOTPGroup, InputOTPSlot, } from '@/components/ui/input-otp'; import { useTranslate } from '@/hooks/common-hooks'; import { zodResolver } from '@hookform/resolvers/zod'; import { useForm } from 'react-hook-form'; import { z } from 'zod'; export function SignUpForm() { const { t } = useTranslate('login'); const FormSchema = z.object({ email: z.string().email({ message: t('emailPlaceholder'), }), nickname: z.string({ required_error: t('nicknamePlaceholder') }), password: z.string({ required_error: t('passwordPlaceholder') }), agree: z.boolean({ required_error: t('passwordPlaceholder') }), }); const form = useForm>({ resolver: zodResolver(FormSchema), defaultValues: { email: '', }, }); function onSubmit(data: z.infer) { console.log('🚀 ~ onSubmit ~ data:', data); toast({ title: 'You submitted the following values:', description: (
          {JSON.stringify(data, null, 2)}
        
), }); } return (
( {t('emailLabel')} )} /> ( {t('nicknameLabel')} )} /> ( {t('passwordLabel')} )} /> (
I understand and agree to the Terms of Service and Privacy Policy.
)} /> ); } export function SignInForm() { const { t } = useTranslate('login'); const FormSchema = z.object({ email: z.string().email({ message: t('emailPlaceholder'), }), password: z.string({ required_error: t('passwordPlaceholder') }), }); const form = useForm>({ resolver: zodResolver(FormSchema), defaultValues: { email: '', }, }); function onSubmit(data: z.infer) { console.log('🚀 ~ onSubmit ~ data:', data); toast({ title: 'You submitted the following values:', description: (
          {JSON.stringify(data, null, 2)}
        
), }); } return (
( {t('emailLabel')} )} /> ( {t('passwordLabel')} )} />
); } export function VerifyEmailForm() { const FormSchema = z.object({ pin: z.string().min(6, { message: 'Your one-time password must be 6 characters.', }), }); const form = useForm>({ resolver: zodResolver(FormSchema), defaultValues: { pin: '', }, }); function onSubmit(data: z.infer) { console.log('🚀 ~ onSubmit ~ data:', data); toast({ title: 'You submitted the following values:', description: (
          {JSON.stringify(data, null, 2)}
        
), }); } return (
( One-Time Password )} /> ); }