import Link from "next/link"; import { Flame, Users, MessageCircle, Heart, UserPlus, Link2, Megaphone, BarChart3, PenLine, Activity, TrendingUp, } from "lucide-react"; import type { PostListItem, ActiveUser, OverviewStats, AnnouncementSummary, NewUser, CheckinStatus, } from "@/lib/api"; import Avatar from "@/components/Avatar"; import { PulseCheckin } from "./CheckinCard"; import { FRIEND_LINKS } from "@/lib/friendLinks"; import { formatCompact, formatShortDate } from "@/lib/format"; /* ---------- 站点数据(2×2 bento 统计瓦片) ---------- */ function PulseCard({ stats, checkin }: { stats: OverviewStats; checkin?: CheckinStatus | null }) { const cells = [ { icon: , label: "注册用户", value: formatCompact(stats.users), foot: `+${formatCompact(stats.today_users)} 今日`, up: true, }, { icon: , label: "话题总数", value: formatCompact(stats.posts), foot: `+${formatCompact(stats.today_posts)} 今日`, up: true, }, { icon: , label: "回复总数", value: formatCompact(stats.comments), foot: `+${formatCompact(stats.today_comments)} 今日`, up: true, }, { icon: , label: "在线用户", value: formatCompact(stats.online), foot: `峰值 ${formatCompact(stats.peak_online)}`, up: false, }, ]; return (

站点数据

{cells.map((c) => (

{c.label}

{c.value}

{c.up &&

))}
); } /* ---------- 站点公告 ---------- */ function Announcements({ items }: { items: AnnouncementSummary[] }) { return (

站点公告

{items.length === 0 ? (

暂无公告

) : (
    {items.map((a) => (
  • {a.tag} {formatShortDate(a.created_at)} {a.title}
  • ))}
)}
); } /* ---------- 热门榜 ---------- */ function HotRanking({ posts }: { posts: PostListItem[] }) { return (

热门讨论

{posts.length === 0 ? (

还没有热门讨论

) : (
    {posts.map((p, i) => (
  1. {i + 1} {p.title} {p.comment_count} {p.like_count}
  2. ))}
)}
); } /* ---------- 最新注册 ---------- */ function NewUsers({ users }: { users: NewUser[] }) { if (users.length === 0) return null; return (

最新注册

    {users.map((u) => { const name = u.nickname || u.username; return (
  • {name}
  • ); })}
); } /* ---------- 活跃成员(本周发帖 / 回复) ---------- */ function ActiveUsers({ users }: { users: ActiveUser[] }) { return (

活跃成员 本周

{users.length === 0 ? (

本周还没有人互动

) : (
    {users.map((u) => { const name = u.nickname || u.username; return (
  • {name} 发帖 {u.post_count} 回复 {u.comment_count} {u.post_count + u.comment_count}
  • ); })}
)}
); } /* ---------- 友情链接 ---------- */ function FriendLinks() { return (

友情链接 申请

{FRIEND_LINKS.map((l) => l.href.startsWith("http") ? ( {l.name} ) : ( {l.name} ) )}
); } /* ---------- 桌面 / 移动两种装配 ---------- */ type PanelsProps = { stats: OverviewStats; hot: PostListItem[]; activeUsers: ActiveUser[]; announcements: AnnouncementSummary[]; newUsers: NewUser[]; checkin?: CheckinStatus | null; }; export function CommunityPanels({ stats, hot, activeUsers, announcements, newUsers, checkin, }: PanelsProps) { return ( ); } export function CommunityPanelsMobile({ stats, hot, activeUsers, announcements, newUsers, checkin, }: PanelsProps) { return (
); }