diff --git a/src/app/(user)/edit/_components/form.tsx b/src/app/(user)/edit/_components/form.tsx index fdfb29f..9e86560 100644 --- a/src/app/(user)/edit/_components/form.tsx +++ b/src/app/(user)/edit/_components/form.tsx @@ -14,7 +14,7 @@ import { zodResolver } from '@hookform/resolvers/zod'; import { sizeJersey } from '@/const/size'; import { faculties } from '@/const/faculties'; import { EditForm, EditSchema } from '@/schema/edit'; -import { educationsMap } from '@/const/educations'; +import { educationsMap, educationsMapReverse } from '@/const/educations'; import { universities } from '@/const/universities'; import { statusMap } from '@/const/status'; @@ -148,9 +148,14 @@ export default function Form() { setValue('education', educationsMap[val])} + setValue={val => + setValue( + 'education', + educationsMapReverse[val as 'กำลังศึกษา' | 'จบการศึกษา'], + ) + } placeholder="กำลังศึกษาอยู่" - choices={Object.keys(educationsMap).map(key => key)} + choices={Object.keys(educationsMapReverse).map(key => key)} /> {errors.education?.message} diff --git a/src/app/(user)/register/_components/subpages/two.tsx b/src/app/(user)/register/_components/subpages/two.tsx index 078e20b..2aef7e5 100644 --- a/src/app/(user)/register/_components/subpages/two.tsx +++ b/src/app/(user)/register/_components/subpages/two.tsx @@ -16,7 +16,7 @@ import { useLiff } from '@/contexts/liff'; import { useAuth } from '@/contexts/auth'; import toast from 'react-hot-toast'; import { RegisterForm } from '@/schema/register'; -import { educationsMap } from '@/const/educations'; +import { educationsMap, educationsMapReverse } from '@/const/educations'; import { universities } from '@/const/universities'; import { faculties } from '@/const/faculties'; import { sizeJersey } from '@/const/size'; @@ -142,9 +142,9 @@ export default function Two({ setStep, form }: TwoProps) { setValue('education', educationsMap[val])} + setValue={val => setValue('education', educationsMapReverse[val])} placeholder="กำลังศึกษาอยู่" - choices={Object.keys(educationsMap).map(key => key)} + choices={Object.keys(educationsMapReverse).map(key => key)} /> {errors.education?.message} diff --git a/src/app/(user)/registered-prepare/page.tsx b/src/app/(user)/registered-prepare/page.tsx index 416570d..d28f066 100644 --- a/src/app/(user)/registered-prepare/page.tsx +++ b/src/app/(user)/registered-prepare/page.tsx @@ -2,9 +2,9 @@ import Header from '@/components/registered-prepare/Header'; import Footer from '@/components/homepage/footer'; import Background from '@/components/profile/Background'; -export default function page() { +export default function Page() { return ( -
+
diff --git a/src/app/admin/dashboard/_components/addRole.tsx b/src/app/admin/dashboard/_components/addRole.tsx index ea62631..fa90aa9 100644 --- a/src/app/admin/dashboard/_components/addRole.tsx +++ b/src/app/admin/dashboard/_components/addRole.tsx @@ -1,5 +1,4 @@ import TextInput from '@/app/(user)/register/_components/textInput'; -import { Button } from '@/components/ui/button'; import { useAuth } from '@/contexts/auth'; import { UserPlus } from 'lucide-react'; import { useState } from 'react'; @@ -35,14 +34,13 @@ export default function AddRole() { value={phone} onChange={e => setPhone(e.target.value)} /> - +
); } diff --git a/src/app/admin/dashboard/_components/table/userRow.tsx b/src/app/admin/dashboard/_components/table/userRow.tsx index 7172703..952cd1c 100644 --- a/src/app/admin/dashboard/_components/table/userRow.tsx +++ b/src/app/admin/dashboard/_components/table/userRow.tsx @@ -10,7 +10,7 @@ export default function UserRow({ user }: { user: User }) { return ( - {user.id} + #{user.uid} {user.name} diff --git a/src/app/admin/profile/_components/Top.tsx b/src/app/admin/profile/_components/Top.tsx index 5e4be2b..66e8bf9 100644 --- a/src/app/admin/profile/_components/Top.tsx +++ b/src/app/admin/profile/_components/Top.tsx @@ -1,8 +1,11 @@ +import { useAuth } from '@/contexts/auth'; import { getImageURL } from '@/utils/image'; import Image from 'next/image'; import React from 'react'; export default function Top() { + const { user } = useAuth(); + return (
-
75th CU-TU Unity Football
+
+ The 75th TU-CU Traditional Football Match +
Welcome!, Admin
-
username
+
{user?.name}
); } diff --git a/src/app/gateway/page.tsx b/src/app/gateway/page.tsx index 6be0471..3f1a8a5 100644 --- a/src/app/gateway/page.tsx +++ b/src/app/gateway/page.tsx @@ -19,7 +19,7 @@ const pages = { admin: { home: '/', qr: '/staff/qr', - profile: '/admin/dashboard', + profile: '/admin/profile', }, }; diff --git a/src/components/profile/Header.tsx b/src/components/profile/Header.tsx index 453ce5e..c4df779 100644 --- a/src/components/profile/Header.tsx +++ b/src/components/profile/Header.tsx @@ -26,10 +26,10 @@ export default function Header() {

- CU-TU Unity Football 75th + The 75th TU-CU Traditional Football Match

- ฟุตบอลประเพณีธรรมศาสตร์-จุฬาฯ ครั้งที่ 75 + งานฟุตบอลประเพณีธรรมศาสตร์-จุฬาฯ ครั้งที่ 75

diff --git a/src/components/profile/Ticket/InfButton.tsx b/src/components/profile/Ticket/InfButton.tsx index e84545f..422b2a2 100644 --- a/src/components/profile/Ticket/InfButton.tsx +++ b/src/components/profile/Ticket/InfButton.tsx @@ -5,7 +5,7 @@ import { getImageURL } from '@/utils/image'; export default function InfButton() { return (
diff --git a/src/components/profile/Ticket/Information.tsx b/src/components/profile/Ticket/Information.tsx index 3a4bed5..fcfb974 100644 --- a/src/components/profile/Ticket/Information.tsx +++ b/src/components/profile/Ticket/Information.tsx @@ -1,20 +1,16 @@ 'use client'; -import { useLiff } from '@/contexts/liff'; import { useAuth } from '@/contexts/auth'; export default function Inf() { - const { client } = useLiff(); - const context = client?.getContext(); - const userId = context?.userId || ''; const { user } = useAuth(); - const username = user?.name; + return (

- #UID{userId} + #{user?.uid}

- {username} + {user?.name}

diff --git a/src/components/registered-prepare/Header.tsx b/src/components/registered-prepare/Header.tsx index dae707e..8f5a626 100644 --- a/src/components/registered-prepare/Header.tsx +++ b/src/components/registered-prepare/Header.tsx @@ -18,10 +18,10 @@ export default function header() {

- CU-TU Unity Football 75th + The 75th TU-CU Traditional Football Match

- ฟุตบอลประเพณีธรรมศาสตร์-จุฬาฯ ครั้งที่ 75 + งานฟุตบอลประเพณีธรรมศาสตร์-จุฬาฯ ครั้งที่ 75

@@ -15,10 +17,10 @@ export default function TopPart() { />

- 75th CU-TU Unity Football + The 75th TU-CU Traditional Football Match

Welcome!, Staff

-

{username}

+

{user?.name}

); } diff --git a/src/const/educations.ts b/src/const/educations.ts index 0213e02..f64caa4 100644 --- a/src/const/educations.ts +++ b/src/const/educations.ts @@ -1,7 +1,12 @@ export const educations = ['studying', 'graduated'] as const; export type Education = (typeof educations)[number]; -export const educationsMap: { [key: string]: Education } = { +export const educationsMap = { + studying: 'กำลังศึกษา', + graduated: 'จบการศึกษา', +}; + +export const educationsMapReverse: { [key: string]: Education } = { กำลังศึกษา: 'studying', จบการศึกษา: 'graduated', }; diff --git a/src/schema/user.ts b/src/schema/user.ts index 04d6cb4..3047f4e 100644 --- a/src/schema/user.ts +++ b/src/schema/user.ts @@ -8,6 +8,7 @@ import { z } from 'zod'; export const UserSchema = z.object({ id: z.string(), + uid: z.string(), name: z.string(), education: z.enum(educations), email: z.string(),