import Link from "next/link";
import {
Flame,
Users,
MessageCircle,
Heart,
UserPlus,
Link2,
Megaphone,
BarChart3,
PenLine,
} from "lucide-react";
import type {
PostListItem,
ActiveUser,
OverviewStats,
AnnouncementSummary,
NewUser,
CheckinStatus,
} from "@/lib/api";
import Avatar from "@/components/Avatar";
import CheckinCard from "./CheckinCard";
import { FRIEND_LINKS } from "@/lib/friendLinks";
import { formatCompact, formatShortDate } from "@/lib/format";
/* ---------- 站点数据(2×2 极简统计表) ---------- */
function StatCell({
index,
label,
value,
foot,
}: {
index: number;
label: string;
value: string;
foot: string;
}) {
const rightCol = index % 2 === 1;
const bottomRow = index >= 2;
return (
);
}
function PulseCard({ stats }: { stats: OverviewStats }) {
return (
);
}
/* ---------- 站点公告 ---------- */
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) => (
-
{i + 1}
{p.title}
{p.comment_count}
{p.like_count}
))}
)}
);
}
/* ---------- 最新注册 ---------- */
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({
hot,
activeUsers,
announcements,
newUsers,
checkin,
}: Omit) {
return (
);
}