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
11 changes: 8 additions & 3 deletions src/app/(user)/edit/_components/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -148,9 +148,14 @@ export default function Form() {
<Label isRequired>การศึกษา</Label>
<DropdownInput
value={educationsMap[user.education]}
setValue={val => 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)}
/>
<ErrorMsgFloat>{errors.education?.message}</ErrorMsgFloat>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/app/(user)/register/_components/subpages/two.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -142,9 +142,9 @@ export default function Two({ setStep, form }: TwoProps) {
<Label isRequired>การศึกษา</Label>
<DropdownInput
value={educationsMap[user.education]}
setValue={val => 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)}
/>
<ErrorMsgFloat>{errors.education?.message}</ErrorMsgFloat>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/app/(user)/registered-prepare/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div>
<div className="min-h-screen w-full">
<Background />
<Header />
<Footer />
Expand Down
8 changes: 3 additions & 5 deletions src/app/admin/dashboard/_components/addRole.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -35,14 +34,13 @@ export default function AddRole() {
value={phone}
onChange={e => setPhone(e.target.value)}
/>
<Button
inClassName="flex items-center justify-center gap-2 text-sm text-nowrap py-1"
variant={'outline'}
<button
className="flex items-center gap-2 text-nowrap rounded-full border border-dark-pink px-4 py-1.5 text-sm text-dark-pink"
onClick={onAddStaff}
>
<UserPlus />
Add Role
</Button>
</button>
</div>
);
}
2 changes: 1 addition & 1 deletion src/app/admin/dashboard/_components/table/userRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function UserRow({ user }: { user: User }) {
return (
<Row className="border-y border-mid-gray">
<Col className="overflow-hidden truncate text-ellipsis px-4">
{user.id}
#{user.uid}
</Col>
<Col className="text-center">{user.name}</Col>
<Col className="px-2">
Expand Down
9 changes: 7 additions & 2 deletions src/app/admin/profile/_components/Top.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="flex flex-col items-center py-10 text-white">
<Image
Expand All @@ -11,9 +14,11 @@ export default function Top() {
width={65}
height={91}
/>
<div className="mt-8 text-xl">75th CU-TU Unity Football</div>
<div className="mt-8 text-xl">
The 75th TU-CU Traditional Football Match
</div>
<div className="mt-6 text-3xl font-semibold">Welcome!, Admin</div>
<div className="text-xl">username</div>
<div className="text-xl">{user?.name}</div>
</div>
);
}
2 changes: 1 addition & 1 deletion src/app/gateway/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const pages = {
admin: {
home: '/',
qr: '/staff/qr',
profile: '/admin/dashboard',
profile: '/admin/profile',
},
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/profile/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export default function Header() {
</div>
<div className="relative flex flex-col gap-1 text-center tracking-normal text-white">
<h1 className="text-[18px] font-semibold leading-5">
CU-TU Unity Football 75<sup>th</sup>
The 75th TU-CU Traditional Football Match
</h1>
<h2 className="text-[12px] font-normal leading-4">
ฟุตบอลประเพณีธรรมศาสตร์-จุฬาฯ ครั้งที่ 75
งานฟุตบอลประเพณีธรรมศาสตร์-จุฬาฯ ครั้งที่ 75
</h2>
<div className="relative mt-3 flex flex-col">
<h1 className="text-[20px] font-semibold leading-6">
Expand Down
2 changes: 1 addition & 1 deletion src/components/profile/Ticket/InfButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getImageURL } from '@/utils/image';
export default function InfButton() {
return (
<Link
href={'user/information'}
href={'/registered-prepare'}
className="mt-2 flex h-8 w-52 items-center justify-center rounded-full border-[1px] border-white bg-gradient-to-r from-[#313051] from-20% via-[#607494] to-[#99C5E4]"
>
<div className="flex flex-row items-center gap-2">
Expand Down
10 changes: 3 additions & 7 deletions src/components/profile/Ticket/Information.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="flex flex-col items-center justify-center text-[12px] text-white">
<p>
#UID<span>{userId}</span>
#<span>{user?.uid}</span>
</p>
<p>
<span>{username}</span>
<span>{user?.name}</span>
</p>
<div className="mt-[5px] h-[1px] w-[245px] bg-white" />
<div className="mt-3 flex flex-col items-center">
Expand Down
4 changes: 2 additions & 2 deletions src/components/registered-prepare/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export default function header() {
</div>
<div className="relative flex flex-col items-center justify-center gap-1 text-center tracking-normal text-white">
<h1 className="text-[18px] font-semibold leading-5">
CU-TU Unity Football 75<sup>th</sup>
The 75th TU-CU Traditional Football Match
</h1>
<h2 className="text-[12px] font-normal leading-4">
ฟุตบอลประเพณีธรรมศาสตร์-จุฬาฯ ครั้งที่ 75
งานฟุตบอลประเพณีธรรมศาสตร์-จุฬาฯ ครั้งที่ 75
</h2>
<Link
href={'user/information'}
Expand Down
8 changes: 5 additions & 3 deletions src/components/staff/qr/toppart.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { useAuth } from '@/contexts/auth';
import { getImageURL } from '@/utils/image';
import Image from 'next/image';

export default function TopPart() {
const username = 'username';
const { user } = useAuth();

return (
<div className="text-center">
<div>
Expand All @@ -15,10 +17,10 @@ export default function TopPart() {
/>
</div>
<h1 className="text-lg font-light text-white">
75th CU-TU Unity Football
The 75th TU-CU Traditional Football Match
</h1>
<h2 className="mt-3 text-2xl font-medium text-white">Welcome!, Staff</h2>
<p className="mt-1 text-white">{username}</p>
<p className="mt-1 text-white">{user?.name}</p>
</div>
);
}
7 changes: 6 additions & 1 deletion src/const/educations.ts
Original file line number Diff line number Diff line change
@@ -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',
};
1 change: 1 addition & 0 deletions src/schema/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Loading