"use client"; import Link from "next/link"; import { Coins, Flame, Gift, TrendingUp } from "lucide-react"; import type { EconomyStats } from "@/lib/api"; import { postTypeLabel } from "@/lib/postMeta"; import { pointReasonLabel } from "@/lib/points"; import { formatRelative } from "@/lib/format"; import { AdminPageHeader, AdminStatCard } from "@/components/admin"; import { AdminChartCard, DeltaBarChart, NamedBarChart, NamedPieChart, SingleAreaChart, } from "@/components/admin/charts"; const fmt = (n: number) => n.toLocaleString("zh-CN"); function netDeltaLabel(n: number) { if (n > 0) return `+${fmt(n)}`; return fmt(n); } export default function EconomyClient({ stats }: { stats: EconomyStats }) { const checkinSeries = (stats.checkin_series || []).map((d) => ({ date: d.date, count: d.count, })); const ledgerByReason = (stats.ledger_by_reason || []).map((r) => ({ label: pointReasonLabel(r.key || r.label), count: r.count, })); const deltaSeries = stats.delta_series || []; const postsByType = Object.entries(stats.posts_by_type || {}) .map(([t, n]) => ({ label: postTypeLabel(t), count: Number(n) || 0 })) .filter((d) => d.count > 0) .sort((a, b) => b.count - a.count); const net = stats.net_delta_7d ?? 0; return (
暂无签到数据
) : (暂无流水
) : (暂无数据
) : (暂无数据
) : (暂无流水
) : ({pointReasonLabel(it.reason)} {it.note ? ` · ${it.note}` : ""}
{formatRelative(it.created_at)}
用户可在{" "} /points {" "} 查看个人流水。