From 1c408df4af3ba555e40ad3b424f9db1e2e6790fe Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Thu, 5 Jun 2025 23:53:35 +0900 Subject: [PATCH 01/20] =?UTF-8?q?=E2=9C=A8=20feat:=20=EC=95=84=EB=A5=B4?= =?UTF-8?q?=EB=B0=94=EC=9D=B4=ED=8A=B8=20=EC=8B=9C=EA=B0=84=20=ED=8F=AC?= =?UTF-8?q?=EB=A9=A7=ED=8C=85=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/utils/formatWorkTime.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/utils/formatWorkTime.ts diff --git a/src/utils/formatWorkTime.ts b/src/utils/formatWorkTime.ts new file mode 100644 index 00000000..c3738eb9 --- /dev/null +++ b/src/utils/formatWorkTime.ts @@ -0,0 +1,16 @@ +function formatWorkTime({ startsAt, workHour }) { + const date = new Date(startsAt); + + const kstDate = new Date(date.getTime() + 9 * 60 * 60 * 1000); + + const year = kstDate.getFullYear(); + const month = String(kstDate.getMonth() + 1).padStart(2, '0'); + const day = String(kstDate.getDate()).padStart(2, '0'); + const hours = String(kstDate.getHours()).padStart(2, '0'); + const afterhours = String(kstDate.getHours() + workHour).padStart(2, '0'); + const minutes = String(kstDate.getMinutes()).padStart(2, '0'); + + return `${year}-${month}-${day} ${hours}:${minutes}~${afterhours}:${minutes} `; +} + +export default formatWorkTime; From 0adf8b858512e277185593ab319af178c33b90ee Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Thu, 5 Jun 2025 23:53:59 +0900 Subject: [PATCH 02/20] =?UTF-8?q?=E2=9C=A8=20feat:=20=ED=98=84=EC=9E=AC?= =?UTF-8?q?=EB=A1=9C=EB=B6=80=ED=84=B0=20=EC=96=BC=EB=A7=88=20=EC=A0=84?= =?UTF-8?q?=EC=9D=B8=EC=A7=80=20=EA=B3=84=EC=82=B0=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=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/utils/calculateTimeDefference.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/utils/calculateTimeDefference.ts diff --git a/src/utils/calculateTimeDefference.ts b/src/utils/calculateTimeDefference.ts new file mode 100644 index 00000000..a3b8ada9 --- /dev/null +++ b/src/utils/calculateTimeDefference.ts @@ -0,0 +1,27 @@ +function calculateTimeDifference(createdAt) { + const currentDate = new Date(); + const createdDate = new Date(createdAt); + + const timeDifference = currentDate.getTime() - createdDate.getTime(); + const minutes = Math.floor(timeDifference / (1000 * 60)); + const hours = Math.floor(minutes / 60); + const days = Math.floor(hours / 24); + const months = Math.floor(days / 30); + const years = Math.floor(months / 12); + + if (minutes < 1) { + return '방금'; + } else if (minutes <= 59) { + return `${minutes}분 전`; + } else if (hours <= 23) { + return `${hours}시간 전`; + } else if (days <= 30) { + return `${days}일 전`; + } else if (months <= 11) { + return `${months}달 전`; + } else { + return `${years}년 전`; + } +} + +export default calculateTimeDifference; From 7eee9929374126a173cd6432aa3fb895c8c25985 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Thu, 5 Jun 2025 23:54:51 +0900 Subject: [PATCH 03/20] =?UTF-8?q?=E2=9C=A8=20feat:=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EB=AA=A8=EB=8B=AC=EC=B0=BD=20=EB=82=B4=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EA=B0=81=20=EC=95=8C=EB=A6=BC=EC=9D=84=20=EB=82=98=ED=83=80?= =?UTF-8?q?=EB=82=BC=20NotificationCard=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/.gitkeep | 0 .../NotificationModal/NotificationCard.tsx | 34 +++++++++++++++++++ src/utils/.gitkeep | 0 3 files changed, 34 insertions(+) delete mode 100644 src/components/common/.gitkeep create mode 100644 src/components/common/NotificationModal/NotificationCard.tsx delete mode 100644 src/utils/.gitkeep diff --git a/src/components/common/.gitkeep b/src/components/common/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/src/components/common/NotificationModal/NotificationCard.tsx b/src/components/common/NotificationModal/NotificationCard.tsx new file mode 100644 index 00000000..4899f309 --- /dev/null +++ b/src/components/common/NotificationModal/NotificationCard.tsx @@ -0,0 +1,34 @@ +import calculateTimeDifference from '@/utils/calculateTimeDefference'; +import formatWorkTime from '@/utils/formatWorkTime'; + +export default function NotificationCard({ + status, + restaurantName, + startsAt, + workHour, + createdAt, +}) { + const formattedTime = formatWorkTime({ + startsAt, + workHour, + }); + const formattedCreatedAt = calculateTimeDifference(createdAt); + const formattedStatus = status === 'accepted' ? '승인' : '거절'; + const formattedStatusClass = + status === 'accepted' ? 'text-blue-20' : 'text-red-20'; + return ( +
+ {status === 'accepted' ? ( +
+ ) : ( +
+ )} +

+ {restaurantName} {formattedTime} 공고 지원이{' '} + {formattedStatus} + 되었어요. +

+

{formattedCreatedAt}

+
+ ); +} diff --git a/src/utils/.gitkeep b/src/utils/.gitkeep deleted file mode 100644 index e69de29b..00000000 From ee0200f2b2cb7a65feb4c014e5f0613c973e3f8b Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Fri, 6 Jun 2025 00:02:59 +0900 Subject: [PATCH 04/20] =?UTF-8?q?=E2=9C=A8=20feat:=20props=20=EB=B0=8F=20r?= =?UTF-8?q?eturn=20type=EC=97=90=20=ED=83=80=EC=9E=85=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/NotificationModal/NotificationCard.tsx | 10 +++++++++- src/utils/calculateTimeDefference.ts | 4 +--- src/utils/formatWorkTime.ts | 12 +++++++++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/components/common/NotificationModal/NotificationCard.tsx b/src/components/common/NotificationModal/NotificationCard.tsx index 4899f309..a628bda0 100644 --- a/src/components/common/NotificationModal/NotificationCard.tsx +++ b/src/components/common/NotificationModal/NotificationCard.tsx @@ -1,13 +1,21 @@ import calculateTimeDifference from '@/utils/calculateTimeDefference'; import formatWorkTime from '@/utils/formatWorkTime'; +interface alert { + status: 'accepted' | 'rejected'; + restaurantName: string; + startsAt: string; + workHour: number; + createdAt: string; +} + export default function NotificationCard({ status, restaurantName, startsAt, workHour, createdAt, -}) { +}: alert) { const formattedTime = formatWorkTime({ startsAt, workHour, diff --git a/src/utils/calculateTimeDefference.ts b/src/utils/calculateTimeDefference.ts index a3b8ada9..ea5ca170 100644 --- a/src/utils/calculateTimeDefference.ts +++ b/src/utils/calculateTimeDefference.ts @@ -1,4 +1,4 @@ -function calculateTimeDifference(createdAt) { +export default function calculateTimeDifference(createdAt: string): string { const currentDate = new Date(); const createdDate = new Date(createdAt); @@ -23,5 +23,3 @@ function calculateTimeDifference(createdAt) { return `${years}년 전`; } } - -export default calculateTimeDifference; diff --git a/src/utils/formatWorkTime.ts b/src/utils/formatWorkTime.ts index c3738eb9..f8a5165b 100644 --- a/src/utils/formatWorkTime.ts +++ b/src/utils/formatWorkTime.ts @@ -1,4 +1,12 @@ -function formatWorkTime({ startsAt, workHour }) { +interface workTime { + startsAt: string; + workHour: number; +} + +export default function formatWorkTime({ + startsAt, + workHour, +}: workTime): string { const date = new Date(startsAt); const kstDate = new Date(date.getTime() + 9 * 60 * 60 * 1000); @@ -12,5 +20,3 @@ function formatWorkTime({ startsAt, workHour }) { return `${year}-${month}-${day} ${hours}:${minutes}~${afterhours}:${minutes} `; } - -export default formatWorkTime; From ed74a67aadce4848aebb08e511c5420ea5473547 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Fri, 6 Jun 2025 23:24:46 +0900 Subject: [PATCH 05/20] =?UTF-8?q?=F0=9F=8E=A8=20style:=20NotificationCard?= =?UTF-8?q?=20=EC=8A=A4=ED=83=80=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/NotificationModal/NotificationCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/NotificationModal/NotificationCard.tsx b/src/components/common/NotificationModal/NotificationCard.tsx index a628bda0..4b2885e2 100644 --- a/src/components/common/NotificationModal/NotificationCard.tsx +++ b/src/components/common/NotificationModal/NotificationCard.tsx @@ -25,7 +25,7 @@ export default function NotificationCard({ const formattedStatusClass = status === 'accepted' ? 'text-blue-20' : 'text-red-20'; return ( -
+
{status === 'accepted' ? (
) : ( From 92d36b8d30ef5d614c98ec8c869324ced80ff792 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Fri, 6 Jun 2025 23:25:12 +0900 Subject: [PATCH 06/20] =?UTF-8?q?=F0=9F=96=BC=EF=B8=8F=20feat:=20=EB=8B=AB?= =?UTF-8?q?=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icons/.gitkeep | 0 src/assets/icons/ic_close.svg | 10 ++++++++++ 2 files changed, 10 insertions(+) delete mode 100644 src/assets/icons/.gitkeep create mode 100644 src/assets/icons/ic_close.svg diff --git a/src/assets/icons/.gitkeep b/src/assets/icons/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/src/assets/icons/ic_close.svg b/src/assets/icons/ic_close.svg new file mode 100644 index 00000000..50f36dc1 --- /dev/null +++ b/src/assets/icons/ic_close.svg @@ -0,0 +1,10 @@ + + + + + + + + + + From a01886a9e87bcdd0a3b25d8e3b5c2456d026e630 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sat, 7 Jun 2025 13:15:14 +0900 Subject: [PATCH 07/20] =?UTF-8?q?=E2=9C=A8=20feat:=20NotificationModal=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NotificationModal/NotificationModal.tsx | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/components/common/NotificationModal/NotificationModal.tsx diff --git a/src/components/common/NotificationModal/NotificationModal.tsx b/src/components/common/NotificationModal/NotificationModal.tsx new file mode 100644 index 00000000..6390e0c0 --- /dev/null +++ b/src/components/common/NotificationModal/NotificationModal.tsx @@ -0,0 +1,38 @@ +import NotificationCard from './NotificationCard'; +import close from '@/assets/icons/ic_close.svg'; + +export default function NotificationModal({ data, count }) { + return ( +
+
+

알람 {count}개

+ +
+
+ + + +
+
+ ); +} From 0fd2d63cfab51b1c74632da05f530e2ea2c2bddb Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sat, 7 Jun 2025 14:31:30 +0900 Subject: [PATCH 08/20] =?UTF-8?q?=F0=9F=8E=A8=20style:=20NotificationCard?= =?UTF-8?q?=20=EC=8A=A4=ED=83=80=EC=9D=BC=EB=A7=81=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/NotificationModal/NotificationCard.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/NotificationModal/NotificationCard.tsx b/src/components/common/NotificationModal/NotificationCard.tsx index 4b2885e2..d5d91ec6 100644 --- a/src/components/common/NotificationModal/NotificationCard.tsx +++ b/src/components/common/NotificationModal/NotificationCard.tsx @@ -25,14 +25,14 @@ export default function NotificationCard({ const formattedStatusClass = status === 'accepted' ? 'text-blue-20' : 'text-red-20'; return ( -
+
{status === 'accepted' ? (
) : (
)}

- {restaurantName} {formattedTime} 공고 지원이{' '} + {restaurantName} ({formattedTime}) 공고 지원이{' '} {formattedStatus} 되었어요.

From baf166b3580070a2fb921c3c072e2586789afbfc Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sat, 7 Jun 2025 15:07:59 +0900 Subject: [PATCH 09/20] =?UTF-8?q?=F0=9F=8E=A8=20style:=20index.css?= =?UTF-8?q?=EC=97=90=20=EA=B7=B8=EB=A6=BC=EC=9E=90=20=EC=8A=A4=ED=83=80?= =?UTF-8?q?=EC=9D=BC=EB=B3=80=EC=88=98=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A1=A4=EB=B0=94=20=EC=88=A8=EA=B8=B0?= =?UTF-8?q?=EA=B8=B0=20=EC=9C=84=ED=95=9C=20tailwind-scrollbar-hide=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 10 ++++++++++ package.json | 1 + src/index.css | 2 ++ 3 files changed, 13 insertions(+) diff --git a/package-lock.json b/package-lock.json index 3bcb0c8a..152afd47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "react": "^19.1.0", "react-dom": "^19.1.0", "react-router-dom": "^7.6.1", + "tailwind-scrollbar-hide": "^4.0.0", "tailwindcss": "^4.1.8" }, "devDependencies": { @@ -4029,6 +4030,15 @@ "url": "https://opencollective.com/synckit" } }, + "node_modules/tailwind-scrollbar-hide": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/tailwind-scrollbar-hide/-/tailwind-scrollbar-hide-4.0.0.tgz", + "integrity": "sha512-gobtvVcThB2Dxhy0EeYSS1RKQJ5baDFkamkhwBvzvevwX6L4XQfpZ3me9s25Ss1ecFVT5jPYJ50n+7xTBJG9WQ==", + "license": "MIT", + "peerDependencies": { + "tailwindcss": ">=3.0.0 || >= 4.0.0 || >= 4.0.0-beta.8 || >= 4.0.0-alpha.20" + } + }, "node_modules/tailwindcss": { "version": "4.1.8", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.8.tgz", diff --git a/package.json b/package.json index bf0c1c7e..d22f2acc 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "react": "^19.1.0", "react-dom": "^19.1.0", "react-router-dom": "^7.6.1", + "tailwind-scrollbar-hide": "^4.0.0", "tailwindcss": "^4.1.8" }, "devDependencies": { diff --git a/src/index.css b/src/index.css index 49a5d5e2..dc25a653 100644 --- a/src/index.css +++ b/src/index.css @@ -1,4 +1,5 @@ @import 'tailwindcss'; +@import 'tailwind-scrollbar-hide/v4'; @font-face { font-family: 'SpoqaHanSansNeo-Regular'; @@ -90,4 +91,5 @@ --text-body1: 16px; --text-body2: 14px; --text-caption: 12px; + --shadow-custom: 0px 2px 8px 0px rgba(120, 116, 134, 0.25); } From e8a93e841634f49c84899bd209d58bbd2007dea0 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sat, 7 Jun 2025 16:15:06 +0900 Subject: [PATCH 10/20] =?UTF-8?q?=E2=9C=A8=20feat:=20NotificationModal=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84=20-=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EB=B3=B4=EC=97=AC=EC=A3=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NotificationModal/NotificationModal.tsx | 43 +++++++------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/src/components/common/NotificationModal/NotificationModal.tsx b/src/components/common/NotificationModal/NotificationModal.tsx index 6390e0c0..90c809c1 100644 --- a/src/components/common/NotificationModal/NotificationModal.tsx +++ b/src/components/common/NotificationModal/NotificationModal.tsx @@ -1,37 +1,26 @@ import NotificationCard from './NotificationCard'; import close from '@/assets/icons/ic_close.svg'; -export default function NotificationModal({ data, count }) { +export default function NotificationModal({ data, count, onClose }) { return ( -
-
-

알람 {count}개

-
-
- - - +
+ {data.map((data, index) => ( + + ))}
); From c3a96792d3df9a9782425443e27c6c1ad7ddf3df Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sat, 7 Jun 2025 16:50:25 +0900 Subject: [PATCH 11/20] =?UTF-8?q?=F0=9F=94=A7=20chore:=20gitignore=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7ceb59f8..b5a8a278 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ node_modules dist dist-ssr *.local +mocks # Editor directories and files .vscode/* From 3d7ede827741fd675bd3cbc2197f2cc112f5dbd0 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sat, 7 Jun 2025 17:15:17 +0900 Subject: [PATCH 12/20] =?UTF-8?q?=E2=9C=A8=20feat:=20=EB=8B=AB=EA=B8=B0=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EB=AA=A8=EB=B0=94=EC=9D=BC=EC=97=90?= =?UTF-8?q?=EC=84=9C=EB=A7=8C=20=EB=B3=B4=EC=9D=B4=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EB=8B=AB=EA=B8=B0=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=ED=81=B4=EB=A6=AD=EC=8B=9C=20=EC=9D=B4=EC=A0=84=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/NotificationModal/NotificationModal.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/common/NotificationModal/NotificationModal.tsx b/src/components/common/NotificationModal/NotificationModal.tsx index 90c809c1..9e6bcb39 100644 --- a/src/components/common/NotificationModal/NotificationModal.tsx +++ b/src/components/common/NotificationModal/NotificationModal.tsx @@ -1,12 +1,14 @@ +import { useNavigate } from 'react-router-dom'; import NotificationCard from './NotificationCard'; import close from '@/assets/icons/ic_close.svg'; -export default function NotificationModal({ data, count, onClose }) { +export default function NotificationModal({ data, count }) { + const navigate = useNavigate(); return (

알림 {count}개

-
From 4ee6e356e2f7ede9e7032164563bfce8302d2c47 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sat, 7 Jun 2025 17:35:44 +0900 Subject: [PATCH 13/20] =?UTF-8?q?=E2=9C=A8=20feat:=20type=20=EC=A7=80?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20type=EB=93=A4=20=EB=94=B0=EB=A1=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NotificationModal/NotificationCard.tsx | 11 ++----- .../NotificationModal/NotificationModal.tsx | 3 +- src/types/notification.ts | 31 +++++++++++++++++++ 3 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 src/types/notification.ts diff --git a/src/components/common/NotificationModal/NotificationCard.tsx b/src/components/common/NotificationModal/NotificationCard.tsx index d5d91ec6..12df86e2 100644 --- a/src/components/common/NotificationModal/NotificationCard.tsx +++ b/src/components/common/NotificationModal/NotificationCard.tsx @@ -1,21 +1,14 @@ +import type { NotificationCardProps } from '@/types/notification'; import calculateTimeDifference from '@/utils/calculateTimeDefference'; import formatWorkTime from '@/utils/formatWorkTime'; -interface alert { - status: 'accepted' | 'rejected'; - restaurantName: string; - startsAt: string; - workHour: number; - createdAt: string; -} - export default function NotificationCard({ status, restaurantName, startsAt, workHour, createdAt, -}: alert) { +}: NotificationCardProps) { const formattedTime = formatWorkTime({ startsAt, workHour, diff --git a/src/components/common/NotificationModal/NotificationModal.tsx b/src/components/common/NotificationModal/NotificationModal.tsx index 9e6bcb39..56d0c0dc 100644 --- a/src/components/common/NotificationModal/NotificationModal.tsx +++ b/src/components/common/NotificationModal/NotificationModal.tsx @@ -1,8 +1,9 @@ import { useNavigate } from 'react-router-dom'; import NotificationCard from './NotificationCard'; +import type { NotificationModalProps } from '@/types/notification'; import close from '@/assets/icons/ic_close.svg'; -export default function NotificationModal({ data, count }) { +export default function NotificationModal({ data, count }: NotificationModalProps) { const navigate = useNavigate(); return (
diff --git a/src/types/notification.ts b/src/types/notification.ts new file mode 100644 index 00000000..aa1fd9d3 --- /dev/null +++ b/src/types/notification.ts @@ -0,0 +1,31 @@ +export interface NotificationItem { + item: { + createdAt: string; + result: 'accepted' | 'rejected'; + read: boolean; + shop: { + item: { + name: string; + }; + }; + notice: { + item: { + startsAt: string; + workhour: number; + }; + }; + }; +} + +export interface NotificationModalProps { + data: NotificationItem[]; + count: number; +} + +export interface NotificationCardProps { + status: 'accepted' | 'rejected'; + restaurantName: string; + startsAt: string; + workHour: number; + createdAt: string; +} \ No newline at end of file From bc0d286f46fc865e04588f57c77626bf6439f27d Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sat, 7 Jun 2025 23:38:40 +0900 Subject: [PATCH 14/20] =?UTF-8?q?=F0=9F=94=A5=20remove:=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=ED=96=88=EB=8D=98=20=ED=83=80=EC=9E=85=EB=93=A4=20?= =?UTF-8?q?=EB=8B=A4=EC=8B=9C=20=ED=95=B4=EB=8B=B9=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EC=97=90=20=EC=9C=84=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types/notification.ts | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 src/types/notification.ts diff --git a/src/types/notification.ts b/src/types/notification.ts deleted file mode 100644 index aa1fd9d3..00000000 --- a/src/types/notification.ts +++ /dev/null @@ -1,31 +0,0 @@ -export interface NotificationItem { - item: { - createdAt: string; - result: 'accepted' | 'rejected'; - read: boolean; - shop: { - item: { - name: string; - }; - }; - notice: { - item: { - startsAt: string; - workhour: number; - }; - }; - }; -} - -export interface NotificationModalProps { - data: NotificationItem[]; - count: number; -} - -export interface NotificationCardProps { - status: 'accepted' | 'rejected'; - restaurantName: string; - startsAt: string; - workHour: number; - createdAt: string; -} \ No newline at end of file From 187474b3a56ebf7cc29982424722e32405530a81 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sat, 7 Jun 2025 23:39:38 +0900 Subject: [PATCH 15/20] =?UTF-8?q?=F0=9F=93=9D=20docs:=20=EA=B0=81=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=97=90=20jsDoc=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=98=EC=97=AC=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NotificationModal/NotificationCard.tsx | 31 +++++++++- .../NotificationModal/NotificationModal.tsx | 59 ++++++++++++++++++- src/utils/calculateTimeDefference.ts | 8 ++- src/utils/formatWorkTime.ts | 17 ++++++ 4 files changed, 112 insertions(+), 3 deletions(-) diff --git a/src/components/common/NotificationModal/NotificationCard.tsx b/src/components/common/NotificationModal/NotificationCard.tsx index 12df86e2..278db13b 100644 --- a/src/components/common/NotificationModal/NotificationCard.tsx +++ b/src/components/common/NotificationModal/NotificationCard.tsx @@ -1,7 +1,36 @@ -import type { NotificationCardProps } from '@/types/notification'; import calculateTimeDifference from '@/utils/calculateTimeDefference'; import formatWorkTime from '@/utils/formatWorkTime'; +/** + * 알림 카드에 필요한 props 정의 + */ +interface NotificationCardProps { + /** 공고 지원 상태 ('accepted' | 'rejected') */ + status: 'accepted' | 'rejected'; + + /** 음식점 이름 */ + restaurantName: string; + + /** 공고 시작 시간 (ISO 8601 문자열) */ + startsAt: string; + + /** 근무 시간 (시간 단위) */ + workHour: number; + + /** 알림 생성 시간 (ISO 8601 문자열) */ + createdAt: string; +} + +/** + * 사용자가 공고에 지원한 결과를 알리는 알림 카드 컴포넌트입니다. + * + * 상태에 따라 '승인' 혹은 '거절'로 표시되며, + * 가게 이름과 알바 시간, 생성 시간을 보여줍니다. + * + * @component + * @param {NotificationCardProps} props - 알림 카드에 전달되는 props + * @returns {JSX.Element} 렌더링된 알림 카드 + */ export default function NotificationCard({ status, restaurantName, diff --git a/src/components/common/NotificationModal/NotificationModal.tsx b/src/components/common/NotificationModal/NotificationModal.tsx index 56d0c0dc..6ed70146 100644 --- a/src/components/common/NotificationModal/NotificationModal.tsx +++ b/src/components/common/NotificationModal/NotificationModal.tsx @@ -1,8 +1,65 @@ import { useNavigate } from 'react-router-dom'; import NotificationCard from './NotificationCard'; -import type { NotificationModalProps } from '@/types/notification'; import close from '@/assets/icons/ic_close.svg'; +/** + * 개별 알림 항목을 나타내는 인터페이스입니다. + */ +interface NotificationItem { + item: { + /** 생성 일시 (ISO 8601 문자열) */ + createdAt: string; + + /** 결과 상태 ('accepted' 또는 'rejected') */ + result: 'accepted' | 'rejected'; + + /** 읽음 여부 */ + read: boolean; + + /** 가게 정보 */ + shop: { + item: { + /** 가게 이름 */ + name: string; + }; + }; + + /** 공고 정보 */ + notice: { + item: { + /** 근무 시작 시간 (ISO 8601 문자열) */ + startsAt: string; + + /** 근무 시간 (시간 단위) */ + workhour: number; + }; + }; + }; +} + +/** + * NotificationModal 컴포넌트에 전달되는 props의 타입입니다. + */ +interface NotificationModalProps { + /** 알림 데이터 배열 */ + data: NotificationItem[]; + + /** 알림 개수 */ + count: number; +} + +/** + * 알림 모달 컴포넌트입니다. + * 알림 데이터들을 카드로 표시하며, 스크롤 가능합니다. + * PC/Tablet에서는 모달 형식으로, 바깥을 클릭하거나 esc를 통해 창을 닫을 수 있습니다. + * 모바일에서는 닫기 버튼으로 창을 닫을 수 있습니다. + * + * @component + * @param {NotificationModalProps} props - 컴포넌트 props + * @param {NotificationItem[]} props.data - 알림 항목 배열 + * @param {number} props.count - 알림 개수 + * @returns {JSX.Element} 알림 모달 UI + */ export default function NotificationModal({ data, count }: NotificationModalProps) { const navigate = useNavigate(); return ( diff --git a/src/utils/calculateTimeDefference.ts b/src/utils/calculateTimeDefference.ts index ea5ca170..9b0dd0b4 100644 --- a/src/utils/calculateTimeDefference.ts +++ b/src/utils/calculateTimeDefference.ts @@ -1,3 +1,9 @@ +/** + * 주어진 날짜로부터 현재까지의 경과 시간을 사람이 읽기 좋은 문자열로 반환합니다. + * + * @param {string} createdAt - 기준이 되는 날짜 및 시간 (ISO 8601 형식 문자열) + * @returns {string} 현재부터 `createdAt`까지의 경과 시간 (예: '방금', '5분 전', '3시간 전', '2일 전', '1달 전', '1년 전') + */ export default function calculateTimeDifference(createdAt: string): string { const currentDate = new Date(); const createdDate = new Date(createdAt); @@ -22,4 +28,4 @@ export default function calculateTimeDifference(createdAt: string): string { } else { return `${years}년 전`; } -} +} \ No newline at end of file diff --git a/src/utils/formatWorkTime.ts b/src/utils/formatWorkTime.ts index f8a5165b..a36281f3 100644 --- a/src/utils/formatWorkTime.ts +++ b/src/utils/formatWorkTime.ts @@ -1,8 +1,25 @@ +/** + * 근무 시간 정보를 담은 객체 타입 + */ interface workTime { + /** 공고 시작 시간 (ISO 8601 형식 문자열) */ startsAt: string; + + /** 근무 시간 (시간 단위) */ workHour: number; } +/** + * 주어진 근무 시작 시간과 근무 시간을 기반으로 + * KST(한국 표준시) 기준의 근무 시작~종료 시간을 + * "YYYY-MM-DD HH:mm~HH:mm" 형식의 문자열로 반환합니다. + * + * @param {workTime} param0 - 근무 시간 정보 + * @param {string} param0.startsAt - 공고 시작 시간 (ISO 문자열) (예: "2025-06-07T02:00:00.000Z") + * @param {number} param0.workHour - 근무 시간 (시간 단위) (예: 6) + * @returns {string} 포맷팅된 근무 시간 문자열 (예: "2025-06-07 11:00~17:00") + */ + export default function formatWorkTime({ startsAt, workHour, From 2a09bc2cd3c7fc4d1ecc13457115a48cef223b13 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sun, 8 Jun 2025 19:44:32 +0900 Subject: [PATCH 16/20] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20data?= =?UTF-8?q?=EC=9D=98=20=ED=83=80=EC=9E=85=EC=9D=84=20item=20=EC=95=88?= =?UTF-8?q?=EC=AA=BD=EC=9C=BC=EB=A1=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NotificationModal/NotificationModal.tsx | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/components/common/NotificationModal/NotificationModal.tsx b/src/components/common/NotificationModal/NotificationModal.tsx index 6ed70146..8e54134c 100644 --- a/src/components/common/NotificationModal/NotificationModal.tsx +++ b/src/components/common/NotificationModal/NotificationModal.tsx @@ -6,37 +6,36 @@ import close from '@/assets/icons/ic_close.svg'; * 개별 알림 항목을 나타내는 인터페이스입니다. */ interface NotificationItem { - item: { - /** 생성 일시 (ISO 8601 문자열) */ - createdAt: string; + /** 생성 일시 (ISO 8601 문자열) */ + createdAt: string; - /** 결과 상태 ('accepted' 또는 'rejected') */ - result: 'accepted' | 'rejected'; + /** 결과 상태 ('accepted' 또는 'rejected') */ + result: 'accepted' | 'rejected'; - /** 읽음 여부 */ - read: boolean; + /** 읽음 여부 */ + read: boolean; - /** 가게 정보 */ - shop: { - item: { - /** 가게 이름 */ - name: string; - }; + /** 가게 정보 */ + shop: { + item: { + /** 가게 이름 */ + name: string; }; + }; - /** 공고 정보 */ - notice: { - item: { - /** 근무 시작 시간 (ISO 8601 문자열) */ - startsAt: string; + /** 공고 정보 */ + notice: { + item: { + /** 근무 시작 시간 (ISO 8601 문자열) */ + startsAt: string; - /** 근무 시간 (시간 단위) */ - workhour: number; - }; + /** 근무 시간 (시간 단위) */ + workhour: number; }; }; } + /** * NotificationModal 컴포넌트에 전달되는 props의 타입입니다. */ @@ -74,11 +73,11 @@ export default function NotificationModal({ data, count }: NotificationModalProp {data.map((data, index) => ( ))}
From 4eae6ee380330a1e05e8c0732d0cd51590895368 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sun, 8 Jun 2025 19:50:58 +0900 Subject: [PATCH 17/20] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=EA=B7=BC=EB=AC=B4?= =?UTF-8?q?=EA=B0=80=20=EB=81=9D=EB=82=98=EB=8A=94=20=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=EC=9D=B4=2024=EC=8B=9C=20=EC=9D=B4=EC=83=81=EC=9D=B8=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=B2=98?= =?UTF-8?q?=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/utils/formatWorkTime.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/utils/formatWorkTime.ts b/src/utils/formatWorkTime.ts index a36281f3..12f04f19 100644 --- a/src/utils/formatWorkTime.ts +++ b/src/utils/formatWorkTime.ts @@ -28,12 +28,18 @@ export default function formatWorkTime({ const kstDate = new Date(date.getTime() + 9 * 60 * 60 * 1000); + /** 시각이 24시를 넘으면 다음날로 설정되어 자동으로 처리 */ + const endDate = new Date(kstDate); + endDate.setHours(endDate.getHours() + workHour); + const year = kstDate.getFullYear(); const month = String(kstDate.getMonth() + 1).padStart(2, '0'); const day = String(kstDate.getDate()).padStart(2, '0'); - const hours = String(kstDate.getHours()).padStart(2, '0'); - const afterhours = String(kstDate.getHours() + workHour).padStart(2, '0'); - const minutes = String(kstDate.getMinutes()).padStart(2, '0'); + const startHours = String(kstDate.getHours()).padStart(2, '0'); + const startMinutes = String(kstDate.getMinutes()).padStart(2, '0'); + + const endHours = String(endDate.getHours()).padStart(2, '0'); + const endMinutes = String(endDate.getMinutes()).padStart(2, '0'); - return `${year}-${month}-${day} ${hours}:${minutes}~${afterhours}:${minutes} `; + return `${year}-${month}-${day} ${startHours}:${startMinutes}~${endHours}:${endMinutes} `; } From 20c536abc86efb0c4010e7318dbd9914c4245950 Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Sun, 8 Jun 2025 21:12:34 +0900 Subject: [PATCH 18/20] =?UTF-8?q?=E2=9C=A8=20feat:=20=EB=82=A0=EC=A7=9C=20?= =?UTF-8?q?=ED=98=95=EC=8B=9D=EC=9D=B4=20=ED=83=80=EC=9E=84=EC=8A=A4?= =?UTF-8?q?=ED=83=AC=ED=94=84=20=ED=98=95=EC=8B=9D=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=A3=BC=EC=96=B4=EC=A7=88=20=EA=B2=BD=EC=9A=B0=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/utils/calculateTimeDefference.ts | 4 ++-- src/utils/formatWorkTime.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/calculateTimeDefference.ts b/src/utils/calculateTimeDefference.ts index 9b0dd0b4..6d7a4f9c 100644 --- a/src/utils/calculateTimeDefference.ts +++ b/src/utils/calculateTimeDefference.ts @@ -1,10 +1,10 @@ /** * 주어진 날짜로부터 현재까지의 경과 시간을 사람이 읽기 좋은 문자열로 반환합니다. * - * @param {string} createdAt - 기준이 되는 날짜 및 시간 (ISO 8601 형식 문자열) + * @param {string|number} createdAt - 기준이 되는 날짜 및 시간 (ISO 8601 형식 문자열 / timestamp 형식) * @returns {string} 현재부터 `createdAt`까지의 경과 시간 (예: '방금', '5분 전', '3시간 전', '2일 전', '1달 전', '1년 전') */ -export default function calculateTimeDifference(createdAt: string): string { +export default function calculateTimeDifference(createdAt: string | number): string { const currentDate = new Date(); const createdDate = new Date(createdAt); diff --git a/src/utils/formatWorkTime.ts b/src/utils/formatWorkTime.ts index 12f04f19..81261e9b 100644 --- a/src/utils/formatWorkTime.ts +++ b/src/utils/formatWorkTime.ts @@ -3,7 +3,7 @@ */ interface workTime { /** 공고 시작 시간 (ISO 8601 형식 문자열) */ - startsAt: string; + startsAt: string | number; /** 근무 시간 (시간 단위) */ workHour: number; From c320b43972a577d670d0ba9c94b734e734a418be Mon Sep 17 00:00:00 2001 From: Yun-Jinwoo Date: Mon, 9 Jun 2025 15:13:09 +0900 Subject: [PATCH 19/20] =?UTF-8?q?=F0=9F=8E=A8=20style:=20spacing=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=88=98=EC=A0=95=20(4px=20->=201px)=20?= =?UTF-8?q?=EB=B0=8F=20=EB=B2=84=ED=8A=BC=20=ED=8F=AC=EC=9D=B8=ED=84=B0=20?= =?UTF-8?q?=EC=86=8D=EC=84=B1=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/NotificationModal/NotificationCard.tsx | 10 +++++----- .../common/NotificationModal/NotificationModal.tsx | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/common/NotificationModal/NotificationCard.tsx b/src/components/common/NotificationModal/NotificationCard.tsx index 278db13b..e56cab62 100644 --- a/src/components/common/NotificationModal/NotificationCard.tsx +++ b/src/components/common/NotificationModal/NotificationCard.tsx @@ -47,18 +47,18 @@ export default function NotificationCard({ const formattedStatusClass = status === 'accepted' ? 'text-blue-20' : 'text-red-20'; return ( -
+
{status === 'accepted' ? ( -
+
) : ( -
+
)} -

+

{restaurantName} ({formattedTime}) 공고 지원이{' '} {formattedStatus} 되었어요.

-

{formattedCreatedAt}

+

{formattedCreatedAt}

); } diff --git a/src/components/common/NotificationModal/NotificationModal.tsx b/src/components/common/NotificationModal/NotificationModal.tsx index 8e54134c..b6e38fdd 100644 --- a/src/components/common/NotificationModal/NotificationModal.tsx +++ b/src/components/common/NotificationModal/NotificationModal.tsx @@ -62,14 +62,14 @@ interface NotificationModalProps { export default function NotificationModal({ data, count }: NotificationModalProps) { const navigate = useNavigate(); return ( -
+

알림 {count}개

-
-
+
{data.map((data, index) => ( Date: Mon, 9 Jun 2025 15:27:51 +0900 Subject: [PATCH 20/20] =?UTF-8?q?=F0=9F=93=9D=20docs:=20=EC=A3=BC=EC=84=9D?= =?UTF-8?q?=EC=9D=98=20=EC=96=91=20=EC=A2=80=20=EC=A4=84=EC=9D=B4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NotificationModal/NotificationCard.tsx | 30 +++--------- .../NotificationModal/NotificationModal.tsx | 49 ++++--------------- src/utils/calculateTimeDefference.ts | 7 +-- src/utils/formatWorkTime.ts | 24 ++------- 4 files changed, 22 insertions(+), 88 deletions(-) diff --git a/src/components/common/NotificationModal/NotificationCard.tsx b/src/components/common/NotificationModal/NotificationCard.tsx index e56cab62..741a1c13 100644 --- a/src/components/common/NotificationModal/NotificationCard.tsx +++ b/src/components/common/NotificationModal/NotificationCard.tsx @@ -1,36 +1,20 @@ import calculateTimeDifference from '@/utils/calculateTimeDefference'; import formatWorkTime from '@/utils/formatWorkTime'; -/** - * 알림 카드에 필요한 props 정의 - */ interface NotificationCardProps { - /** 공고 지원 상태 ('accepted' | 'rejected') */ - status: 'accepted' | 'rejected'; - - /** 음식점 이름 */ - restaurantName: string; - - /** 공고 시작 시간 (ISO 8601 문자열) */ - startsAt: string; - - /** 근무 시간 (시간 단위) */ - workHour: number; - - /** 알림 생성 시간 (ISO 8601 문자열) */ - createdAt: string; + status: 'accepted' | 'rejected'; // 공고 지원 상태 + restaurantName: string; // 음식점 이름 + startsAt: string; // 공고 시작 시간 (ISO 8601 문자열) + workHour: number; // 근무 시간 (시간 단위) + createdAt: string; // 알림 생성 시간 (ISO 8601 문자열) } -/** +/* * 사용자가 공고에 지원한 결과를 알리는 알림 카드 컴포넌트입니다. - * * 상태에 따라 '승인' 혹은 '거절'로 표시되며, * 가게 이름과 알바 시간, 생성 시간을 보여줍니다. - * - * @component - * @param {NotificationCardProps} props - 알림 카드에 전달되는 props - * @returns {JSX.Element} 렌더링된 알림 카드 */ + export default function NotificationCard({ status, restaurantName, diff --git a/src/components/common/NotificationModal/NotificationModal.tsx b/src/components/common/NotificationModal/NotificationModal.tsx index b6e38fdd..1f9508f8 100644 --- a/src/components/common/NotificationModal/NotificationModal.tsx +++ b/src/components/common/NotificationModal/NotificationModal.tsx @@ -2,63 +2,34 @@ import { useNavigate } from 'react-router-dom'; import NotificationCard from './NotificationCard'; import close from '@/assets/icons/ic_close.svg'; -/** - * 개별 알림 항목을 나타내는 인터페이스입니다. - */ interface NotificationItem { - /** 생성 일시 (ISO 8601 문자열) */ - createdAt: string; - - /** 결과 상태 ('accepted' 또는 'rejected') */ - result: 'accepted' | 'rejected'; - - /** 읽음 여부 */ - read: boolean; - - /** 가게 정보 */ + createdAt: string; // 생성 일시 (ISO 8601 문자열) + result: 'accepted' | 'rejected'; // 결과 상태 + read: boolean; // 읽음 여부 shop: { item: { - /** 가게 이름 */ - name: string; + name: string; // 가게 이름 }; }; - - /** 공고 정보 */ notice: { item: { - /** 근무 시작 시간 (ISO 8601 문자열) */ - startsAt: string; - - /** 근무 시간 (시간 단위) */ - workhour: number; + startsAt: string; // 근무 시작 시간 (ISO 8601 문자열) + workhour: number; // 근무 시간 (시간 단위) }; }; } - - -/** - * NotificationModal 컴포넌트에 전달되는 props의 타입입니다. - */ interface NotificationModalProps { - /** 알림 데이터 배열 */ - data: NotificationItem[]; - - /** 알림 개수 */ - count: number; + data: NotificationItem[]; // 알림 데이터 배열 + count: number; // 알림 개수 } -/** +/* * 알림 모달 컴포넌트입니다. * 알림 데이터들을 카드로 표시하며, 스크롤 가능합니다. * PC/Tablet에서는 모달 형식으로, 바깥을 클릭하거나 esc를 통해 창을 닫을 수 있습니다. * 모바일에서는 닫기 버튼으로 창을 닫을 수 있습니다. - * - * @component - * @param {NotificationModalProps} props - 컴포넌트 props - * @param {NotificationItem[]} props.data - 알림 항목 배열 - * @param {number} props.count - 알림 개수 - * @returns {JSX.Element} 알림 모달 UI */ + export default function NotificationModal({ data, count }: NotificationModalProps) { const navigate = useNavigate(); return ( diff --git a/src/utils/calculateTimeDefference.ts b/src/utils/calculateTimeDefference.ts index 6d7a4f9c..90901985 100644 --- a/src/utils/calculateTimeDefference.ts +++ b/src/utils/calculateTimeDefference.ts @@ -1,9 +1,4 @@ -/** - * 주어진 날짜로부터 현재까지의 경과 시간을 사람이 읽기 좋은 문자열로 반환합니다. - * - * @param {string|number} createdAt - 기준이 되는 날짜 및 시간 (ISO 8601 형식 문자열 / timestamp 형식) - * @returns {string} 현재부터 `createdAt`까지의 경과 시간 (예: '방금', '5분 전', '3시간 전', '2일 전', '1달 전', '1년 전') - */ +/* 주어진 날짜로부터 현재까지의 경과 시간을 사람이 읽기 좋은 문자열로 반환하는 함수 */ export default function calculateTimeDifference(createdAt: string | number): string { const currentDate = new Date(); const createdDate = new Date(createdAt); diff --git a/src/utils/formatWorkTime.ts b/src/utils/formatWorkTime.ts index 81261e9b..92b4c5b7 100644 --- a/src/utils/formatWorkTime.ts +++ b/src/utils/formatWorkTime.ts @@ -1,25 +1,9 @@ -/** - * 근무 시간 정보를 담은 객체 타입 - */ interface workTime { - /** 공고 시작 시간 (ISO 8601 형식 문자열) */ - startsAt: string | number; - - /** 근무 시간 (시간 단위) */ - workHour: number; + startsAt: string | number; // 근무 시작 시간 (ISO 8601 형식 문자열) + workHour: number; // 근무 시간 (시간 단위) } -/** - * 주어진 근무 시작 시간과 근무 시간을 기반으로 - * KST(한국 표준시) 기준의 근무 시작~종료 시간을 - * "YYYY-MM-DD HH:mm~HH:mm" 형식의 문자열로 반환합니다. - * - * @param {workTime} param0 - 근무 시간 정보 - * @param {string} param0.startsAt - 공고 시작 시간 (ISO 문자열) (예: "2025-06-07T02:00:00.000Z") - * @param {number} param0.workHour - 근무 시간 (시간 단위) (예: 6) - * @returns {string} 포맷팅된 근무 시간 문자열 (예: "2025-06-07 11:00~17:00") - */ - +/* 주어진 근무 시작 시간과 근무 시간을 기반으로 근무 시작~종료 시간을 "YYYY-MM-DD HH:mm~HH:mm" 형식의 문자열로 반환하는 함수 */ export default function formatWorkTime({ startsAt, workHour, @@ -28,7 +12,7 @@ export default function formatWorkTime({ const kstDate = new Date(date.getTime() + 9 * 60 * 60 * 1000); - /** 시각이 24시를 넘으면 다음날로 설정되어 자동으로 처리 */ + /* 시각이 24시를 넘으면 다음날로 설정되어 자동으로 처리 */ const endDate = new Date(kstDate); endDate.setHours(endDate.getHours() + workHour);