'use client'; import { useSetPageInfo } from '@/components/providers/dashboard-provider'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@nice/ui/components/card'; import { Badge } from '@nice/ui/components/badge'; import { Button } from '@nice/ui/components/button'; import { Progress } from '@nice/ui/components/progress'; import { IconFileText, IconEye, IconHeart, IconCloud, IconTrendingUp, IconTrendingDown, IconBell, IconCalendar, IconClock, IconEdit, IconShare, IconBookmark, IconChartBar, IconDatabase, IconFolder, IconDownload, IconUpload, } from '@tabler/icons-react'; // 模拟用户个人数据 const userStats = { articles: { total: 24, published: 18, draft: 6, totalViews: 15420, totalLikes: 892, thisMonth: 3, growth: '+12%', }, storage: { used: '1.2GB', total: '5GB', usedBytes: 1288490189, totalBytes: 5368709120, filesCount: 156, foldersCount: 12, }, engagement: { avgViews: 642, avgLikes: 37, comments: 234, shares: 89, bookmarks: 156, }, }; const recentNotifications = [ { id: 1, type: 'like', message: '您的文章《Next.js 最佳实践》收到了新的点赞', time: '5分钟前', unread: true }, { id: 2, type: 'comment', message: '用户李四评论了您的文章《TypeScript 进阶指南》', time: '1小时前', unread: true }, { id: 3, type: 'follow', message: '用户王五关注了您', time: '2小时前', unread: false }, { id: 4, type: 'system', message: '您的存储空间使用已达到60%', time: '6小时前', unread: false }, ]; const recentArticles = [ { id: 1, title: 'Next.js 最佳实践指南', status: 'published', views: 1240, likes: 89, publishedAt: '2024-01-15' }, { id: 2, title: 'TypeScript 进阶技巧', status: 'published', views: 856, likes: 67, publishedAt: '2024-01-12' }, { id: 3, title: 'React Hooks 深度解析', status: 'draft', views: 0, likes: 0, publishedAt: null }, { id: 4, title: 'Tailwind CSS 实战教程', status: 'published', views: 1523, likes: 124, publishedAt: '2024-01-08' }, ]; const quickActions = [ { title: '写新文章', icon: IconEdit, href: '/editor', description: '开始创作新的文章' }, { title: '上传文件', icon: IconUpload, href: '/resource', description: '上传文件到云盘' }, // { title: '查看统计', icon: IconChartBar, href: '/articles/analytics', description: '查看文章数据分析' }, // { title: '管理文件', icon: IconFolder, href: '/drive', description: '管理您的云盘文件' }, ]; function StatsCard({ title, value, description, icon: Icon, trend, trendValue, className = '', }: { title: string; value: string | number; description: string; icon: any; trend?: 'up' | 'down'; trendValue?: string; className?: string; }) { return ( {title}
{value}
{description} {trend && trendValue && (
{trend === 'up' ? ( ) : ( )} {trendValue}
)}
); } function StorageCard() { const usagePercent = Math.round((userStats.storage.usedBytes / userStats.storage.totalBytes) * 100); return ( 存储使用情况 您的云盘存储空间使用状态
已使用空间 {userStats.storage.used} / {userStats.storage.total}
{usagePercent}% 已使用 {100 - usagePercent}% 可用
{userStats.storage.filesCount}
文件数量
{userStats.storage.foldersCount}
文件夹数量
); } function NotificationsCard() { const getNotificationIcon = (type: string) => { switch (type) { case 'like': return ; case 'comment': return ; case 'follow': return ; case 'system': return ; default: return ; } }; return (
最新通知
{recentNotifications.filter((n) => n.unread).length}
您的最新消息和通知
{recentNotifications.slice(0, 4).map((notification) => (
{getNotificationIcon(notification.type)}

{notification.message}

{notification.time} {notification.unread &&
}
))}
); } function RecentArticlesCard() { const getStatusBadge = (status: string) => { switch (status) { case 'published': return 已发布; case 'draft': return 草稿; default: return 其他; } }; return ( 最近文章 您最近创作的文章
{recentArticles.map((article) => (

{article.title}

{getStatusBadge(article.status)}
{article.views}
{article.likes}
{article.publishedAt && (
{article.publishedAt}
)}
))}
); } function QuickActionsCard() { return ( 快捷操作 常用功能快速入口
{quickActions.map((action, index) => ( ))}
); } export default function DashboardPage() { // 设置页面信息 useSetPageInfo({ title: '我的仪表盘', subtitle: '欢迎回来,查看您的创作数据和最新动态', }); return (
{/* 统计卡片 */}
{/* 详细信息第一行 */}
{/* 详细信息第二行 */}
); }