import { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; import api from '../../api/client'; export default function AdminIndex() { const [stats, setStats] = useState(null); useEffect(() => { api.get('/admin/stats').then(r => setStats(r.data)).catch(() => {}); }, []); const cards = stats ? [ { label: '์ด ์‚ฌ์šฉ์ž', value: stats.users.toLocaleString(), icon: '๐Ÿ‘ค' }, { label: '์ „์ฒด ํ”„๋กœ์ ํŠธ', value: stats.projects.total.toLocaleString(), icon: '๐Ÿ“' }, { label: '์Šน์ธ ๋Œ€๊ธฐ', value: stats.projects.pending.toLocaleString(), icon: 'โณ', warn: stats.projects.pending > 0 }, { label: '์ด ๋งค์ถœ', value: `โ‚ฉ${(stats.revenue.total || 0).toLocaleString()}`, icon: '๐Ÿ’ฐ' }, { label: '์ด ์ฃผ๋ฌธ', value: stats.revenue.orders.toLocaleString(), icon: '๐Ÿ›’' }, ] : []; return (

๊ด€๋ฆฌ์ž ๋Œ€์‹œ๋ณด๋“œ

{/* ํ†ต๊ณ„ ์นด๋“œ */} {stats && (
{cards.map(c => (
{c.icon}
{c.value}
{c.label}
))}
)} {/* ๋น ๋ฅธ ๋ฉ”๋‰ด */}
{[ { to: '/admin/projects', icon: '๐Ÿ“‹', title: 'ํ”„๋กœ์ ํŠธ ์Šน์ธ', desc: '๊ฒ€ํ†  ๋Œ€๊ธฐ ์ค‘์ธ ํ”„๋กœ์ ํŠธ๋ฅผ ์Šน์ธ/๋ฐ˜๋ ค' }, { to: '/admin/users', icon: '๐Ÿ‘ฅ', title: '์‚ฌ์šฉ์ž ๊ด€๋ฆฌ', desc: '์‚ฌ์šฉ์ž ๋ชฉ๋ก, ์—ญํ•  ๋ณ€๊ฒฝ, ๊ณ„์ • ๋น„ํ™œ์„ฑํ™”' }, { to: '/admin/logs', icon: '๐Ÿ“œ', title: '๊ฐ์‚ฌ ๋กœ๊ทธ', desc: '๋ชจ๋“  ์ฃผ์š” ํ–‰๋™ ๊ธฐ๋ก ์กฐํšŒ' }, ].map(m => (
e.currentTarget.style.borderColor = 'var(--accent)'} onMouseLeave={e => e.currentTarget.style.borderColor = 'var(--border)'}>
{m.icon}
{m.title}
{m.desc}
))}
); }