From c7097e2d451db955c9b65724f14443a2770a9d72 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 11 Jun 2025 14:49:32 +0900 Subject: [PATCH 01/64] =?UTF-8?q?=E2=9C=A8=20feat:=20Table=20component=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/components/common/Table.tsx diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx new file mode 100644 index 00000000..892f1d9e --- /dev/null +++ b/src/components/common/Table.tsx @@ -0,0 +1,3 @@ +export default function Table() { + return; +} From 0b43d7860341d235488ce6e75c197e40f595db3c Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 11 Jun 2025 16:22:58 +0900 Subject: [PATCH 02/64] =?UTF-8?q?=E2=9C=A8=20feat:=20=EA=B8=B0=EB=B3=B8=20?= =?UTF-8?q?table=20=EA=B5=AC=EC=A1=B0=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 892f1d9e..eb0ad14a 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -1,3 +1,9 @@ export default function Table() { - return; + return ( + + + + +
+ ); } From 26f36db3986bf4357a576579107d8d8257c3373f Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 11 Jun 2025 16:53:13 +0900 Subject: [PATCH 03/64] =?UTF-8?q?=E2=9C=A8=20feat:=20=EC=99=B8=EB=B6=80=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20type=20=EC=9E=84=EC=8B=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 추후에 api 파일 등에서 import로 변경 예정 --- src/components/common/Table.tsx | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index eb0ad14a..221cf4ad 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -1,3 +1,54 @@ +interface User { + item: { + id: string; + email: string; + type: 'employer' | 'employee'; + name?: string; + phone?: string; + address?: string; + bio?: string; + }; + href: string; +} + +interface Shop { + item: { + id: string; + name: string; + category: string; + address1: string; + address2: string; + description: string; + imageUrl: string; + originalHourlyPay: number; + }; + href: string; +} + +interface Notice { + item: { + id: string; + hourlyPay: number; + description: string; + startsAt: string; + workhour: number; + closed: boolean; + }; + href: string; +} + +interface Item { + item: { + id: string; + status: 'pending' | 'accepted' | 'rejected' | 'canceled'; + createdAt: string; + user?: User; + shop: Shop; + notice: Notice; + }; + links: string[]; +} + export default function Table() { return ( From a8dfdf35b1abdbb51b573fa400bfbf5490a96250 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 11 Jun 2025 17:13:09 +0900 Subject: [PATCH 04/64] =?UTF-8?q?=E2=9C=A8=20feat:=20Props=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 221cf4ad..76c03256 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -37,7 +37,7 @@ interface Notice { href: string; } -interface Item { +interface Application { item: { id: string; status: 'pending' | 'accepted' | 'rejected' | 'canceled'; @@ -49,7 +49,12 @@ interface Item { links: string[]; } -export default function Table() { +interface Props { + className?: string; + applications: Application[]; +} + +export default function Table({ className = '', applications }: Props) { return (
From 875027bc60c97dd5e52d29452aa1debb7dc355e1 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 11 Jun 2025 17:13:40 +0900 Subject: [PATCH 05/64] =?UTF-8?q?=E2=9C=A8=20feat:=20=EC=9E=84=EC=8B=9C=20?= =?UTF-8?q?Link=20type=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 76c03256..8d236248 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -37,6 +37,13 @@ interface Notice { href: string; } +interface Link { + rel: string; + description: string; + method: string; + href: string; +} + interface Application { item: { id: string; @@ -46,7 +53,7 @@ interface Application { shop: Shop; notice: Notice; }; - links: string[]; + links: Link[]; } interface Props { From 6b87d16f231cb8a1a2daf99ab729a20be75f2af4 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 11 Jun 2025 18:27:46 +0900 Subject: [PATCH 06/64] =?UTF-8?q?=E2=9C=A8=20feat:=20mode=20props=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 8d236248..2d5375ef 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -58,10 +58,11 @@ interface Application { interface Props { className?: string; + mode: 'user' | 'notice'; applications: Application[]; } -export default function Table({ className = '', applications }: Props) { +export default function Table({ className = '', mode, applications }: Props) { return (
From 44e80485b4791782f4d68121423958844b5a853b Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 11 Jun 2025 22:10:20 +0900 Subject: [PATCH 07/64] =?UTF-8?q?=E2=9C=A8=20feat:=20applications=20?= =?UTF-8?q?=EB=B0=B0=EC=97=B4=20=EA=B8=B8=EC=9D=B4=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - application 배열 길이가 항상 5이도록 변경 --- src/components/common/Table.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 2d5375ef..430ffd33 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -59,10 +59,18 @@ interface Application { interface Props { className?: string; mode: 'user' | 'notice'; - applications: Application[]; + applications: (Application | null)[]; } -export default function Table({ className = '', mode, applications }: Props) { +export default function Table({ + className = '', + mode, + applications: initialApplications, +}: Props) { + const applications = initialApplications.concat( + Array(5 - initialApplications.length).fill(null), + ); + return (
From ec0fc3c476d96af5ad01096ca756211170b3a526 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 11 Jun 2025 23:28:59 +0900 Subject: [PATCH 08/64] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20null=20?= =?UTF-8?q?=ED=97=88=EC=9A=A9=20=EB=B0=B0=EC=97=B4=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - initialApplications prop 말고 applications 변수에서 null 허용 --- src/components/common/Table.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 430ffd33..21ae9e39 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -59,7 +59,7 @@ interface Application { interface Props { className?: string; mode: 'user' | 'notice'; - applications: (Application | null)[]; + applications: Application[]; } export default function Table({ @@ -67,7 +67,7 @@ export default function Table({ mode, applications: initialApplications, }: Props) { - const applications = initialApplications.concat( + const applications: (Application | null)[] = initialApplications.concat( Array(5 - initialApplications.length).fill(null), ); From c386100801fdbbf3cb6a1cba19e6038be8d7dc59 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 11 Jun 2025 23:30:17 +0900 Subject: [PATCH 09/64] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20applicat?= =?UTF-8?q?ions=20=EB=B3=80=EC=88=98=20=EA=B8=B8=EC=9D=B4=205=EB=A1=9C=20?= =?UTF-8?q?=EA=B3=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 21ae9e39..936a6f84 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -67,9 +67,10 @@ export default function Table({ mode, applications: initialApplications, }: Props) { - const applications: (Application | null)[] = initialApplications.concat( - Array(5 - initialApplications.length).fill(null), - ); + const applications: (Application | null)[] = [ + ...initialApplications, + ...[null, null, null, null, null], + ].slice(0, 5); return (
From f1807c69ed0e3cd02be735872413231f42176bf2 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 11 Jun 2025 23:53:25 +0900 Subject: [PATCH 10/64] =?UTF-8?q?=E2=9C=A8=20feat:=20datas=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - datas는 보여줄 정보 배열 --- src/components/common/Table.tsx | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 936a6f84..4d04e57f 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -1,3 +1,5 @@ +import formatWorkTime from '@/utils/formatWorkTime'; + interface User { item: { id: string; @@ -67,11 +69,35 @@ export default function Table({ mode, applications: initialApplications, }: Props) { - const applications: (Application | null)[] = [ + const applications = [ ...initialApplications, ...[null, null, null, null, null], ].slice(0, 5); + const datas = applications.map((app) => { + if (!app) return Array(5).fill([null, null, null, null]); + + const { item } = app; + + return [ + ...(mode === 'notice' + ? [ + item?.user?.item?.name, + item?.user?.item?.bio, + item?.user?.item?.phone, + ] + : [ + item.shop.item.name, + `${formatWorkTime({ + startsAt: item.notice.item.startsAt, + workHour: item.notice.item.workhour, + })} (${item.notice.item.workhour}시간)`, + item.notice.item.hourlyPay.toLocaleString('ko-KR') + '원', + ]), + item.status, + ]; + }); + return (
From 9fdd1a6db4c0fb3ea50219c63273e68f3e4905d1 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 00:01:33 +0900 Subject: [PATCH 11/64] =?UTF-8?q?=E2=9C=A8=20feat:=20headers=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - table의 머리글 행에 해당 --- src/components/common/Table.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 4d04e57f..d9c5981f 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -74,6 +74,11 @@ export default function Table({ ...[null, null, null, null, null], ].slice(0, 5); + const headers = + mode === 'notice' + ? ['신청자', '소개', '전화번호', '상태'] + : ['가게', '일자', '시급', '상태']; + const datas = applications.map((app) => { if (!app) return Array(5).fill([null, null, null, null]); From 5cc44fe8169a87876d7a26c135a9c4490b9f1988 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 02:24:39 +0900 Subject: [PATCH 12/64] =?UTF-8?q?=E2=9C=A8=20feat:=20thead(header)=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index d9c5981f..cf50d4fd 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -105,7 +105,14 @@ export default function Table({ return (
- + + + + + + + +
{headers[0]}{headers[1]}{headers[2]}{headers[3]}
From 761dda379d9214614a2b1b9f2f66611a4d6bfdba Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 13:25:52 +0900 Subject: [PATCH 13/64] =?UTF-8?q?=E2=9C=A8=20feat:=20tbody=20data=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index cf50d4fd..495ddcba 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -1,3 +1,4 @@ +import Button from './Button'; import formatWorkTime from '@/utils/formatWorkTime'; interface User { @@ -113,7 +114,33 @@ export default function Table({ {headers[3]} - + + {datas.map((data, index) => ( + + {data[0]} + {data[1]} + {data[2]} + + {data[3] === 'pending' ? ( + mode === 'notice' ? ( +
+ + +
+ ) : ( +
대기중
+ ) + ) : data[3] === 'accepted' ? ( +
승인 완료
+ ) : data[3] === 'rejected' ? ( +
거절
+ ) : data[3] === 'canceled' ? ( +
취소
+ ) : null} + + + ))} + ); From 326ff534e9b077f64da139ba3e6e12d92a4eb65e Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 14:27:39 +0900 Subject: [PATCH 14/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20table=20=ED=8B=80?= =?UTF-8?q?=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 495ddcba..addec724 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -105,7 +105,7 @@ export default function Table({ }); return ( - +
From 6fc8d4ddf9c84b77560bf25864f9d6622c65613b Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 14:29:38 +0900 Subject: [PATCH 15/64] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20thead?= =?UTF-8?q?=EC=97=90=EC=84=9C=20td=20>=20th=EB=A1=9C=20=ED=83=9C=EA=B7=B8?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index addec724..3132dbfe 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -108,10 +108,10 @@ export default function Table({
{headers[0]}
- - - - + + + + From 19f87c5e225b2a62b2ea80f6e9623fe5f33f7d95 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 15:32:56 +0900 Subject: [PATCH 16/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20thead=20=EC=8A=A4?= =?UTF-8?q?=ED=83=80=EC=9D=BC=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 3132dbfe..1acd033c 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -105,8 +105,8 @@ export default function Table({ }); return ( -
{headers[0]}{headers[1]}{headers[2]}{headers[3]}{headers[0]}{headers[1]}{headers[2]}{headers[3]}
- +
+ From 0bcb88119201e3e83cc55ae6dc7daace4df14bb4 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 15:41:54 +0900 Subject: [PATCH 17/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20th=20=EC=8A=A4?= =?UTF-8?q?=ED=83=80=EC=9D=BC=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 1acd033c..c3a89209 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -108,10 +108,12 @@ export default function Table({
{headers[0]} {headers[1]}
- - - - + + + + From 7fe5486e1f6cfe8efb5ef43f4de64e60502a2939 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 17:31:43 +0900 Subject: [PATCH 18/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20tbody=20=EC=8A=A4?= =?UTF-8?q?=ED=83=80=EC=9D=BC=20=EC=A0=81=EC=9A=A9=20(font=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=83=81=EC=86=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index c3a89209..67c8ad19 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -116,7 +116,7 @@ export default function Table({ - + {datas.map((data, index) => ( From 51a0eef8cd6a8a42abd82acca39cf0b50756518c Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 18:40:05 +0900 Subject: [PATCH 19/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20td=20=EC=8A=A4?= =?UTF-8?q?=ED=83=80=EC=9D=BC=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 67c8ad19..ae4dacd5 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -104,6 +104,9 @@ export default function Table({ ]; }); + const tdStyle = + 'border-b border-gray-20 px-8 pt-12 pb-11 md:px-12 md:pt-20 md:pb-19'; + return (
{headers[0]}{headers[1]}{headers[2]}{headers[3]}{headers[0]}{headers[1]}{headers[2]} + {headers[3]} +
{data[0]}
@@ -119,10 +122,10 @@ export default function Table({ {datas.map((data, index) => ( - - - - + + + + {datas.map((data, index) => ( + + + + + + + ))} + + +
{data[0]}{data[1]}{data[2]} + {data[0]}{data[1]}{data[2]} {data[3] === 'pending' ? ( mode === 'notice' ? (
From c819b8eebf7fc3d343d13d484de50754310ae8fa Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 22:04:47 +0900 Subject: [PATCH 20/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20=EA=B1=B0?= =?UTF-8?q?=EC=A0=88/=EC=8A=B9=EC=9D=B8=20Button=20=EC=8A=A4=ED=83=80?= =?UTF-8?q?=EC=9D=BC=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index ae4dacd5..40de6b95 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -128,9 +128,20 @@ export default function Table({
{data[3] === 'pending' ? ( mode === 'notice' ? ( -
- - +
+ +
) : (
대기중
From aac9cdf9a8f0a0b99f599eaa5dbe1af12bb98dea Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 22:20:11 +0900 Subject: [PATCH 21/64] =?UTF-8?q?=E2=9C=A8=20feat:=20isMobile=20state=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 현재 페이지 사이즈가 모바일인지 아닌지를 확인하는 state --- src/components/common/Table.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 40de6b95..809f4ae9 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -1,3 +1,4 @@ +import { useEffect, useState } from 'react'; import Button from './Button'; import formatWorkTime from '@/utils/formatWorkTime'; @@ -70,6 +71,8 @@ export default function Table({ mode, applications: initialApplications, }: Props) { + const [isMobile, setIsMobile] = useState(window.innerWidth < 768); + const applications = [ ...initialApplications, ...[null, null, null, null, null], @@ -104,6 +107,14 @@ export default function Table({ ]; }); + useEffect(() => { + const handleResize = () => { + setIsMobile(window.innerWidth < 768); + }; + window.addEventListener('resize', handleResize); + return () => window.removeEventListener('resize', handleResize); + }, []); + const tdStyle = 'border-b border-gray-20 px-8 pt-12 pb-11 md:px-12 md:pt-20 md:pb-19'; From 1f3ae042bac177e0503d09a11b98816687d329b4 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 12 Jun 2025 22:20:52 +0900 Subject: [PATCH 22/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20Button=20size=20p?= =?UTF-8?q?rop=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Table.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/common/Table.tsx b/src/components/common/Table.tsx index 809f4ae9..0282b3d4 100644 --- a/src/components/common/Table.tsx +++ b/src/components/common/Table.tsx @@ -140,11 +140,16 @@ export default function Table({ {data[3] === 'pending' ? ( mode === 'notice' ? (
-
{data[3] === 'pending' ? ( mode === 'notice' ? ( -
+
+ {data[0]} + + {data[1]} + + {data[2]} + + {mode === 'notice' && data[3] === 'pending' ? ( + + ) : ( + + )} +
+ ); } From 63a0b57900ab3b76fb056cb9cb3e3c849985a0f5 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Sat, 14 Jun 2025 14:01:09 +0900 Subject: [PATCH 29/64] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20tfoot=20?= =?UTF-8?q?div=20=ED=83=9C=EA=B7=B8=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EB=B0=8F=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 1a208619..207d34e1 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -106,14 +106,22 @@ export default function Table({ }); return ( -
- - +
+
+ - - - - + + + @@ -140,8 +148,8 @@ export default function Table({ ))} -
{headers[0]}{headers[1]}{headers[2]} + + {headers[0]} + + {headers[1]} + + {headers[2]} + {headers[3]}
+
); } From 35227c97680436be2328a3826bedc6d14d31046e Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Sat, 14 Jun 2025 15:02:45 +0900 Subject: [PATCH 30/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=20=ED=96=89=20=EA=B3=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 207d34e1..341c6795 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -121,7 +121,7 @@ export default function Table({ {headers[2]} - + {headers[3]} @@ -138,7 +138,7 @@ export default function Table({ {data[2]} - + {mode === 'notice' && data[3] === 'pending' ? ( ) : ( From 6a326f9efd50bb2bb077ccdb0063f0ed546b1e47 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Sat, 14 Jun 2025 15:17:27 +0900 Subject: [PATCH 31/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20PC/Tablet?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=ED=96=89=20=EC=B5=9C=EC=86=8C=20=EB=86=92?= =?UTF-8?q?=EC=9D=B4=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 341c6795..6587b5eb 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -139,11 +139,13 @@ export default function Table({ {data[2]} - {mode === 'notice' && data[3] === 'pending' ? ( - - ) : ( - - )} +
+ {mode === 'notice' && data[3] === 'pending' ? ( + + ) : ( + + )} +
))} From d0a7e9d758bad592cc5665bb603a49637e6eadba Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Sat, 14 Jun 2025 15:37:02 +0900 Subject: [PATCH 32/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20Mobile=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=ED=96=89=20=EC=B5=9C=EC=86=8C=20=EB=86=92=EC=9D=B4?= =?UTF-8?q?=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 6587b5eb..d672e19f 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -139,7 +139,7 @@ export default function Table({ {data[2]} -
+
{mode === 'notice' && data[3] === 'pending' ? ( ) : ( From 51243c1b9965bbd49e4eac83a1efea2f6b654ed8 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Sat, 14 Jun 2025 15:37:54 +0900 Subject: [PATCH 33/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20table=20=ED=95=98?= =?UTF-8?q?=EB=8B=A8=20=EB=84=88=EB=B9=84=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index d672e19f..64f6f195 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -151,7 +151,7 @@ export default function Table({ ))} -
+
); } From 5ada94d96f013eda615c4e44cb67badb3b6d8c61 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Sat, 14 Jun 2025 15:40:06 +0900 Subject: [PATCH 34/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A1=A4=EB=B0=94=20=EC=88=A8=EA=B9=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 64f6f195..e731eea8 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -107,7 +107,7 @@ export default function Table({ return (
From 6cb2c69b1a81e8c7e5fb818a3c8206ceb39bd98d Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Sat, 14 Jun 2025 16:21:26 +0900 Subject: [PATCH 35/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20=EB=84=88?= =?UTF-8?q?=EB=B9=84=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=83=81=ED=83=9C=20?= =?UTF-8?q?=EC=97=B4=20border=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index e731eea8..9fd70a68 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -107,7 +107,7 @@ export default function Table({ return (
@@ -121,7 +121,7 @@ export default function Table({ - @@ -138,7 +138,7 @@ export default function Table({ -
{headers[2]} + {headers[3]}
{data[2]} +
{mode === 'notice' && data[3] === 'pending' ? ( From b6823a4456420cd12df199f455ed37683599374b Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Sat, 14 Jun 2025 16:40:28 +0900 Subject: [PATCH 36/64] =?UTF-8?q?=F0=9F=8E=A8=20style:=20=EC=A2=8C?= =?UTF-8?q?=EC=9A=B0=20=EB=84=88=EB=B9=84=20=EC=95=8C=EB=A7=9E=EA=B2=8C=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 9fd70a68..f13ae572 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -109,10 +109,10 @@ export default function Table({
- +
- - @@ -129,7 +129,7 @@ export default function Table({ {datas.map((data, index) => ( - - From faace2daa82fb0b0e9525ff76c9c9586b87a2145 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 18:55:48 +0900 Subject: [PATCH 49/64] =?UTF-8?q?=E2=9C=A8=20feat:=20page=20state=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index e93f10b2..880a3d9c 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -29,6 +29,7 @@ export default function Table(props: UserProps | NoticeProps) { const [datas, setDatas] = useState<(string | undefined)[][]>( Array(5).fill(['', '', '', '']), ); + const [page, setPage] = useState(1); useEffect(() => { (async () => { @@ -37,6 +38,10 @@ export default function Table(props: UserProps | NoticeProps) { const { items } = await getNoticeApplications( props.shopId, props.noticeId, + { + offset: (page - 1) * 5, + limit: 5, + }, ); setDatas( @@ -54,7 +59,10 @@ export default function Table(props: UserProps | NoticeProps) { }), ); } else { - const { items } = await getUserApplications(props.userId); + const { items } = await getUserApplications(props.userId, { + offset: (page - 1) * 5, + limit: 5, + }); setDatas( [...items, ...[null, null, null, null, null]] @@ -95,7 +103,7 @@ export default function Table(props: UserProps | NoticeProps) { } } } - }, [mode]); + }, [mode, page]); return (
Date: Wed, 18 Jun 2025 19:06:37 +0900 Subject: [PATCH 50/64] =?UTF-8?q?=E2=9C=A8=20feat:=20totalPage=20state=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 880a3d9c..1ced4d52 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -30,12 +30,13 @@ export default function Table(props: UserProps | NoticeProps) { Array(5).fill(['', '', '', '']), ); const [page, setPage] = useState(1); + const [totalPage, setTotalPage] = useState(1); useEffect(() => { (async () => { try { if (mode === 'notice') { - const { items } = await getNoticeApplications( + const { items, count } = await getNoticeApplications( props.shopId, props.noticeId, { @@ -44,6 +45,7 @@ export default function Table(props: UserProps | NoticeProps) { }, ); + setTotalPage(Math.ceil(count / 5)); setDatas( [...items, ...[null, null, null, null, null]] .slice(0, 5) @@ -59,11 +61,12 @@ export default function Table(props: UserProps | NoticeProps) { }), ); } else { - const { items } = await getUserApplications(props.userId, { + const { items, count } = await getUserApplications(props.userId, { offset: (page - 1) * 5, limit: 5, }); + setTotalPage(Math.ceil(count / 5)); setDatas( [...items, ...[null, null, null, null, null]] .slice(0, 5) From 4bfe776a12a2c9ecd3e78dddf65cc3e2f63e4a0f Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 19:31:05 +0900 Subject: [PATCH 51/64] =?UTF-8?q?=F0=9F=90=9B=20fix:=20totalPage=20?= =?UTF-8?q?=EC=B5=9C=EC=86=8C=20=EA=B0=9C=EC=88=98=201=EB=A1=9C=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 1ced4d52..8cb31152 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -45,7 +45,7 @@ export default function Table(props: UserProps | NoticeProps) { }, ); - setTotalPage(Math.ceil(count / 5)); + setTotalPage(count ? Math.ceil(count / 5) : 1); setDatas( [...items, ...[null, null, null, null, null]] .slice(0, 5) @@ -66,7 +66,7 @@ export default function Table(props: UserProps | NoticeProps) { limit: 5, }); - setTotalPage(Math.ceil(count / 5)); + setTotalPage(count ? Math.ceil(count / 5) : 1); setDatas( [...items, ...[null, null, null, null, null]] .slice(0, 5) From 0959889dce4955a5a51012238812cd4ff05e4b9a Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 19:32:07 +0900 Subject: [PATCH 52/64] =?UTF-8?q?=E2=9C=A8=20feat:=20Table=20Pagination=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 8cb31152..3095e864 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react'; import TableStatus from './TableStatus'; import TableButtons from './TableButtons'; +import Pagination from '../Pagination'; import formatWorkTime from '@/utils/formatWorkTime'; import { getNoticeApplications, @@ -154,7 +155,13 @@ export default function Table(props: UserProps | NoticeProps) { ))}
+ {headers[0]} @@ -121,7 +121,7 @@ export default function Table({ {headers[2]} + {headers[3]}
+ {data[0]} @@ -138,7 +138,7 @@ export default function Table({ {data[2]} +
{mode === 'notice' && data[3] === 'pending' ? ( From fb7efd779e6b665ba3719ec00e3f162c17eb1155 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Sat, 14 Jun 2025 22:43:51 +0900 Subject: [PATCH 37/64] =?UTF-8?q?=E2=9C=A8=20feat:=20=EB=91=90=20=EC=A4=84?= =?UTF-8?q?=20=EC=9D=B4=ED=95=98=EB=A1=9C=20=EB=82=B4=EC=9A=A9=20=EC=9E=90?= =?UTF-8?q?=EB=A5=B4=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index f13ae572..0d6bb6f9 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -1,6 +1,7 @@ import formatWorkTime from '@/utils/formatWorkTime'; import TableStatus from './TableStatus'; import TableButtons from './TableButtons'; +import { useEffect } from 'react'; interface User { item: { @@ -105,6 +106,26 @@ export default function Table({ ]; }); + useEffect(() => { + const maxHeight = 52; + const elements = document.querySelectorAll('td div.t'); + + for (const element of elements) { + if (element.offsetHeight < maxHeight) continue; + + const originalText = element.textContent ?? ''; + element.textContent = originalText.slice(0, 2); + + for (let i = 2; i < originalText.length; i++) { + element.textContent += originalText[i]; + if (element.offsetHeight > maxHeight) { + element.textContent = originalText.slice(0, i - 2) + '...'; + break; + } + } + } + }, []); + return (
(
- {data[0]} +
{data[0]}
- {data[1]} +
{data[1]}
- {data[2]} +
{data[2]}
From 7848ac9e8f28ef5be2d8ec11822a8ac7b734c4ae Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 12:56:32 +0900 Subject: [PATCH 38/64] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20import?= =?UTF-8?q?=20=EB=AC=B8=20=EC=88=9C=EC=84=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 0d6bb6f9..878d1d5e 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -1,7 +1,7 @@ -import formatWorkTime from '@/utils/formatWorkTime'; +import { useEffect } from 'react'; import TableStatus from './TableStatus'; import TableButtons from './TableButtons'; -import { useEffect } from 'react'; +import formatWorkTime from '@/utils/formatWorkTime'; interface User { item: { From b714510494526f4410d59d3a6635ed409f5aa5ba Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 13:00:35 +0900 Subject: [PATCH 39/64] =?UTF-8?q?=F0=9F=90=9B=20fix:=20formatWorkTime=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=EC=97=90=20=EC=9D=98=ED=95=9C=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 878d1d5e..9921af2e 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -98,7 +98,7 @@ export default function Table({ item.shop.item.name, `${formatWorkTime({ startsAt: item.notice.item.startsAt, - workHour: item.notice.item.workhour, + workhour: item.notice.item.workhour, })} (${item.notice.item.workhour}시간)`, item.notice.item.hourlyPay.toLocaleString('ko-KR') + '원', ]), From 276bf9e9e6188524096d16deaa7988830619cdee Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 14:52:49 +0900 Subject: [PATCH 40/64] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20table=20?= =?UTF-8?q?=EC=99=B8=EB=B6=80=20=ED=8C=8C=EC=9D=BC=EC=97=90=EC=84=9C=20typ?= =?UTF-8?q?e=20import=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 72 +++++---------------------- 1 file changed, 12 insertions(+), 60 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 9921af2e..6b429b22 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -2,76 +2,28 @@ import { useEffect } from 'react'; import TableStatus from './TableStatus'; import TableButtons from './TableButtons'; import formatWorkTime from '@/utils/formatWorkTime'; +import type { + ApplicationNoticeInfo, + ApplicationUserInfo, +} from '@/api/applicationApi'; -interface User { - item: { - id: string; - email: string; - type: 'employer' | 'employee'; - name?: string; - phone?: string; - address?: string; - bio?: string; - }; - href: string; -} - -interface Shop { - item: { - id: string; - name: string; - category: string; - address1: string; - address2: string; - description: string; - imageUrl: string; - originalHourlyPay: number; - }; - href: string; -} - -interface Notice { - item: { - id: string; - hourlyPay: number; - description: string; - startsAt: string; - workhour: number; - closed: boolean; - }; - href: string; -} - -interface Link { - rel: string; - description: string; - method: string; - href: string; -} - -interface Application { - item: { - id: string; - status: 'pending' | 'accepted' | 'rejected' | 'canceled'; - createdAt: string; - user?: User; - shop: Shop; - notice: Notice; - }; - links: Link[]; +interface UserProps { + className?: string; + mode: 'user'; + applications: ApplicationUserInfo[]; } -interface Props { +interface NoticeProps { className?: string; - mode: 'user' | 'notice'; - applications: Application[]; + mode: 'notice'; + applications: ApplicationNoticeInfo[]; } export default function Table({ className = '', mode, applications: initialApplications, -}: Props) { +}: UserProps | NoticeProps) { const applications = [ ...initialApplications, ...[null, null, null, null, null], From 47a7d7cbfa5072e396cd8e34549f6f420dd9709e Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 15:03:51 +0900 Subject: [PATCH 41/64] =?UTF-8?q?=F0=9F=90=9B=20fix:=20applications?= =?UTF-8?q?=EC=97=90=20=EB=8C=80=ED=95=9C=20type=20error=20=EC=97=86?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 61 ++++++++++++++------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 6b429b22..eef22bfb 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -24,39 +24,42 @@ export default function Table({ mode, applications: initialApplications, }: UserProps | NoticeProps) { - const applications = [ - ...initialApplications, - ...[null, null, null, null, null], - ].slice(0, 5); + let headers, datas; - const headers = - mode === 'notice' - ? ['신청자', '소개', '전화번호', '상태'] - : ['가게', '일자', '시급', '상태']; + if (mode === 'notice') { + headers = ['신청자', '소개', '전화번호', '상태']; - const datas = applications.map((app) => { - if (!app) return Array(5).fill([null, null, null, null]); + datas = [...initialApplications, ...[null, null, null, null, null]] + .slice(0, 5) + .map((element) => { + if (!element) return [null, null, null, null]; - const { item } = app; + return [ + element.item.user.item.name, + element.item.user.item.bio, + element.item.user.item.phone, + element.item.status, + ]; + }); + } else { + headers = ['가게', '일자', '시급', '상태']; - return [ - ...(mode === 'notice' - ? [ - item?.user?.item?.name, - item?.user?.item?.bio, - item?.user?.item?.phone, - ] - : [ - item.shop.item.name, - `${formatWorkTime({ - startsAt: item.notice.item.startsAt, - workhour: item.notice.item.workhour, - })} (${item.notice.item.workhour}시간)`, - item.notice.item.hourlyPay.toLocaleString('ko-KR') + '원', - ]), - item.status, - ]; - }); + datas = [...initialApplications, ...[null, null, null, null, null]] + .slice(0, 5) + .map((element) => { + if (!element) return [null, null, null, null]; + + return [ + element.item.shop.item.name, + `${formatWorkTime({ + startsAt: element.item.notice.item.startsAt, + workhour: element.item.notice.item.workhour, + })} (${element.item.notice.item.workhour}시간)`, + element.item.notice.item.hourlyPay.toLocaleString('ko-KR') + '원', + element.item.status, + ]; + }); + } useEffect(() => { const maxHeight = 52; From 127eceab4f5c3eff8caace36969985a24b59ea45 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 16:17:56 +0900 Subject: [PATCH 42/64] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20TableSta?= =?UTF-8?q?tus=20status=20prop=20type=20string=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/TableStatus.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/common/table/TableStatus.tsx b/src/components/common/table/TableStatus.tsx index cae0c933..3e0d6822 100644 --- a/src/components/common/table/TableStatus.tsx +++ b/src/components/common/table/TableStatus.tsx @@ -1,8 +1,4 @@ -export default function TableStatus({ - status, -}: { - status: 'pending' | 'accepted' | 'rejected' | 'canceled'; -}) { +export default function TableStatus({ status }: { status: string }) { return status === 'pending' ? (
대기중 From 807a9b470e0454bc7785f3250addbe8ffb4acb6b Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 16:22:29 +0900 Subject: [PATCH 43/64] =?UTF-8?q?=F0=9F=90=9B=20fix:=20element=EA=B0=80=20?= =?UTF-8?q?=EC=97=86=EC=9D=84=20=EC=8B=9C=20=EB=B0=98=ED=99=98=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=B0=B0=EC=97=B4=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index eef22bfb..be12a177 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -32,7 +32,7 @@ export default function Table({ datas = [...initialApplications, ...[null, null, null, null, null]] .slice(0, 5) .map((element) => { - if (!element) return [null, null, null, null]; + if (!element) return ['', '', '', '']; return [ element.item.user.item.name, @@ -47,7 +47,7 @@ export default function Table({ datas = [...initialApplications, ...[null, null, null, null, null]] .slice(0, 5) .map((element) => { - if (!element) return [null, null, null, null]; + if (!element) return ['', '', '', '']; return [ element.item.shop.item.name, From 9c6d9bfc8a8d3b51b2a7d0c44979e576465400c2 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 17:01:26 +0900 Subject: [PATCH 44/64] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20datas=20?= =?UTF-8?q?=EB=B3=80=EC=88=98=20state=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 59 +++++++++++++++------------ 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index be12a177..962adfcc 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -1,4 +1,4 @@ -import { useEffect } from 'react'; +import { useEffect, useState } from 'react'; import TableStatus from './TableStatus'; import TableButtons from './TableButtons'; import formatWorkTime from '@/utils/formatWorkTime'; @@ -24,41 +24,46 @@ export default function Table({ mode, applications: initialApplications, }: UserProps | NoticeProps) { - let headers, datas; + let headers; + const [datas, setDatas] = useState<(string | undefined)[][]>([]); if (mode === 'notice') { headers = ['신청자', '소개', '전화번호', '상태']; - datas = [...initialApplications, ...[null, null, null, null, null]] - .slice(0, 5) - .map((element) => { - if (!element) return ['', '', '', '']; + setDatas( + [...initialApplications, ...[null, null, null, null, null]] + .slice(0, 5) + .map((element) => { + if (!element) return ['', '', '', '']; - return [ - element.item.user.item.name, - element.item.user.item.bio, - element.item.user.item.phone, - element.item.status, - ]; - }); + return [ + element.item.user.item.name, + element.item.user.item.bio, + element.item.user.item.phone, + element.item.status, + ]; + }), + ); } else { headers = ['가게', '일자', '시급', '상태']; - datas = [...initialApplications, ...[null, null, null, null, null]] - .slice(0, 5) - .map((element) => { - if (!element) return ['', '', '', '']; + setDatas( + [...initialApplications, ...[null, null, null, null, null]] + .slice(0, 5) + .map((element) => { + if (!element) return ['', '', '', '']; - return [ - element.item.shop.item.name, - `${formatWorkTime({ - startsAt: element.item.notice.item.startsAt, - workhour: element.item.notice.item.workhour, - })} (${element.item.notice.item.workhour}시간)`, - element.item.notice.item.hourlyPay.toLocaleString('ko-KR') + '원', - element.item.status, - ]; - }); + return [ + element.item.shop.item.name, + `${formatWorkTime({ + startsAt: element.item.notice.item.startsAt, + workhour: element.item.notice.item.workhour, + })} (${element.item.notice.item.workhour}시간)`, + element.item.notice.item.hourlyPay.toLocaleString('ko-KR') + '원', + element.item.status, + ]; + }), + ); } useEffect(() => { From 7480a65fa3858619d47fbae4ee5c747b24451c77 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 17:24:12 +0900 Subject: [PATCH 45/64] =?UTF-8?q?=E2=9C=A8=20feat:=20applications=20prop?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20api=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 100 ++++++++++++++------------ 1 file changed, 56 insertions(+), 44 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 962adfcc..a4320be0 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -2,71 +2,83 @@ import { useEffect, useState } from 'react'; import TableStatus from './TableStatus'; import TableButtons from './TableButtons'; import formatWorkTime from '@/utils/formatWorkTime'; -import type { - ApplicationNoticeInfo, - ApplicationUserInfo, +import { + getNoticeApplications, + getUserApplications, } from '@/api/applicationApi'; interface UserProps { className?: string; mode: 'user'; - applications: ApplicationUserInfo[]; + userId: string; } interface NoticeProps { className?: string; mode: 'notice'; - applications: ApplicationNoticeInfo[]; + shopId: string; + noticeId: string; } -export default function Table({ - className = '', - mode, - applications: initialApplications, -}: UserProps | NoticeProps) { +export default function Table(props: UserProps | NoticeProps) { + const { className, mode } = props; let headers; const [datas, setDatas] = useState<(string | undefined)[][]>([]); if (mode === 'notice') { headers = ['신청자', '소개', '전화번호', '상태']; - - setDatas( - [...initialApplications, ...[null, null, null, null, null]] - .slice(0, 5) - .map((element) => { - if (!element) return ['', '', '', '']; - - return [ - element.item.user.item.name, - element.item.user.item.bio, - element.item.user.item.phone, - element.item.status, - ]; - }), - ); } else { headers = ['가게', '일자', '시급', '상태']; - - setDatas( - [...initialApplications, ...[null, null, null, null, null]] - .slice(0, 5) - .map((element) => { - if (!element) return ['', '', '', '']; - - return [ - element.item.shop.item.name, - `${formatWorkTime({ - startsAt: element.item.notice.item.startsAt, - workhour: element.item.notice.item.workhour, - })} (${element.item.notice.item.workhour}시간)`, - element.item.notice.item.hourlyPay.toLocaleString('ko-KR') + '원', - element.item.status, - ]; - }), - ); } useEffect(() => { + (async () => { + try { + if (mode === 'notice') { + const { items } = await getNoticeApplications( + props.shopId, + props.noticeId, + ); + + setDatas( + [...items, ...[null, null, null, null, null]] + .slice(0, 5) + .map((element) => { + if (!element) return ['', '', '', '']; + + return [ + element.item.user.item.name, + element.item.user.item.bio, + element.item.user.item.phone, + element.item.status, + ]; + }), + ); + } else { + const { items } = await getUserApplications(props.userId); + + setDatas( + [...items, ...[null, null, null, null, null]] + .slice(0, 5) + .map((element) => { + if (!element) return ['', '', '', '']; + + return [ + element.item.shop.item.name, + `${formatWorkTime({ + startsAt: element.item.notice.item.startsAt, + workhour: element.item.notice.item.workhour, + })} (${element.item.notice.item.workhour}시간)`, + element.item.notice.item.hourlyPay.toLocaleString('ko-KR') + + '원', + element.item.status, + ]; + }), + ); + } + } catch {} + })(); + const maxHeight = 52; const elements = document.querySelectorAll('td div.t'); @@ -84,7 +96,7 @@ export default function Table({ } } } - }, []); + }, [mode]); return (
Date: Wed, 18 Jun 2025 17:30:12 +0900 Subject: [PATCH 46/64] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20headers?= =?UTF-8?q?=20=EB=B3=80=EC=88=98=20refactoring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index a4320be0..5d05fab8 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -22,15 +22,12 @@ interface NoticeProps { export default function Table(props: UserProps | NoticeProps) { const { className, mode } = props; - let headers; + const headers = + mode === 'notice' + ? ['신청자', '소개', '전화번호', '상태'] + : ['가게', '일자', '시급', '상태']; const [datas, setDatas] = useState<(string | undefined)[][]>([]); - if (mode === 'notice') { - headers = ['신청자', '소개', '전화번호', '상태']; - } else { - headers = ['가게', '일자', '시급', '상태']; - } - useEffect(() => { (async () => { try { From 18a20463a5a4c8c230d4d6900c51fe8a96996abd Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 17:35:06 +0900 Subject: [PATCH 47/64] =?UTF-8?q?=E2=9C=A8=20feat:=20datas=20state=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=EA=B0=92=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 5d05fab8..ff1dbbe7 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -26,7 +26,9 @@ export default function Table(props: UserProps | NoticeProps) { mode === 'notice' ? ['신청자', '소개', '전화번호', '상태'] : ['가게', '일자', '시급', '상태']; - const [datas, setDatas] = useState<(string | undefined)[][]>([]); + const [datas, setDatas] = useState<(string | undefined)[][]>( + Array(5).fill(['', '', '', '']), + ); useEffect(() => { (async () => { From 9c7f79f24238241bd06d36bca22ca4b966f6b687 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 17:36:00 +0900 Subject: [PATCH 48/64] =?UTF-8?q?=F0=9F=90=9B=20fix:=20TableStatus=20statu?= =?UTF-8?q?s=20prop=EC=97=90=20=EB=84=98=EA=B2=A8=EC=A3=BC=EB=8A=94=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index ff1dbbe7..e93f10b2 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -135,7 +135,7 @@ export default function Table(props: UserProps | NoticeProps) { {mode === 'notice' && data[3] === 'pending' ? ( ) : ( - + )}
-
+
+ +
); } From 10a627334b66f8bdcaa2223ce99b268834316bd8 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 19:33:55 +0900 Subject: [PATCH 53/64] =?UTF-8?q?=E2=9C=A8=20feat:=20api=20=EB=B6=80?= =?UTF-8?q?=EB=B6=84=20error=20=EC=B2=98=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 3095e864..bdd1e120 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -87,7 +87,11 @@ export default function Table(props: UserProps | NoticeProps) { }), ); } - } catch {} + } catch { + setDatas(Array(5).fill(['', '', '', ''])); + setPage(1); + setTotalPage(1); + } })(); const maxHeight = 52; From b50d8e0e66c2546ee05cb8d3778c3c4b76aac91d Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 21:36:05 +0900 Subject: [PATCH 54/64] =?UTF-8?q?=E2=9C=A8=20feat:=20TableButtons=20api=20?= =?UTF-8?q?request=20=EB=B0=8F=20props=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/TableButtons.tsx | 31 +++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/components/common/table/TableButtons.tsx b/src/components/common/table/TableButtons.tsx index ba91af88..cad598a2 100644 --- a/src/components/common/table/TableButtons.tsx +++ b/src/components/common/table/TableButtons.tsx @@ -1,18 +1,33 @@ import { useEffect, useState } from 'react'; import Button from '../Button'; import TableStatus from './TableStatus'; +import { putNoticeApplications } from '@/api/applicationApi'; -export default function TableButtons() { +interface Props { + shopId: string; + noticeId: string; + applicaitonId: string; +} + +export default function TableButtons({ + shopId, + noticeId, + applicaitonId, +}: Props) { const [status, setStatus] = useState<'pending' | 'accepted' | 'rejected'>( 'pending', ); const [isMobile, setIsMobile] = useState(window.innerWidth < 768); - const handleClickReject = () => { - setStatus('rejected'); - }; - const handleClickAccept = () => { - setStatus('accepted'); + const changeStatus = async (stat: 'accepted' | 'rejected') => { + setStatus(stat); + try { + await putNoticeApplications(shopId, noticeId, applicaitonId, { + status: stat, + }); + } catch { + setStatus('pending'); + } }; useEffect(() => { @@ -29,7 +44,7 @@ export default function TableButtons() { solid={false} size={isMobile ? 'small' : 'medium'} className="w-69 md:w-92" - onClick={handleClickReject} + onClick={() => changeStatus('rejected')} > 거절하기 @@ -41,7 +56,7 @@ export default function TableButtons() { color: 'var(--color-blue-20)', borderColor: 'var(--color-blue-20)', }} - onClick={handleClickAccept} + onClick={() => changeStatus('accepted')} > 승인하기 From eb1f6247f022617524aa76398d911234091b91de Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 21:37:24 +0900 Subject: [PATCH 55/64] =?UTF-8?q?=E2=9C=A8=20feat:=20Table=20TableButtons?= =?UTF-8?q?=20props=20=EC=95=8C=EB=A7=9E=EA=B2=8C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index bdd1e120..61a39026 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -58,6 +58,7 @@ export default function Table(props: UserProps | NoticeProps) { element.item.user.item.bio, element.item.user.item.phone, element.item.status, + element.item.id, ]; }), ); @@ -149,7 +150,11 @@ export default function Table(props: UserProps | NoticeProps) {
{mode === 'notice' && data[3] === 'pending' ? ( - + ) : ( )} From 17cb0a05f3ffe6062eaab5878f6edc1ebdcf8adb Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 21:51:37 +0900 Subject: [PATCH 56/64] =?UTF-8?q?=F0=9F=93=9D=20docs:=20=EC=A3=BC=EC=84=9D?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 61a39026..3182b3dd 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -95,6 +95,7 @@ export default function Table(props: UserProps | NoticeProps) { } })(); + // tr의 내용이 2줄 이상 넘어가는 것을 방지하기 위한 코드 const maxHeight = 52; const elements = document.querySelectorAll('td div.t'); From 4659bd759dd756a672f2a7aea5716fdf26c499c7 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Wed, 18 Jun 2025 22:22:33 +0900 Subject: [PATCH 57/64] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=ED=85=8D=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EB=84=98=EC=B9=A8=20=EC=8A=A4=ED=83=80=EC=9D=BC=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/Table.tsx | 31 ++++++++------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/src/components/common/table/Table.tsx b/src/components/common/table/Table.tsx index 3182b3dd..d6537526 100644 --- a/src/components/common/table/Table.tsx +++ b/src/components/common/table/Table.tsx @@ -94,25 +94,6 @@ export default function Table(props: UserProps | NoticeProps) { setTotalPage(1); } })(); - - // tr의 내용이 2줄 이상 넘어가는 것을 방지하기 위한 코드 - const maxHeight = 52; - const elements = document.querySelectorAll('td div.t'); - - for (const element of elements) { - if (element.offsetHeight < maxHeight) continue; - - const originalText = element.textContent ?? ''; - element.textContent = originalText.slice(0, 2); - - for (let i = 2; i < originalText.length; i++) { - element.textContent += originalText[i]; - if (element.offsetHeight > maxHeight) { - element.textContent = originalText.slice(0, i - 2) + '...'; - break; - } - } - } }, [mode, page]); return ( @@ -140,13 +121,19 @@ export default function Table(props: UserProps | NoticeProps) { {datas.map((data, index) => (
-
{data[0]}
+
+ {data[0]} +
-
{data[1]}
+
+ {data[1]} +
-
{data[2]}
+
+ {data[2]} +
From e0609dc4b088995f4a6ea8c73ef1d20601609cd9 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 19 Jun 2025 02:26:11 +0900 Subject: [PATCH 58/64] =?UTF-8?q?=E2=9C=A8=20feat:=20TableButtons=20Modal?= =?UTF-8?q?=20component=20=EB=B0=8F=20state=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/TableButtons.tsx | 56 ++++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/components/common/table/TableButtons.tsx b/src/components/common/table/TableButtons.tsx index cad598a2..47cb982b 100644 --- a/src/components/common/table/TableButtons.tsx +++ b/src/components/common/table/TableButtons.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'; import Button from '../Button'; import TableStatus from './TableStatus'; import { putNoticeApplications } from '@/api/applicationApi'; +import Modal from '../Modal'; interface Props { shopId: string; @@ -17,6 +18,10 @@ export default function TableButtons({ const [status, setStatus] = useState<'pending' | 'accepted' | 'rejected'>( 'pending', ); + const [modal, setModal] = useState({ + isOpen: false, + message: '', + }); const [isMobile, setIsMobile] = useState(window.innerWidth < 768); const changeStatus = async (stat: 'accepted' | 'rejected') => { @@ -39,28 +44,35 @@ export default function TableButtons({ }, []); return status === 'pending' ? ( -
- - -
+ <> +
+ + +
+ {modal.isOpen && ( + null}> + {modal.message} + + )} + ) : ( ); From aaaeb74427455dc77a8278aaeff9f01e66e0c310 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 19 Jun 2025 02:38:15 +0900 Subject: [PATCH 59/64] =?UTF-8?q?=E2=9C=A8=20feat:=20modal=20state=20prope?= =?UTF-8?q?rty=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/TableButtons.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/common/table/TableButtons.tsx b/src/components/common/table/TableButtons.tsx index 47cb982b..685ae9de 100644 --- a/src/components/common/table/TableButtons.tsx +++ b/src/components/common/table/TableButtons.tsx @@ -18,9 +18,12 @@ export default function TableButtons({ const [status, setStatus] = useState<'pending' | 'accepted' | 'rejected'>( 'pending', ); - const [modal, setModal] = useState({ + const [modal, setModal] = useState<{ + isOpen: boolean; + status: 'accepted' | 'rejected'; + }>({ isOpen: false, - message: '', + status: 'accepted', }); const [isMobile, setIsMobile] = useState(window.innerWidth < 768); @@ -69,7 +72,7 @@ export default function TableButtons({
{modal.isOpen && ( null}> - {modal.message} + 신청을 {modal.status === 'accepted' ? '승인' : '거절'}하시겠어요? )} From d2a9be3e79dfd8538b4d8e69074287f02948995b Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 19 Jun 2025 02:45:33 +0900 Subject: [PATCH 60/64] =?UTF-8?q?=E2=9C=A8=20feat:=20handleClick=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=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 --- src/components/common/table/TableButtons.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/common/table/TableButtons.tsx b/src/components/common/table/TableButtons.tsx index 685ae9de..6c161037 100644 --- a/src/components/common/table/TableButtons.tsx +++ b/src/components/common/table/TableButtons.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { useEffect, useState, type MouseEvent } from 'react'; import Button from '../Button'; import TableStatus from './TableStatus'; import { putNoticeApplications } from '@/api/applicationApi'; @@ -27,6 +27,13 @@ export default function TableButtons({ }); const [isMobile, setIsMobile] = useState(window.innerWidth < 768); + const handleClick = (e: MouseEvent) => { + setModal({ + isOpen: true, + status: e.currentTarget.value as 'accepted' | 'rejected', + }); + }; + const changeStatus = async (stat: 'accepted' | 'rejected') => { setStatus(stat); try { @@ -53,7 +60,8 @@ export default function TableButtons({ solid={false} size={isMobile ? 'small' : 'medium'} className="w-69 md:w-92" - onClick={() => changeStatus('rejected')} + value="rejected" + onClick={handleClick} > 거절하기 @@ -65,7 +73,8 @@ export default function TableButtons({ color: 'var(--color-blue-20)', borderColor: 'var(--color-blue-20)', }} - onClick={() => changeStatus('accepted')} + value="accepted" + onClick={handleClick} > 승인하기 From 1e29baa53080e664c6658b287f091a50ade2c0db Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 19 Jun 2025 02:48:34 +0900 Subject: [PATCH 61/64] =?UTF-8?q?=F0=9F=90=9B=20fix:=20changeStatus=20>=20?= =?UTF-8?q?handleModalClick=20=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/TableButtons.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/common/table/TableButtons.tsx b/src/components/common/table/TableButtons.tsx index 6c161037..481de4f5 100644 --- a/src/components/common/table/TableButtons.tsx +++ b/src/components/common/table/TableButtons.tsx @@ -34,11 +34,11 @@ export default function TableButtons({ }); }; - const changeStatus = async (stat: 'accepted' | 'rejected') => { - setStatus(stat); + const handleModalClick = async () => { + setStatus(modal.status); try { await putNoticeApplications(shopId, noticeId, applicaitonId, { - status: stat, + status: modal.status, }); } catch { setStatus('pending'); @@ -80,7 +80,11 @@ export default function TableButtons({ {modal.isOpen && ( - null}> + null} + > 신청을 {modal.status === 'accepted' ? '승인' : '거절'}하시겠어요? )} From 1aacae5d93c6a61fbcf9f8a81e19fc207518c119 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 19 Jun 2025 02:56:55 +0900 Subject: [PATCH 62/64] =?UTF-8?q?=E2=9C=A8=20feat:=20TableButtons=20closeM?= =?UTF-8?q?odal=20=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/TableButtons.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/common/table/TableButtons.tsx b/src/components/common/table/TableButtons.tsx index 481de4f5..4f4986f0 100644 --- a/src/components/common/table/TableButtons.tsx +++ b/src/components/common/table/TableButtons.tsx @@ -35,6 +35,7 @@ export default function TableButtons({ }; const handleModalClick = async () => { + closeModal(); setStatus(modal.status); try { await putNoticeApplications(shopId, noticeId, applicaitonId, { @@ -45,6 +46,11 @@ export default function TableButtons({ } }; + const closeModal = () => + setModal((prev) => { + return { ...prev, isOpen: false }; + }); + useEffect(() => { const handleResize = () => { setIsMobile(window.innerWidth < 768); @@ -82,8 +88,9 @@ export default function TableButtons({ {modal.isOpen && ( null} + onClose={closeModal} > 신청을 {modal.status === 'accepted' ? '승인' : '거절'}하시겠어요? From ea206c00b0a2e2586d2d48b9745233402da1d37e Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 19 Jun 2025 02:58:11 +0900 Subject: [PATCH 63/64] =?UTF-8?q?=E2=9C=A8=20feat:=20TableButtons=20Modal?= =?UTF-8?q?=EC=97=90=20yesButtonContent=20prop=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/TableButtons.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/common/table/TableButtons.tsx b/src/components/common/table/TableButtons.tsx index 4f4986f0..95d08c51 100644 --- a/src/components/common/table/TableButtons.tsx +++ b/src/components/common/table/TableButtons.tsx @@ -90,6 +90,7 @@ export default function TableButtons({ option="action" onButtonClick={closeModal} onYesButtonClick={handleModalClick} + yesButtonContent="예" onClose={closeModal} > 신청을 {modal.status === 'accepted' ? '승인' : '거절'}하시겠어요? From d5a9ecf547851a39daadb59d08077a3ea24aa4c7 Mon Sep 17 00:00:00 2001 From: Moon-ju-young Date: Thu, 19 Jun 2025 14:59:34 +0900 Subject: [PATCH 64/64] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20TableBut?= =?UTF-8?q?tons=20=EB=82=B4=EB=B6=80=20=ED=95=A8=EC=88=98=20=EC=84=A0?= =?UTF-8?q?=EC=96=B8=20=EC=88=9C=EC=84=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/table/TableButtons.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/common/table/TableButtons.tsx b/src/components/common/table/TableButtons.tsx index 95d08c51..8a6f241c 100644 --- a/src/components/common/table/TableButtons.tsx +++ b/src/components/common/table/TableButtons.tsx @@ -27,12 +27,10 @@ export default function TableButtons({ }); const [isMobile, setIsMobile] = useState(window.innerWidth < 768); - const handleClick = (e: MouseEvent) => { - setModal({ - isOpen: true, - status: e.currentTarget.value as 'accepted' | 'rejected', + const closeModal = () => + setModal((prev) => { + return { ...prev, isOpen: false }; }); - }; const handleModalClick = async () => { closeModal(); @@ -46,10 +44,12 @@ export default function TableButtons({ } }; - const closeModal = () => - setModal((prev) => { - return { ...prev, isOpen: false }; + const handleClick = (e: MouseEvent) => { + setModal({ + isOpen: true, + status: e.currentTarget.value as 'accepted' | 'rejected', }); + }; useEffect(() => { const handleResize = () => {