'use client'; import { useState, useEffect } from 'react'; import Link from 'next/link'; import { LogOut } from 'lucide-react'; import { fetchApi, getDateTime } from '@/lib/utils/client'; import type { WalletBalanceResponse } from '@/types/response/wallet/balance'; import { TRANSACTION_TYPE_MAP } from '../constants'; import Loading from '@/app/component/Loading'; export default function WalletBalancePage() { const [loading, setLoading] = useState(true); const [data, setData] = useState(null); useEffect(() => { fetchApi('/api/studio/wallet/balance') .then(res => { if (res.data) { setData(res.data); } }) .catch(() => {}) .finally(() => setLoading(false)); }, []); if (loading || !data) { return ; } return (

잔액 현황

{/* Summary Cards */}
출금 가능 잔액 (M)
{data.withdrawableBalance.toLocaleString()}원
누적 수익
{data.totalEarned.toLocaleString()}원
누적 출금
{data.totalWithdrawn.toLocaleString()}원
{/* Actions */}
출금하기
{/* Recent Transactions */}

최근 거래 내역

{data.recentTransactions.length > 0 ? ( data.recentTransactions.map((tx) => ( )) ) : ( )}
일시 유형 내용 금액 잔액
{getDateTime(tx.createdAt)} {TRANSACTION_TYPE_MAP[tx.type] ?? tx.type} {tx.description} = 0 ? 'wallet__amount--plus' : 'wallet__amount--minus'}> {tx.amount >= 0 ? '+' : ''}{tx.amount.toLocaleString()}원 {tx.balance.toLocaleString()}원
거래 내역이 없습니다.
); }