2026-02-06 10:43:16 +09:00
|
|
|
/**
|
|
|
|
|
* @file app/(main)/dashboard/page.tsx
|
|
|
|
|
* @description 사용자 대시보드 메인 페이지 (보호된 라우트)
|
|
|
|
|
* @remarks
|
|
|
|
|
* - [레이어] Pages (Server Component)
|
|
|
|
|
* - [역할] 사용자 자산 현황, 최근 활동, 통계 요약을 보여줌
|
|
|
|
|
* - [권한] 로그인한 사용자만 접근 가능 (Middleware에 의해 보호됨)
|
|
|
|
|
*/
|
|
|
|
|
|
2026-02-05 16:36:42 +09:00
|
|
|
import { createClient } from "@/utils/supabase/server";
|
|
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
|
|
|
import { Activity, CreditCard, DollarSign, Users } from "lucide-react";
|
|
|
|
|
|
2026-02-06 10:43:16 +09:00
|
|
|
/**
|
|
|
|
|
* 대시보드 페이지 (비동기 서버 컴포넌트)
|
|
|
|
|
* @returns Dashboard Grid Layout
|
|
|
|
|
*/
|
2026-02-05 16:36:42 +09:00
|
|
|
export default async function DashboardPage() {
|
2026-02-06 10:43:16 +09:00
|
|
|
// [Step 1] 세션 확인 (Middleware가 1차 방어하지만, 데이터 접근 시 2차 확인)
|
2026-02-05 16:36:42 +09:00
|
|
|
const supabase = await createClient();
|
2026-02-06 10:43:16 +09:00
|
|
|
await supabase.auth.getUser();
|
2026-02-05 16:36:42 +09:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex-1 space-y-4 p-8 pt-6">
|
|
|
|
|
<div className="flex items-center justify-between space-y-2">
|
|
|
|
|
<h2 className="text-3xl font-bold tracking-tight">대시보드</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
|
|
|
|
<CardTitle className="text-sm font-medium">총 수익</CardTitle>
|
|
|
|
|
<DollarSign className="h-4 w-4 text-muted-foreground" />
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<div className="text-2xl font-bold">$45,231.89</div>
|
|
|
|
|
<p className="text-xs text-muted-foreground">지난달 대비 +20.1%</p>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
|
|
|
|
<CardTitle className="text-sm font-medium">구독자</CardTitle>
|
|
|
|
|
<Users className="h-4 w-4 text-muted-foreground" />
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<div className="text-2xl font-bold">+2350</div>
|
|
|
|
|
<p className="text-xs text-muted-foreground">지난달 대비 +180.1%</p>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
|
|
|
|
<CardTitle className="text-sm font-medium">판매량</CardTitle>
|
|
|
|
|
<CreditCard className="h-4 w-4 text-muted-foreground" />
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<div className="text-2xl font-bold">+12,234</div>
|
|
|
|
|
<p className="text-xs text-muted-foreground">지난달 대비 +19%</p>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
|
|
|
|
<CardTitle className="text-sm font-medium">현재 활동 중</CardTitle>
|
|
|
|
|
<Activity className="h-4 w-4 text-muted-foreground" />
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<div className="text-2xl font-bold">+573</div>
|
|
|
|
|
<p className="text-xs text-muted-foreground">지난 시간 대비 +201</p>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-7">
|
|
|
|
|
<Card className="col-span-4">
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<CardTitle>개요</CardTitle>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent className="pl-2">
|
|
|
|
|
{/* Chart placeholder */}
|
|
|
|
|
<div className="h-[200px] w-full bg-slate-100 dark:bg-slate-800 rounded-md flex items-center justify-center text-muted-foreground">
|
|
|
|
|
차트 영역 (준비 중)
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
<Card className="col-span-3">
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<CardTitle>최근 활동</CardTitle>
|
|
|
|
|
<div className="text-sm text-muted-foreground">
|
|
|
|
|
이번 달 265건의 거래가 있었습니다.
|
|
|
|
|
</div>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<div className="space-y-8">
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
|
<div className="ml-4 space-y-1">
|
|
|
|
|
<p className="text-sm font-medium leading-none">
|
|
|
|
|
비트코인 매수
|
|
|
|
|
</p>
|
|
|
|
|
<p className="text-sm text-muted-foreground">BTC/USDT</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="ml-auto font-medium">+$1,999.00</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
|
<div className="ml-4 space-y-1">
|
|
|
|
|
<p className="text-sm font-medium leading-none">
|
|
|
|
|
이더리움 매도
|
|
|
|
|
</p>
|
|
|
|
|
<p className="text-sm text-muted-foreground">ETH/USDT</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="ml-auto font-medium">+$39.00</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|