From 16ce3118b9dc4510bbbad9bee3d5741852a58ed2 Mon Sep 17 00:00:00 2001 From: HyungWookChoi Date: Fri, 15 Dec 2023 22:39:19 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20today=20status=20API=20integr?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(route)/(index)/page.tsx | 25 +++++++++++----- app/(route)/(index)/queries.ts | 10 +++---- app/(route)/login/page.tsx | 7 ++++- app/(route)/sign-up/page.tsx | 36 +++++++++++------------ app/_service/challenge/challenge.types.ts | 7 +++++ app/_service/challenge/index.ts | 6 ++-- next.config.js | 10 +++++++ tailwind.config.ts | 4 +-- 8 files changed, 70 insertions(+), 35 deletions(-) diff --git a/app/(route)/(index)/page.tsx b/app/(route)/(index)/page.tsx index e2d23db..13c6d36 100644 --- a/app/(route)/(index)/page.tsx +++ b/app/(route)/(index)/page.tsx @@ -2,15 +2,26 @@ import Image from 'next/image' -import { useChallengesQuery } from './queries' +import { useTodayStatusQuery } from './queries' + +export const CHAMPION = { + RED: 'https://dodals3.s3.ap-northeast-2.amazonaws.com/asset/red.png', + YELLOW: 'https://dodals3.s3.ap-northeast-2.amazonaws.com/asset/yellow.png', + GREEN: 'https://dodals3.s3.ap-northeast-2.amazonaws.com/asset/green.png', + BLUE: 'https://dodals3.s3.ap-northeast-2.amazonaws.com/asset/blue.png', + BEIGE: 'https://dodals3.s3.ap-northeast-2.amazonaws.com/asset/beige.png', + PINK: 'https://dodals3.s3.ap-northeast-2.amazonaws.com/asset/pink.png', +} export default function HomePage() { - const challengesQuery = useChallengesQuery() + const todayStatusQuery = useTodayStatusQuery() - if (!challengesQuery.isSuccess) { + if (!todayStatusQuery.isSuccess) { return null } + const { champion, certificatedCount, explorationCount } = todayStatusQuery.data.data + return (

오늘의 도달률

@@ -18,12 +29,12 @@ export default function HomePage() {
100
%
-
🌙 탐사 필요 0
-
🌕 탐사 완료 5
+
🌙 탐사 필요 {explorationCount}
+
🌕 탐사 완료 {certificatedCount}
-
- +
+
diff --git a/app/(route)/(index)/queries.ts b/app/(route)/(index)/queries.ts index 869c69b..8750e37 100644 --- a/app/(route)/(index)/queries.ts +++ b/app/(route)/(index)/queries.ts @@ -1,14 +1,14 @@ import { useQuery } from '@tanstack/react-query' -import { getChallenges } from '@/app/_service/challenge' +import { getTodayStatus } from '@/app/_service/challenge' const QUERY_KEY = { - challenges: ['challenges'], + todayStatus: ['todayStatus'], } -export const useChallengesQuery = () => { +export const useTodayStatusQuery = () => { return useQuery({ - queryKey: QUERY_KEY.challenges, - queryFn: () => getChallenges(), + queryKey: QUERY_KEY.todayStatus, + queryFn: () => getTodayStatus(), }) } diff --git a/app/(route)/login/page.tsx b/app/(route)/login/page.tsx index 854bc5d..c16d3e1 100644 --- a/app/(route)/login/page.tsx +++ b/app/(route)/login/page.tsx @@ -6,7 +6,12 @@ export default function Home() { return (
- 도달 로고 + 도달 로고 1:1 매칭 목표 달성 서비스
('RED') @@ -104,7 +104,7 @@ export default function Register() {
- {Object.keys(PROFILES.DEFAULT).map((champion) => ( + {Object.keys(CHAMPION.DEFAULT).map((champion) => (