import { useMemo } from "react" import type { Author, Lineage, Repo } from "@/lib/types" import { relName, T } from "@/lib/i18n" import { num as fmt, hfUrl } from "@/lib/format" import { relColor } from "@/components/rel" import { Who } from "@/components/who" export function TopModels({ repos, authors }: { repos: Repo[]; authors: Record }) { const top = useMemo(() => [...repos].sort((a, b) => (b.dl30 ?? 0) - (a.dl30 ?? 0)).slice(0, 10), [repos]) const max = Math.max(1, ...top.map((r) => r.dl30 ?? 0)) return (
    {top.map((r) => { const [owner, name] = r.id.split("/") return (
  1. {owner}/{name} {fmt(r.dl30)}
    {relName(r.rel)}
  2. ) })}
) } export function TopAuthors({ L, authors }: { L: Lineage; authors: Record }) { const top = (L.top_authors ?? []).slice(0, 10) const max = Math.max(1, ...top.map((a) => a.n)) return (
    {top.map((t) => (
  1. ))}
) }