From 42ea3608d49b847f9bdc70bd41cd0fe83189ce60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=ED=98=B8=EC=97=B0?= Date: Thu, 21 Mar 2024 14:10:18 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=EB=B9=8C=EB=93=9C=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/home/ticket-tile/ticket-button.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/components/home/ticket-tile/ticket-button.tsx b/components/home/ticket-tile/ticket-button.tsx index b491162..d2176a1 100644 --- a/components/home/ticket-tile/ticket-button.tsx +++ b/components/home/ticket-tile/ticket-button.tsx @@ -1,7 +1,6 @@ 'use client'; import QrScanner from '@/public/qr-scanner.svg'; -import BottomSheet from '@/components/common/bottom-sheet'; import useBottomSheet from '@/hooks/useBottomSheet'; type TicketButtonProps = { @@ -9,7 +8,7 @@ type TicketButtonProps = { }; export default function TicketButton({ label }: TicketButtonProps) { - const { isOpen, open, close } = useBottomSheet(); + const [BottomSheet, open] = useBottomSheet(); return ( <> */} ; @@ -11,9 +11,3 @@ export const smsCodeSchema = z.object({ }); export type SMSCodeSchema = z.infer; - -export const tokenSchema = z.object({ - token: z.string().uuid(), -}); - -export type TokenSchema = z.infer; \ No newline at end of file diff --git a/app/[locale]/signup/schema.ts b/app/[locale]/signup/schema.ts new file mode 100644 index 0000000..cdd270a --- /dev/null +++ b/app/[locale]/signup/schema.ts @@ -0,0 +1,7 @@ +import { z } from 'zod'; + +export const tokenSchema = z.object({ + token: z.string().uuid(), +}); + +export type TokenSchema = z.infer; diff --git a/app/[locale]/signup/studentId/page.tsx b/app/[locale]/signup/studentId/page.tsx index c1a0bb1..21aa8ce 100644 --- a/app/[locale]/signup/studentId/page.tsx +++ b/app/[locale]/signup/studentId/page.tsx @@ -84,7 +84,10 @@ export default function Page() { {step === '학번' && } {step === '비밀번호' && } -
입력해주세요.
+ {step === '약관동의' && ( + + )} + {step !== '약관동의' &&
입력해주세요.
}
{ if (isStudentId(event.target.value) && step === '학번') { onNext(steps[currentStep]); diff --git a/components/common/form/index.tsx b/components/common/form/index.tsx index cd795a8..4755470 100644 --- a/components/common/form/index.tsx +++ b/components/common/form/index.tsx @@ -1,13 +1,8 @@ 'use client'; import clsx from 'clsx'; -import { - HTMLAttributes, - HTMLInputTypeAttribute, - forwardRef, - useEffect, -} from 'react'; -import { AnimatePresence, motion, useAnimate } from 'framer-motion'; +import { HTMLAttributes, HTMLInputTypeAttribute, forwardRef } from 'react'; +import { AnimatePresence, motion } from 'framer-motion'; import { variants } from './motion'; import { ChangeHandler, @@ -50,6 +45,8 @@ type InputProps = { onChange?: ChangeHandler; options?: RegisterOptions; required?: boolean; + disabled?: boolean; + customError?: string; }; type InputSubComponents = Omit & { @@ -87,7 +84,7 @@ export default function Form({ } const Input = forwardRef(function ( - { className, name, options, label, ...props }, + { className, name, options, label, disabled, customError, ...props }, reference ) { const { register, formState } = useFormContext(); @@ -118,15 +115,17 @@ const Input = forwardRef(function ( variants={variants.input} initial='initial' whileTap='active' - className={clsx( + className={cn( 'bg-neutral-200 w-full rounded-md h-12 px-4 dark:bg-neutral-800 dark:placeholder-neutral-500 placeholder-neutral-400', + disabled && 'text-neutral-300 dark:text-neutral-600', className )} + disabled={disabled} {...props} {...rest} /> - {errors[name]?.message && ( + {(errors[name]?.message || customError) && ( (function ( transition={{ duration: 0.2 }} className='text-xs text-red-500 dark:text-red-400' > - {errors[name]?.message?.toString()} + {errors[name]?.message?.toString() || customError} )} diff --git a/constants/index.ts b/constants/index.ts index 9d436fc..dc65751 100644 --- a/constants/index.ts +++ b/constants/index.ts @@ -9,7 +9,7 @@ export const API_ROUTES = { user: { me: '/user', login: '/user/login', - signup: '/user/signup', + signup: (token: string) => `/user/${token}`, dku: { verify: '/user/dku/verify', }, @@ -17,6 +17,7 @@ export const API_ROUTES = { send: (token: string) => `/user/sms/${token}`, verify: (token: string) => `/user/sms/verify/${token}`, }, + valid: (nickname: string) => `/user/valid?nickname=${nickname}`, }, ticket: { reservation: '/ticket/reservation', From e32bf949ff665ba234ab5a5a6eb7a12e78214989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=ED=98=B8=EC=97=B0?= Date: Thu, 21 Mar 2024 16:54:32 +0900 Subject: [PATCH 3/5] =?UTF-8?q?feat:=20=EC=9D=B8=EC=A6=9D=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EC=9E=85=EB=A0=A5=20=EC=8B=9C=20=EB=B0=94=EB=A1=9C?= =?UTF-8?q?=20=EB=84=98=EC=96=B4=EA=B0=80=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/[locale]/(navigation)/login/page.tsx | 6 +++++- app/[locale]/signup/info/action.ts | 2 ++ app/[locale]/signup/info/page.tsx | 14 +++++--------- app/[locale]/signup/phone/action.ts | 2 ++ app/[locale]/signup/phone/page.tsx | 1 - 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/[locale]/(navigation)/login/page.tsx b/app/[locale]/(navigation)/login/page.tsx index 047b583..b4350a5 100644 --- a/app/[locale]/(navigation)/login/page.tsx +++ b/app/[locale]/(navigation)/login/page.tsx @@ -6,14 +6,18 @@ import useToastStore from '@/stores/toast-state'; import { useLocale } from 'next-intl'; import Link from 'next/link'; import { AuthInfoSchema, authInfoSchema } from './schema'; +import { useState } from 'react'; export default function LoginPage() { const { open } = useToastStore(); + const [isLoading, setIsLoading] = useState(false); const locale = useLocale(); const onSubmit = async (data: AuthInfoSchema) => { try { + setIsLoading(true); await authenticate(data); + setIsLoading(false); } catch (error) { open('로그인에 실패했습니다. 다시 시도해주세요.'); } @@ -32,7 +36,7 @@ export default function LoginPage() { placeholder='비밀번호' /> - + 로그인