mirror of
https://github.com/joeseesun/wechat-radar.git
synced 2026-09-08 03:38:30 +09:00
Publish updated WeChat Radar
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Link from 'next/link';
|
||||
import { Flame } from 'lucide-react';
|
||||
import { FileText, Flame } from 'lucide-react';
|
||||
|
||||
export interface ActiveGroup {
|
||||
chatroom_id: string;
|
||||
@@ -9,7 +9,7 @@ export interface ActiveGroup {
|
||||
top_senders: Array<{ sender: string; count: number }>;
|
||||
}
|
||||
|
||||
export default function ActiveGroupsList({ groups }: { groups: ActiveGroup[] }) {
|
||||
export default function ActiveGroupsList({ groups, date }: { groups: ActiveGroup[]; date?: string }) {
|
||||
const max = groups[0]?.total ?? 1;
|
||||
return (
|
||||
<div className="card p-5">
|
||||
@@ -19,7 +19,7 @@ export default function ActiveGroupsList({ groups }: { groups: ActiveGroup[] })
|
||||
智能活跃群
|
||||
</div>
|
||||
<div className="text-[11px] text-[var(--text-3)]">
|
||||
去噪后 {groups.length} 个 · 综合排序
|
||||
去噪后 {groups.length} 个 · 前 10 个有日报入口
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function ActiveGroupsList({ groups }: { groups: ActiveGroup[] })
|
||||
) : (
|
||||
<div className="space-y-1">
|
||||
{groups.slice(0, 12).map((g, i) => (
|
||||
<Row key={g.chatroom_id} group={g} rank={i + 1} max={max} />
|
||||
<Row key={g.chatroom_id} group={g} rank={i + 1} max={max} date={date} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
@@ -38,42 +38,69 @@ export default function ActiveGroupsList({ groups }: { groups: ActiveGroup[] })
|
||||
);
|
||||
}
|
||||
|
||||
function Row({ group, rank, max }: { group: ActiveGroup; rank: number; max: number }) {
|
||||
function Row({
|
||||
group,
|
||||
rank,
|
||||
max,
|
||||
date,
|
||||
}: {
|
||||
group: ActiveGroup;
|
||||
rank: number;
|
||||
max: number;
|
||||
date?: string;
|
||||
}) {
|
||||
const initial = group.name.slice(0, 2);
|
||||
const senders = group.top_senders
|
||||
.slice(0, 3)
|
||||
.map((s) => s.sender)
|
||||
.join(' · ');
|
||||
const pct = (group.total / max) * 100;
|
||||
const groupHref = `/groups/${encodeURIComponent(group.chatroom_id)}${date ? `?date=${date}` : ''}`;
|
||||
const reportHref = `/reports/groups/${encodeURIComponent(group.chatroom_id)}?date=${date}`;
|
||||
|
||||
return (
|
||||
<Link
|
||||
href={`/groups/${encodeURIComponent(group.chatroom_id)}`}
|
||||
className="grid grid-cols-[24px_36px_1fr_70px] items-center gap-3 rounded-md px-2 py-2 transition-colors hover:bg-[var(--surface-2)]"
|
||||
>
|
||||
<span className="rounded bg-[var(--surface-2)] py-0.5 text-center text-[10px] tabular-nums text-[var(--text-3)]">
|
||||
{rank}
|
||||
</span>
|
||||
<div className="flex h-8 w-8 items-center justify-center rounded-md border border-[var(--border-soft)] bg-[var(--surface-2)] text-[11px] text-[var(--text-2)]">
|
||||
{initial}
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<div className="truncate text-[13px] text-[var(--text)]">{group.name}</div>
|
||||
{senders && (
|
||||
<div className="truncate text-[11px] text-[var(--text-3)]">{senders}</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-right">
|
||||
<div className="text-[14px] font-semibold tabular-nums text-[var(--text)]">
|
||||
{group.total.toLocaleString()}
|
||||
<div className="grid grid-cols-[1fr_auto] items-center gap-2 rounded-md px-2 py-2 transition-colors hover:bg-[var(--surface-2)]">
|
||||
<Link
|
||||
href={groupHref}
|
||||
className="grid min-w-0 grid-cols-[24px_36px_1fr_88px] items-center gap-3"
|
||||
title="查看群详情"
|
||||
>
|
||||
<span className="rounded bg-[var(--surface-2)] py-0.5 text-center text-[10px] tabular-nums text-[var(--text-3)]">
|
||||
{rank}
|
||||
</span>
|
||||
<div className="flex h-8 w-8 items-center justify-center rounded-md border border-[var(--border-soft)] bg-[var(--surface-2)] text-[11px] text-[var(--text-2)]">
|
||||
{initial}
|
||||
</div>
|
||||
<div className="mt-1 h-1 overflow-hidden rounded-full bg-[var(--surface-2)]">
|
||||
<div
|
||||
className="h-full rounded-full bg-[var(--accent)]"
|
||||
style={{ width: `${pct}%` }}
|
||||
/>
|
||||
<div className="min-w-0">
|
||||
<div className="truncate text-[13px] text-[var(--text)]">{group.name}</div>
|
||||
{senders && (
|
||||
<div className="truncate text-[11px] text-[var(--text-3)]">{senders}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<div className="text-right">
|
||||
<div className="text-[14px] font-semibold tabular-nums text-[var(--text)]">
|
||||
{group.total.toLocaleString()}
|
||||
</div>
|
||||
<div className="mt-1 h-1 overflow-hidden rounded-full bg-[var(--surface-2)]">
|
||||
<div
|
||||
className="h-full rounded-full bg-[var(--accent)]"
|
||||
style={{ width: `${pct}%` }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
{rank <= 10 && date ? (
|
||||
<Link
|
||||
href={reportHref}
|
||||
className="inline-flex h-7 items-center gap-1 rounded border border-[var(--border-soft)] bg-[var(--accent-soft)] px-2 text-[11px] font-medium text-[var(--accent)] transition-colors hover:border-[var(--accent)]"
|
||||
title="查看群日报"
|
||||
>
|
||||
<FileText size={12} />
|
||||
日报
|
||||
</Link>
|
||||
) : (
|
||||
<span className="w-[52px]" />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user