"use client"; import Link from "next/link"; import { ChevronRight, Trophy } from "lucide-react"; import type { Artist } from "@/types/artist"; import { cn } from "@/lib/cn"; import ArtistPortrait from "./cards/ArtistPortrait"; interface Top12BarProps { artists: Artist[]; /** 是否显示头部标题 */ showHeader?: boolean; } function formatVotes(v: number): string { if (v >= 10_000) return `${(v / 10_000).toFixed(1)}W 票`; return `${v.toLocaleString()} 票`; } export default function Top12Bar({ artists, showHeader = true }: Top12BarProps) { // Top12 出道位 只看「真正有票」的人 —— 0 票时不靠编号兜底占位 const top12 = artists.filter((a) => a.votes > 0).slice(0, 12); return (
{showHeader && (

实时 Top12 出道位

查看完整榜单
)} {top12.length === 0 ? ( ) : ( // 12 张胶囊卡片 · grid 等分铺满,无滚动 · 无外边框无背景
{top12.map((artist) => ( ))}
)}
); } function Top12Empty() { return (

Awaiting Votes

出道位尚未产生 · 等你为 ta 投下第一票

); } function Top12Card({ artist }: { artist: Artist }) { const inTop3 = artist.rank <= 3; return ( {/* 外层 relative,徽章可以完整显示在外面,不会被卡片圆角裁切 */}
{/* 卡片本体:2:3 矩形,上下两端 = 半圆(rounded-full 在 2:3 矩形上 = 胶囊形) */}
{/* 排名徽章 · 完整悬浮在卡片左上角(外层定位,不被 overflow 裁切) */} {artist.rank}
{/* 卡片下方 · 名字 + 票数 */}
{artist.name}
{formatVotes(artist.votes)}
); }