From 17c0a5a141f569eac736015e55fece4a5c9a2af4 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 16:46:39 +0900 Subject: [PATCH 01/19] =?UTF-8?q?feat=20:=20"=EB=AF=B8=EB=A6=AC=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0"=EC=99=80=20"=EC=A0=84=EC=B2=B4=20=EC=A1=B0=ED=9A=8C"?= =?UTF-8?q?=20API=20=EA=B5=AC=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/auth.api.ts | 10 ++++++++++ .../allUserPreview/AllUserPreview.tsx | 12 +++--------- src/hooks/queries/user/keys.ts | 1 + src/mock/browser.ts | 2 ++ src/models/auth.ts | 4 ++-- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/api/auth.api.ts b/src/api/auth.api.ts index b866b37c..566a890e 100644 --- a/src/api/auth.api.ts +++ b/src/api/auth.api.ts @@ -106,6 +106,16 @@ export const getOauthLogin = async (oauthAccessToken: string) => { } }; +export const getAllUsersPreview = async () => { + try { + const response = await httpClient.get(`/users/preview`); + return response.data.data; + } catch (e) { + console.error(e); + throw e; + } +}; + export const getAllUsers = async () => { try { const response = await httpClient.get(`/users`); diff --git a/src/components/admin/previewComponent/allUserPreview/AllUserPreview.tsx b/src/components/admin/previewComponent/allUserPreview/AllUserPreview.tsx index 9131fd10..00c91d60 100644 --- a/src/components/admin/previewComponent/allUserPreview/AllUserPreview.tsx +++ b/src/components/admin/previewComponent/allUserPreview/AllUserPreview.tsx @@ -1,13 +1,13 @@ import React from 'react'; import * as S from './AllUserPreview.styled'; -import { useGetAllUsers } from '../../../../hooks/admin/useGetAllUsers'; import Avatar from '../../../common/avatar/Avatar'; import { ADMIN_ROUTE } from '../../../../constants/routes'; import arrow_right from '../../../../assets/ArrowRight.svg'; import LoadingSpinner from '../../../common/loadingSpinner/LoadingSpinner'; +import { useGetAllUsersPreview } from '../../../../hooks/admin/useGetAllUsersPreview'; const AllUserPreview = () => { - const { allUserData, isLoading, isFetching } = useGetAllUsers(); + const { allUserData, isLoading, isFetching } = useGetAllUsersPreview(); if (isLoading || isFetching) { return ; @@ -17,15 +17,9 @@ const AllUserPreview = () => { return 가입된 회원이 없습니다.; } - const previewList = allUserData - ? allUserData.length > 6 - ? allUserData.slice(0, 4) - : allUserData - : []; - return ( - {previewList?.map((user) => ( + {allUserData?.map((user) => ( diff --git a/src/hooks/queries/user/keys.ts b/src/hooks/queries/user/keys.ts index 22708439..a9081216 100644 --- a/src/hooks/queries/user/keys.ts +++ b/src/hooks/queries/user/keys.ts @@ -62,4 +62,5 @@ export const ReportData = { export const UserData = { allUser: ['AllUser'], + allUserPreview: ['AllUserPreview'], }; diff --git a/src/mock/browser.ts b/src/mock/browser.ts index 2c4da947..caac0f09 100644 --- a/src/mock/browser.ts +++ b/src/mock/browser.ts @@ -18,6 +18,7 @@ import { } from './mypage'; import { userAll, + userAllPreview, userPageAppliedProjectList, userPageProfile, } from './userpage'; @@ -57,6 +58,7 @@ export const handlers = [ createProject, reportsAll, userAll, + userAllPreview, ]; export const worker = setupWorker(...handlers); diff --git a/src/models/auth.ts b/src/models/auth.ts index ae4d1fb9..20e3f96e 100644 --- a/src/models/auth.ts +++ b/src/models/auth.ts @@ -29,10 +29,10 @@ export interface ApiOauth extends ApiCommonType { } export interface ApiGetAllUsers extends ApiCommonType { - data: AllUser[]; + data: AllUserPreview[]; } -export interface AllUser { +export interface AllUserPreview { id: number; email: string; user: User; From efb41d84b6939a657a853d937bb7e3745e81f09e Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 16:47:20 +0900 Subject: [PATCH 02/19] =?UTF-8?q?feat=20:=20"=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=A1=B0=ED=9A=8C=20=EB=AF=B8=EB=A6=AC?= =?UTF-8?q?=EB=B3=B4=EA=B8=B0"=EC=97=90=EC=84=9C=20useQuery=EC=9D=98=20sel?= =?UTF-8?q?ect=20=EC=98=B5=EC=85=98=EC=9D=84=20=ED=86=B5=ED=95=B4=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=EC=9D=98=20=EC=83=81=EC=9C=84=205?= =?UTF-8?q?=EA=B0=9C=EB=A7=8C=20=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/admin/useGetAllUsersPreview.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/hooks/admin/useGetAllUsersPreview.ts diff --git a/src/hooks/admin/useGetAllUsersPreview.ts b/src/hooks/admin/useGetAllUsersPreview.ts new file mode 100644 index 00000000..9a90d386 --- /dev/null +++ b/src/hooks/admin/useGetAllUsersPreview.ts @@ -0,0 +1,17 @@ +import { useQuery } from '@tanstack/react-query'; +import { UserData } from '../queries/user/keys'; +import { getAllUsersPreview } from '../../api/auth.api'; + +export const useGetAllUsersPreview = () => { + const { + data: allUserData, + isLoading, + isFetching, + } = useQuery({ + queryKey: [UserData.allUserPreview], + queryFn: () => getAllUsersPreview(), + select: (allUsers) => allUsers.slice(0, 5), + }); + + return { allUserData, isLoading, isFetching }; +}; From 8d80351e985daa2e033bebe9e6592692dfab21f5 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 16:48:04 +0900 Subject: [PATCH 03/19] =?UTF-8?q?feat=20:=20mock=20=ED=86=B5=EC=8B=A0=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20"=EB=AF=B8=EB=A6=AC=EB=B3=B4=EA=B8=B0"?= =?UTF-8?q?=EC=99=80=20"=ED=9A=8C=EC=9B=90=20=EC=A0=84=EC=B2=B4=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C"=20=EA=B5=AC=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mock/userpage.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mock/userpage.ts b/src/mock/userpage.ts index 21090fff..b188ae18 100644 --- a/src/mock/userpage.ts +++ b/src/mock/userpage.ts @@ -21,6 +21,13 @@ export const userPageAppliedProjectList = http.get( } ); +export const userAllPreview = http.get( + `${import.meta.env.VITE_APP_API_BASE_URL}users/preview`, + () => { + return HttpResponse.json(mockUsers, { status: 200 }); + } +); + export const userAll = http.get( `${import.meta.env.VITE_APP_API_BASE_URL}users`, () => { From bad575249bb363a421ef6d4af2cd52323b2ed50e Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 16:58:13 +0900 Subject: [PATCH 04/19] =?UTF-8?q?refactor=20:=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reportsPreview/ReportsPreview.styled.ts | 6 +++--- .../previewComponent/reportsPreview/ReportsPreview.tsx | 8 ++++---- src/models/report.ts | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/admin/previewComponent/reportsPreview/ReportsPreview.styled.ts b/src/components/admin/previewComponent/reportsPreview/ReportsPreview.styled.ts index 5514ca39..e68b6d9f 100644 --- a/src/components/admin/previewComponent/reportsPreview/ReportsPreview.styled.ts +++ b/src/components/admin/previewComponent/reportsPreview/ReportsPreview.styled.ts @@ -21,7 +21,7 @@ export const ContentArea = styled.div` margin-left: 16px; `; -export const ImposedCount = styled.div` +export const ReportedCount = styled.div` font-size: 9px; opacity: 0.5; `; @@ -49,9 +49,9 @@ export const Divider = styled.p` margin-right: 3px; `; -export const IsImposed = styled.p<{ $isImposed: boolean }>` +export const IsDone = styled.p<{ $isDone: boolean }>` font-size: 9px; - color: ${({ $isImposed }) => ($isImposed ? `#07DE00` : `#DE1A00`)}; + color: ${({ $isDone }) => ($isDone ? `#07DE00` : `#DE1A00`)}; `; export const MoveToReportsArea = styled(Link)` diff --git a/src/components/admin/previewComponent/reportsPreview/ReportsPreview.tsx b/src/components/admin/previewComponent/reportsPreview/ReportsPreview.tsx index 0f7f4d21..794d952d 100644 --- a/src/components/admin/previewComponent/reportsPreview/ReportsPreview.tsx +++ b/src/components/admin/previewComponent/reportsPreview/ReportsPreview.tsx @@ -20,14 +20,14 @@ const ReportsPreview = () => { - {report.imposedCount} 번 + {report.reportedCount} 번 {report.category} {report.createdAt} | - - {report.isImposed ? '검토 완료' : '검토 미완료'} - + + {report.isDone ? '검토 완료' : '검토 미완료'} + diff --git a/src/models/report.ts b/src/models/report.ts index 4ace69eb..abe0affc 100644 --- a/src/models/report.ts +++ b/src/models/report.ts @@ -13,9 +13,9 @@ export interface ApiAllReports extends ApiCommonType { export interface AllReports { id: number; - imposedCount: number; + reportedCount: number; category: string; user: User; - isImposed: boolean; + isDone: boolean; createdAt: string; } From 27d61e7624885f5c6748e70899766e4843fc6897 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 19:41:17 +0900 Subject: [PATCH 05/19] =?UTF-8?q?feat=20:=20"=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=A1=B0=ED=9A=8C"=20mock=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mock/mockAllUser.json | 686 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 686 insertions(+) create mode 100644 src/mock/mockAllUser.json diff --git a/src/mock/mockAllUser.json b/src/mock/mockAllUser.json new file mode 100644 index 00000000..65ea15f2 --- /dev/null +++ b/src/mock/mockAllUser.json @@ -0,0 +1,686 @@ +{ + "success": true, + "message": "지원서 조회 성공", + "data": [ + { + "id": 1, + "email": "user1@example.com", + "user": { + "id": 101, + "nickname": "alpha", + "img": "https://example.com/avatars/alpha.png" + }, + "userState": "접속 중", + "createdAt": "2023-12-01", + "skill": [ + { + "id": 11, + "name": "JavaScript", + "img": "https://example.com/skills/javascript.png", + "createdAt": "2023-01-10" + }, + { + "id": 12, + "name": "React", + "img": "https://example.com/skills/react.png", + "createdAt": "2023-02-15" + } + ], + "position": [ + { + "id": 21, + "name": "Frontend", + "createdAt": "2023-03-05" + }, + { + "id": 21, + "name": "Frontend", + "createdAt": "2023-03-05" + }, + { + "id": 21, + "name": "Frontend", + "createdAt": "2023-03-05" + }, + { + "id": 21, + "name": "Frontend", + "createdAt": "2023-03-05" + }, + { + "id": 21, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 0 + }, + { + "id": 2, + "email": "user2@example.com", + "user": { + "id": 102, + "nickname": "bravo", + "img": "https://example.com/avatars/bravo.png" + }, + "userState": "오프라인", + "createdAt": "2024-01-15", + "skill": [ + { + "id": 13, + "name": "TypeScript", + "img": "https://example.com/skills/typescript.png", + "createdAt": "2023-04-12" + }, + { + "id": 14, + "name": "HTML", + "img": "https://example.com/skills/html.png", + "createdAt": "2023-05-01" + } + ], + "position": [ + { + "id": 22, + "name": "Fullstack", + "createdAt": "2023-06-20" + } + ], + "reportedCount": 1 + }, + { + "id": 3, + "email": "user3@example.com", + "user": { + "id": 103, + "nickname": "charlie", + "img": "https://example.com/avatars/charlie.png" + }, + "userState": "정지", + "createdAt": "2022-11-20", + "skill": [ + { + "id": 15, + "name": "CSS", + "img": "https://example.com/skills/css.png", + "createdAt": "2023-03-22" + }, + { + "id": 16, + "name": "Node.js", + "img": "https://example.com/skills/nodejs.png", + "createdAt": "2023-04-18" + } + ], + "position": [ + { + "id": 23, + "name": "Backend", + "createdAt": "2023-05-30" + } + ], + "reportedCount": 3 + }, + { + "id": 4, + "email": "user4@example.com", + "user": { + "id": 104, + "nickname": "delta", + "img": "https://example.com/avatars/delta.png" + }, + "userState": "접속 중", + "createdAt": "2024-03-03", + "skill": [ + { + "id": 17, + "name": "Python", + "img": "https://example.com/skills/python.png", + "createdAt": "2023-06-10" + }, + { + "id": 18, + "name": "Docker", + "img": "https://example.com/skills/docker.png", + "createdAt": "2023-07-25" + } + ], + "position": [ + { + "id": 24, + "name": "DevOps", + "createdAt": "2023-08-05" + } + ], + "reportedCount": 0 + }, + { + "id": 5, + "email": "user5@example.com", + "user": { + "id": 105, + "nickname": "echo", + "img": "https://example.com/avatars/echo.png" + }, + "userState": "오프라인", + "createdAt": "2024-02-10", + "skill": [ + { + "id": 19, + "name": "AWS", + "img": "https://example.com/skills/aws.png", + "createdAt": "2023-09-02" + }, + { + "id": 20, + "name": "HTML", + "img": "https://example.com/skills/html.png", + "createdAt": "2023-05-01" + } + ], + "position": [ + { + "id": 25, + "name": "Fullstack", + "createdAt": "2023-10-12" + } + ], + "reportedCount": 2 + }, + { + "id": 6, + "email": "user6@example.com", + "user": { + "id": 106, + "nickname": "foxtrot", + "img": "https://example.com/avatars/foxtrot.png" + }, + "userState": "접속 중", + "createdAt": "2023-08-15", + "skill": [ + { + "id": 21, + "name": "JavaScript", + "img": "https://example.com/skills/javascript.png", + "createdAt": "2023-01-10" + }, + { + "id": 22, + "name": "React", + "img": "https://example.com/skills/react.png", + "createdAt": "2023-02-15" + } + ], + "position": [ + { + "id": 26, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 0 + }, + { + "id": 7, + "email": "user7@example.com", + "user": { + "id": 107, + "nickname": "golf", + "img": "https://example.com/avatars/golf.png" + }, + "userState": "오프라인", + "createdAt": "2024-05-01", + "skill": [ + { + "id": 23, + "name": "TypeScript", + "img": "https://example.com/skills/typescript.png", + "createdAt": "2023-04-12" + }, + { + "id": 24, + "name": "CSS", + "img": "https://example.com/skills/css.png", + "createdAt": "2023-03-22" + } + ], + "position": [ + { + "id": 27, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 4 + }, + { + "id": 8, + "email": "user8@example.com", + "user": { + "id": 108, + "nickname": "hotel", + "img": "https://example.com/avatars/hotel.png" + }, + "userState": "정지", + "createdAt": "2023-09-10", + "skill": [ + { + "id": 25, + "name": "Node.js", + "img": "https://example.com/skills/nodejs.png", + "createdAt": "2023-04-18" + }, + { + "id": 26, + "name": "Docker", + "img": "https://example.com/skills/docker.png", + "createdAt": "2023-07-25" + } + ], + "position": [ + { + "id": 28, + "name": "Backend", + "createdAt": "2023-05-30" + } + ], + "reportedCount": 5 + }, + { + "id": 9, + "email": "user9@example.com", + "user": { + "id": 109, + "nickname": "india", + "img": "https://example.com/avatars/india.png" + }, + "userState": "접속 중", + "createdAt": "2024-04-20", + "skill": [ + { + "id": 27, + "name": "Python", + "img": "https://example.com/skills/python.png", + "createdAt": "2023-06-10" + }, + { + "id": 28, + "name": "AWS", + "img": "https://example.com/skills/aws.png", + "createdAt": "2023-09-02" + } + ], + "position": [ + { + "id": 29, + "name": "DevOps", + "createdAt": "2023-08-05" + } + ], + "reportedCount": 0 + }, + { + "id": 10, + "email": "user10@example.com", + "user": { + "id": 110, + "nickname": "juliet", + "img": "https://example.com/avatars/juliet.png" + }, + "userState": "오프라인", + "createdAt": "2022-12-25", + "skill": [ + { + "id": 29, + "name": "HTML", + "img": "https://example.com/skills/html.png", + "createdAt": "2023-05-01" + }, + { + "id": 30, + "name": "CSS", + "img": "https://example.com/skills/css.png", + "createdAt": "2023-03-22" + } + ], + "position": [ + { + "id": 30, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 2 + }, + { + "id": 11, + "email": "user11@example.com", + "user": { + "id": 111, + "nickname": "kilo", + "img": "https://example.com/avatars/kilo.png" + }, + "userState": "접속 중", + "createdAt": "2024-06-02", + "skill": [ + { + "id": 31, + "name": "JavaScript", + "img": "https://example.com/skills/javascript.png", + "createdAt": "2023-01-10" + }, + { + "id": 32, + "name": "React", + "img": "https://example.com/skills/react.png", + "createdAt": "2023-02-15" + } + ], + "position": [ + { + "id": 31, + "name": "Fullstack", + "createdAt": "2023-06-20" + } + ], + "reportedCount": 1 + }, + { + "id": 12, + "email": "user12@example.com", + "user": { + "id": 112, + "nickname": "lima", + "img": "https://example.com/avatars/lima.png" + }, + "userState": "오프라인", + "createdAt": "2023-07-18", + "skill": [ + { + "id": 33, + "name": "TypeScript", + "img": "https://example.com/skills/typescript.png", + "createdAt": "2023-04-12" + }, + { + "id": 34, + "name": "Node.js", + "img": "https://example.com/skills/nodejs.png", + "createdAt": "2023-04-18" + } + ], + "position": [ + { + "id": 32, + "name": "Backend", + "createdAt": "2023-05-30" + } + ], + "reportedCount": 0 + }, + { + "id": 13, + "email": "user13@example.com", + "user": { + "id": 113, + "nickname": "mike", + "img": "https://example.com/avatars/mike.png" + }, + "userState": "정지", + "createdAt": "2024-02-28", + "skill": [ + { + "id": 35, + "name": "Docker", + "img": "https://example.com/skills/docker.png", + "createdAt": "2023-07-25" + }, + { + "id": 36, + "name": "AWS", + "img": "https://example.com/skills/aws.png", + "createdAt": "2023-09-02" + } + ], + "position": [ + { + "id": 33, + "name": "DevOps", + "createdAt": "2023-08-05" + } + ], + "reportedCount": 4 + }, + { + "id": 14, + "email": "user14@example.com", + "user": { + "id": 114, + "nickname": "november", + "img": "https://example.com/avatars/november.png" + }, + "userState": "접속 중", + "createdAt": "2023-10-05", + "skill": [ + { + "id": 37, + "name": "HTML", + "img": "https://example.com/skills/html.png", + "createdAt": "2023-05-01" + }, + { + "id": 38, + "name": "CSS", + "img": "https://example.com/skills/css.png", + "createdAt": "2023-03-22" + } + ], + "position": [ + { + "id": 34, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 1 + }, + { + "id": 15, + "email": "user15@example.com", + "user": { + "id": 115, + "nickname": "oscar", + "img": "https://example.com/avatars/oscar.png" + }, + "userState": "오프라인", + "createdAt": "2024-03-22", + "skill": [ + { + "id": 39, + "name": "JavaScript", + "img": "https://example.com/skills/javascript.png", + "createdAt": "2023-01-10" + }, + { + "id": 40, + "name": "React", + "img": "https://example.com/skills/react.png", + "createdAt": "2023-02-15" + } + ], + "position": [ + { + "id": 35, + "name": "Fullstack", + "createdAt": "2023-06-20" + } + ], + "reportedCount": 2 + }, + { + "id": 16, + "email": "user16@example.com", + "user": { + "id": 116, + "nickname": "papa", + "img": "https://example.com/avatars/papa.png" + }, + "userState": "접속 중", + "createdAt": "2023-11-11", + "skill": [ + { + "id": 41, + "name": "TypeScript", + "img": "https://example.com/skills/typescript.png", + "createdAt": "2023-04-12" + }, + { + "id": 42, + "name": "Node.js", + "img": "https://example.com/skills/nodejs.png", + "createdAt": "2023-04-18" + } + ], + "position": [ + { + "id": 36, + "name": "Backend", + "createdAt": "2023-05-30" + } + ], + "reportedCount": 0 + }, + { + "id": 17, + "email": "user17@example.com", + "user": { + "id": 117, + "nickname": "quebec", + "img": "https://example.com/avatars/quebec.png" + }, + "userState": "오프라인", + "createdAt": "2023-08-30", + "skill": [ + { + "id": 43, + "name": "Docker", + "img": "https://example.com/skills/docker.png", + "createdAt": "2023-07-25" + }, + { + "id": 44, + "name": "AWS", + "img": "https://example.com/skills/aws.png", + "createdAt": "2023-09-02" + } + ], + "position": [ + { + "id": 37, + "name": "DevOps", + "createdAt": "2023-08-05" + } + ], + "reportedCount": 3 + }, + { + "id": 18, + "email": "user18@example.com", + "user": { + "id": 118, + "nickname": "romeo", + "img": "https://example.com/avatars/romeo.png" + }, + "userState": "정지", + "createdAt": "2022-10-10", + "skill": [ + { + "id": 45, + "name": "JavaScript", + "img": "https://example.com/skills/javascript.png", + "createdAt": "2023-01-10" + }, + { + "id": 46, + "name": "React", + "img": "https://example.com/skills/react.png", + "createdAt": "2023-02-15" + } + ], + "position": [ + { + "id": 38, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 5 + }, + { + "id": 19, + "email": "user19@example.com", + "user": { + "id": 119, + "nickname": "sierra", + "img": "https://example.com/avatars/sierra.png" + }, + "userState": "접속 중", + "createdAt": "2023-06-14", + "skill": [ + { + "id": 47, + "name": "Python", + "img": "https://example.com/skills/python.png", + "createdAt": "2023-06-10" + }, + { + "id": 48, + "name": "AWS", + "img": "https://example.com/skills/aws.png", + "createdAt": "2023-09-02" + } + ], + "position": [ + { + "id": 39, + "name": "DevOps", + "createdAt": "2023-08-05" + } + ], + "reportedCount": 0 + }, + { + "id": 20, + "email": "user20@example.com", + "user": { + "id": 120, + "nickname": "tango", + "img": "https://example.com/avatars/tango.png" + }, + "userState": "오프라인", + "createdAt": "2024-05-30", + "skill": [ + { + "id": 49, + "name": "HTML", + "img": "https://example.com/skills/html.png", + "createdAt": "2023-05-01" + }, + { + "id": 50, + "name": "CSS", + "img": "https://example.com/skills/css.png", + "createdAt": "2023-03-22" + } + ], + "position": [ + { + "id": 40, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 1 + } + ] +} From c0ba886ee54b33ffb3e50f49bf308b13759b4ef4 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 19:41:44 +0900 Subject: [PATCH 06/19] =?UTF-8?q?feat=20:=20"=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=A1=B0=ED=9A=8C"=20=EB=AA=A8=EB=8D=B8?= =?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/models/auth.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/models/auth.ts b/src/models/auth.ts index 20e3f96e..419363fb 100644 --- a/src/models/auth.ts +++ b/src/models/auth.ts @@ -1,5 +1,6 @@ //model import { ApiCommonType, User } from './apiCommon'; +import { PositionTag, SkillTag } from './tags'; export interface VerifyEmail { email: string; @@ -28,13 +29,24 @@ export interface ApiOauth extends ApiCommonType { user: UserData; } -export interface ApiGetAllUsers extends ApiCommonType { +export interface ApiGetAllUsersPreview extends ApiCommonType { data: AllUserPreview[]; } +export interface ApiGetAllUsers extends ApiCommonType { + data: AllUser[]; +} + export interface AllUserPreview { id: number; email: string; user: User; + userState: '접속 중' | '오프라인' | '정지'; createdAt: string; } + +export interface AllUser extends AllUserPreview { + skill: SkillTag[]; + position: PositionTag[]; + reportedCount: number; +} From e82178e377a065f4b008221bc1fd0d5406dc4c90 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 19:42:19 +0900 Subject: [PATCH 07/19] =?UTF-8?q?feat=20:=20"=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=A1=B0=ED=9A=8C"=EC=9D=98=20=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=20=EC=B9=B4=EB=93=9C=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/auth.api.ts | 5 +- .../admin/userCard/UserCard.styled.ts | 59 +++++++++++++++++++ src/components/admin/userCard/UserCard.tsx | 47 +++++++++++++++ src/mock/userpage.ts | 3 +- 4 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 src/components/admin/userCard/UserCard.styled.ts create mode 100644 src/components/admin/userCard/UserCard.tsx diff --git a/src/api/auth.api.ts b/src/api/auth.api.ts index 566a890e..8c0c67dc 100644 --- a/src/api/auth.api.ts +++ b/src/api/auth.api.ts @@ -1,5 +1,6 @@ import { ApiGetAllUsers, + ApiGetAllUsersPreview, type ApiOauth, type ApiVerifyNickname, type VerifyEmail, @@ -108,7 +109,9 @@ export const getOauthLogin = async (oauthAccessToken: string) => { export const getAllUsersPreview = async () => { try { - const response = await httpClient.get(`/users/preview`); + const response = await httpClient.get( + `/users/preview` + ); return response.data.data; } catch (e) { console.error(e); diff --git a/src/components/admin/userCard/UserCard.styled.ts b/src/components/admin/userCard/UserCard.styled.ts new file mode 100644 index 00000000..5250bb29 --- /dev/null +++ b/src/components/admin/userCard/UserCard.styled.ts @@ -0,0 +1,59 @@ +import styled from 'styled-components'; + +export const Container = styled.div` + width: 240px; + display: flex; + flex-direction: column; + border: 1px solid #000000; + border-radius: ${({ theme }) => theme.borderRadius.primary}; + padding: 10px; +`; + +export const ProfileHeader = styled.div` + display: flex; + flex-direction: column; + align-items: center; +`; + +export const NickName = styled.p` + margin-top: 5px; +`; + +export const MainContentArea = styled.div` + padding: 15px; +`; + +export const TextLabel = styled.label` + display: inline-block; + font-size: 14px; + opacity: 0.3; + word-break: break-word; + white-space: pre-wrap; +`; + +export const TextContent = styled.p<{ + $userState?: '접속 중' | '오프라인' | '정지'; +}>` + font-size: 14px; + color: ${({ $userState }) => + $userState === '접속 중' + ? `#39E81E` + : $userState === '오프라인' + ? `#2560E8` + : $userState === '정지' + ? `#E8000C` + : `#000000`}; + margin-left: 15px; +`; + +export const SkillTagArea = styled.div` + display: flex; + gap: 4px; +`; + +export const SkillTag = styled.img` + width: 29px; + height: 29px; + border: 1px solid #ccc; + border-radius: 50%; +`; diff --git a/src/components/admin/userCard/UserCard.tsx b/src/components/admin/userCard/UserCard.tsx new file mode 100644 index 00000000..3150f4c1 --- /dev/null +++ b/src/components/admin/userCard/UserCard.tsx @@ -0,0 +1,47 @@ +import React from 'react'; +import * as S from './UserCard.styled'; +import Avatar from '../../common/avatar/Avatar'; +import { AllUser } from '../../../models/auth'; + +interface UserCardProps { + userData: AllUser; +} + +const UserCard = ({ userData }: UserCardProps) => { + return ( + + + + {userData.user.nickname} + + + 이메일 + {userData.email} + 포지션 + + {userData.position.map((position) => position.name).join(', ')} + + 회원 상태 + + {userData.userState} + + 경고 횟수 + + {userData.reportedCount === 0 + ? '없음' + : `${userData.reportedCount}번`} + + 계정 생성 날짜 + {userData.createdAt} + 대표 스킬 + + {userData.skill.map((skillTag) => ( + + ))} + + + + ); +}; + +export default UserCard; diff --git a/src/mock/userpage.ts b/src/mock/userpage.ts index b188ae18..94b9d8a9 100644 --- a/src/mock/userpage.ts +++ b/src/mock/userpage.ts @@ -2,6 +2,7 @@ import { http, HttpResponse } from 'msw'; import mockUserpageProfileData from './mockUserpageProfileData.json'; import mockUserpageAppliedProjectListData from './mockUserpageAppliedProjectListData.json'; import mockUsers from './mockUsers.json'; +import mockAllUsers from './mockAllUser.json'; export const userPageProfile = http.get( `${import.meta.env.VITE_APP_API_BASE_URL}user/:id`, @@ -31,6 +32,6 @@ export const userAllPreview = http.get( export const userAll = http.get( `${import.meta.env.VITE_APP_API_BASE_URL}users`, () => { - return HttpResponse.json(mockUsers, { status: 200 }); + return HttpResponse.json(mockAllUsers, { status: 200 }); } ); From bc1addd2b70903db130b858487935237dcdb904f Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:33:31 +0900 Subject: [PATCH 08/19] =?UTF-8?q?style=20:=20"=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=A1=B0=ED=9A=8C"=20=EC=B9=B4=EB=93=9C?= =?UTF-8?q?=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/admin/userCard/UserCard.styled.ts | 1 + src/components/admin/userCard/UserCard.tsx | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/admin/userCard/UserCard.styled.ts b/src/components/admin/userCard/UserCard.styled.ts index 5250bb29..9652fe31 100644 --- a/src/components/admin/userCard/UserCard.styled.ts +++ b/src/components/admin/userCard/UserCard.styled.ts @@ -49,6 +49,7 @@ export const TextContent = styled.p<{ export const SkillTagArea = styled.div` display: flex; gap: 4px; + margin-left: 15px; `; export const SkillTag = styled.img` diff --git a/src/components/admin/userCard/UserCard.tsx b/src/components/admin/userCard/UserCard.tsx index 3150f4c1..7c19444e 100644 --- a/src/components/admin/userCard/UserCard.tsx +++ b/src/components/admin/userCard/UserCard.tsx @@ -17,10 +17,6 @@ const UserCard = ({ userData }: UserCardProps) => { 이메일 {userData.email} - 포지션 - - {userData.position.map((position) => position.name).join(', ')} - 회원 상태 {userData.userState} @@ -31,14 +27,18 @@ const UserCard = ({ userData }: UserCardProps) => { ? '없음' : `${userData.reportedCount}번`} - 계정 생성 날짜 - {userData.createdAt} + 포지션 + + {userData.position.map((position) => position.name).join(', ')} + 대표 스킬 {userData.skill.map((skillTag) => ( ))} + 계정 생성 날짜 + {userData.createdAt} ); From 616fd08d106c7b927c240d675af67fcddb1e84c9 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:33:56 +0900 Subject: [PATCH 09/19] =?UTF-8?q?feat=20:=20=EA=B2=80=EC=83=89=20=EB=B0=8F?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=84=A4=EC=9D=B4=EC=85=98?= =?UTF-8?q?=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EB=AA=A8=EB=8D=B8=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/models/auth.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/models/auth.ts b/src/models/auth.ts index 419363fb..13efd9be 100644 --- a/src/models/auth.ts +++ b/src/models/auth.ts @@ -32,11 +32,6 @@ export interface ApiOauth extends ApiCommonType { export interface ApiGetAllUsersPreview extends ApiCommonType { data: AllUserPreview[]; } - -export interface ApiGetAllUsers extends ApiCommonType { - data: AllUser[]; -} - export interface AllUserPreview { id: number; email: string; @@ -45,8 +40,17 @@ export interface AllUserPreview { createdAt: string; } +export interface ApiGetAllUsers extends ApiCommonType { + data: AllUserList; +} + export interface AllUser extends AllUserPreview { skill: SkillTag[]; position: PositionTag[]; reportedCount: number; } + +export interface AllUserList { + allUsers: AllUser[]; + totalPages: number; +} From 9b8156f7f85046fed4fd8d6fc5114bdb8e9c4906 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:34:54 +0900 Subject: [PATCH 10/19] =?UTF-8?q?feat=20:=20SearchBar=EB=A5=BC=20=ED=86=B5?= =?UTF-8?q?=ED=95=B4=20=EA=B2=80=EC=83=89=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/auth.api.ts | 5 +- .../admin/searchBar/SearchBar.styled.ts | 40 ++++++++++ .../common/admin/searchBar/SearchBar.tsx | 75 +++++++++++++++++++ src/hooks/admin/useGetAllUsers.ts | 7 +- src/hooks/admin/useSearchBar.ts | 34 +++++++++ src/models/search.ts | 4 + 6 files changed, 160 insertions(+), 5 deletions(-) create mode 100644 src/components/common/admin/searchBar/SearchBar.styled.ts create mode 100644 src/components/common/admin/searchBar/SearchBar.tsx create mode 100644 src/hooks/admin/useSearchBar.ts create mode 100644 src/models/search.ts diff --git a/src/api/auth.api.ts b/src/api/auth.api.ts index 8c0c67dc..d31f3719 100644 --- a/src/api/auth.api.ts +++ b/src/api/auth.api.ts @@ -9,6 +9,7 @@ import { httpClient } from './http.api'; import { loginFormValues } from '../pages/login/Login'; import { registerFormValues } from '../pages/user/register/Register'; import { changePasswordFormValues } from '../pages/user/changePassword/ChangePassword'; +import { SearchType } from '../models/search'; export const postVerificationEmail = async (email: string) => { try { @@ -119,9 +120,9 @@ export const getAllUsersPreview = async () => { } }; -export const getAllUsers = async () => { +export const getAllUsers = async (params: SearchType) => { try { - const response = await httpClient.get(`/users`); + const response = await httpClient.get(`/users`, { params }); return response.data.data; } catch (e) { console.error(e); diff --git a/src/components/common/admin/searchBar/SearchBar.styled.ts b/src/components/common/admin/searchBar/SearchBar.styled.ts new file mode 100644 index 00000000..527ec672 --- /dev/null +++ b/src/components/common/admin/searchBar/SearchBar.styled.ts @@ -0,0 +1,40 @@ +import styled from 'styled-components'; + +export const AdminSearchBarContainer = styled.form` + width: 100%; + display: flex; + justify-content: center; + margin-bottom: 2rem; +`; + +export const AdminSearchBarWrapper = styled.div` + display: flex; + width: 70%; + justify-content: space-between; + padding: 0.5rem 0.5rem 0.5rem 1rem; + border: 1px solid ${({ theme }) => theme.color.deepGrey}; + border-radius: ${({ theme }) => theme.borderRadius.large} 0 0 + ${({ theme }) => theme.borderRadius.large}; +`; + +export const AdminSearchBarInput = styled.input` + width: 100%; + font-size: 1.3rem; +`; + +export const AdminSearchBarBackIcon = styled.button` + svg { + width: 1.5rem; + } +`; + +export const AdminSearchBarButton = styled.button` + width: 10%; + border: 1px solid ${({ theme }) => theme.color.navy}; + background: ${({ theme }) => theme.color.navy}; + border-radius: 0 ${({ theme }) => theme.borderRadius.large} + ${({ theme }) => theme.borderRadius.large} 0; + font-size: 1.3rem; + color: ${({ theme }) => theme.color.white}; + padding: 0.5rem 1rem 0.5rem 0.5rem; +`; diff --git a/src/components/common/admin/searchBar/SearchBar.tsx b/src/components/common/admin/searchBar/SearchBar.tsx new file mode 100644 index 00000000..5c38957c --- /dev/null +++ b/src/components/common/admin/searchBar/SearchBar.tsx @@ -0,0 +1,75 @@ +import { XMarkIcon } from '@heroicons/react/24/outline'; +import * as S from './SearchBar.styled'; +import { useState } from 'react'; +import { useSearchParams } from 'react-router-dom'; +import { useModal } from '../../../../hooks/useModal'; +import { MODAL_MESSAGE_CUSTOMER_SERVICE } from '../../../../constants/user/customerService'; +import Modal from '../../modal/Modal'; + +interface SearchBarProps { + onGetKeyword: (value: string) => void; + value: string; +} + +export default function SearchBar({ onGetKeyword, value }: SearchBarProps) { + const [keyword, setKeyword] = useState(''); + const { isOpen, message, handleModalOpen, handleModalClose } = useModal(); + const [searchParams, setSearchParams] = useSearchParams(); + + const handleKeyword = (inputValue: string) => { + const newSearchParams = new URLSearchParams(searchParams); + if (inputValue === '') { + newSearchParams.delete('keyword'); + } else { + newSearchParams.set('keyword', inputValue); + } + setSearchParams(newSearchParams); + }; + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + + if (keyword.trim() === '') { + return handleModalOpen(MODAL_MESSAGE_CUSTOMER_SERVICE.noKeyword); + } else { + onGetKeyword(keyword); + handleKeyword(keyword); + return; + } + }; + + const handleChangeKeyword = (e: React.ChangeEvent) => { + const value = e.target.value; + setKeyword(value); + }; + + const handleClickSearchDefault = () => { + setKeyword(''); + onGetKeyword(''); + handleKeyword(''); + }; + + return ( + + + + {value && ( + + + + )} + + 검색 + + {message} + + + ); +} diff --git a/src/hooks/admin/useGetAllUsers.ts b/src/hooks/admin/useGetAllUsers.ts index 769cfea7..14bd99d3 100644 --- a/src/hooks/admin/useGetAllUsers.ts +++ b/src/hooks/admin/useGetAllUsers.ts @@ -1,15 +1,16 @@ import { useQuery } from '@tanstack/react-query'; import { UserData } from '../queries/user/keys'; import { getAllUsers } from '../../api/auth.api'; +import { SearchType } from '../../models/search'; -export const useGetAllUsers = () => { +export const useGetAllUsers = (searchUnit: SearchType) => { const { data: allUserData, isLoading, isFetching, } = useQuery({ - queryKey: [UserData.allUser], - queryFn: () => getAllUsers(), + queryKey: [UserData.allUser, searchUnit.keyword, searchUnit.page], + queryFn: () => getAllUsers(searchUnit), }); return { allUserData, isLoading, isFetching }; diff --git a/src/hooks/admin/useSearchBar.ts b/src/hooks/admin/useSearchBar.ts new file mode 100644 index 00000000..e3fb9538 --- /dev/null +++ b/src/hooks/admin/useSearchBar.ts @@ -0,0 +1,34 @@ +import { useEffect, useState } from 'react'; +import { useSearchParams } from 'react-router-dom'; +import { SearchType } from '../../models/search'; + +const useSearchBar = () => { + const [searchUnit, setSearchUnit] = useState({ + keyword: '', + page: 1, + }); + const [value, setValue] = useState(''); + const [searchParams] = useSearchParams(); + + useEffect(() => { + const searchKeyword = searchParams.get('keyword'); + + if (searchKeyword) { + setSearchUnit((prev) => ({ ...prev, keyword: searchKeyword })); + setValue((prev) => (searchKeyword ? searchKeyword : prev)); + } + }, [searchParams]); + + const handleGetKeyword = (keyword: string) => { + setSearchUnit((prev) => ({ ...prev, keyword })); + setValue(keyword); + }; + + const handleChangePagination = (page: number) => { + setSearchUnit((prev) => ({ ...prev, page })); + }; + + return { searchUnit, value, handleGetKeyword, handleChangePagination }; +}; + +export default useSearchBar; diff --git a/src/models/search.ts b/src/models/search.ts new file mode 100644 index 00000000..db97ff2e --- /dev/null +++ b/src/models/search.ts @@ -0,0 +1,4 @@ +export interface SearchType { + keyword: string; + page: number; +} From 2c552dbb3856dbda2938556b99ca388a6a782c2e Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:35:08 +0900 Subject: [PATCH 11/19] =?UTF-8?q?feat=20:=20"=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=A1=B0=ED=9A=8C"=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/adminAllUser/AdminAllUser.styled.ts | 31 +++++++++++ src/pages/admin/adminAllUser/AdminAllUser.tsx | 53 +++++++++++++++++-- 2 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 src/pages/admin/adminAllUser/AdminAllUser.styled.ts diff --git a/src/pages/admin/adminAllUser/AdminAllUser.styled.ts b/src/pages/admin/adminAllUser/AdminAllUser.styled.ts new file mode 100644 index 00000000..ad33b6e4 --- /dev/null +++ b/src/pages/admin/adminAllUser/AdminAllUser.styled.ts @@ -0,0 +1,31 @@ +import styled from 'styled-components'; + +export const Container = styled.div``; + +export const SearchBar = styled.div` + margin-top: 20px; +`; + +export const ScrollArea = styled.div` + height: calc(100vh - 200px); + overflow-y: auto; + padding-bottom: 100px; + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background-color: #ccc; + border-radius: 4px; + } +`; + +export const UserContainer = styled.div` + display: grid; + grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); + gap: 10px; + padding: 20px; +`; + +export const PageNumber = styled.div``; diff --git a/src/pages/admin/adminAllUser/AdminAllUser.tsx b/src/pages/admin/adminAllUser/AdminAllUser.tsx index c2e5ee24..e8b80372 100644 --- a/src/pages/admin/adminAllUser/AdminAllUser.tsx +++ b/src/pages/admin/adminAllUser/AdminAllUser.tsx @@ -1,3 +1,50 @@ -export default function AdminAllUser() { - return
; -} +import * as S from './AdminAllUser.styled'; +import AdminTitle from '../../../components/common/admin/title/AdminTitle'; +import { useGetAllUsers } from '../../../hooks/admin/useGetAllUsers'; +import LoadingSpinner from '../../../components/common/loadingSpinner/LoadingSpinner'; +import UserCard from '../../../components/admin/userCard/UserCard'; +import ScrollPreventor from '../../../components/common/modal/ScrollPreventor'; +import SearchBar from '../../../components/common/admin/searchBar/SearchBar'; +import Pagination from '../../../components/common/pagination/Pagination'; +import useSearchBar from '../../../hooks/admin/useSearchBar'; + +const AdminAllUser = () => { + const { searchUnit, value, handleGetKeyword, handleChangePagination } = + useSearchBar(); + const { allUserData, isLoading, isFetching } = useGetAllUsers(searchUnit); + + if (isLoading || isFetching) { + return ; + } + + if (!allUserData || allUserData.allUsers.length === 0) { + return 결과가 존재하지 않습니다.; + } + + return ( + + + + + + + + + + + {allUserData.allUsers?.map((userData) => ( + + ))} + + + + + + ); +}; + +export default AdminAllUser; From 4af6e42dc2f3ecc188330b55648a32bd2a649133 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:36:08 +0900 Subject: [PATCH 12/19] =?UTF-8?q?feat=20:=20=EB=B3=80=EA=B2=BD=EB=90=9C=20?= =?UTF-8?q?API=EC=97=90=20=EB=A7=9E=EA=B2=8C=20mock=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mock/mockAllUser.json | 1271 ++++++++++++++++++------------------- 1 file changed, 627 insertions(+), 644 deletions(-) diff --git a/src/mock/mockAllUser.json b/src/mock/mockAllUser.json index 65ea15f2..f557fdd0 100644 --- a/src/mock/mockAllUser.json +++ b/src/mock/mockAllUser.json @@ -1,686 +1,669 @@ { "success": true, - "message": "지원서 조회 성공", - "data": [ - { - "id": 1, - "email": "user1@example.com", - "user": { - "id": 101, - "nickname": "alpha", - "img": "https://example.com/avatars/alpha.png" - }, - "userState": "접속 중", - "createdAt": "2023-12-01", - "skill": [ - { - "id": 11, - "name": "JavaScript", - "img": "https://example.com/skills/javascript.png", - "createdAt": "2023-01-10" - }, - { - "id": 12, - "name": "React", - "img": "https://example.com/skills/react.png", - "createdAt": "2023-02-15" - } - ], - "position": [ - { - "id": 21, - "name": "Frontend", - "createdAt": "2023-03-05" - }, - { - "id": 21, - "name": "Frontend", - "createdAt": "2023-03-05" - }, - { - "id": 21, - "name": "Frontend", - "createdAt": "2023-03-05" - }, - { - "id": 21, - "name": "Frontend", - "createdAt": "2023-03-05" + "message": "성공", + "data": { + "allUsers": [ + { + "id": 1, + "email": "user1@example.com", + "user": { + "id": 101, + "nickname": "alpha", + "img": "https://example.com/avatars/alpha.png" }, - { - "id": 21, - "name": "Frontend", - "createdAt": "2023-03-05" - } - ], - "reportedCount": 0 - }, - { - "id": 2, - "email": "user2@example.com", - "user": { - "id": 102, - "nickname": "bravo", - "img": "https://example.com/avatars/bravo.png" + "userState": "접속 중", + "createdAt": "2023-12-01", + "skill": [ + { + "id": 11, + "name": "JavaScript", + "img": "https://example.com/skills/javascript.png", + "createdAt": "2023-01-10" + }, + { + "id": 12, + "name": "React", + "img": "https://example.com/skills/react.png", + "createdAt": "2023-02-15" + } + ], + "position": [ + { + "id": 21, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 0 }, - "userState": "오프라인", - "createdAt": "2024-01-15", - "skill": [ - { - "id": 13, - "name": "TypeScript", - "img": "https://example.com/skills/typescript.png", - "createdAt": "2023-04-12" + { + "id": 2, + "email": "user2@example.com", + "user": { + "id": 102, + "nickname": "bravo", + "img": "https://example.com/avatars/bravo.png" }, - { - "id": 14, - "name": "HTML", - "img": "https://example.com/skills/html.png", - "createdAt": "2023-05-01" - } - ], - "position": [ - { - "id": 22, - "name": "Fullstack", - "createdAt": "2023-06-20" - } - ], - "reportedCount": 1 - }, - { - "id": 3, - "email": "user3@example.com", - "user": { - "id": 103, - "nickname": "charlie", - "img": "https://example.com/avatars/charlie.png" + "userState": "오프라인", + "createdAt": "2024-01-15", + "skill": [ + { + "id": 13, + "name": "TypeScript", + "img": "https://example.com/skills/typescript.png", + "createdAt": "2023-04-12" + }, + { + "id": 14, + "name": "HTML", + "img": "https://example.com/skills/html.png", + "createdAt": "2023-05-01" + } + ], + "position": [ + { + "id": 22, + "name": "Fullstack", + "createdAt": "2023-06-20" + } + ], + "reportedCount": 1 }, - "userState": "정지", - "createdAt": "2022-11-20", - "skill": [ - { - "id": 15, - "name": "CSS", - "img": "https://example.com/skills/css.png", - "createdAt": "2023-03-22" + { + "id": 3, + "email": "user3@example.com", + "user": { + "id": 103, + "nickname": "charlie", + "img": "https://example.com/avatars/charlie.png" }, - { - "id": 16, - "name": "Node.js", - "img": "https://example.com/skills/nodejs.png", - "createdAt": "2023-04-18" - } - ], - "position": [ - { - "id": 23, - "name": "Backend", - "createdAt": "2023-05-30" - } - ], - "reportedCount": 3 - }, - { - "id": 4, - "email": "user4@example.com", - "user": { - "id": 104, - "nickname": "delta", - "img": "https://example.com/avatars/delta.png" + "userState": "정지", + "createdAt": "2022-11-20", + "skill": [ + { + "id": 15, + "name": "CSS", + "img": "https://example.com/skills/css.png", + "createdAt": "2023-03-22" + }, + { + "id": 16, + "name": "Node.js", + "img": "https://example.com/skills/nodejs.png", + "createdAt": "2023-04-18" + } + ], + "position": [ + { + "id": 23, + "name": "Backend", + "createdAt": "2023-05-30" + } + ], + "reportedCount": 3 }, - "userState": "접속 중", - "createdAt": "2024-03-03", - "skill": [ - { - "id": 17, - "name": "Python", - "img": "https://example.com/skills/python.png", - "createdAt": "2023-06-10" + { + "id": 4, + "email": "user4@example.com", + "user": { + "id": 104, + "nickname": "delta", + "img": "https://example.com/avatars/delta.png" }, - { - "id": 18, - "name": "Docker", - "img": "https://example.com/skills/docker.png", - "createdAt": "2023-07-25" - } - ], - "position": [ - { - "id": 24, - "name": "DevOps", - "createdAt": "2023-08-05" - } - ], - "reportedCount": 0 - }, - { - "id": 5, - "email": "user5@example.com", - "user": { - "id": 105, - "nickname": "echo", - "img": "https://example.com/avatars/echo.png" + "userState": "접속 중", + "createdAt": "2024-03-03", + "skill": [ + { + "id": 17, + "name": "Python", + "img": "https://example.com/skills/python.png", + "createdAt": "2023-06-10" + }, + { + "id": 18, + "name": "Docker", + "img": "https://example.com/skills/docker.png", + "createdAt": "2023-07-25" + } + ], + "position": [ + { + "id": 24, + "name": "DevOps", + "createdAt": "2023-08-05" + } + ], + "reportedCount": 0 }, - "userState": "오프라인", - "createdAt": "2024-02-10", - "skill": [ - { - "id": 19, - "name": "AWS", - "img": "https://example.com/skills/aws.png", - "createdAt": "2023-09-02" + { + "id": 5, + "email": "user5@example.com", + "user": { + "id": 105, + "nickname": "echo", + "img": "https://example.com/avatars/echo.png" }, - { - "id": 20, - "name": "HTML", - "img": "https://example.com/skills/html.png", - "createdAt": "2023-05-01" - } - ], - "position": [ - { - "id": 25, - "name": "Fullstack", - "createdAt": "2023-10-12" - } - ], - "reportedCount": 2 - }, - { - "id": 6, - "email": "user6@example.com", - "user": { - "id": 106, - "nickname": "foxtrot", - "img": "https://example.com/avatars/foxtrot.png" + "userState": "오프라인", + "createdAt": "2024-02-10", + "skill": [ + { + "id": 19, + "name": "AWS", + "img": "https://example.com/skills/aws.png", + "createdAt": "2023-09-02" + }, + { + "id": 20, + "name": "HTML", + "img": "https://example.com/skills/html.png", + "createdAt": "2023-05-01" + } + ], + "position": [ + { + "id": 25, + "name": "Fullstack", + "createdAt": "2023-10-12" + } + ], + "reportedCount": 2 }, - "userState": "접속 중", - "createdAt": "2023-08-15", - "skill": [ - { - "id": 21, - "name": "JavaScript", - "img": "https://example.com/skills/javascript.png", - "createdAt": "2023-01-10" + { + "id": 6, + "email": "user6@example.com", + "user": { + "id": 106, + "nickname": "foxtrot", + "img": "https://example.com/avatars/foxtrot.png" }, - { - "id": 22, - "name": "React", - "img": "https://example.com/skills/react.png", - "createdAt": "2023-02-15" - } - ], - "position": [ - { - "id": 26, - "name": "Frontend", - "createdAt": "2023-03-05" - } - ], - "reportedCount": 0 - }, - { - "id": 7, - "email": "user7@example.com", - "user": { - "id": 107, - "nickname": "golf", - "img": "https://example.com/avatars/golf.png" + "userState": "정지", + "createdAt": "2023-08-15T21:30:00Z", + "skill": [ + { + "id": 21, + "name": "JavaScript", + "img": "https://example.com/skills/javascript.png", + "createdAt": "2023-01-10" + }, + { + "id": 22, + "name": "React", + "img": "https://example.com/skills/react.png", + "createdAt": "2023-02-15" + } + ], + "position": [ + { + "id": 26, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 0 }, - "userState": "오프라인", - "createdAt": "2024-05-01", - "skill": [ - { - "id": 23, - "name": "TypeScript", - "img": "https://example.com/skills/typescript.png", - "createdAt": "2023-04-12" + { + "id": 7, + "email": "user7@example.com", + "user": { + "id": 107, + "nickname": "golf", + "img": "https://example.com/avatars/golf.png" }, - { - "id": 24, - "name": "CSS", - "img": "https://example.com/skills/css.png", - "createdAt": "2023-03-22" - } - ], - "position": [ - { - "id": 27, - "name": "Frontend", - "createdAt": "2023-03-05" - } - ], - "reportedCount": 4 - }, - { - "id": 8, - "email": "user8@example.com", - "user": { - "id": 108, - "nickname": "hotel", - "img": "https://example.com/avatars/hotel.png" + "userState": "접속 중", + "createdAt": "2024-05-01", + "skill": [ + { + "id": 23, + "name": "TypeScript", + "img": "https://example.com/skills/typescript.png", + "createdAt": "2023-04-12" + }, + { + "id": 24, + "name": "CSS", + "img": "https://example.com/skills/css.png", + "createdAt": "2023-03-22" + } + ], + "position": [ + { + "id": 27, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 4 }, - "userState": "정지", - "createdAt": "2023-09-10", - "skill": [ - { - "id": 25, - "name": "Node.js", - "img": "https://example.com/skills/nodejs.png", - "createdAt": "2023-04-18" + { + "id": 8, + "email": "user8@example.com", + "user": { + "id": 108, + "nickname": "hotel", + "img": "https://example.com/avatars/hotel.png" }, - { - "id": 26, - "name": "Docker", - "img": "https://example.com/skills/docker.png", - "createdAt": "2023-07-25" - } - ], - "position": [ - { - "id": 28, - "name": "Backend", - "createdAt": "2023-05-30" - } - ], - "reportedCount": 5 - }, - { - "id": 9, - "email": "user9@example.com", - "user": { - "id": 109, - "nickname": "india", - "img": "https://example.com/avatars/india.png" + "userState": "오프라인", + "createdAt": "2023-09-10", + "skill": [ + { + "id": 25, + "name": "Node.js", + "img": "https://example.com/skills/nodejs.png", + "createdAt": "2023-04-18" + }, + { + "id": 26, + "name": "Docker", + "img": "https://example.com/skills/docker.png", + "createdAt": "2023-07-25" + } + ], + "position": [ + { + "id": 28, + "name": "Backend", + "createdAt": "2023-05-30" + } + ], + "reportedCount": 5 }, - "userState": "접속 중", - "createdAt": "2024-04-20", - "skill": [ - { - "id": 27, - "name": "Python", - "img": "https://example.com/skills/python.png", - "createdAt": "2023-06-10" + { + "id": 9, + "email": "user9@example.com", + "user": { + "id": 109, + "nickname": "india", + "img": "https://example.com/avatars/india.png" }, - { - "id": 28, - "name": "AWS", - "img": "https://example.com/skills/aws.png", - "createdAt": "2023-09-02" - } - ], - "position": [ - { - "id": 29, - "name": "DevOps", - "createdAt": "2023-08-05" - } - ], - "reportedCount": 0 - }, - { - "id": 10, - "email": "user10@example.com", - "user": { - "id": 110, - "nickname": "juliet", - "img": "https://example.com/avatars/juliet.png" + "userState": "정지", + "createdAt": "2024-04-20", + "skill": [ + { + "id": 27, + "name": "Python", + "img": "https://example.com/skills/python.png", + "createdAt": "2023-06-10" + }, + { + "id": 28, + "name": "AWS", + "img": "https://example.com/skills/aws.png", + "createdAt": "2023-09-02" + } + ], + "position": [ + { + "id": 29, + "name": "DevOps", + "createdAt": "2023-08-05" + } + ], + "reportedCount": 0 }, - "userState": "오프라인", - "createdAt": "2022-12-25", - "skill": [ - { - "id": 29, - "name": "HTML", - "img": "https://example.com/skills/html.png", - "createdAt": "2023-05-01" + { + "id": 10, + "email": "user10@example.com", + "user": { + "id": 110, + "nickname": "juliet", + "img": "https://example.com/avatars/juliet.png" }, - { - "id": 30, - "name": "CSS", - "img": "https://example.com/skills/css.png", - "createdAt": "2023-03-22" - } - ], - "position": [ - { - "id": 30, - "name": "Frontend", - "createdAt": "2023-03-05" - } - ], - "reportedCount": 2 - }, - { - "id": 11, - "email": "user11@example.com", - "user": { - "id": 111, - "nickname": "kilo", - "img": "https://example.com/avatars/kilo.png" + "userState": "접속 중", + "createdAt": "2022-12-25", + "skill": [ + { + "id": 29, + "name": "HTML", + "img": "https://example.com/skills/html.png", + "createdAt": "2023-05-01" + }, + { + "id": 30, + "name": "CSS", + "img": "https://example.com/skills/css.png", + "createdAt": "2023-03-22" + } + ], + "position": [ + { + "id": 30, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 2 }, - "userState": "접속 중", - "createdAt": "2024-06-02", - "skill": [ - { - "id": 31, - "name": "JavaScript", - "img": "https://example.com/skills/javascript.png", - "createdAt": "2023-01-10" + { + "id": 11, + "email": "user11@example.com", + "user": { + "id": 111, + "nickname": "kilo", + "img": "https://example.com/avatars/kilo.png" }, - { - "id": 32, - "name": "React", - "img": "https://example.com/skills/react.png", - "createdAt": "2023-02-15" - } - ], - "position": [ - { - "id": 31, - "name": "Fullstack", - "createdAt": "2023-06-20" - } - ], - "reportedCount": 1 - }, - { - "id": 12, - "email": "user12@example.com", - "user": { - "id": 112, - "nickname": "lima", - "img": "https://example.com/avatars/lima.png" + "userState": "오프라인", + "createdAt": "2024-06-02", + "skill": [ + { + "id": 31, + "name": "JavaScript", + "img": "https://example.com/skills/javascript.png", + "createdAt": "2023-01-10" + }, + { + "id": 32, + "name": "React", + "img": "https://example.com/skills/react.png", + "createdAt": "2023-02-15" + } + ], + "position": [ + { + "id": 31, + "name": "Fullstack", + "createdAt": "2023-06-20" + } + ], + "reportedCount": 1 }, - "userState": "오프라인", - "createdAt": "2023-07-18", - "skill": [ - { - "id": 33, - "name": "TypeScript", - "img": "https://example.com/skills/typescript.png", - "createdAt": "2023-04-12" + { + "id": 12, + "email": "user12@example.com", + "user": { + "id": 112, + "nickname": "lima", + "img": "https://example.com/avatars/lima.png" }, - { - "id": 34, - "name": "Node.js", - "img": "https://example.com/skills/nodejs.png", - "createdAt": "2023-04-18" - } - ], - "position": [ - { - "id": 32, - "name": "Backend", - "createdAt": "2023-05-30" - } - ], - "reportedCount": 0 - }, - { - "id": 13, - "email": "user13@example.com", - "user": { - "id": 113, - "nickname": "mike", - "img": "https://example.com/avatars/mike.png" + "userState": "정지", + "createdAt": "2023-07-18", + "skill": [ + { + "id": 33, + "name": "TypeScript", + "img": "https://example.com/skills/typescript.png", + "createdAt": "2023-04-12" + }, + { + "id": 34, + "name": "Node.js", + "img": "https://example.com/skills/nodejs.png", + "createdAt": "2023-04-18" + } + ], + "position": [ + { + "id": 32, + "name": "Backend", + "createdAt": "2023-05-30" + } + ], + "reportedCount": 0 }, - "userState": "정지", - "createdAt": "2024-02-28", - "skill": [ - { - "id": 35, - "name": "Docker", - "img": "https://example.com/skills/docker.png", - "createdAt": "2023-07-25" + { + "id": 13, + "email": "user13@example.com", + "user": { + "id": 113, + "nickname": "mike", + "img": "https://example.com/avatars/mike.png" }, - { - "id": 36, - "name": "AWS", - "img": "https://example.com/skills/aws.png", - "createdAt": "2023-09-02" - } - ], - "position": [ - { - "id": 33, - "name": "DevOps", - "createdAt": "2023-08-05" - } - ], - "reportedCount": 4 - }, - { - "id": 14, - "email": "user14@example.com", - "user": { - "id": 114, - "nickname": "november", - "img": "https://example.com/avatars/november.png" + "userState": "접속 중", + "createdAt": "2024-02-28T20:15:00Z", + "skill": [ + { + "id": 35, + "name": "Docker", + "img": "https://example.com/skills/docker.png", + "createdAt": "2023-07-25" + }, + { + "id": 36, + "name": "AWS", + "img": "https://example.com/skills/aws.png", + "createdAt": "2023-09-02" + } + ], + "position": [ + { + "id": 33, + "name": "DevOps", + "createdAt": "2023-08-05" + } + ], + "reportedCount": 4 }, - "userState": "접속 중", - "createdAt": "2023-10-05", - "skill": [ - { - "id": 37, - "name": "HTML", - "img": "https://example.com/skills/html.png", - "createdAt": "2023-05-01" + { + "id": 14, + "email": "user14@example.com", + "user": { + "id": 114, + "nickname": "november", + "img": "https://example.com/avatars/november.png" }, - { - "id": 38, - "name": "CSS", - "img": "https://example.com/skills/css.png", - "createdAt": "2023-03-22" - } - ], - "position": [ - { - "id": 34, - "name": "Frontend", - "createdAt": "2023-03-05" - } - ], - "reportedCount": 1 - }, - { - "id": 15, - "email": "user15@example.com", - "user": { - "id": 115, - "nickname": "oscar", - "img": "https://example.com/avatars/oscar.png" + "userState": "오프라인", + "createdAt": "2023-10-05", + "skill": [ + { + "id": 37, + "name": "HTML", + "img": "https://example.com/skills/html.png", + "createdAt": "2023-05-01" + }, + { + "id": 38, + "name": "CSS", + "img": "https://example.com/skills/css.png", + "createdAt": "2023-03-22" + } + ], + "position": [ + { + "id": 34, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 1 }, - "userState": "오프라인", - "createdAt": "2024-03-22", - "skill": [ - { - "id": 39, - "name": "JavaScript", - "img": "https://example.com/skills/javascript.png", - "createdAt": "2023-01-10" + { + "id": 15, + "email": "user15@example.com", + "user": { + "id": 115, + "nickname": "oscar", + "img": "https://example.com/avatars/oscar.png" }, - { - "id": 40, - "name": "React", - "img": "https://example.com/skills/react.png", - "createdAt": "2023-02-15" - } - ], - "position": [ - { - "id": 35, - "name": "Fullstack", - "createdAt": "2023-06-20" - } - ], - "reportedCount": 2 - }, - { - "id": 16, - "email": "user16@example.com", - "user": { - "id": 116, - "nickname": "papa", - "img": "https://example.com/avatars/papa.png" + "userState": "정지", + "createdAt": "2024-03-22", + "skill": [ + { + "id": 39, + "name": "JavaScript", + "img": "https://example.com/skills/javascript.png", + "createdAt": "2023-01-10" + }, + { + "id": 40, + "name": "React", + "img": "https://example.com/skills/react.png", + "createdAt": "2023-02-15" + } + ], + "position": [ + { + "id": 35, + "name": "Fullstack", + "createdAt": "2023-06-20" + } + ], + "reportedCount": 2 }, - "userState": "접속 중", - "createdAt": "2023-11-11", - "skill": [ - { - "id": 41, - "name": "TypeScript", - "img": "https://example.com/skills/typescript.png", - "createdAt": "2023-04-12" + { + "id": 16, + "email": "user16@example.com", + "user": { + "id": 116, + "nickname": "papa", + "img": "https://example.com/avatars/papa.png" }, - { - "id": 42, - "name": "Node.js", - "img": "https://example.com/skills/nodejs.png", - "createdAt": "2023-04-18" - } - ], - "position": [ - { - "id": 36, - "name": "Backend", - "createdAt": "2023-05-30" - } - ], - "reportedCount": 0 - }, - { - "id": 17, - "email": "user17@example.com", - "user": { - "id": 117, - "nickname": "quebec", - "img": "https://example.com/avatars/quebec.png" + "userState": "접속 중", + "createdAt": "2023-11-11", + "skill": [ + { + "id": 41, + "name": "TypeScript", + "img": "https://example.com/skills/typescript.png", + "createdAt": "2023-04-12" + }, + { + "id": 42, + "name": "Node.js", + "img": "https://example.com/skills/nodejs.png", + "createdAt": "2023-04-18" + } + ], + "position": [ + { + "id": 36, + "name": "Backend", + "createdAt": "2023-05-30" + } + ], + "reportedCount": 0 }, - "userState": "오프라인", - "createdAt": "2023-08-30", - "skill": [ - { - "id": 43, - "name": "Docker", - "img": "https://example.com/skills/docker.png", - "createdAt": "2023-07-25" + { + "id": 17, + "email": "user17@example.com", + "user": { + "id": 117, + "nickname": "quebec", + "img": "https://example.com/avatars/quebec.png" }, - { - "id": 44, - "name": "AWS", - "img": "https://example.com/skills/aws.png", - "createdAt": "2023-09-02" - } - ], - "position": [ - { - "id": 37, - "name": "DevOps", - "createdAt": "2023-08-05" - } - ], - "reportedCount": 3 - }, - { - "id": 18, - "email": "user18@example.com", - "user": { - "id": 118, - "nickname": "romeo", - "img": "https://example.com/avatars/romeo.png" + "userState": "오프라인", + "createdAt": "2023-08-30", + "skill": [ + { + "id": 43, + "name": "Docker", + "img": "https://example.com/skills/docker.png", + "createdAt": "2023-07-25" + }, + { + "id": 44, + "name": "AWS", + "img": "https://example.com/skills/aws.png", + "createdAt": "2023-09-02" + } + ], + "position": [ + { + "id": 37, + "name": "DevOps", + "createdAt": "2023-08-05" + } + ], + "reportedCount": 3 }, - "userState": "정지", - "createdAt": "2022-10-10", - "skill": [ - { - "id": 45, - "name": "JavaScript", - "img": "https://example.com/skills/javascript.png", - "createdAt": "2023-01-10" + { + "id": 18, + "email": "user18@example.com", + "user": { + "id": 118, + "nickname": "romeo", + "img": "https://example.com/avatars/romeo.png" }, - { - "id": 46, - "name": "React", - "img": "https://example.com/skills/react.png", - "createdAt": "2023-02-15" - } - ], - "position": [ - { - "id": 38, - "name": "Frontend", - "createdAt": "2023-03-05" - } - ], - "reportedCount": 5 - }, - { - "id": 19, - "email": "user19@example.com", - "user": { - "id": 119, - "nickname": "sierra", - "img": "https://example.com/avatars/sierra.png" + "userState": "정지", + "createdAt": "2022-10-10", + "skill": [ + { + "id": 45, + "name": "JavaScript", + "img": "https://example.com/skills/javascript.png", + "createdAt": "2023-01-10" + }, + { + "id": 46, + "name": "React", + "img": "https://example.com/skills/react.png", + "createdAt": "2023-02-15" + } + ], + "position": [ + { + "id": 38, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 5 }, - "userState": "접속 중", - "createdAt": "2023-06-14", - "skill": [ - { - "id": 47, - "name": "Python", - "img": "https://example.com/skills/python.png", - "createdAt": "2023-06-10" + { + "id": 19, + "email": "user19@example.com", + "user": { + "id": 119, + "nickname": "sierra", + "img": "https://example.com/avatars/sierra.png" }, - { - "id": 48, - "name": "AWS", - "img": "https://example.com/skills/aws.png", - "createdAt": "2023-09-02" - } - ], - "position": [ - { - "id": 39, - "name": "DevOps", - "createdAt": "2023-08-05" - } - ], - "reportedCount": 0 - }, - { - "id": 20, - "email": "user20@example.com", - "user": { - "id": 120, - "nickname": "tango", - "img": "https://example.com/avatars/tango.png" + "userState": "접속 중", + "createdAt": "2023-06-14", + "skill": [ + { + "id": 47, + "name": "Python", + "img": "https://example.com/skills/python.png", + "createdAt": "2023-06-10" + }, + { + "id": 48, + "name": "AWS", + "img": "https://example.com/skills/aws.png", + "createdAt": "2023-09-02" + } + ], + "position": [ + { + "id": 39, + "name": "DevOps", + "createdAt": "2023-08-05" + } + ], + "reportedCount": 0 }, - "userState": "오프라인", - "createdAt": "2024-05-30", - "skill": [ - { - "id": 49, - "name": "HTML", - "img": "https://example.com/skills/html.png", - "createdAt": "2023-05-01" + { + "id": 20, + "email": "user20@example.com", + "user": { + "id": 120, + "nickname": "tango", + "img": "https://example.com/avatars/tango.png" }, - { - "id": 50, - "name": "CSS", - "img": "https://example.com/skills/css.png", - "createdAt": "2023-03-22" - } - ], - "position": [ - { - "id": 40, - "name": "Frontend", - "createdAt": "2023-03-05" - } - ], - "reportedCount": 1 - } - ] + "userState": "오프라인", + "createdAt": "2024-05-30", + "skill": [ + { + "id": 49, + "name": "HTML", + "img": "https://example.com/skills/html.png", + "createdAt": "2023-05-01" + }, + { + "id": 50, + "name": "CSS", + "img": "https://example.com/skills/css.png", + "createdAt": "2023-03-22" + } + ], + "position": [ + { + "id": 40, + "name": "Frontend", + "createdAt": "2023-03-05" + } + ], + "reportedCount": 1 + } + ], + "totalPages": 2 + } } From e2781b413a3072a6a107042fe13ed6e6225ddd84 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Thu, 5 Jun 2025 17:06:25 +0900 Subject: [PATCH 13/19] =?UTF-8?q?feat=20:=20=EB=A6=AC=EB=B7=B0=20=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/auth.api.ts | 2 +- src/components/admin/userCard/UserCard.tsx | 4 ++-- src/constants/admin/adminModal.ts | 1 + src/hooks/admin/useGetAllUsers.ts | 2 +- src/hooks/admin/useSearchBar.ts | 4 ++-- src/mock/mockAllUser.json | 4 ++-- src/models/auth.ts | 14 +++++++++++++- .../admin/adminAllUser/AdminAllUser.styled.ts | 2 -- src/pages/admin/adminAllUser/AdminAllUser.tsx | 7 ++++--- 9 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/api/auth.api.ts b/src/api/auth.api.ts index d31f3719..6a236128 100644 --- a/src/api/auth.api.ts +++ b/src/api/auth.api.ts @@ -9,7 +9,7 @@ import { httpClient } from './http.api'; import { loginFormValues } from '../pages/login/Login'; import { registerFormValues } from '../pages/user/register/Register'; import { changePasswordFormValues } from '../pages/user/changePassword/ChangePassword'; -import { SearchType } from '../models/search'; +import { type SearchType } from '../models/search'; export const postVerificationEmail = async (email: string) => { try { diff --git a/src/components/admin/userCard/UserCard.tsx b/src/components/admin/userCard/UserCard.tsx index 7c19444e..27bf9b5b 100644 --- a/src/components/admin/userCard/UserCard.tsx +++ b/src/components/admin/userCard/UserCard.tsx @@ -1,7 +1,7 @@ import React from 'react'; import * as S from './UserCard.styled'; import Avatar from '../../common/avatar/Avatar'; -import { AllUser } from '../../../models/auth'; +import { type AllUser } from '../../../models/auth'; interface UserCardProps { userData: AllUser; @@ -34,7 +34,7 @@ const UserCard = ({ userData }: UserCardProps) => { 대표 스킬 {userData.skill.map((skillTag) => ( - + ))} 계정 생성 날짜 diff --git a/src/constants/admin/adminModal.ts b/src/constants/admin/adminModal.ts index a4f8082f..e1c88bf8 100644 --- a/src/constants/admin/adminModal.ts +++ b/src/constants/admin/adminModal.ts @@ -4,4 +4,5 @@ export const ADMIN_MODAL_MESSAGE = { writeDeleteSuccess: '삭제되었습니다.', writeDeleteFail: '삭제가 실패하였습니다.', writeError: '알수없는 에러가 발생했습니다.', + NO_RESULT: '결과가 존재하지 않습니다.', }; diff --git a/src/hooks/admin/useGetAllUsers.ts b/src/hooks/admin/useGetAllUsers.ts index 14bd99d3..243fffea 100644 --- a/src/hooks/admin/useGetAllUsers.ts +++ b/src/hooks/admin/useGetAllUsers.ts @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/react-query'; import { UserData } from '../queries/user/keys'; import { getAllUsers } from '../../api/auth.api'; -import { SearchType } from '../../models/search'; +import type { SearchType } from '../../models/search'; export const useGetAllUsers = (searchUnit: SearchType) => { const { diff --git a/src/hooks/admin/useSearchBar.ts b/src/hooks/admin/useSearchBar.ts index e3fb9538..27aaf097 100644 --- a/src/hooks/admin/useSearchBar.ts +++ b/src/hooks/admin/useSearchBar.ts @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; -import { SearchType } from '../../models/search'; +import type { SearchType } from '../../models/search'; const useSearchBar = () => { const [searchUnit, setSearchUnit] = useState({ @@ -20,7 +20,7 @@ const useSearchBar = () => { }, [searchParams]); const handleGetKeyword = (keyword: string) => { - setSearchUnit((prev) => ({ ...prev, keyword })); + setSearchUnit((prev) => ({ ...prev, keyword, page: 1 })); setValue(keyword); }; diff --git a/src/mock/mockAllUser.json b/src/mock/mockAllUser.json index f557fdd0..0c7a4aa6 100644 --- a/src/mock/mockAllUser.json +++ b/src/mock/mockAllUser.json @@ -177,7 +177,7 @@ "img": "https://example.com/avatars/foxtrot.png" }, "userState": "정지", - "createdAt": "2023-08-15T21:30:00Z", + "createdAt": "2023-08-15", "skill": [ { "id": 21, @@ -408,7 +408,7 @@ "img": "https://example.com/avatars/mike.png" }, "userState": "접속 중", - "createdAt": "2024-02-28T20:15:00Z", + "createdAt": "2024-02-28", "skill": [ { "id": 35, diff --git a/src/models/auth.ts b/src/models/auth.ts index ef7fcc73..6069ffad 100644 --- a/src/models/auth.ts +++ b/src/models/auth.ts @@ -1,6 +1,18 @@ import { PositionTag, SkillTag } from './tags'; import { type ApiCommonType, type User } from './apiCommon'; +export enum UserState { + ONLINE = 'ONLINE', + OFFLINE = 'OFFLINE', + SUSPENDED = 'SUSPENDED', +} + +export const USER_STATE_LABELS = { + [UserState.ONLINE]: '접속 중', + [UserState.OFFLINE]: '오프라인', + [UserState.SUSPENDED]: '정지', +} as const; + export interface VerifyEmail { email: string; code: string; @@ -35,7 +47,7 @@ export interface AllUserPreview { id: number; email: string; user: User; - userState: '접속 중' | '오프라인' | '정지'; + userState: UserState; createdAt: string; } diff --git a/src/pages/admin/adminAllUser/AdminAllUser.styled.ts b/src/pages/admin/adminAllUser/AdminAllUser.styled.ts index ad33b6e4..74b4443f 100644 --- a/src/pages/admin/adminAllUser/AdminAllUser.styled.ts +++ b/src/pages/admin/adminAllUser/AdminAllUser.styled.ts @@ -27,5 +27,3 @@ export const UserContainer = styled.div` gap: 10px; padding: 20px; `; - -export const PageNumber = styled.div``; diff --git a/src/pages/admin/adminAllUser/AdminAllUser.tsx b/src/pages/admin/adminAllUser/AdminAllUser.tsx index e8b80372..2a051432 100644 --- a/src/pages/admin/adminAllUser/AdminAllUser.tsx +++ b/src/pages/admin/adminAllUser/AdminAllUser.tsx @@ -7,9 +7,10 @@ import ScrollPreventor from '../../../components/common/modal/ScrollPreventor'; import SearchBar from '../../../components/common/admin/searchBar/SearchBar'; import Pagination from '../../../components/common/pagination/Pagination'; import useSearchBar from '../../../hooks/admin/useSearchBar'; +import { ADMIN_MODAL_MESSAGE } from '../../../constants/admin/adminModal'; const AdminAllUser = () => { - const { searchUnit, value, handleGetKeyword, handleChangePagination } = + const { searchUnit, handleGetKeyword, handleChangePagination } = useSearchBar(); const { allUserData, isLoading, isFetching } = useGetAllUsers(searchUnit); @@ -18,7 +19,7 @@ const AdminAllUser = () => { } if (!allUserData || allUserData.allUsers.length === 0) { - return 결과가 존재하지 않습니다.; + return {ADMIN_MODAL_MESSAGE.NO_RESULT}; } return ( @@ -27,7 +28,7 @@ const AdminAllUser = () => { - + From 8a6b4dc1498fad2825dd5c72526fb7f5f03608c7 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Thu, 5 Jun 2025 17:08:24 +0900 Subject: [PATCH 14/19] =?UTF-8?q?feat=20:=20=EC=83=89=EC=97=90=20theme=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/mainCard/MainCard.styled.ts | 2 +- .../inquiresPreview/InquiresPreview.styled.ts | 3 ++- .../reportsPreview/ReportsPreview.styled.ts | 3 ++- .../admin/userCard/UserCard.styled.ts | 23 ++++++++++--------- src/style/theme.ts | 4 +++- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/components/admin/mainCard/MainCard.styled.ts b/src/components/admin/mainCard/MainCard.styled.ts index 44e6d803..99bad462 100644 --- a/src/components/admin/mainCard/MainCard.styled.ts +++ b/src/components/admin/mainCard/MainCard.styled.ts @@ -4,7 +4,7 @@ import styled from 'styled-components'; export const Container = styled.div` display: flex; flex-direction: column; - border: 1px solid #ccc; + border: 1px solid ${({ theme }) => theme.color.grey}; border-radius: ${({ theme }) => theme.borderRadius.primary}; `; diff --git a/src/components/admin/previewComponent/inquiresPreview/InquiresPreview.styled.ts b/src/components/admin/previewComponent/inquiresPreview/InquiresPreview.styled.ts index 0fa5c181..216304c5 100644 --- a/src/components/admin/previewComponent/inquiresPreview/InquiresPreview.styled.ts +++ b/src/components/admin/previewComponent/inquiresPreview/InquiresPreview.styled.ts @@ -51,7 +51,8 @@ export const Divider = styled.p` export const InquiryState = styled.p<{ $isCompleted: boolean }>` font-size: 9px; - color: ${({ $isCompleted }) => ($isCompleted ? `#07DE00` : `#DE1A00`)}; + color: ${({ theme, $isCompleted }) => + $isCompleted ? theme.color.green : theme.color.red}; `; export const MoveToInquiryArea = styled(Link)` diff --git a/src/components/admin/previewComponent/reportsPreview/ReportsPreview.styled.ts b/src/components/admin/previewComponent/reportsPreview/ReportsPreview.styled.ts index e68b6d9f..5ae6b91a 100644 --- a/src/components/admin/previewComponent/reportsPreview/ReportsPreview.styled.ts +++ b/src/components/admin/previewComponent/reportsPreview/ReportsPreview.styled.ts @@ -51,7 +51,8 @@ export const Divider = styled.p` export const IsDone = styled.p<{ $isDone: boolean }>` font-size: 9px; - color: ${({ $isDone }) => ($isDone ? `#07DE00` : `#DE1A00`)}; + color: ${({ theme, $isDone }) => + $isDone ? theme.color.green : theme.color.red}; `; export const MoveToReportsArea = styled(Link)` diff --git a/src/components/admin/userCard/UserCard.styled.ts b/src/components/admin/userCard/UserCard.styled.ts index 9652fe31..1b973477 100644 --- a/src/components/admin/userCard/UserCard.styled.ts +++ b/src/components/admin/userCard/UserCard.styled.ts @@ -1,10 +1,11 @@ import styled from 'styled-components'; +import { UserState } from '../../../models/auth'; export const Container = styled.div` width: 240px; display: flex; flex-direction: column; - border: 1px solid #000000; + border: 1px solid ${({ theme }) => theme.color.white}; border-radius: ${({ theme }) => theme.borderRadius.primary}; padding: 10px; `; @@ -32,17 +33,17 @@ export const TextLabel = styled.label` `; export const TextContent = styled.p<{ - $userState?: '접속 중' | '오프라인' | '정지'; + $userState?: UserState; }>` font-size: 14px; - color: ${({ $userState }) => - $userState === '접속 중' - ? `#39E81E` - : $userState === '오프라인' - ? `#2560E8` - : $userState === '정지' - ? `#E8000C` - : `#000000`}; + color: ${({ theme, $userState }) => + $userState === UserState.ONLINE + ? theme.color.green + : $userState === UserState.OFFLINE + ? theme.color.blue + : $userState === UserState.SUSPENDED + ? theme.color.red + : theme.color.white}; margin-left: 15px; `; @@ -55,6 +56,6 @@ export const SkillTagArea = styled.div` export const SkillTag = styled.img` width: 29px; height: 29px; - border: 1px solid #ccc; + border: 1px solid ${({ theme }) => theme.color.grey}; border-radius: 50%; `; diff --git a/src/style/theme.ts b/src/style/theme.ts index 32ac3e58..73c0e363 100644 --- a/src/style/theme.ts +++ b/src/style/theme.ts @@ -10,7 +10,8 @@ export type ColorKey = | 'green' | 'navy' | 'lightnavy' - | 'warn'; + | 'warn' + | 'blue'; export type HeadingSize = | 'large' @@ -78,6 +79,7 @@ export const defaultTheme: Theme = { navy: '#213555', lightnavy: '#92bbf0', warn: '#EC1E4F', + blue: '#2560E8', }, heading: { large: { fontSize: '1.75rem', tabletFontSize: '1.5rem' }, From 76912bd88cd64aae53f0dd32b8ea0d447ed35f00 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Thu, 5 Jun 2025 17:08:52 +0900 Subject: [PATCH 15/19] =?UTF-8?q?refactor=20:=20searchBar=EC=9D=98=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EB=B0=8F=20=EC=BD=94=EB=93=9C=20hook?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/adminNotice/AdminNoticeList.tsx | 35 ++++--------------- .../common/admin/searchBar/SearchBar.tsx | 3 +- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/src/components/admin/adminNotice/AdminNoticeList.tsx b/src/components/admin/adminNotice/AdminNoticeList.tsx index 3bb10740..30012924 100644 --- a/src/components/admin/adminNotice/AdminNoticeList.tsx +++ b/src/components/admin/adminNotice/AdminNoticeList.tsx @@ -1,38 +1,15 @@ -import { useEffect, useState } from 'react'; import SearchBar from '../../../components/common/admin/searchBar/SearchBar'; import * as S from './AdminNoticeList.styled'; -import type { NoticeSearch } from '../../../models/customerService'; import { useGetNotice } from '../../../hooks/user/useGetNotice'; -import { useSearchParams } from 'react-router-dom'; import Pagination from '../../../components/common/pagination/Pagination'; import Spinner from '../../../components/user/mypage/Spinner'; import NoticeItem from '../../../pages/user/customerService/notice/noticeItem/NoticeItem'; +import useSearchBar from '../../../hooks/admin/useSearchBar'; export default function AdminNoticeList() { - const [noticeSearch, setNoticeSearch] = useState({ - keyword: '', - page: 1, - }); - const [value, setValue] = useState(''); - const { noticeData, isLoading } = useGetNotice(noticeSearch); - const [searchParams] = useSearchParams(); - - useEffect(() => { - const searchKeyword = searchParams.get('keyword'); - - if (searchKeyword) { - setNoticeSearch((prev) => ({ ...prev, keyword: searchKeyword })); - setValue((prev) => (searchKeyword ? searchKeyword : prev)); - } - }, [searchParams]); - - const handleGetKeyword = (keyword: string) => { - setNoticeSearch((prev) => ({ ...prev, keyword })); - setValue(keyword); - }; - const handleChangePagination = (page: number) => { - setNoticeSearch((prev) => ({ ...prev, page })); - }; + const { searchUnit, value, handleGetKeyword, handleChangePagination } = + useSearchBar(); + const { noticeData, isLoading } = useGetNotice(searchUnit); if (isLoading) { return ( @@ -48,7 +25,7 @@ export default function AdminNoticeList() { return ( <> - + diff --git a/src/components/common/admin/searchBar/SearchBar.tsx b/src/components/common/admin/searchBar/SearchBar.tsx index dc90b5cb..07069c67 100644 --- a/src/components/common/admin/searchBar/SearchBar.tsx +++ b/src/components/common/admin/searchBar/SearchBar.tsx @@ -9,10 +9,9 @@ import { ADMIN_ROUTE } from '../../../../constants/routes'; interface SearchBarProps { onGetKeyword: (value: string) => void; - value: string; } -export default function SearchBar({ onGetKeyword, value }: SearchBarProps) { +export default function SearchBar({ onGetKeyword }: SearchBarProps) { const [keyword, setKeyword] = useState(''); const { isOpen, message, handleModalOpen, handleModalClose } = useModal(); const [searchParams, setSearchParams] = useSearchParams(); From 671e812e48a7f5021ff8015a66ea4113e52220fa Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Thu, 5 Jun 2025 17:21:02 +0900 Subject: [PATCH 16/19] =?UTF-8?q?feat=20:=20searchBar=EC=97=90=20"?= =?UTF-8?q?=EC=9E=91=EC=84=B1=ED=95=98=EA=B8=B0"=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EB=B6=84=EA=B8=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/admin/adminNotice/AdminNoticeList.tsx | 2 +- src/components/common/admin/searchBar/SearchBar.tsx | 11 +++++++---- src/pages/admin/adminAllUser/AdminAllUser.tsx | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/admin/adminNotice/AdminNoticeList.tsx b/src/components/admin/adminNotice/AdminNoticeList.tsx index 30012924..dc0549ac 100644 --- a/src/components/admin/adminNotice/AdminNoticeList.tsx +++ b/src/components/admin/adminNotice/AdminNoticeList.tsx @@ -25,7 +25,7 @@ export default function AdminNoticeList() { return ( <> - + void; + isNotice?: boolean; } -export default function SearchBar({ onGetKeyword }: SearchBarProps) { +export default function SearchBar({ onGetKeyword, isNotice }: SearchBarProps) { const [keyword, setKeyword] = useState(''); const { isOpen, message, handleModalOpen, handleModalClose } = useModal(); const [searchParams, setSearchParams] = useSearchParams(); @@ -70,9 +71,11 @@ export default function SearchBar({ onGetKeyword }: SearchBarProps) { 검색 - - 작성하기 - + {isNotice && ( + + 작성하기 + + )} {message} diff --git a/src/pages/admin/adminAllUser/AdminAllUser.tsx b/src/pages/admin/adminAllUser/AdminAllUser.tsx index 2a051432..d74b4128 100644 --- a/src/pages/admin/adminAllUser/AdminAllUser.tsx +++ b/src/pages/admin/adminAllUser/AdminAllUser.tsx @@ -28,7 +28,7 @@ const AdminAllUser = () => { - + From 37c542fe9b7926d46873a7f21a903088925bc834 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Thu, 5 Jun 2025 17:26:56 +0900 Subject: [PATCH 17/19] =?UTF-8?q?feat=20:=20UserCard=20=ED=85=8C=EB=91=90?= =?UTF-8?q?=EB=A6=AC=20=EC=83=89=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/admin/userCard/UserCard.styled.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/admin/userCard/UserCard.styled.ts b/src/components/admin/userCard/UserCard.styled.ts index 1b973477..1bc8839e 100644 --- a/src/components/admin/userCard/UserCard.styled.ts +++ b/src/components/admin/userCard/UserCard.styled.ts @@ -5,7 +5,7 @@ export const Container = styled.div` width: 240px; display: flex; flex-direction: column; - border: 1px solid ${({ theme }) => theme.color.white}; + border: 1px solid ${({ theme }) => theme.color.grey}; border-radius: ${({ theme }) => theme.borderRadius.primary}; padding: 10px; `; From 28188258f8fcb2a6d4f2ba3011b81e8cf4a1a1f9 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Thu, 5 Jun 2025 21:10:45 +0900 Subject: [PATCH 18/19] =?UTF-8?q?feat=20:=20searchBar=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20=ED=9B=84=20=EB=92=A4=EB=A1=9C=20=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=ED=96=88=EC=9D=84=20=EB=95=8C=20=EC=A0=84=EC=B2=B4?= =?UTF-8?q?=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EB=82=98=EC=98=A4=EA=B2=8C=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 --- src/components/common/admin/searchBar/SearchBar.tsx | 12 ++++++++---- src/hooks/admin/useSearchBar.ts | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/common/admin/searchBar/SearchBar.tsx b/src/components/common/admin/searchBar/SearchBar.tsx index 54b729f9..ecd605a4 100644 --- a/src/components/common/admin/searchBar/SearchBar.tsx +++ b/src/components/common/admin/searchBar/SearchBar.tsx @@ -9,11 +9,16 @@ import { ADMIN_ROUTE } from '../../../../constants/routes'; interface SearchBarProps { onGetKeyword: (value: string) => void; + value: string; isNotice?: boolean; } -export default function SearchBar({ onGetKeyword, isNotice }: SearchBarProps) { - const [keyword, setKeyword] = useState(''); +export default function SearchBar({ + onGetKeyword, + value, + isNotice, +}: SearchBarProps) { + const [keyword, setKeyword] = useState(value); const { isOpen, message, handleModalOpen, handleModalClose } = useModal(); const [searchParams, setSearchParams] = useSearchParams(); @@ -40,8 +45,7 @@ export default function SearchBar({ onGetKeyword, isNotice }: SearchBarProps) { }; const handleChangeKeyword = (e: React.ChangeEvent) => { - const value = e.target.value; - setKeyword(value); + setKeyword(e.target.value); }; const handleClickSearchDefault = () => { diff --git a/src/hooks/admin/useSearchBar.ts b/src/hooks/admin/useSearchBar.ts index 27aaf097..84ed2f6d 100644 --- a/src/hooks/admin/useSearchBar.ts +++ b/src/hooks/admin/useSearchBar.ts @@ -16,6 +16,9 @@ const useSearchBar = () => { if (searchKeyword) { setSearchUnit((prev) => ({ ...prev, keyword: searchKeyword })); setValue((prev) => (searchKeyword ? searchKeyword : prev)); + } else { + setSearchUnit((prev) => ({ ...prev, keyword: '' })); + setValue(''); } }, [searchParams]); From 7d6e27dec5bcbd27954065b8022522a1a4c1fc3d Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Thu, 5 Jun 2025 21:11:35 +0900 Subject: [PATCH 19/19] =?UTF-8?q?feat=20:=20searchBar=EC=97=90=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=ED=95=9C=20=EB=82=B4=EC=9A=A9=EC=9D=84=20=EC=9C=A0?= =?UTF-8?q?=EC=A7=80=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=9C=20value=20?= =?UTF-8?q?=EB=A1=A4=EB=B0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/admin/adminNotice/AdminNoticeList.tsx | 6 +++++- src/pages/admin/adminAllUser/AdminAllUser.tsx | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/admin/adminNotice/AdminNoticeList.tsx b/src/components/admin/adminNotice/AdminNoticeList.tsx index dc0549ac..acbf1ea0 100644 --- a/src/components/admin/adminNotice/AdminNoticeList.tsx +++ b/src/components/admin/adminNotice/AdminNoticeList.tsx @@ -25,7 +25,11 @@ export default function AdminNoticeList() { return ( <> - + { - const { searchUnit, handleGetKeyword, handleChangePagination } = + const { searchUnit, value, handleGetKeyword, handleChangePagination } = useSearchBar(); const { allUserData, isLoading, isFetching } = useGetAllUsers(searchUnit); @@ -28,7 +28,11 @@ const AdminAllUser = () => { - +