Files
a301_client/src/pages/WalletPage.jsx
tolelom 3dc1aad8ac feat: add wallet UI with 4 tabs and HomePage summary
- chain.js: API wrapper with Idempotency-Key auto-generation
- WalletPage: 4-tab container (wallet/assets/inventory/market)
- WalletTab: balance, address (truncated+copy), key export
- AssetsTab: asset list with detail expand, market listing
- InventoryTab: read-only slot display
- MarketTab: buy/cancel with confirm dialog, all/mine filter
- WalletSummary: HomePage card with balance + stats
- PrivateRoute guard for /wallet, header link on HomePage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 13:43:46 +09:00

59 lines
1.9 KiB
JavaScript

import { useState } from 'react';
import { Link } from 'react-router-dom';
import { useAuth } from '../context/useAuth';
import WalletTab from '../components/wallet/WalletTab';
import AssetsTab from '../components/wallet/AssetsTab';
import InventoryTab from '../components/wallet/InventoryTab';
import MarketTab from '../components/wallet/MarketTab';
import './WalletPage.css';
const TABS = [
{ key: 'wallet', label: '지갑' },
{ key: 'assets', label: '자산' },
{ key: 'inventory', label: '인벤토리' },
{ key: 'market', label: '마켓' },
];
export default function WalletPage() {
const { user, logout } = useAuth();
const [tab, setTab] = useState('wallet');
return (
<div className="wallet-page">
<header className="wallet-header">
<div className="wallet-header-left">
<Link to="/" className="wallet-home-link"> 메인으로</Link>
<h1 className="wallet-title">지갑</h1>
</div>
<div className="wallet-header-right">
<span className="wallet-username">{user?.username}</span>
<button className="btn-wallet-logout" onClick={logout}>로그아웃</button>
</div>
</header>
<div className="wallet-tabs" role="tablist">
{TABS.map((t) => (
<button
key={t.key}
role="tab"
id={`tab-${t.key}`}
aria-selected={tab === t.key}
aria-controls={`tabpanel-${t.key}`}
className={`wallet-tab${tab === t.key ? ' active' : ''}`}
onClick={() => setTab(t.key)}
>
{t.label}
</button>
))}
</div>
<main className="wallet-main" role="tabpanel" id={`tabpanel-${tab}`} aria-labelledby={`tab-${tab}`}>
{tab === 'wallet' && <WalletTab />}
{tab === 'assets' && <AssetsTab />}
{tab === 'inventory' && <InventoryTab />}
{tab === 'market' && <MarketTab />}
</main>
</div>
);
}