From d0711a8c3ac61bfb10d7a6b5b6e2ca445e960d14 Mon Sep 17 00:00:00 2001 From: jhj2713 Date: Mon, 12 Aug 2024 11:28:17 +0900 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20gitignore=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/admin/.gitignore b/admin/.gitignore index a547bf36..3b0b4037 100644 --- a/admin/.gitignore +++ b/admin/.gitignore @@ -22,3 +22,5 @@ dist-ssr *.njsproj *.sln *.sw? + +.env \ No newline at end of file From 8e7b167f3329bdf4930bc5c60303eecb3408e57b Mon Sep 17 00:00:00 2001 From: jhj2713 Date: Mon, 12 Aug 2024 11:51:12 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=EC=B0=B8=EC=97=AC=EC=9E=90=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/apis/lotteryAPI.ts | 56 +++++++ admin/src/constants/lottery.ts | 19 +++ admin/src/pages/Lottery/index.tsx | 9 +- .../pages/LotteryParticipantList/index.tsx | 143 ++++++++++++++++++ admin/src/pages/LotteryWinnerList/index.tsx | 11 +- admin/src/pages/RushWinnerList/index.tsx | 5 +- admin/src/router.tsx | 5 + admin/src/types/lottery.ts | 5 + admin/src/types/lotteryApi.ts | 9 +- 9 files changed, 249 insertions(+), 13 deletions(-) create mode 100644 admin/src/pages/LotteryParticipantList/index.tsx diff --git a/admin/src/apis/lotteryAPI.ts b/admin/src/apis/lotteryAPI.ts index c716da82..7a33a7df 100644 --- a/admin/src/apis/lotteryAPI.ts +++ b/admin/src/apis/lotteryAPI.ts @@ -1,6 +1,7 @@ import { GetLotteryExpectationsParams, GetLotteryExpectationsResponse, + GetLotteryParticipantResponse, GetLotteryResponse, GetLotteryWinnerParams, GetLotteryWinnerResponse, @@ -52,6 +53,61 @@ export const LotteryAPI = { throw error; } }, + async getLotteryParticipant({ + id, + size, + page, + phoneNumber, + }: GetLotteryWinnerParams): Promise { + try { + return new Promise((resolve) => + resolve({ + data: [ + { + id: 1, + phoneNumber: "010-1111-2222", + linkClickedCounts: 1, + expectation: 1, + appliedCount: 3, + createdAt: "2024-08-12T02:10:37.279369", + updatedAt: "2024-08-12T02:13:48.390954", + }, + { + id: 2, + phoneNumber: "010-1111-2223", + linkClickedCounts: 1, + expectation: 1, + appliedCount: 3, + createdAt: "2024-08-12T02:10:37.279369", + updatedAt: "2024-08-12T02:13:48.390954", + }, + { + id: 3, + phoneNumber: "010-1111-2224", + linkClickedCounts: 1, + expectation: 1, + appliedCount: 3, + createdAt: "2024-08-12T02:10:37.279369", + updatedAt: "2024-08-12T02:13:48.390954", + }, + ], + isLastPage: true, + totalParticipants: 10000, + }) + ); + const response = await fetchWithTimeout( + `${baseURL}/${id}/participants?size=${size}&page=${page}&number=${phoneNumber}`, + { + method: "GET", + headers: headers, + } + ); + return response.json(); + } catch (error) { + console.error("Error:", error); + throw error; + } + }, async getLotteryWinner({ id, size, diff --git a/admin/src/constants/lottery.ts b/admin/src/constants/lottery.ts index af72f0be..5b24689c 100644 --- a/admin/src/constants/lottery.ts +++ b/admin/src/constants/lottery.ts @@ -7,3 +7,22 @@ export const LOTTERY_HEADER = [ "추첨 당첨 인원 수", "진행 상태", ]; + +export const LOTTERY_WINNER_HEADER = [ + "등수", + "ID", + "전화번호", + "공유 링크 클릭 횟수", + "기대평 작성 여부", + "총 응모 횟수", +]; +export const LOTTERY_EXPECTATIONS_HEADER = ["캐스퍼 ID", "기대평"]; +export const LOTTERY_PARTICIPANT_HEADER = [ + "ID", + "생성 날짜", + "생성 시간", + "전화 번호", + "공유 링크 클릭 횟수", + "기대평 작성 여부", + "총 응모 횟수", +]; diff --git a/admin/src/pages/Lottery/index.tsx b/admin/src/pages/Lottery/index.tsx index f4dabcfe..90856ae8 100644 --- a/admin/src/pages/Lottery/index.tsx +++ b/admin/src/pages/Lottery/index.tsx @@ -76,7 +76,14 @@ export default function Lottery() {
- +
+ + +
+ + + + + +
+ + + ); +} diff --git a/admin/src/pages/LotteryWinnerList/index.tsx b/admin/src/pages/LotteryWinnerList/index.tsx index 636c603f..89fe747c 100644 --- a/admin/src/pages/LotteryWinnerList/index.tsx +++ b/admin/src/pages/LotteryWinnerList/index.tsx @@ -4,22 +4,13 @@ import { LotteryAPI } from "@/apis/lotteryAPI"; import Button from "@/components/Button"; import TabHeader from "@/components/TabHeader"; import Table from "@/components/Table"; +import { LOTTERY_EXPECTATIONS_HEADER, LOTTERY_WINNER_HEADER } from "@/constants/lottery"; import useInfiniteFetch from "@/hooks/useInfiniteFetch"; import useIntersectionObserver from "@/hooks/useIntersectionObserver"; import useModal from "@/hooks/useModal"; import { LotteryExpectationsType } from "@/types/lottery"; import { GetLotteryWinnerResponse } from "@/types/lotteryApi"; -const LOTTERY_WINNER_HEADER = [ - "등수", - "ID", - "전화번호", - "공유 링크 클릭 횟수", - "기대평 작성 여부", - "총 응모 횟수", -]; -const LOTTERY_EXPECTATIONS_HEADER = ["캐스퍼 ID", "기대평"]; - export default function LotteryWinnerList() { const location = useLocation(); const navigate = useNavigate(); diff --git a/admin/src/pages/RushWinnerList/index.tsx b/admin/src/pages/RushWinnerList/index.tsx index 06ac7b51..538a5153 100644 --- a/admin/src/pages/RushWinnerList/index.tsx +++ b/admin/src/pages/RushWinnerList/index.tsx @@ -170,7 +170,10 @@ export default function RushWinnerList() { />

선착순 참여자 리스트{" "} - {isWinnerToggle ? winnersLength : participantsLength} 명 + {(isWinnerToggle ? winnersLength : participantsLength).toLocaleString( + "en-US" + )}{" "} + 명