From 7e1f40147ed8078d9a93b7bd3c2bb9772d2384a6 Mon Sep 17 00:00:00 2001 From: bicochan Date: Thu, 7 Aug 2025 09:55:10 +0900 Subject: [PATCH 01/28] =?UTF-8?q?[common/components]=20feat:=20=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=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/pages/dashboard/ui/dashboard-page.tsx | 36 ++--- .../common/components/src/api/notice-user.ts | 86 +++++++++++ packages/common/components/src/config/api.ts | 2 + .../common/components/src/ui/footer/index.tsx | 6 +- .../common/components/src/ui/header/index.tsx | 48 +++--- .../src/ui/header/notice-popover.tsx | 141 ++++++++++++++++++ 6 files changed, 269 insertions(+), 50 deletions(-) create mode 100644 packages/common/components/src/api/notice-user.ts create mode 100644 packages/common/components/src/ui/header/notice-popover.tsx diff --git a/apps/cs/src/pages/dashboard/ui/dashboard-page.tsx b/apps/cs/src/pages/dashboard/ui/dashboard-page.tsx index b217531dd..65fd0030a 100644 --- a/apps/cs/src/pages/dashboard/ui/dashboard-page.tsx +++ b/apps/cs/src/pages/dashboard/ui/dashboard-page.tsx @@ -134,7 +134,7 @@ function DashboardPage() { {/* 전체 게시물 카드 */}
-
+

전체 게시물

{data?.pstTotCnt ? data.pstTotCnt.toLocaleString() : "-"} @@ -157,7 +157,7 @@ function DashboardPage() { {/* 오늘 접속자 수 카드 */}
-
+

오늘 접속자 수

{data?.accessTodayCnt @@ -184,7 +184,7 @@ function DashboardPage() { {/* API 호출 건수 카드 */}
-
+

API 호출 건수

{data?.apiTodayCnt ? data.apiTodayCnt.toLocaleString() : "-"} @@ -206,13 +206,13 @@ function DashboardPage() {
{/* 승인 대기 알림 */}
-
+

승인 대기 알림

{/* 사용자 승인 */} -
+
-
+
신규 가입 승인 대기
{/* 매뉴 승인 */} -
+
{(3).toLocaleString()}건
-
+
매뉴 수정 승인 대기
{/* 컨텐츠 승인 */} -
+
-
+
컨텐츠 수정 승인 대기
@@ -318,11 +318,11 @@ function DashboardPage() {
{/* 실시간 알림 */}
-
+

실시간 알림

-
+
신규 사용자 가입 {(1).toLocaleString()}분 전 @@ -344,11 +344,11 @@ function DashboardPage() {
{/* 일정 알림 */}
-
+

일정 알림

-
+
{(3).toLocaleString()}월 정기 시스템 점검 @@ -377,7 +377,7 @@ function DashboardPage() {
{/* 접속자 통계 */}
-
+

접속자 통계

@@ -392,7 +392,7 @@ function DashboardPage() {
{/* 메뉴별 접속 통계 */}
-
+

메뉴별 접속 통계

@@ -412,14 +412,14 @@ function DashboardPage() {
{/* 공지사항 */}
-
+

공지사항

{noticePostTableComponent}
{/* 신규 게시글 */}
-
+

신규 게시글

{recentPostTableComponent} diff --git a/packages/common/components/src/api/notice-user.ts b/packages/common/components/src/api/notice-user.ts new file mode 100644 index 000000000..fbbd6b9b1 --- /dev/null +++ b/packages/common/components/src/api/notice-user.ts @@ -0,0 +1,86 @@ +import { ENDPOINT } from "../config"; +import { getApiClient } from "./client"; + +interface PageableParams { + page?: number; + size?: number; + sort?: string[]; +} + +interface SortConfig { + empty: boolean; + sorted: boolean; + unsorted: boolean; +} + +interface PageableConfig { + sort: SortConfig; + offset: number; + pageNumber: number; + pageSize: number; + paged: boolean; + unpaged: boolean; +} + +interface PageableList { + content: T[]; + pageable: PageableConfig; + sort: SortConfig; + totalPages: number; + totalElements: number; + number: number; + numberOfElements: number; + size: number; + first: boolean; + last: boolean; + empty: boolean; +} + +interface NoticeUserListParams extends PageableParams { + recvUnqId?: string; + senderUnqId?: string; + notiType?: string; + notiTtlKeyword?: string; + notiCnKeyword?: string; + notReadYn?: string; + delYn?: string; +} + +interface NoticeUser { + notiId: number; + recvUnqId: string; + senderUnqId: string; + notiType: string; + notiTtl: string; + notReadYn: string; + regDt: string; +} + +const client = getApiClient(); + +const getNoticeUserList = async ( + recvUnqId: string, + params?: NoticeUserListParams, +) => { + const response = await client.get>( + `${ENDPOINT.CMS_SERVICE.NOTICE_USER}/${recvUnqId}/list`, + { params }, + ); + return response.data; +}; + +const getUnreadNoticeCount = async (recvUnqId: string) => { + const response = await client.get>( + `${ENDPOINT.CMS_SERVICE.NOTICE_USER}/${recvUnqId}/unread/count`, + ); + return response.data; +}; + +const readNotice = async (notiId: number) => { + const response = await client.post( + `${ENDPOINT.CMS_SERVICE.NOTICE}/${notiId}/read`, + ); + return response.data; +}; + +export { getNoticeUserList, getUnreadNoticeCount, readNotice }; diff --git a/packages/common/components/src/config/api.ts b/packages/common/components/src/config/api.ts index a12ff5887..019a86d75 100644 --- a/packages/common/components/src/config/api.ts +++ b/packages/common/components/src/config/api.ts @@ -7,6 +7,8 @@ export const ENDPOINT = { POPUPS: "/cms-service/api/v1/popups", IPS: "/cms-service/api/v1/site-ips", CONNECTION_LOG: "/cms-service/api/v1/cntnlog", + NOTICE: "/cms-service/api/v1/noti", + NOTICE_USER: "/cms-service/api/v1/noti/user", }, USER_SERVICE: { USERS: "/user-service/api/v1/users", diff --git a/packages/common/components/src/ui/footer/index.tsx b/packages/common/components/src/ui/footer/index.tsx index b72e3a9be..8bb6e0c90 100644 --- a/packages/common/components/src/ui/footer/index.tsx +++ b/packages/common/components/src/ui/footer/index.tsx @@ -24,7 +24,7 @@ export function Footer() { const plugin = useRef(Autoplay({ delay: 2000, stopOnInteraction: true })); return ( -