import { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; const API = (path) => fetch(path, { headers: { Authorization: `Bearer ${localStorage.getItem('admin_token')}` }, }).then(r => r.json()); export default function AdminDashboard() { const [stats, setStats] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { API('/api/admin/dashboard') .then(setStats) .finally(() => setLoading(false)); }, []); if (loading) return

로딩 중...

; if (!stats) return null; const STAT_CARDS = [ { icon: '📰', label: '전체 뉴스', value: stats.totalNews, sub: `공개 ${stats.visibleNews}건`, color: 'blue' }, { icon: '📩', label: '전체 문의', value: stats.totalInquiries, sub: `미답변 ${stats.pendingInquiries}건`, color: stats.pendingInquiries > 0 ? 'red' : 'green' }, { icon: '👥', label: '채용공고', value: stats.totalRecruits, sub: `진행중 ${stats.activeRecruits}건`, color: 'green' }, ]; return ( <> {/* Stats */}
{STAT_CARDS.map(s => (
{s.icon}

{s.value}

{s.label}
{s.sub}

))} {stats.pendingInquiries > 0 && (
🔔

{stats.pendingInquiries}

미답변 문의
바로가기 →

)}
{/* Recent panels */}

📰 최근 뉴스

전체보기

📩 최근 문의

전체보기
); }