import type { RecentActivityItem } from "@/shared/types"; import { formatRelativeTime } from "../shared/lib/format"; const ROW_H = 28; // px,无缝滚动依赖统一行高 const VISIBLE = 3; function badge(r: RecentActivityItem) { if (r.type === "project_submitted") { return ( New project ); } if (r.type === "disclosed") { return ( Disclosed · {r.meta} ); } // scan_completed with findings return ( {(r.meta ?? "").replace(" findings", "")} findings ); } /** 欢迎页滚动信息流(无边框、左右透明渐变):new project / new finding 摘要,无缝纵滚,hover 暂停 */ export function EventTicker({ events }: { events: RecentActivityItem[] | undefined }) { const items = (events ?? []) .filter( (r) => r.type === "project_submitted" || r.type === "disclosed" || (r.type === "scan_completed" && r.meta && !r.meta.startsWith("+0")), ) .slice(0, 8); if (items.length === 0) return null; const row = (r: RecentActivityItem, key: string) => (
  • {badge(r)} {r.full_name ?? r.text} {formatRelativeTime(r.ts)}
  • ); return (
    ); }