From b37cba62bbef6e3c6bbabe5a2c2c1208f25690b0 Mon Sep 17 00:00:00 2001 From: darkdulgi Date: Tue, 20 Aug 2024 18:23:45 +0900 Subject: [PATCH 1/7] =?UTF-8?q?[feat]=20=EC=9C=A0=EC=A0=80=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/adminPage/App.jsx | 2 ++ src/adminPage/features/users/index.jsx | 3 +++ src/adminPage/pages/UsersPage.jsx | 16 ++++++++++++++++ src/adminPage/shared/components/NavBar.jsx | 6 ++++++ 4 files changed, 27 insertions(+) create mode 100644 src/adminPage/features/users/index.jsx create mode 100644 src/adminPage/pages/UsersPage.jsx diff --git a/src/adminPage/App.jsx b/src/adminPage/App.jsx index 76e51fc0..32c60e5b 100644 --- a/src/adminPage/App.jsx +++ b/src/adminPage/App.jsx @@ -9,6 +9,7 @@ import ProtectedRoute from "./pages/ProtectedRoute.jsx"; import RootRoute from "./pages/RootRoute.jsx"; import CommentsPage from "./pages/CommentsPage.jsx"; import CommentsIDPage from "./pages/CommentsIDPage.jsx"; +import UsersPage from "./pages/UsersPage.jsx"; import ServerTimeInitializer from "./shared/serverTime/ServerTimeInitializer.jsx"; import Modal from "@common/modal/modal.jsx"; @@ -31,6 +32,7 @@ function App() { } /> } /> } /> + } /> } /> } /> diff --git a/src/adminPage/features/users/index.jsx b/src/adminPage/features/users/index.jsx new file mode 100644 index 00000000..e3335b5e --- /dev/null +++ b/src/adminPage/features/users/index.jsx @@ -0,0 +1,3 @@ +export default function Users() { + return <>유저들; +} diff --git a/src/adminPage/pages/UsersPage.jsx b/src/adminPage/pages/UsersPage.jsx new file mode 100644 index 00000000..85ec1a52 --- /dev/null +++ b/src/adminPage/pages/UsersPage.jsx @@ -0,0 +1,16 @@ +import Container from "@admin/components/Container.jsx"; +import Users from "../features/users"; + +function UsersPage() { + return ( + +
+ 유저 조회 + + +
+
+ ); +} + +export default UsersPage; diff --git a/src/adminPage/shared/components/NavBar.jsx b/src/adminPage/shared/components/NavBar.jsx index 12451c45..c3f91b22 100644 --- a/src/adminPage/shared/components/NavBar.jsx +++ b/src/adminPage/shared/components/NavBar.jsx @@ -18,9 +18,15 @@ function NavBar() { events + 기대평 + + + 유저 + + {isLogin && LOGOUT} From c34a53a91f393d09fd73f695a0a72abfa5302c88 Mon Sep 17 00:00:00 2001 From: darkdulgi Date: Tue, 20 Aug 2024 18:40:13 +0900 Subject: [PATCH 2/7] =?UTF-8?q?[feat]=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=20=EC=A1=B0=ED=9A=8C=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EB=8C=80=EC=B6=A9=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/adminPage/features/users/Loading.jsx | 9 +++++ src/adminPage/features/users/Users.jsx | 49 +++++++++++++++++++++++ src/adminPage/features/users/index.jsx | 50 +++++++++++++++++++++++- 3 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 src/adminPage/features/users/Loading.jsx create mode 100644 src/adminPage/features/users/Users.jsx diff --git a/src/adminPage/features/users/Loading.jsx b/src/adminPage/features/users/Loading.jsx new file mode 100644 index 00000000..40e4ff40 --- /dev/null +++ b/src/adminPage/features/users/Loading.jsx @@ -0,0 +1,9 @@ +import Spinner from "@common/components/Spinner"; + +export default function Loading() { + return ( +
+ +
+ ); +} diff --git a/src/adminPage/features/users/Users.jsx b/src/adminPage/features/users/Users.jsx new file mode 100644 index 00000000..2b486ba1 --- /dev/null +++ b/src/adminPage/features/users/Users.jsx @@ -0,0 +1,49 @@ +// import { useQuery } from "@common/dataFetch/getQuery.js"; +// import { fetchServer } from "@common/dataFetch/fetchServer.js"; +// import Pagination from "@admin/components/Pagination"; +// import { useState } from "react"; + +export default function Comments({ + searchString, +}) { + searchString; + // const [page, setPage] = useState(1); + // const data = useQuery( + // "admin-users", + // () => + // fetchServer( + // `/api/v1/admin/호출!!!!!!`, + // ) + // .then((res) => { + // console.log(res); + // return res; + // }) + // .catch((e) => { + // console.log(e); + // }), + // [page, searchString], + // ); + + return ( +
+ {/* {data.comments.map((comment) => ( +
+ + +
+
+ + {comment.content} +
+ ))} + + */} +
+ ); +} diff --git a/src/adminPage/features/users/index.jsx b/src/adminPage/features/users/index.jsx index e3335b5e..d2801863 100644 --- a/src/adminPage/features/users/index.jsx +++ b/src/adminPage/features/users/index.jsx @@ -1,3 +1,49 @@ -export default function Users() { - return <>유저들; +import Suspense from "@common/components/Suspense"; +import Loading from "./Loading.jsx"; +import Users from "./Users.jsx"; +import { useState } from "react"; + +export default function AdminCommentID() { + const [formString, setFormString] = useState(""); + const [searchString, setSearchString] = useState(""); + + function searchComment(e) { + e.preventDefault(); + setSearchString(formString); + } + + return ( +
+
+ setFormString(e.target.value)} + placeholder="검색 단어 입력" + className="bg-neutral-50 focus:bg-white w-full px-4 py-2 rounded-lg text-body-s" + /> + + 검색 +
+ +
+ + 선택 + + 작성 시간 + 기대평 내용 +
+ + }> + + +
+ ); } From 1a58b0efac1369f3a00c9c378c800aa0a3f2c53f Mon Sep 17 00:00:00 2001 From: darkdulgi Date: Tue, 20 Aug 2024 19:10:10 +0900 Subject: [PATCH 3/7] =?UTF-8?q?[feat]=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=20=EC=A1=B0=ED=9A=8C=EC=99=80=20mock=20?= =?UTF-8?q?=EB=8C=80=EC=B6=A9=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/adminPage/features/users/Users.jsx | 46 ++++++++++++-------------- src/adminPage/features/users/index.jsx | 2 +- src/adminPage/features/users/mock.js | 8 +++++ src/adminPage/mock.js | 2 ++ 4 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 src/adminPage/features/users/mock.js diff --git a/src/adminPage/features/users/Users.jsx b/src/adminPage/features/users/Users.jsx index 2b486ba1..cb7330a3 100644 --- a/src/adminPage/features/users/Users.jsx +++ b/src/adminPage/features/users/Users.jsx @@ -1,28 +1,24 @@ -// import { useQuery } from "@common/dataFetch/getQuery.js"; -// import { fetchServer } from "@common/dataFetch/fetchServer.js"; -// import Pagination from "@admin/components/Pagination"; -// import { useState } from "react"; +import { useQuery } from "@common/dataFetch/getQuery.js"; +import { fetchServer } from "@common/dataFetch/fetchServer.js"; +import Pagination from "@admin/components/Pagination"; +import { useState } from "react"; -export default function Comments({ - searchString, -}) { +export default function Comments({ searchString }) { searchString; - // const [page, setPage] = useState(1); - // const data = useQuery( - // "admin-users", - // () => - // fetchServer( - // `/api/v1/admin/호출!!!!!!`, - // ) - // .then((res) => { - // console.log(res); - // return res; - // }) - // .catch((e) => { - // console.log(e); - // }), - // [page, searchString], - // ); + const [page, setPage] = useState(1); + const data = useQuery( + "admin-users", + () => + fetchServer(`/api/v1/admin/users?page=${page - 1}&search=${searchString}`) + .then((res) => { + console.log(res); + return res; + }) + .catch((e) => { + console.log(e); + }), + [page, searchString], + ); return (
@@ -41,9 +37,9 @@ export default function Comments({ {comment.content}
- ))} + ))} */} - */} + ); } diff --git a/src/adminPage/features/users/index.jsx b/src/adminPage/features/users/index.jsx index d2801863..84e76749 100644 --- a/src/adminPage/features/users/index.jsx +++ b/src/adminPage/features/users/index.jsx @@ -19,7 +19,7 @@ export default function AdminCommentID() { type="text" value={formString} onChange={(e) => setFormString(e.target.value)} - placeholder="검색 단어 입력" + placeholder="유저 이름 검색" className="bg-neutral-50 focus:bg-white w-full px-4 py-2 rounded-lg text-body-s" /> diff --git a/src/adminPage/features/users/mock.js b/src/adminPage/features/users/mock.js new file mode 100644 index 00000000..2901e045 --- /dev/null +++ b/src/adminPage/features/users/mock.js @@ -0,0 +1,8 @@ +import { http, HttpResponse } from "msw"; +// import getRandomString from "@common/mock/getRandomString"; + +const handlers = [ + http.get("/api/v1/admin/users", () => HttpResponse.json([])), +]; + +export default handlers; diff --git a/src/adminPage/mock.js b/src/adminPage/mock.js index 51502b59..dd937ea3 100644 --- a/src/adminPage/mock.js +++ b/src/adminPage/mock.js @@ -5,6 +5,7 @@ import serverTimeHandler from "@admin/serverTime/mock.js"; import eventSearchHandler from "./features/eventList/mock.js"; import eventCreateHandler from "./features/eventEdit/mock.js"; import drawHandler from "./features/eventDetail/drawButton/mock.js"; +import usersHandler from "./features/users/mock.js"; // mocking은 기본적으로 각 feature 폴더 내의 mock.js로 정의합니다. // 새로운 feature의 mocking을 추가하셨으면, mock.js의 setupWorker 내부 함수에 인자를 spread 연산자를 이용해 추가해주세요. @@ -16,4 +17,5 @@ export default setupWorker( ...commentHandler, ...eventCreateHandler, ...drawHandler, + ...usersHandler, ); From 8489307a484ff9431a2ad0b29db7c3de3f446fe9 Mon Sep 17 00:00:00 2001 From: darkdulgi Date: Wed, 21 Aug 2024 10:45:14 +0900 Subject: [PATCH 4/7] =?UTF-8?q?[feat]=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=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/adminPage/features/users/Users.jsx | 25 +++++++++---------------- src/adminPage/features/users/index.jsx | 25 +++++++++++++------------ src/adminPage/features/users/mock.js | 22 ++++++++++++++++++---- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/adminPage/features/users/Users.jsx b/src/adminPage/features/users/Users.jsx index cb7330a3..c4c9d866 100644 --- a/src/adminPage/features/users/Users.jsx +++ b/src/adminPage/features/users/Users.jsx @@ -9,9 +9,8 @@ export default function Comments({ searchString }) { const data = useQuery( "admin-users", () => - fetchServer(`/api/v1/admin/users?page=${page - 1}&search=${searchString}`) + fetchServer(`/api/v1/admin/event-users?page=${page - 1}&search=${searchString}&size=15`) .then((res) => { - console.log(res); return res; }) .catch((e) => { @@ -22,24 +21,18 @@ export default function Comments({ searchString }) { return (
- {/* {data.comments.map((comment) => ( + {data.users.map((user) => (
- - -
-
- - {comment.content} + {user.userName} + {user.phoneNumber} + {user.frameId}
- ))} */} + ))} - +
); } diff --git a/src/adminPage/features/users/index.jsx b/src/adminPage/features/users/index.jsx index 84e76749..c45c3162 100644 --- a/src/adminPage/features/users/index.jsx +++ b/src/adminPage/features/users/index.jsx @@ -13,13 +13,18 @@ export default function AdminCommentID() { } return ( -
-
+
+
+ 성명 검색 문자열: + {searchString} +
+ + setFormString(e.target.value)} - placeholder="유저 이름 검색" + placeholder="유저 성명 검색" className="bg-neutral-50 focus:bg-white w-full px-4 py-2 rounded-lg text-body-s" /> @@ -31,18 +36,14 @@ export default function AdminCommentID() { /> -
- - 선택 - - 작성 시간 - 기대평 내용 +
+ 성명 + 전화번호 + 이벤트 frameId
}> - +
); diff --git a/src/adminPage/features/users/mock.js b/src/adminPage/features/users/mock.js index 2901e045..e7676a30 100644 --- a/src/adminPage/features/users/mock.js +++ b/src/adminPage/features/users/mock.js @@ -1,8 +1,22 @@ import { http, HttpResponse } from "msw"; -// import getRandomString from "@common/mock/getRandomString"; +import getRandomString from "@common/mock/getRandomString"; -const handlers = [ - http.get("/api/v1/admin/users", () => HttpResponse.json([])), -]; +function getRandomUsers() { + let users = []; + const num = 15; + for (let i = 0; i < num; i++) { + users = [ + ...users, + { + userName: getRandomString(3), + phoneNumber: "010-0000-0000", + frameId: "event-test", + }, + ]; + } + return { users: users, totalPage: 15 }; +} + +const handlers = [http.get("/api/v1/admin/event-users", () => HttpResponse.json(getRandomUsers()))]; export default handlers; From 70193d5d2d5b8e96f7df10d0956a4b67e34ec15d Mon Sep 17 00:00:00 2001 From: darkdulgi Date: Wed, 21 Aug 2024 14:45:06 +0900 Subject: [PATCH 5/7] =?UTF-8?q?[feat]=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=20=EC=A1=B0=ED=9A=8C=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=9C=84=ED=95=9C=20=EC=82=AC=EC=A0=84?= =?UTF-8?q?=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/adminPage/features/users/Users.jsx | 3 ++- src/adminPage/features/users/index.jsx | 35 ++++++++++++++++++-------- src/adminPage/features/users/mock.js | 1 + 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/adminPage/features/users/Users.jsx b/src/adminPage/features/users/Users.jsx index c4c9d866..9ad1ad0f 100644 --- a/src/adminPage/features/users/Users.jsx +++ b/src/adminPage/features/users/Users.jsx @@ -3,7 +3,7 @@ import { fetchServer } from "@common/dataFetch/fetchServer.js"; import Pagination from "@admin/components/Pagination"; import { useState } from "react"; -export default function Comments({ searchString }) { +export default function Comments({ searchString, category }) { searchString; const [page, setPage] = useState(1); const data = useQuery( @@ -11,6 +11,7 @@ export default function Comments({ searchString }) { () => fetchServer(`/api/v1/admin/event-users?page=${page - 1}&search=${searchString}&size=15`) .then((res) => { + console.log(category); return res; }) .catch((e) => { diff --git a/src/adminPage/features/users/index.jsx b/src/adminPage/features/users/index.jsx index c45c3162..bb4afb49 100644 --- a/src/adminPage/features/users/index.jsx +++ b/src/adminPage/features/users/index.jsx @@ -6,6 +6,7 @@ import { useState } from "react"; export default function AdminCommentID() { const [formString, setFormString] = useState(""); const [searchString, setSearchString] = useState(""); + const [category, setCategory] = useState("name"); function searchComment(e) { e.preventDefault(); @@ -14,9 +15,11 @@ export default function AdminCommentID() { return (
-
- 성명 검색 문자열: - {searchString} +
+ 검색 문자열: + {searchString}
@@ -28,12 +31,24 @@ export default function AdminCommentID() { className="bg-neutral-50 focus:bg-white w-full px-4 py-2 rounded-lg text-body-s" /> - 검색 +
+ + + 검색 +
@@ -43,7 +58,7 @@ export default function AdminCommentID() {
}> - +
); diff --git a/src/adminPage/features/users/mock.js b/src/adminPage/features/users/mock.js index e7676a30..7005b05d 100644 --- a/src/adminPage/features/users/mock.js +++ b/src/adminPage/features/users/mock.js @@ -8,6 +8,7 @@ function getRandomUsers() { users = [ ...users, { + id: i, userName: getRandomString(3), phoneNumber: "010-0000-0000", frameId: "event-test", From 50fa70edd5ad32517314fecc632ba62e4d0545f9 Mon Sep 17 00:00:00 2001 From: darkdulgi Date: Wed, 21 Aug 2024 15:39:15 +0900 Subject: [PATCH 6/7] =?UTF-8?q?[fix]=20HD=5F=20=EB=A1=9C=20=EC=8B=9C?= =?UTF-8?q?=EC=9E=91=ED=95=98=EB=8A=94=20=EC=9D=B4=EB=B2=A4=ED=8A=B8id?= =?UTF-8?q?=EA=B0=80=20=EC=95=84=EB=8B=88=EB=8D=94=EB=9D=BC=EB=8F=84=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=EC=97=90=20=EB=9C=A8=EA=B2=8C=20=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/adminPage/features/comment/index.jsx | 29 +++++++++++------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/adminPage/features/comment/index.jsx b/src/adminPage/features/comment/index.jsx index fec05d12..f55f36ef 100644 --- a/src/adminPage/features/comment/index.jsx +++ b/src/adminPage/features/comment/index.jsx @@ -20,18 +20,13 @@ export default function AdminComment() { } function onChangeForm(e) { - let newString = e.target.value.replace(/[^0-9]/g, ""); + const newString = e.target.value.replace(/[^0-9]/g, ""); + const filteredFormString = formString.replace(/[^0-9]/g, ""); - if (!newString) { - newString = ""; - } else if (newString.length <= 6) { - newString = "HD_" + newString; - } else if (newString.length <= 9) { - newString = "HD_" + newString.slice(0, 6) + "_" + newString.slice(6); - } else return; + if (newString.length > 9) return; - if (newString !== formString) { - if (newString.length >= 9) { + if (newString !== filteredFormString) { + if (newString.length >= 6) { setSelectedEvent(-1); setIsSpread(true); autoCorrect(newString); @@ -39,18 +34,20 @@ export default function AdminComment() { setIsSpread(false); } } - setFormString(newString); + if (!newString) { + setFormString(""); + } else if (newString.length <= 6) { + setFormString("HD_" + newString); + } else { + setFormString("HD_" + newString.slice(0, 6) + "_" + newString.slice(6)); + } } function searchEvent(e, eventId) { e.preventDefault(); - const eventIDRegex = /^HD_\d{6}_\d{3}$/; const searchID = eventId ?? formString; - - if (eventIDRegex.test(searchID)) { - navigate(`/comments/${searchID}`); - } + navigate(`/comments/${searchID}`); } function onKeyDown(e) { From 1ec1a6f83c234d05dd7edc4a9d6df79bc4033307 Mon Sep 17 00:00:00 2001 From: darkdulgi Date: Wed, 21 Aug 2024 16:33:23 +0900 Subject: [PATCH 7/7] =?UTF-8?q?[fix]=20EVENT=5FFCFS=5FID=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/common/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/constants.js b/src/common/constants.js index c4f3acf8..8d5ab06c 100644 --- a/src/common/constants.js +++ b/src/common/constants.js @@ -1,4 +1,4 @@ -export const EVENT_FCFS_ID = "HD_240808_002"; +export const EVENT_FCFS_ID = "HD240821_001"; export const EVENT_DRAW_ID = "HD_240808_001"; export const EVENT_ID = "the-new-ioniq5"; export const EVENT_START_DATE = new Date(2024, 8, 9);