From 38d072572958e8dc012a6197abebd9a13803d24e Mon Sep 17 00:00:00 2001 From: suhyun Date: Sat, 20 Dec 2025 01:53:19 +0900 Subject: [PATCH] [feat] fix mainpage example --- src/App.tsx | 3 +- .../TankRenderer/FishTankPreview.tsx | 4 +- src/pages/MainPage.tsx | 113 ++++++++++++++-- src/pages/TestPage.tsx | 123 ------------------ 4 files changed, 106 insertions(+), 137 deletions(-) delete mode 100644 src/pages/TestPage.tsx diff --git a/src/App.tsx b/src/App.tsx index 647a523..b8b13a6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,5 @@ import { BrowserRouter, Routes, Route } from "react-router-dom"; -import { MainPage, MyPage, ShopPage, TestPage, GitHubCallbackPage } from "./pages"; +import { MainPage, MyPage, ShopPage, GitHubCallbackPage } from "./pages"; import CollectionPage from "./pages/CollectionPage"; import { AuthProvider } from "@/auth/AuthContext"; import { ViewportProvider } from "@/contexts/ViewportContext"; @@ -13,7 +13,6 @@ function App() { } /> } /> } /> - } /> } /> } /> diff --git a/src/components/TankRenderer/FishTankPreview.tsx b/src/components/TankRenderer/FishTankPreview.tsx index af6173a..16a104e 100644 --- a/src/components/TankRenderer/FishTankPreview.tsx +++ b/src/components/TankRenderer/FishTankPreview.tsx @@ -39,10 +39,10 @@ export default function FishTank({ )} {/* 배경 이미지가 없을 때 → 기본 하늘색 배경 */} - {!bgImage &&
} + {!bgImage &&
} {/* 좌상단 Repository 이름 */} -
+
{repositoryName}
diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx index 1c5576b..3702e49 100644 --- a/src/pages/MainPage.tsx +++ b/src/pages/MainPage.tsx @@ -1,7 +1,72 @@ -import { Footer, Header } from "@/components"; +import { Footer, Header, FishTankPreview } from "@/components"; // FishTankPreview 추가 import LogoText from "@/components/LogoText"; import { useNavigate } from "react-router-dom"; import { useState, useEffect } from "react"; +import type { Fish } from "@/types/fish"; // Fish 타입 추가 + +// 1. Mock 데이터 추가 (FishTank에 표시될 데이터) +const mockFishList: Fish[] = [ + { + id: 101, + name: "SpaceOcto_4", + github_username: "Jongpippan", + group_code: "SpaceOcto", + maturity: 4, + repository_name: "octo-space/frontend", + commit_count: 132, + unlocked_at: "2024-11-20T12:00:00Z", + is_visible_in_aquarium: true, + is_visible_in_fishtank: true, + }, + { + id: 101, + name: "RBFishbun_3", + github_username: "Imggaggu", + group_code: "RBFishbun", + maturity: 3, + repository_name: "octo-space/frontend", + commit_count: 142, + unlocked_at: "2024-11-20T12:00:00Z", + is_visible_in_aquarium: true, + is_visible_in_fishtank: true, + }, + { + id: 101, + name: "ShrimpWich_5", + github_username: "SuhyunBan", + group_code: "ShrimpWich", + maturity: 5, + repository_name: "octo-space/frontend", + commit_count: 124, + unlocked_at: "2024-11-20T12:00:00Z", + is_visible_in_aquarium: true, + is_visible_in_fishtank: true, + }, + { + id: 102, + name: "ShrimpWich_2", + github_username: "eileen914", + group_code: "ShrimpWich", + maturity: 2, + repository_name: "shrimpwich/engine", + commit_count: 117, + unlocked_at: "2024-10-03T09:30:00Z", + is_visible_in_aquarium: true, + is_visible_in_fishtank: true, + }, + { + id: 104, + name: "LaptopSunfish", + github_username: "jay20012024", + group_code: "LaptopSunfish", + maturity: 4, + repository_name: "suntech/laptop-ui", + commit_count: 155, + unlocked_at: "2024-07-12T11:20:00Z", + is_visible_in_aquarium: true, + is_visible_in_fishtank: true, + }, +]; export default function MainPage() { const navigate = useNavigate(); @@ -19,12 +84,10 @@ export default function MainPage() { }; }, []); - // 화면 너비가 768px 이하면 더 빨리 나타나도록 임계값 감소 const baseWidth = 768; const baseThreshold1 = 900; const baseThreshold2 = 1600; - // 768px 이하에서는 0.7배를 곱해서 더 빨리 나타나도록 함 const scrollThreshold1 = windowWidth <= baseWidth ? Math.max(300, Math.floor((baseThreshold1 * windowWidth * 0.7) / baseWidth)) @@ -36,6 +99,7 @@ export default function MainPage() { return (
+ {/* 배경 설정 */}
+
+ + {/* Hero 섹션 */}
+ + {/* 2. FishTank Preview 섹션: example.png를 컴포넌트로 교체 */}
-
- +
+ {/* 1. aspect-[16/9]로 비율 고정 + 2. overflow-hidden으로 내부 물고기 이탈 방지 + */} +
+ 896 ? 896 : windowWidth - 96} // max-w-4xl(896px) 기준 + height={(windowWidth > 896 ? 896 : windowWidth - 96) * 0.5625} // 16:9 비율 유지 + className="h-full w-full" + repositoryName="GitHub Aquarium" + fishList={mockFishList} + /> +
+ + {/* 하단 그림자 효과 */}
+ + {/* Explore 섹션 */}
+ + {/* 장식용 미역들 */} seaweed + + {/* 메뉴 이동 버튼 (말풍선) */} my aquarium
+ {/* 하단 설명 섹션 */}

🐟 Ready to raise your own fish?

@@ -146,12 +236,14 @@ export default function MainPage() {

Show off your contributions at a glance

+ + {/* 하단 장식 요소 */}
+
); diff --git a/src/pages/TestPage.tsx b/src/pages/TestPage.tsx deleted file mode 100644 index 7dc2f96..0000000 --- a/src/pages/TestPage.tsx +++ /dev/null @@ -1,123 +0,0 @@ -// src/pages/TestPage.tsx -import React, { useEffect, useState } from "react"; -import { Footer, Header, FishTankPreview, AquariumPreview } from "@/components"; -import type { Fish } from "@/types/fish"; -import type { AquariumDetail } from "@/types/aquarium"; -import { getAquariumDetail } from "@/apis/aquarium"; - -const mockFishList: Fish[] = [ - { - id: 101, - name: "SpaceOcto_6", // species - github_username: "alice", // 소유자 - group_code: "SpaceOcto", - maturity: 3, - repository_name: "octo-space/frontend", - commit_count: 42, - unlocked_at: "2024-11-20T12:00:00Z", - is_visible_in_aquarium: true, - is_visible_in_fishtank: true, - }, - { - id: 102, - name: "ShrimpWich_6", - github_username: "bob", - group_code: "ShrimpWich", - maturity: 2, - repository_name: "shrimpwich/engine", - commit_count: 17, - unlocked_at: "2024-10-03T09:30:00Z", - is_visible_in_aquarium: true, - is_visible_in_fishtank: true, - }, - { - id: 103, - name: "SPFishbun_3", - github_username: "charlie", - group_code: "Fishbun", - maturity: 1, - repository_name: "bakery/fishbun-core", - commit_count: 8, - unlocked_at: "2024-08-15T15:00:00Z", - is_visible_in_aquarium: true, - is_visible_in_fishtank: false, // 피시탱크에서는 안 보임 - }, - { - id: 104, - name: "LaptopSunfish", - github_username: "diana", - group_code: "LaptopSunfish", - maturity: 4, - repository_name: "suntech/laptop-ui", - commit_count: 105, - unlocked_at: "2024-07-12T11:20:00Z", - is_visible_in_aquarium: true, - is_visible_in_fishtank: true, - }, -]; - -export default function TestPage() { - const [aquarium, setAquarium] = useState(null); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - - useEffect(() => { - let mounted = true; - - (async () => { - try { - const data = await getAquariumDetail(); - if (!mounted) return; - setAquarium(data); - console.log("Fetched aquarium data:", data); - } catch (e) { - if (!mounted) return; - setError(e instanceof Error ? e.message : "아쿠아리움 정보를 불러오지 못했습니다."); - } finally { - if (mounted) setLoading(false); - } - })(); - - return () => { - mounted = false; - }; - }, []); - - return ( -
-
-
-

Test Page

-

Test Page

-

Test Page

-

테스트 페이지

- - {/* 레포 피시탱크: mock 데이터 사용 */} - - - {/* 아쿠아리움: 실제 API 데이터 사용 */} - {loading &&
아쿠아리움 로딩 중...
} - - {error && !loading &&
{error}
} - - {aquarium && !loading && !error && ( - - )} -
-
- ); -}