import Link from "next/link"; import { Flame, Users, MessageCircle, Heart, MessageSquareText, UserPlus, Link2, } from "lucide-react"; import type { PostListItem, ActiveUser, OverviewStats, LatestComment, NewUser, CheckinStatus, } from "@/lib/api"; import Avatar from "@/components/Avatar"; import CheckinCard from "./CheckinCard"; import { FRIEND_LINKS } from "@/lib/friendLinks"; import { formatRelative } from "@/lib/format"; /* ---------- 品牌卡 ---------- */ function BrandCard({ stats }: { stats: OverviewStats }) { const items: { num: number; label: string }[] = [ { num: stats.posts, label: "帖子" }, { num: stats.comments, label: "回复" }, { num: stats.users, label: "用户" }, ]; return ( 姜十三论坛 分享技术、讨论问题、交流心得 {items.map((it) => ( {it.num} {it.label} ))} ); } /* ---------- 最新评论 ---------- */ function LatestComments({ comments }: { comments: LatestComment[] }) { if (comments.length === 0) return null; return ( 最新评论 {comments.map((c) => { const name = c.user.nickname || c.user.username; return ( {name} {c.content} {c.post.title} {formatRelative(c.created_at)} ); })} ); } /* ---------- 热门榜 ---------- */ function HotRanking({ posts }: { posts: PostListItem[] }) { return ( 热门讨论 {posts.length === 0 ? ( 还没有热门讨论 ) : ( {posts.map((p, i) => ( {i + 1} {p.title} {p.comment_count} {p.like_count} {p.board.name} ))} )} ); } /* ---------- 最新注册 ---------- */ 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 ? ( 近 14 天还没有人互动 ) : ( {users.map((u) => ( {u.nickname || u.username} {u.activity_count} 次 ))} )} 按近 14 天发帖与评论计数 ); } /* ---------- 友情链接 ---------- */ function FriendLinks() { return ( 友情链接 申请 {FRIEND_LINKS.map((l) => l.href.startsWith("http") ? ( {l.name} ) : ( {l.name} ) )} ); } /* ---------- 桌面 / 移动两种装配 ---------- */ type PanelsProps = { stats: OverviewStats; hot: PostListItem[]; activeUsers: ActiveUser[]; latestComments: LatestComment[]; newUsers: NewUser[]; checkin?: CheckinStatus | null; }; export function CommunityPanels({ stats, hot, activeUsers, latestComments, newUsers, checkin, }: PanelsProps) { return ( ); } export function CommunityPanelsMobile({ hot, activeUsers, latestComments, newUsers, checkin, }: Omit) { return ( ); }
姜十三论坛
分享技术、讨论问题、交流心得
{it.num}
{it.label}
最新评论
热门讨论
还没有热门讨论
最新注册
活跃成员
近 14 天还没有人互动
按近 14 天发帖与评论计数
友情链接 申请