import { useEffect, useRef, useState } from "react" import { ArrowLeft, ArrowRight, ArrowUpRight } from "lucide-react" import type { Release, Site } from "@/lib/types" import { full, hfUrl, mdy, num } from "@/lib/format" import { href } from "@/lib/route" import { Tile } from "@/components/media" import { T } from "@/lib/i18n" /** Every release in order, as minimax.io shows its flagship models: a card with the model's * picture, its name and date, and the community it has today. */ export function ReleaseRail({ site }: { site: Site }) { const rail = useRef(null) const [edge, setEdge] = useState({ start: true, end: false }) const rels = [...site.releases].sort((a, b) => a.date.localeCompare(b.date)) const sync = () => { const el = rail.current if (!el) return setEdge({ start: el.scrollLeft < 8, end: el.scrollLeft + el.clientWidth > el.scrollWidth - 8 }) } useEffect(() => { const el = rail.current if (!el) return el.scrollLeft = el.scrollWidth // newest in view; history is a scroll away sync() }, []) const page = (dir: number) => rail.current?.scrollBy({ left: dir * rail.current.clientWidth * 0.8, behavior: "smooth" }) return (

{T.everyRelease}

{[-1, 1].map((d) => ( ))}
    {rels.map((r) => )}
) } function Card({ r }: { r: Release }) { const external = !r.page return (
  • {r.name.replace(/-/g, " ")} {external && }
    {mdy(r.date)}
    {full(r.n)}
    {T.railCommunity}
    {num(r.official.dlall)}
    {T.railDownloads}
  • ) }