"use client"; import React, { useState, useEffect } from "react"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Mail, Send, Inbox, FileText, RefreshCw, TrendingUp, Users, Calendar, Clock } from "lucide-react"; interface DashboardStats { totalAccounts: number; totalTemplates: number; sentToday: number; receivedToday: number; sentThisMonth: number; successRate: number; } export default function MailDashboardPage() { const [stats, setStats] = useState({ totalAccounts: 0, totalTemplates: 0, sentToday: 0, receivedToday: 0, sentThisMonth: 0, successRate: 0, }); const [loading, setLoading] = useState(false); const loadStats = async () => { setLoading(true); try { // 계정 수 const accountsRes = await fetch('/api/mail/accounts'); const accountsData = await accountsRes.json(); // 템플릿 수 const templatesRes = await fetch('/api/mail/templates-file'); const templatesData = await templatesRes.json(); setStats({ totalAccounts: accountsData.success ? accountsData.data.length : 0, totalTemplates: templatesData.success ? templatesData.data.length : 0, sentToday: 0, // TODO: 실제 발송 통계 API 연동 receivedToday: 0, sentThisMonth: 0, successRate: 0, }); } catch (error) { // console.error('통계 로드 실패:', error); } finally { setLoading(false); } }; useEffect(() => { loadStats(); }, []); const statCards = [ { title: "등록된 계정", value: stats.totalAccounts, icon: Users, color: "blue", bgColor: "bg-blue-100", iconColor: "text-blue-500", }, { title: "템플릿 수", value: stats.totalTemplates, icon: FileText, color: "green", bgColor: "bg-green-100", iconColor: "text-green-500", }, { title: "오늘 발송", value: stats.sentToday, icon: Send, color: "orange", bgColor: "bg-orange-100", iconColor: "text-orange-500", }, { title: "오늘 수신", value: stats.receivedToday, icon: Inbox, color: "purple", bgColor: "bg-purple-100", iconColor: "text-purple-500", }, ]; return (
{/* 페이지 제목 */}

메일 관리 대시보드

메일 시스템의 전체 현황을 확인합니다

{/* 통계 카드 */}
{statCards.map((stat, index) => (

{stat.title}

{stat.value}

))}
{/* 이번 달 통계 */}
이번 달 발송 통계
총 발송 건수 {stats.sentThisMonth}건
성공률 {stats.successRate}%
전월 대비 12% 증가
최근 활동

최근 활동이 없습니다

{/* 빠른 액세스 */} 빠른 액세스 {/* 안내 정보 */} 메일 관리 시스템 안내

💡 메일 관리 시스템의 주요 기능을 확인하세요!

  • SMTP 계정을 등록하여 메일 발송
  • 드래그 앤 드롭으로 템플릿 디자인
  • 동적 변수와 SQL 쿼리 연동
  • 발송 통계 및 이력 관리
); }