import { Template } from "interface/template";
import { Container, Heading, Text, Box, Flex, Card } from "@radix-ui/themes";
import {
BarChartIcon,
ReaderIcon,
ChatBubbleIcon,
PersonIcon,
EyeOpenIcon,
HeartIcon,
RocketIcon,
LayersIcon,
} from "@radix-ui/react-icons";
import { useMemo } from "react";
// 模拟统计数据
const stats = [
{
label: "文章总数",
value: "128",
icon: ,
trend: "+12%",
color: "var(--accent-9)",
},
{
label: "总访问量",
value: "25,438",
icon: ,
trend: "+8.2%",
color: "var(--green-9)",
},
{
label: "评论数",
value: "1,024",
icon: ,
trend: "+5.4%",
color: "var(--blue-9)",
},
{
label: "用户互动",
value: "3,842",
icon: ,
trend: "+15.3%",
color: "var(--pink-9)",
},
];
// 模拟最近文章数据
const recentPosts = [
{
title: "构建现代化的前端开发工作流",
views: 1234,
comments: 23,
likes: 89,
status: "published",
},
{
title: "React 18 新特性详解",
views: 892,
comments: 15,
likes: 67,
status: "published",
},
{
title: "TypeScript 高级特性指南",
views: 756,
comments: 12,
likes: 45,
status: "draft",
},
{
title: "前端性能优化实践",
views: 645,
comments: 8,
likes: 34,
status: "published",
},
];
export default new Template({}, ({ http, args }) => {
return (
{/* 页面标题 */}
仪表盘
{/* 统计卡片 */}
{stats.map((stat, index) => (
{stat.label}
{stat.value}
{stat.trend}
{stat.icon}
))}
{/* 最近文章列表 */}
最近文章
{recentPosts.map((post, index) => (
{post.title}
{post.views}
{post.comments}
{post.likes}
{post.status === 'published' ? '已发布' : '草稿'}
))}
);
});