import Link from "next/link"; import { BarChart3, Flame, Users, MessagesSquare, MessageCircle, Heart, Sparkles } from "lucide-react"; import type { OverviewStats, PostListItem, ActiveUser } from "@/lib/api"; import Avatar from "@/components/Avatar"; /* ---------- 统计 2×2 ---------- */ function StatsGrid({ stats }: { stats: OverviewStats }) { const items = [ { icon: MessagesSquare, label: "讨论", value: stats.posts }, { icon: Users, label: "成员", value: stats.users }, { icon: MessageCircle, label: "评论", value: stats.comments }, { icon: Sparkles, label: "今日", value: stats.today_posts }, ]; return (

社区数据

{items.map(({ icon: Icon, label, value }) => (
{value} {label}
))}
); } /* ---------- 热门榜 ---------- */ function HotRanking({ posts }: { posts: PostListItem[] }) { return (

热门讨论

{posts.length === 0 ? (

还没有热门讨论

) : (
    {posts.map((p, i) => (
  1. {i + 1} {p.title} {p.comment_count} {p.like_count} {p.board.name}
  2. ))}
)}
); } /* ---------- 活跃用户 ---------- */ function ActiveUsers({ users }: { users: ActiveUser[] }) { return (

活跃成员

{users.length === 0 ? (

近 14 天还没有人互动

) : ( )}

按近 14 天发帖与评论计数

); } /* ---------- 桌面 / 移动两种装配 ---------- */ export function CommunityPanels({ stats, hot, activeUsers, }: { stats: OverviewStats; hot: PostListItem[]; activeUsers: ActiveUser[]; }) { return ( ); } export function CommunityPanelsMobile({ stats, hot, activeUsers, }: { stats: OverviewStats; hot: PostListItem[]; activeUsers: ActiveUser[]; }) { return (
); }