code: sync from git
Browse files- code/web/package-lock.json +20 -0
- code/web/package.json +2 -0
- code/web/public/media/hero-image.jpg +3 -0
- code/web/public/media/hero-image.mp4 +3 -0
- code/web/public/media/hero-language.jpg +3 -0
- code/web/public/media/hero-language.mp4 +3 -0
- code/web/public/media/hero-music.jpg +3 -0
- code/web/public/media/hero-music.mp4 +3 -0
- code/web/public/media/hero-video.jpg +3 -0
- code/web/public/media/hero-video.mp4 +3 -0
- code/web/public/media/tile-image.jpg +3 -0
- code/web/public/media/tile-image.mp4 +3 -0
- code/web/public/media/tile-language.jpg +3 -0
- code/web/public/media/tile-language.mp4 +3 -0
- code/web/public/media/tile-music.jpg +3 -0
- code/web/public/media/tile-music.mp4 +3 -0
- code/web/public/media/tile-video.jpg +3 -0
- code/web/public/media/tile-video.mp4 +3 -0
- code/web/src/components/category-blocks.tsx +15 -20
- code/web/src/components/community-chart.tsx +27 -32
- code/web/src/components/galaxy.tsx +182 -117
- code/web/src/components/layout.tsx +21 -33
- code/web/src/components/lockup.tsx +36 -0
- code/web/src/components/logo.tsx +12 -0
- code/web/src/components/media.tsx +42 -0
- code/web/src/components/release-rail.tsx +25 -34
- code/web/src/components/segmented.tsx +4 -4
- code/web/src/components/site-header.tsx +14 -16
- code/web/src/hooks/motion.ts +30 -0
- code/web/src/index.css +76 -58
- code/web/src/lib/category.ts +1 -1
- code/web/src/main.tsx +1 -5
- code/web/src/pages/category.tsx +33 -29
- code/web/src/pages/home.tsx +55 -51
code/web/package-lock.json
CHANGED
|
@@ -10,6 +10,8 @@
|
|
| 10 |
"dependencies": {
|
| 11 |
"@fontsource-variable/dm-sans": "^5.2.8",
|
| 12 |
"@fontsource-variable/outfit": "^5.3.0",
|
|
|
|
|
|
|
| 13 |
"@tailwindcss/vite": "^4.3.5",
|
| 14 |
"class-variance-authority": "^0.7.1",
|
| 15 |
"cn": "^0.5.2",
|
|
@@ -715,6 +717,24 @@
|
|
| 715 |
"url": "https://github.com/sponsors/ayuhito"
|
| 716 |
}
|
| 717 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 718 |
"node_modules/@jridgewell/gen-mapping": {
|
| 719 |
"version": "0.3.13",
|
| 720 |
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
|
|
|
| 10 |
"dependencies": {
|
| 11 |
"@fontsource-variable/dm-sans": "^5.2.8",
|
| 12 |
"@fontsource-variable/outfit": "^5.3.0",
|
| 13 |
+
"@fontsource/abhaya-libre": "^5.3.0",
|
| 14 |
+
"@fontsource/libre-baskerville": "^5.3.0",
|
| 15 |
"@tailwindcss/vite": "^4.3.5",
|
| 16 |
"class-variance-authority": "^0.7.1",
|
| 17 |
"cn": "^0.5.2",
|
|
|
|
| 717 |
"url": "https://github.com/sponsors/ayuhito"
|
| 718 |
}
|
| 719 |
},
|
| 720 |
+
"node_modules/@fontsource/abhaya-libre": {
|
| 721 |
+
"version": "5.3.0",
|
| 722 |
+
"resolved": "https://registry.npmjs.org/@fontsource/abhaya-libre/-/abhaya-libre-5.3.0.tgz",
|
| 723 |
+
"integrity": "sha512-4T/+zRKIvpzBa235ihU4f8DicGMsFYvy9yoS2HT7s+MRw20ewX4ugawE1M3gCTKMcbLbv9WZ4AnwWzMyIIhcjg==",
|
| 724 |
+
"license": "OFL-1.1",
|
| 725 |
+
"funding": {
|
| 726 |
+
"url": "https://github.com/sponsors/ayuhito"
|
| 727 |
+
}
|
| 728 |
+
},
|
| 729 |
+
"node_modules/@fontsource/libre-baskerville": {
|
| 730 |
+
"version": "5.3.0",
|
| 731 |
+
"resolved": "https://registry.npmjs.org/@fontsource/libre-baskerville/-/libre-baskerville-5.3.0.tgz",
|
| 732 |
+
"integrity": "sha512-IA6OLq36/JWMX70Fha15sri2qWsijFh7hgdDXCRZHjKUHtWarLQoiGilvm7iMqm7HiYFEv9acF3+IuRHO9kUiA==",
|
| 733 |
+
"license": "OFL-1.1",
|
| 734 |
+
"funding": {
|
| 735 |
+
"url": "https://github.com/sponsors/ayuhito"
|
| 736 |
+
}
|
| 737 |
+
},
|
| 738 |
"node_modules/@jridgewell/gen-mapping": {
|
| 739 |
"version": "0.3.13",
|
| 740 |
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
code/web/package.json
CHANGED
|
@@ -12,6 +12,8 @@
|
|
| 12 |
"dependencies": {
|
| 13 |
"@fontsource-variable/dm-sans": "^5.2.8",
|
| 14 |
"@fontsource-variable/outfit": "^5.3.0",
|
|
|
|
|
|
|
| 15 |
"@tailwindcss/vite": "^4.3.5",
|
| 16 |
"class-variance-authority": "^0.7.1",
|
| 17 |
"cn": "^0.5.2",
|
|
|
|
| 12 |
"dependencies": {
|
| 13 |
"@fontsource-variable/dm-sans": "^5.2.8",
|
| 14 |
"@fontsource-variable/outfit": "^5.3.0",
|
| 15 |
+
"@fontsource/abhaya-libre": "^5.3.0",
|
| 16 |
+
"@fontsource/libre-baskerville": "^5.3.0",
|
| 17 |
"@tailwindcss/vite": "^4.3.5",
|
| 18 |
"class-variance-authority": "^0.7.1",
|
| 19 |
"cn": "^0.5.2",
|
code/web/public/media/hero-image.jpg
ADDED
|
Git LFS Details
|
code/web/public/media/hero-image.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d78767ec4c310b4bb871fcc4933d8168899547e5947bd7fca5d068008d530c29
|
| 3 |
+
size 1394375
|
code/web/public/media/hero-language.jpg
ADDED
|
Git LFS Details
|
code/web/public/media/hero-language.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e685161a4dbb765e8a888036dbb88914083b4cbf18abc4d6e4a557340e62a59c
|
| 3 |
+
size 1218623
|
code/web/public/media/hero-music.jpg
ADDED
|
Git LFS Details
|
code/web/public/media/hero-music.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fb386ab2d366df828456756f008895aa3b565be85b74490a467ea5a3c4234c3b
|
| 3 |
+
size 147551
|
code/web/public/media/hero-video.jpg
ADDED
|
Git LFS Details
|
code/web/public/media/hero-video.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a5da3d1f7ec6e454af7e73de366561e7f9df734450c4d4d736dfdc6cbd4411e6
|
| 3 |
+
size 1288000
|
code/web/public/media/tile-image.jpg
ADDED
|
Git LFS Details
|
code/web/public/media/tile-image.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:717a1a7f08b80401f8b46ecf210a708a9243f873060b391202a55070632ea115
|
| 3 |
+
size 118155
|
code/web/public/media/tile-language.jpg
ADDED
|
Git LFS Details
|
code/web/public/media/tile-language.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:568d347a5562d0b7b6b10566072e861e386c0a2d53f1201666a2c22ab32ebf61
|
| 3 |
+
size 22680
|
code/web/public/media/tile-music.jpg
ADDED
|
Git LFS Details
|
code/web/public/media/tile-music.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:11b26f805b71d83f7876e01a33eaca1b42c1c01c47260c0ce4c62262c1246588
|
| 3 |
+
size 37798
|
code/web/public/media/tile-video.jpg
ADDED
|
Git LFS Details
|
code/web/public/media/tile-video.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:71c6bebea684623b710e33562f7ab7c85f56a6a14c55e66bda7e6ff3a7ebade7
|
| 3 |
+
size 43163
|
code/web/src/components/category-blocks.tsx
CHANGED
|
@@ -9,12 +9,12 @@ import { Spark } from "@/components/sparkline"
|
|
| 9 |
export function CategoryBlocks({ site }: { site: Site }) {
|
| 10 |
return (
|
| 11 |
<div className="grid gap-5 lg:grid-cols-2">
|
| 12 |
-
{site.categories.map((c, i) => <Block key={c.key} site={site} cat={c.key} wide={i < 2 || site.categories.length % 2 === 1 && i === site.categories.length - 1}
|
| 13 |
</div>
|
| 14 |
)
|
| 15 |
}
|
| 16 |
|
| 17 |
-
function Block({ site, cat, wide
|
| 18 |
const c = site.categories.find((x) => x.key === cat)!
|
| 19 |
const rels = c.releases.map((k) => site.releases.find((r) => r.key === k)!)
|
| 20 |
const n = rels.reduce((a, r) => a + r.n, 0)
|
|
@@ -36,32 +36,27 @@ function Block({ site, cat, wide, i }: { site: Site; cat: string; wide: boolean;
|
|
| 36 |
|
| 37 |
return (
|
| 38 |
<a href={href(cat)}
|
| 39 |
-
className={`group relative
|
| 40 |
-
style={{ animation: `rise 700ms cubic-bezier(.22,.61,.36,1) ${i * 80}ms both` }}>
|
| 41 |
-
<div aria-hidden className="absolute -top-40 -right-24 -z-10 size-[420px] rounded-full opacity-[0.16] blur-[90px] transition-opacity duration-300 group-hover:opacity-30"
|
| 42 |
-
style={{ background: `linear-gradient(135deg, ${catFrom(cat)}, ${catTo(cat)})` }} />
|
| 43 |
<div className="flex-1 p-7 sm:p-10">
|
| 44 |
<div className="flex items-start justify-between gap-4">
|
| 45 |
-
<h2 className="
|
| 46 |
-
|
| 47 |
-
{c.name}
|
| 48 |
-
</h2>
|
| 49 |
-
<span className="grid size-11 shrink-0 place-items-center rounded-full border border-border transition-[background-color,color,transform] duration-200 group-hover:rotate-45 group-hover:bg-foreground group-hover:text-background">
|
| 50 |
<ArrowUpRight className="size-5" />
|
| 51 |
</span>
|
| 52 |
</div>
|
| 53 |
|
| 54 |
<div className={`mt-8 ${wide ? "lg:flex lg:items-end lg:justify-between lg:gap-10" : ""}`}>
|
| 55 |
<div>
|
| 56 |
-
<div className="font-display text-[72px] leading-[0.9] font-semibold tracking-[-0.04em] tabular-nums sm:text-[96px]"
|
| 57 |
-
|
|
|
|
| 58 |
</div>
|
| 59 |
-
<dl className={`mt-8 grid grid-cols-2 gap-x-8 gap-y-6 ${wide ? "sm:grid-cols-4 lg:mt-0" : ""}`}>
|
| 60 |
{stats.map(([v, l]) => (
|
| 61 |
<div key={l}>
|
| 62 |
<dt className="sr-only">{l}</dt>
|
| 63 |
-
<dd className="font-
|
| 64 |
-
<dd className="mt-2 text-[15px] text-muted-foreground">{l}</dd>
|
| 65 |
</div>
|
| 66 |
))}
|
| 67 |
</dl>
|
|
@@ -71,16 +66,16 @@ function Block({ site, cat, wide, i }: { site: Site; cat: string; wide: boolean;
|
|
| 71 |
{rels.map((r) => (
|
| 72 |
<span key={r.key} className="inline-flex h-9 items-center gap-2 rounded-full bg-muted px-3.5 text-[15px]">
|
| 73 |
<span className="font-medium">{r.name}</span>
|
| 74 |
-
{r.n > 0 && <span className="
|
| 75 |
</span>
|
| 76 |
))}
|
| 77 |
</div>
|
| 78 |
|
| 79 |
{c.top_authors.length > 0 && (
|
| 80 |
-
<div className="mt-
|
| 81 |
<div className="flex -space-x-2.5">
|
| 82 |
{c.top_authors.map((a) => (
|
| 83 |
-
<span key={a.id} title={a.n} className="grid size-9 place-items-center overflow-hidden rounded-full bg-muted text-sm font-medium ring-[3px] ring-
|
| 84 |
{a.a ? <img src={a.a} alt="" loading="lazy" className="size-full object-cover" /> : a.id.slice(0, 1).toUpperCase()}
|
| 85 |
</span>
|
| 86 |
))}
|
|
@@ -92,7 +87,7 @@ function Block({ site, cat, wide, i }: { site: Site; cat: string; wide: boolean;
|
|
| 92 |
)}
|
| 93 |
</div>
|
| 94 |
<Spark events={events} from={first} to={site.today} cat={cat} height={wide ? 120 : 100}
|
| 95 |
-
dots={rels.map((r) => r.date)} />
|
| 96 |
</a>
|
| 97 |
)
|
| 98 |
}
|
|
|
|
| 9 |
export function CategoryBlocks({ site }: { site: Site }) {
|
| 10 |
return (
|
| 11 |
<div className="grid gap-5 lg:grid-cols-2">
|
| 12 |
+
{site.categories.map((c, i) => <Block key={c.key} site={site} cat={c.key} wide={i < 2 || site.categories.length % 2 === 1 && i === site.categories.length - 1} />)}
|
| 13 |
</div>
|
| 14 |
)
|
| 15 |
}
|
| 16 |
|
| 17 |
+
function Block({ site, cat, wide }: { site: Site; cat: string; wide: boolean }) {
|
| 18 |
const c = site.categories.find((x) => x.key === cat)!
|
| 19 |
const rels = c.releases.map((k) => site.releases.find((r) => r.key === k)!)
|
| 20 |
const n = rels.reduce((a, r) => a + r.n, 0)
|
|
|
|
| 36 |
|
| 37 |
return (
|
| 38 |
<a href={href(cat)}
|
| 39 |
+
className={`group relative flex flex-col overflow-hidden rounded-[24px] border border-border bg-white shadow-[var(--shadow-card)] transition-[transform,box-shadow] duration-300 ease-[cubic-bezier(.22,.61,.36,1)] hover:-translate-y-1 hover:shadow-[0_28px_56px_-24px_rgba(23,23,23,0.28)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${wide ? "lg:col-span-2" : ""}`}>
|
|
|
|
|
|
|
|
|
|
| 40 |
<div className="flex-1 p-7 sm:p-10">
|
| 41 |
<div className="flex items-start justify-between gap-4">
|
| 42 |
+
<h2 className="font-display text-[30px] leading-none font-semibold tracking-[-0.01em] sm:text-[36px]">{c.name}</h2>
|
| 43 |
+
<span className="grid size-11 shrink-0 place-items-center rounded-full border border-border transition-[background-color,color,border-color,transform] duration-200 group-hover:rotate-45 group-hover:border-[#171717] group-hover:bg-[#171717] group-hover:text-white">
|
|
|
|
|
|
|
|
|
|
| 44 |
<ArrowUpRight className="size-5" />
|
| 45 |
</span>
|
| 46 |
</div>
|
| 47 |
|
| 48 |
<div className={`mt-8 ${wide ? "lg:flex lg:items-end lg:justify-between lg:gap-10" : ""}`}>
|
| 49 |
<div>
|
| 50 |
+
<div className="gradient-text w-fit pb-1 font-display text-[72px] leading-[0.9] font-semibold tracking-[-0.04em] tabular-nums sm:text-[96px]"
|
| 51 |
+
style={{ "--from": catFrom(cat), "--to": catTo(cat) } as React.CSSProperties}>{full(n)}</div>
|
| 52 |
+
<div className="mt-2 text-lg text-muted-foreground">community models</div>
|
| 53 |
</div>
|
| 54 |
+
<dl className={`mt-8 grid grid-cols-2 gap-x-8 gap-y-6 ${wide ? "sm:grid-cols-4 lg:mt-0 lg:gap-x-12" : ""}`}>
|
| 55 |
{stats.map(([v, l]) => (
|
| 56 |
<div key={l}>
|
| 57 |
<dt className="sr-only">{l}</dt>
|
| 58 |
+
<dd className="font-serif text-[26px] leading-none">{v}</dd>
|
| 59 |
+
<dd className="mt-2.5 text-[15px] text-muted-foreground">{l}</dd>
|
| 60 |
</div>
|
| 61 |
))}
|
| 62 |
</dl>
|
|
|
|
| 66 |
{rels.map((r) => (
|
| 67 |
<span key={r.key} className="inline-flex h-9 items-center gap-2 rounded-full bg-muted px-3.5 text-[15px]">
|
| 68 |
<span className="font-medium">{r.name}</span>
|
| 69 |
+
{r.n > 0 && <span className="text-muted-foreground tabular-nums">{full(r.n)}</span>}
|
| 70 |
</span>
|
| 71 |
))}
|
| 72 |
</div>
|
| 73 |
|
| 74 |
{c.top_authors.length > 0 && (
|
| 75 |
+
<div className="mt-6 flex items-center gap-3">
|
| 76 |
<div className="flex -space-x-2.5">
|
| 77 |
{c.top_authors.map((a) => (
|
| 78 |
+
<span key={a.id} title={a.n} className="grid size-9 place-items-center overflow-hidden rounded-full bg-muted text-sm font-medium ring-[3px] ring-white">
|
| 79 |
{a.a ? <img src={a.a} alt="" loading="lazy" className="size-full object-cover" /> : a.id.slice(0, 1).toUpperCase()}
|
| 80 |
</span>
|
| 81 |
))}
|
|
|
|
| 87 |
)}
|
| 88 |
</div>
|
| 89 |
<Spark events={events} from={first} to={site.today} cat={cat} height={wide ? 120 : 100}
|
| 90 |
+
dots={rels.map((r) => r.date)} ring="#fff" />
|
| 91 |
</a>
|
| 92 |
)
|
| 93 |
}
|
code/web/src/components/community-chart.tsx
CHANGED
|
@@ -177,31 +177,28 @@ export function CommunityChart({ site, series, metric, hidden, onPick, className
|
|
| 177 |
<defs>
|
| 178 |
{keys.map((c) => (
|
| 179 |
<linearGradient key={c} id={`fill-${c}`} x1="0" y1="0" x2="0" y2="1">
|
| 180 |
-
<stop offset="0" style={{ stopColor: catColor(c), stopOpacity: 0.
|
| 181 |
-
<stop offset="1" style={{ stopColor: catColor(c), stopOpacity: 0.
|
| 182 |
</linearGradient>
|
| 183 |
))}
|
| 184 |
<linearGradient id="top-stroke" x1="0" y1="0" x2="1" y2="0">
|
| 185 |
-
<stop offset="0" stopColor="#
|
| 186 |
-
<stop offset="0.7" stopColor="#
|
| 187 |
-
<stop offset="1" stopColor="#
|
| 188 |
</linearGradient>
|
| 189 |
-
<filter id="glow" x="-10%" y="-30%" width="120%" height="160%">
|
| 190 |
-
<feGaussianBlur stdDeviation="7" />
|
| 191 |
-
</filter>
|
| 192 |
</defs>
|
| 193 |
|
| 194 |
{g.ticksY.map((v) => (
|
| 195 |
<g key={v}>
|
| 196 |
-
<line x1={m.l} x2={W - m.r} y1={g.y(v)} y2={g.y(v)} stroke="
|
| 197 |
-
<text x={W - m.r + 12} y={g.y(v)} dy="0.35em" fontSize={14} fill="
|
| 198 |
-
fillOpacity={Math.abs(g.y(v) - g.y(g.top.at(-1) ?? 0)) < 16 ? 0 :
|
| 199 |
className="font-display tabular-nums">{tick(v)}</text>
|
| 200 |
</g>
|
| 201 |
))}
|
| 202 |
{g.xt.map((tk) => (
|
| 203 |
-
<text key={tk.t} x={g.x(tk.t)} y={H - m.b + 26} textAnchor="middle" fontSize={14}
|
| 204 |
-
|
| 205 |
))}
|
| 206 |
|
| 207 |
{/* the milestones: every pole starts on the same line at the top and ends on the curve */}
|
|
@@ -209,8 +206,8 @@ export function CommunityChart({ site, series, metric, hidden, onPick, className
|
|
| 209 |
const px = g.x(p.t), py = g.y(g.valueAt(p.t))
|
| 210 |
const on = lit === p.key || near === p
|
| 211 |
return (
|
| 212 |
-
<line key={p.key} x1={px} x2={px} y1={ROW_TOP} y2={py -
|
| 213 |
-
strokeOpacity={on ? 0.
|
| 214 |
style={{ animation: `fade 500ms ease-out ${(REVEAL * (px - m.l)) / plotW}ms both` }} />
|
| 215 |
)
|
| 216 |
})}
|
|
@@ -220,10 +217,9 @@ export function CommunityChart({ site, series, metric, hidden, onPick, className
|
|
| 220 |
<path key={s.key} d={g.areaGen(s as never) ?? ""} fill={`url(#fill-${s.key})`} />
|
| 221 |
))}
|
| 222 |
{g.stacked.map((s) => (
|
| 223 |
-
<path key={s.key} d={g.edge(s as never) ?? ""} fill="none" stroke={catColor(s.key)} strokeWidth={
|
| 224 |
))}
|
| 225 |
-
<path d={g.topLine} fill="none" stroke="#
|
| 226 |
-
<path d={g.topLine} fill="none" stroke="url(#top-stroke)" strokeWidth={2.5} strokeLinecap="round" />
|
| 227 |
</g>
|
| 228 |
|
| 229 |
{g.pins.map((p) => {
|
|
@@ -231,24 +227,23 @@ export function CommunityChart({ site, series, metric, hidden, onPick, className
|
|
| 231 |
const delay = (REVEAL * (px - m.l)) / plotW
|
| 232 |
return (
|
| 233 |
<g key={`${metric}:${p.key}`} style={{ animation: `pop 520ms cubic-bezier(.34,1.56,.64,1) ${delay}ms both`, transformOrigin: `${px}px ${py}px` }}>
|
| 234 |
-
<circle cx={px} cy={py} r={
|
| 235 |
-
<circle cx={px} cy={py} r={5.5} fill={catColor(p.cat)} stroke="var(--stage)" strokeWidth={2} />
|
| 236 |
</g>
|
| 237 |
)
|
| 238 |
})}
|
| 239 |
|
| 240 |
{/* today */}
|
| 241 |
<g key={`now:${metric}`} style={{ animation: `fade 400ms ease-out ${REVEAL}ms both` }}>
|
| 242 |
-
<circle cx={g.x(last)} cy={g.y(g.top.at(-1) ?? 0)} r={14} fill="
|
| 243 |
style={{ animation: "breathe 2.8s ease-in-out infinite", transformOrigin: `${g.x(last)}px ${g.y(g.top.at(-1) ?? 0)}px` }} />
|
| 244 |
-
<circle cx={g.x(last)} cy={g.y(g.top.at(-1) ?? 0)} r={5} fill="#
|
| 245 |
</g>
|
| 246 |
|
| 247 |
{hr && (
|
| 248 |
<g pointerEvents="none">
|
| 249 |
-
<line x1={g.x(hr.t)} x2={g.x(hr.t)} y1={m.t - 8} y2={H - m.b} stroke="
|
| 250 |
{g.stacked.map((s) => (
|
| 251 |
-
<circle key={s.key} cx={g.x(hr.t)} cy={g.y(s[hover!][1])} r={4.5} fill={catColor(s.key)} stroke="
|
| 252 |
))}
|
| 253 |
</g>
|
| 254 |
)}
|
|
@@ -270,9 +265,9 @@ export function CommunityChart({ site, series, metric, hidden, onPick, className
|
|
| 270 |
onPointerEnter={() => setLit(p.key)} onPointerLeave={() => setLit(null)}>
|
| 271 |
{p.rels.map((r) => (
|
| 272 |
<button key={r.key} type="button" onClick={() => onPick(r)}
|
| 273 |
-
className={`group inline-flex items-center gap-2.5 font-display text-[15px] leading-none font-medium whitespace-nowrap text-
|
| 274 |
style={{ height: LINE_H }}>
|
| 275 |
-
<span className="size-2.5 shrink-0 rounded-full ring-2 ring-
|
| 276 |
style={{ background: catColor(r.cat) }} />
|
| 277 |
{shortName(r.name)}
|
| 278 |
</button>
|
|
@@ -282,14 +277,14 @@ export function CommunityChart({ site, series, metric, hidden, onPick, className
|
|
| 282 |
|
| 283 |
{g && hr && (
|
| 284 |
<Tip x={g.x(hr.t)} W={W} top={m.t}>
|
| 285 |
-
<div className="text-[15px] text-
|
| 286 |
-
<div className="mt-
|
| 287 |
{value(keys.reduce((a, c) => a + hr[c], 0))}
|
| 288 |
</div>
|
| 289 |
<div className="mt-2 space-y-1">
|
| 290 |
{[...keys].reverse().filter((c) => hr[c] > 0).map((c) => (
|
| 291 |
<div key={c} className="flex items-center justify-between gap-6 text-[15px]">
|
| 292 |
-
<span className="inline-flex items-center gap-2 text-
|
| 293 |
<span className="size-2.5 rounded-full" style={{ background: catColor(c) }} />
|
| 294 |
{site.categories.find((x) => x.key === c)?.name}
|
| 295 |
</span>
|
|
@@ -298,11 +293,11 @@ export function CommunityChart({ site, series, metric, hidden, onPick, className
|
|
| 298 |
))}
|
| 299 |
</div>
|
| 300 |
{near && (
|
| 301 |
-
<div className="mt-3 border-t border-
|
| 302 |
{near.rels.map((r) => (
|
| 303 |
<div key={r.key} className="flex items-center justify-between gap-6">
|
| 304 |
<span className="font-medium">{r.name}</span>
|
| 305 |
-
<span className="text-
|
| 306 |
</div>
|
| 307 |
))}
|
| 308 |
</div>
|
|
@@ -317,7 +312,7 @@ function Tip({ x, W, top, children }: { x: number; W: number; top: number; child
|
|
| 317 |
const w = 248
|
| 318 |
const left = x + 18 + w < W ? x + 18 : Math.max(0, x - 18 - w)
|
| 319 |
return (
|
| 320 |
-
<div className="pointer-events-none absolute z-10 rounded-2xl border border-
|
| 321 |
style={{ left, top, width: w }}>
|
| 322 |
{children}
|
| 323 |
</div>
|
|
|
|
| 177 |
<defs>
|
| 178 |
{keys.map((c) => (
|
| 179 |
<linearGradient key={c} id={`fill-${c}`} x1="0" y1="0" x2="0" y2="1">
|
| 180 |
+
<stop offset="0" style={{ stopColor: catColor(c), stopOpacity: 0.42 }} />
|
| 181 |
+
<stop offset="1" style={{ stopColor: catColor(c), stopOpacity: 0.05 }} />
|
| 182 |
</linearGradient>
|
| 183 |
))}
|
| 184 |
<linearGradient id="top-stroke" x1="0" y1="0" x2="1" y2="0">
|
| 185 |
+
<stop offset="0" stopColor="#171717" stopOpacity={0.35} />
|
| 186 |
+
<stop offset="0.7" stopColor="#171717" stopOpacity={0.85} />
|
| 187 |
+
<stop offset="1" stopColor="#171717" />
|
| 188 |
</linearGradient>
|
|
|
|
|
|
|
|
|
|
| 189 |
</defs>
|
| 190 |
|
| 191 |
{g.ticksY.map((v) => (
|
| 192 |
<g key={v}>
|
| 193 |
+
<line x1={m.l} x2={W - m.r} y1={g.y(v)} y2={g.y(v)} stroke="var(--foreground)" strokeOpacity={v === 0 ? 0.22 : 0.06} />
|
| 194 |
+
<text x={W - m.r + 12} y={g.y(v)} dy="0.35em" fontSize={14} fill="var(--muted-foreground)"
|
| 195 |
+
fillOpacity={Math.abs(g.y(v) - g.y(g.top.at(-1) ?? 0)) < 16 ? 0 : 1}
|
| 196 |
className="font-display tabular-nums">{tick(v)}</text>
|
| 197 |
</g>
|
| 198 |
))}
|
| 199 |
{g.xt.map((tk) => (
|
| 200 |
+
<text key={tk.t} x={g.x(tk.t)} y={H - m.b + 26} textAnchor="middle" fontSize={14}
|
| 201 |
+
fill={tk.label.length === 4 ? "var(--foreground)" : "var(--muted-foreground)"} className="font-display">{tk.label}</text>
|
| 202 |
))}
|
| 203 |
|
| 204 |
{/* the milestones: every pole starts on the same line at the top and ends on the curve */}
|
|
|
|
| 206 |
const px = g.x(p.t), py = g.y(g.valueAt(p.t))
|
| 207 |
const on = lit === p.key || near === p
|
| 208 |
return (
|
| 209 |
+
<line key={p.key} x1={px} x2={px} y1={ROW_TOP} y2={py - 8} stroke="var(--foreground)" strokeDasharray="2 5"
|
| 210 |
+
strokeOpacity={on ? 0.6 : 0.2} className="transition-[stroke-opacity] duration-200"
|
| 211 |
style={{ animation: `fade 500ms ease-out ${(REVEAL * (px - m.l)) / plotW}ms both` }} />
|
| 212 |
)
|
| 213 |
})}
|
|
|
|
| 217 |
<path key={s.key} d={g.areaGen(s as never) ?? ""} fill={`url(#fill-${s.key})`} />
|
| 218 |
))}
|
| 219 |
{g.stacked.map((s) => (
|
| 220 |
+
<path key={s.key} d={g.edge(s as never) ?? ""} fill="none" stroke={catColor(s.key)} strokeWidth={1.5} />
|
| 221 |
))}
|
| 222 |
+
<path d={g.topLine} fill="none" stroke="url(#top-stroke)" strokeWidth={2} strokeLinecap="round" />
|
|
|
|
| 223 |
</g>
|
| 224 |
|
| 225 |
{g.pins.map((p) => {
|
|
|
|
| 227 |
const delay = (REVEAL * (px - m.l)) / plotW
|
| 228 |
return (
|
| 229 |
<g key={`${metric}:${p.key}`} style={{ animation: `pop 520ms cubic-bezier(.34,1.56,.64,1) ${delay}ms both`, transformOrigin: `${px}px ${py}px` }}>
|
| 230 |
+
<circle cx={px} cy={py} r={6.5} fill="#fff" stroke={catColor(p.cat)} strokeWidth={2.5} />
|
|
|
|
| 231 |
</g>
|
| 232 |
)
|
| 233 |
})}
|
| 234 |
|
| 235 |
{/* today */}
|
| 236 |
<g key={`now:${metric}`} style={{ animation: `fade 400ms ease-out ${REVEAL}ms both` }}>
|
| 237 |
+
<circle cx={g.x(last)} cy={g.y(g.top.at(-1) ?? 0)} r={14} fill="var(--brand)" opacity={0.22}
|
| 238 |
style={{ animation: "breathe 2.8s ease-in-out infinite", transformOrigin: `${g.x(last)}px ${g.y(g.top.at(-1) ?? 0)}px` }} />
|
| 239 |
+
<circle cx={g.x(last)} cy={g.y(g.top.at(-1) ?? 0)} r={5} fill="#171717" />
|
| 240 |
</g>
|
| 241 |
|
| 242 |
{hr && (
|
| 243 |
<g pointerEvents="none">
|
| 244 |
+
<line x1={g.x(hr.t)} x2={g.x(hr.t)} y1={m.t - 8} y2={H - m.b} stroke="var(--foreground)" strokeOpacity={0.3} />
|
| 245 |
{g.stacked.map((s) => (
|
| 246 |
+
<circle key={s.key} cx={g.x(hr.t)} cy={g.y(s[hover!][1])} r={4.5} fill={catColor(s.key)} stroke="#fff" strokeWidth={2} />
|
| 247 |
))}
|
| 248 |
</g>
|
| 249 |
)}
|
|
|
|
| 265 |
onPointerEnter={() => setLit(p.key)} onPointerLeave={() => setLit(null)}>
|
| 266 |
{p.rels.map((r) => (
|
| 267 |
<button key={r.key} type="button" onClick={() => onPick(r)}
|
| 268 |
+
className={`group inline-flex items-center gap-2.5 font-display text-[15px] leading-none font-medium whitespace-nowrap text-foreground/75 transition-colors hover:text-foreground ${p.side === "left" ? "flex-row-reverse" : ""}`}
|
| 269 |
style={{ height: LINE_H }}>
|
| 270 |
+
<span className="size-2.5 shrink-0 rounded-full ring-2 ring-white transition-transform group-hover:scale-125"
|
| 271 |
style={{ background: catColor(r.cat) }} />
|
| 272 |
{shortName(r.name)}
|
| 273 |
</button>
|
|
|
|
| 277 |
|
| 278 |
{g && hr && (
|
| 279 |
<Tip x={g.x(hr.t)} W={W} top={m.t}>
|
| 280 |
+
<div className="text-[15px] text-muted-foreground">{mdy(new Date(hr.t).toISOString())}</div>
|
| 281 |
+
<div className="mt-1 font-display text-[28px] leading-tight font-semibold tabular-nums">
|
| 282 |
{value(keys.reduce((a, c) => a + hr[c], 0))}
|
| 283 |
</div>
|
| 284 |
<div className="mt-2 space-y-1">
|
| 285 |
{[...keys].reverse().filter((c) => hr[c] > 0).map((c) => (
|
| 286 |
<div key={c} className="flex items-center justify-between gap-6 text-[15px]">
|
| 287 |
+
<span className="inline-flex items-center gap-2 text-foreground/75">
|
| 288 |
<span className="size-2.5 rounded-full" style={{ background: catColor(c) }} />
|
| 289 |
{site.categories.find((x) => x.key === c)?.name}
|
| 290 |
</span>
|
|
|
|
| 293 |
))}
|
| 294 |
</div>
|
| 295 |
{near && (
|
| 296 |
+
<div className="mt-3 border-t border-border pt-2.5 text-[15px]">
|
| 297 |
{near.rels.map((r) => (
|
| 298 |
<div key={r.key} className="flex items-center justify-between gap-6">
|
| 299 |
<span className="font-medium">{r.name}</span>
|
| 300 |
+
<span className="text-muted-foreground">{md(r.date)}</span>
|
| 301 |
</div>
|
| 302 |
))}
|
| 303 |
</div>
|
|
|
|
| 312 |
const w = 248
|
| 313 |
const left = x + 18 + w < W ? x + 18 : Math.max(0, x - 18 - w)
|
| 314 |
return (
|
| 315 |
+
<div className="pointer-events-none absolute z-10 rounded-2xl border border-border bg-white/95 p-4 text-foreground shadow-[0_18px_40px_-12px_rgba(23,23,23,0.25)] backdrop-blur-md"
|
| 316 |
style={{ left, top, width: w }}>
|
| 317 |
{children}
|
| 318 |
</div>
|
code/web/src/components/galaxy.tsx
CHANGED
|
@@ -14,6 +14,10 @@ type Layout = { pos: P[]; rings: Ring[]; extent: number }
|
|
| 14 |
const RING_NAME = ["", "Built on it directly", "Second generation", "Third generation and on"]
|
| 15 |
const ORDER: Rel[] = ["adapter", "finetune", "quantized", "repackage", "merge", "mirror", "component"]
|
| 16 |
const CENTER_R = 64
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
const LABEL_FONT = '500 14px "DM Sans Variable", system-ui, sans-serif'
|
| 18 |
|
| 19 |
/** Deterministic 0..1 from a string, so every bubble keeps its own rhythm across loads. */
|
|
@@ -27,9 +31,11 @@ function hash(s: string): number {
|
|
| 27 |
* The official model in the middle (the MiniMax Code octopus), every community model around it:
|
| 28 |
* one ring per generation, each bubble near the model it is built on, bigger bubble for more
|
| 29 |
* downloads. Bubbles are painted in exactly the relation colours used everywhere else on the
|
| 30 |
-
* page.
|
| 31 |
-
*
|
| 32 |
-
*
|
|
|
|
|
|
|
| 33 |
*/
|
| 34 |
export function Galaxy({ lineageKey, repos, L, authors, name, cat }: {
|
| 35 |
lineageKey: string; repos: Repo[]; L: Lineage; authors: Record<string, Author>; name: string; cat: string
|
|
@@ -42,7 +48,9 @@ export function Galaxy({ lineageKey, repos, L, authors, name, cat }: {
|
|
| 42 |
const tapRef = useRef<string | null>(null) // what was showing before this tap
|
| 43 |
const typeRef = useRef("mouse")
|
| 44 |
const hoverRef = useRef<string | null>(null)
|
| 45 |
-
const cur = useRef<Float32Array>(new Float32Array(0)) // current x, y of every bubble
|
|
|
|
|
|
|
| 46 |
// A first guess from the window, so the picture has its size before the observer reports.
|
| 47 |
const [w, setW] = useState(() => Math.min(window.innerWidth - 64, 1072))
|
| 48 |
|
|
@@ -66,10 +74,18 @@ export function Galaxy({ lineageKey, repos, L, authors, name, cat }: {
|
|
| 66 |
return () => ro.disconnect()
|
| 67 |
}, [])
|
| 68 |
|
| 69 |
-
const size = Math.min(w,
|
| 70 |
const E = (layout?.extent ?? 300) + 8
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
const index = useMemo(() => new Map(layout?.pos.map((p, i) => [p.id, i]) ?? []), [layout])
|
| 75 |
const kids = useMemo(() => {
|
|
@@ -78,26 +94,14 @@ export function Galaxy({ lineageKey, repos, L, authors, name, cat }: {
|
|
| 78 |
return m
|
| 79 |
}, [layout])
|
| 80 |
|
| 81 |
-
//
|
| 82 |
const labels = useMemo(() => {
|
| 83 |
if (!layout || size < 560) return []
|
| 84 |
const ctx = document.createElement("canvas").getContext("2d")!
|
| 85 |
ctx.font = LABEL_FONT
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
for (const [p, i] of order) {
|
| 90 |
-
if (p.r * k < 9 || out.length >= 6) break
|
| 91 |
-
const wpx = ctx.measureText(p.id).width + 22
|
| 92 |
-
const x = toPx(p.x), y = toPx(p.y) + p.r * k + 6
|
| 93 |
-
const rect = { x0: x - wpx / 2 - 6, x1: x + wpx / 2 + 6, y0: y - 4, y1: y + 30 }
|
| 94 |
-
if (placed.some((q) => rect.x0 < q.x1 && rect.x1 > q.x0 && rect.y0 < q.y1 && rect.y1 > q.y0)) continue
|
| 95 |
-
placed.push(rect)
|
| 96 |
-
out.push({ i, w: wpx })
|
| 97 |
-
}
|
| 98 |
-
return out
|
| 99 |
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
| 100 |
-
}, [layout, size])
|
| 101 |
|
| 102 |
const lit = useMemo(() => {
|
| 103 |
if (!hover || !layout) return null
|
|
@@ -117,17 +121,19 @@ export function Galaxy({ lineageKey, repos, L, authors, name, cat }: {
|
|
| 117 |
litRef.current = lit
|
| 118 |
}, [hover, lit])
|
| 119 |
|
| 120 |
-
// The animation loop:
|
| 121 |
-
//
|
| 122 |
useEffect(() => {
|
| 123 |
const cv = canvas.current, stage = stageRef.current
|
| 124 |
if (!cv || !stage || !layout || !size) return
|
| 125 |
const dpr = Math.min(2, window.devicePixelRatio || 1)
|
| 126 |
cv.width = Math.round(size * dpr)
|
| 127 |
-
cv.height = Math.round(
|
| 128 |
const ctx = cv.getContext("2d")!
|
| 129 |
const n = layout.pos.length
|
| 130 |
if (cur.current.length !== 2 * n) cur.current = new Float32Array(2 * n)
|
|
|
|
|
|
|
| 131 |
const rho = new Float32Array(n), theta = new Float32Array(n)
|
| 132 |
const ph = new Float32Array(n), fq = new Float32Array(n), amp = new Float32Array(n)
|
| 133 |
const maxR = Math.max(1, ...layout.pos.map((p) => p.r))
|
|
@@ -138,118 +144,149 @@ export function Galaxy({ lineageKey, repos, L, authors, name, cat }: {
|
|
| 138 |
fq[i] = 0.55 + hash(p.id + "f") * 0.6 // radians per second
|
| 139 |
amp[i] = (1.2 + 2.6 * (1 - p.r / maxR)) / k // small bubbles wander more
|
| 140 |
})
|
| 141 |
-
const byColor = new Map<Rel, number[]>()
|
| 142 |
-
layout.pos.forEach((p, i) => byColor.set(p.repo.rel, [...(byColor.get(p.repo.rel) ?? []), i]))
|
| 143 |
|
| 144 |
const still = matchMedia("(prefers-reduced-motion: reduce)").matches
|
| 145 |
let visible = true
|
| 146 |
const io = new IntersectionObserver(([e]) => (visible = e.isIntersecting))
|
| 147 |
io.observe(cv)
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
let clock = 0, last = performance.now(), raf = 0
|
|
|
|
|
|
|
| 151 |
|
| 152 |
const frame = (now: number) => {
|
| 153 |
raf = requestAnimationFrame(frame)
|
| 154 |
const dt = Math.min(0.05, (now - last) / 1000)
|
| 155 |
last = now
|
| 156 |
-
const hovering = hoverRef.current != null
|
| 157 |
if (!visible) return
|
|
|
|
|
|
|
| 158 |
if (!still && !hovering) clock += dt
|
| 159 |
-
if (
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
colorsAt = now
|
| 163 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
const t = clock
|
| 165 |
-
const c = cur.current
|
| 166 |
for (let i = 0; i < n; i++) {
|
| 167 |
const ring = layout.pos[i].ring
|
| 168 |
const sway = 0.022 * (ring % 2 ? 1 : -1) * Math.sin((t * 2 * Math.PI) / 16 + ring * 0.9)
|
| 169 |
const a = theta[i] + sway
|
| 170 |
-
|
| 171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
}
|
|
|
|
|
|
|
| 173 |
|
| 174 |
-
ctx.setTransform(
|
| 175 |
-
ctx.clearRect(0, 0,
|
| 176 |
-
ctx.
|
| 177 |
|
| 178 |
-
|
|
|
|
| 179 |
ctx.beginPath()
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
ctx.setLineDash([])
|
| 184 |
ctx.stroke()
|
| 185 |
-
|
| 186 |
-
ctx.
|
| 187 |
-
ctx.
|
| 188 |
-
ctx.
|
| 189 |
-
ctx.setLineDash([2 / k, 6 / k])
|
| 190 |
ctx.stroke()
|
| 191 |
}
|
| 192 |
ctx.setLineDash([])
|
| 193 |
|
| 194 |
const L2 = litRef.current
|
| 195 |
const hv = hoverRef.current
|
|
|
|
| 196 |
if (hv && L2) {
|
| 197 |
-
const hi =
|
| 198 |
-
|
| 199 |
-
ctx.
|
| 200 |
-
ctx.lineWidth = 1.3 / k
|
| 201 |
ctx.beginPath()
|
| 202 |
const link = (bx: number, by: number) => {
|
| 203 |
ctx.moveTo(ax, ay)
|
| 204 |
-
ctx.quadraticCurveTo(((ax + bx) / 2) * 0.82, ((ay + by) / 2) * 0.82, bx, by)
|
| 205 |
}
|
| 206 |
-
for (const j of L2) if (j !== hi) link(
|
| 207 |
-
if (hi != null && index.get(layout.pos[hi].repo.up) == null) link(
|
| 208 |
ctx.stroke()
|
| 209 |
}
|
| 210 |
|
| 211 |
-
for (const
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
if (L2 && (pass === 0) === L2.has(i)) continue
|
| 219 |
-
const x = c[2 * i], y = c[2 * i + 1], r = layout.pos[i].r
|
| 220 |
-
ctx.moveTo(x + r, y)
|
| 221 |
-
ctx.arc(x, y, r, 0, Math.PI * 2)
|
| 222 |
-
}
|
| 223 |
-
ctx.fill()
|
| 224 |
-
}
|
| 225 |
}
|
| 226 |
-
ctx.globalAlpha =
|
| 227 |
-
const hi = hv ? index.get(hv) : undefined
|
| 228 |
if (hi != null) {
|
| 229 |
ctx.beginPath()
|
| 230 |
-
ctx.arc(
|
| 231 |
ctx.strokeStyle = "#fff"
|
| 232 |
-
ctx.lineWidth = 2
|
| 233 |
ctx.stroke()
|
| 234 |
}
|
| 235 |
|
| 236 |
-
// names
|
| 237 |
-
ctx.setTransform(dpr, 0, 0, dpr, 0, 0)
|
| 238 |
ctx.font = LABEL_FONT
|
| 239 |
ctx.textAlign = "center"
|
| 240 |
ctx.textBaseline = "middle"
|
| 241 |
-
|
| 242 |
-
const x = size / 2 + c[2 * i] * k, y = size / 2 + c[2 * i + 1] * k + layout.pos[i].r * k + 6
|
| 243 |
-
ctx.globalAlpha = L2 && !L2.has(i) ? 0.2 : 1
|
| 244 |
ctx.beginPath()
|
| 245 |
ctx.roundRect(x - lw / 2, y, lw, 26, 13)
|
| 246 |
-
ctx.fillStyle = "rgba(
|
| 247 |
ctx.fill()
|
| 248 |
ctx.strokeStyle = "rgba(255,255,255,0.12)"
|
| 249 |
ctx.lineWidth = 1
|
| 250 |
ctx.stroke()
|
| 251 |
-
ctx.fillStyle =
|
| 252 |
-
ctx.fillText(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
}
|
| 254 |
ctx.globalAlpha = 1
|
| 255 |
}
|
|
@@ -258,73 +295,101 @@ export function Galaxy({ lineageKey, repos, L, authors, name, cat }: {
|
|
| 258 |
cancelAnimationFrame(raf)
|
| 259 |
io.disconnect()
|
| 260 |
}
|
| 261 |
-
}, [layout, size, k, labels, index])
|
| 262 |
|
|
|
|
| 263 |
const hit = (e: React.PointerEvent) => {
|
| 264 |
if (!layout) return
|
| 265 |
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect()
|
| 266 |
-
const
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
let best = -1, bd = Infinity
|
| 270 |
for (let i = 0; i < layout.pos.length; i++) {
|
| 271 |
-
const
|
| 272 |
-
if (
|
| 273 |
}
|
| 274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
}
|
| 276 |
|
| 277 |
const present = ORDER.filter((r) => repos.some((x) => x.rel === r))
|
| 278 |
const center = hover === L.base
|
| 279 |
const hi = hover && !center ? index.get(hover) : undefined
|
| 280 |
const hp = hi != null ? layout!.pos[hi] : null
|
| 281 |
-
const hpos = hi != null ? { x:
|
| 282 |
-
const icon = Math.max(30, CENTER_R * k * 1.
|
| 283 |
|
| 284 |
return (
|
| 285 |
-
<div ref={stageRef} className="stage relative isolate overflow-hidden rounded-[28px] px-4 pt-8 pb-6 sm:px-8 sm:pt-10">
|
| 286 |
-
<div aria-hidden className="pointer-events-none absolute top-
|
| 287 |
-
style={{ background: `radial-gradient(
|
| 288 |
<DownloadButton target={stageRef} name={`${name} galaxy`} tone="stage" className="absolute top-[26px] right-4 z-20 sm:top-[34px] sm:right-8" />
|
| 289 |
<RelLegend rels={present} className="pr-12 text-white/70" />
|
| 290 |
<div ref={box} className="w-full">
|
| 291 |
-
<div className="relative mx-auto select-none" style={{ width: size, height:
|
| 292 |
-
onPointerMove={(e) =>
|
| 293 |
-
|
| 294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
onClick={() => {
|
|
|
|
| 296 |
const touch = typeRef.current !== "mouse"
|
| 297 |
if (hover && (!touch || tapRef.current === hover)) window.open(hfUrl(hover), "_blank", "noopener")
|
| 298 |
}}
|
| 299 |
role="img" aria-label={`${full(L.n_models)} community models around ${name}`}>
|
| 300 |
{size > 0 && (
|
| 301 |
<div aria-hidden className="pointer-events-none absolute rounded-full blur-[30px]"
|
| 302 |
-
style={{ left:
|
| 303 |
-
background: `radial-gradient(
|
| 304 |
opacity: 0.8, animation: "breathe 4s ease-in-out infinite" }} />
|
| 305 |
)}
|
| 306 |
-
{
|
| 307 |
-
<div className="absolute inset-0" style={{ animation: "unfold 1500ms cubic-bezier(.22,.61,.36,1) both", transformOrigin: "50% 50%" }}>
|
| 308 |
-
<canvas ref={canvas} className="absolute inset-0" style={{ width: size, height: size }} />
|
| 309 |
-
</div>
|
| 310 |
{size > 0 && (
|
| 311 |
<div className="pointer-events-none absolute" title={name}
|
| 312 |
-
style={{ left:
|
| 313 |
animation: "pop 900ms cubic-bezier(.34,1.56,.64,1) 300ms both" }}>
|
| 314 |
<Octopus size={icon} />
|
| 315 |
</div>
|
| 316 |
)}
|
| 317 |
-
{layout?.rings.map((g) => size >= 480 && (
|
| 318 |
-
<span key={g.ring} className="pointer-events-none absolute -translate-x-1/2 rounded-full border border-white/10 bg-[var(--stage)] px-3 py-0.5 text-sm whitespace-nowrap text-white/60"
|
| 319 |
-
style={{ left: size / 2, top: toPx(-g.outer - 8) - 12, animation: "fade 600ms ease-out 900ms both" }}>
|
| 320 |
-
{RING_NAME[g.ring]}
|
| 321 |
-
</span>
|
| 322 |
-
))}
|
| 323 |
{!layout && size > 0 && (
|
| 324 |
<div className="absolute inset-0 grid place-items-center text-[15px] text-white/60">Placing {full(repos.length)} models…</div>
|
| 325 |
)}
|
| 326 |
{hover && (center || (hp && hpos)) && (
|
| 327 |
-
<Card pos={center ? { x:
|
| 328 |
{center ? <Official L={L} authors={authors} kidsN={L.n_models} /> : <Model p={hp!} authors={authors} />}
|
| 329 |
</Card>
|
| 330 |
)}
|
|
@@ -334,11 +399,11 @@ export function Galaxy({ lineageKey, repos, L, authors, name, cat }: {
|
|
| 334 |
)
|
| 335 |
}
|
| 336 |
|
| 337 |
-
function Card({ pos, size, children }: { pos: { x: number; y: number; r: number }; size: number; children: React.ReactNode }) {
|
| 338 |
const W = 300
|
| 339 |
const right = pos.x + pos.r + 14 + W < size
|
| 340 |
const left = right ? pos.x + pos.r + 14 : Math.max(0, pos.x - pos.r - 14 - W)
|
| 341 |
-
const top = Math.min(Math.max(0, pos.y - 70),
|
| 342 |
return (
|
| 343 |
<div className="pointer-events-none absolute z-10 rounded-2xl border border-white/12 bg-[#15151c]/92 p-4 text-[15px] text-white shadow-[0_18px_40px_rgba(0,0,0,0.5)] backdrop-blur-md"
|
| 344 |
style={{ left, top, width: W }}>
|
|
|
|
| 14 |
const RING_NAME = ["", "Built on it directly", "Second generation", "Third generation and on"]
|
| 15 |
const ORDER: Rel[] = ["adapter", "finetune", "quantized", "repackage", "merge", "mirror", "component"]
|
| 16 |
const CENTER_R = 64
|
| 17 |
+
const TILT = 1.02 // the disc leans back this far (radians from facing the camera)
|
| 18 |
+
const DIST = 3.4 // camera distance in disc radii: enough perspective to read depth, no fisheye
|
| 19 |
+
const SPIN = 0.045 // radians a second when left alone, a turn every two and a half minutes
|
| 20 |
+
const R_NEAR = 44 // the largest bubble, for headroom at the near rim
|
| 21 |
const LABEL_FONT = '500 14px "DM Sans Variable", system-ui, sans-serif'
|
| 22 |
|
| 23 |
/** Deterministic 0..1 from a string, so every bubble keeps its own rhythm across loads. */
|
|
|
|
| 31 |
* The official model in the middle (the MiniMax Code octopus), every community model around it:
|
| 32 |
* one ring per generation, each bubble near the model it is built on, bigger bubble for more
|
| 33 |
* downloads. Bubbles are painted in exactly the relation colours used everywhere else on the
|
| 34 |
+
* page. The rings lie on a disc seen in perspective: it turns slowly by itself (drag sideways to
|
| 35 |
+
* turn it), far bubbles recede and dim, and the biggest show their names as they come round to
|
| 36 |
+
* the front. Bubbles also drift a little while neighbouring rings sway against each other; all of
|
| 37 |
+
* it pauses while something is hovered or the picture is off screen, and the disc only moves by
|
| 38 |
+
* hand under reduced motion. Drawn on a canvas: 1,000+ moving circles would choke SVG.
|
| 39 |
*/
|
| 40 |
export function Galaxy({ lineageKey, repos, L, authors, name, cat }: {
|
| 41 |
lineageKey: string; repos: Repo[]; L: Lineage; authors: Record<string, Author>; name: string; cat: string
|
|
|
|
| 48 |
const tapRef = useRef<string | null>(null) // what was showing before this tap
|
| 49 |
const typeRef = useRef("mouse")
|
| 50 |
const hoverRef = useRef<string | null>(null)
|
| 51 |
+
const cur = useRef<Float32Array>(new Float32Array(0)) // current x, y of every bubble on the disc
|
| 52 |
+
const proj = useRef<Float32Array>(new Float32Array(0)) // where each lands on screen: x, y, scale
|
| 53 |
+
const view = useRef({ psi: 0, vel: 0, drag: false }) // the disc's turn, and a flick's speed
|
| 54 |
// A first guess from the window, so the picture has its size before the observer reports.
|
| 55 |
const [w, setW] = useState(() => Math.min(window.innerWidth - 64, 1072))
|
| 56 |
|
|
|
|
| 74 |
return () => ro.disconnect()
|
| 75 |
}, [])
|
| 76 |
|
| 77 |
+
const size = Math.min(w, 1040)
|
| 78 |
const E = (layout?.extent ?? 300) + 8
|
| 79 |
+
// The disc seen from above at TILT, a camera DIST world-extents away: its far rim rises less
|
| 80 |
+
// than its near rim falls, so the centre sits above the middle of a wide, low picture; and the
|
| 81 |
+
// near half spreads wider than the disc itself, so the scale leaves room for that.
|
| 82 |
+
const sinT = Math.sin(TILT), cosT = Math.cos(TILT)
|
| 83 |
+
const sNear = DIST / (DIST - sinT), sFar = DIST / (DIST + sinT)
|
| 84 |
+
const spread = Math.max(...Array.from({ length: 90 }, (_, q) => Math.cos(q / 57.3) * DIST / (DIST - Math.sin(q / 57.3) * sinT)))
|
| 85 |
+
const k = size / (2 * E * spread + 2 * R_NEAR) // world -> px
|
| 86 |
+
const top = 34 + cosT * sFar * E * k
|
| 87 |
+
const height = Math.round(top + cosT * sNear * E * k + 16 + R_NEAR * sNear * k)
|
| 88 |
+
const cx = size / 2, cy = top
|
| 89 |
|
| 90 |
const index = useMemo(() => new Map(layout?.pos.map((p, i) => [p.id, i]) ?? []), [layout])
|
| 91 |
const kids = useMemo(() => {
|
|
|
|
| 94 |
return m
|
| 95 |
}, [layout])
|
| 96 |
|
| 97 |
+
// The biggest bubbles carry their names while they are on the near half of the disc.
|
| 98 |
const labels = useMemo(() => {
|
| 99 |
if (!layout || size < 560) return []
|
| 100 |
const ctx = document.createElement("canvas").getContext("2d")!
|
| 101 |
ctx.font = LABEL_FONT
|
| 102 |
+
return layout.pos.map((p, i) => [p, i] as const).sort((x, y) => y[0].r - x[0].r).slice(0, 7)
|
| 103 |
+
.filter(([p]) => p.r * k >= 7).map(([p, i]) => ({ i, w: ctx.measureText(p.id).width + 22 }))
|
| 104 |
+
}, [layout, size, k])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
const lit = useMemo(() => {
|
| 107 |
if (!hover || !layout) return null
|
|
|
|
| 121 |
litRef.current = lit
|
| 122 |
}, [hover, lit])
|
| 123 |
|
| 124 |
+
// The animation loop: bubbles drift on the disc by a clock that runs while the picture is on
|
| 125 |
+
// screen and nothing is hovered; the disc turns slowly on its own and follows a drag.
|
| 126 |
useEffect(() => {
|
| 127 |
const cv = canvas.current, stage = stageRef.current
|
| 128 |
if (!cv || !stage || !layout || !size) return
|
| 129 |
const dpr = Math.min(2, window.devicePixelRatio || 1)
|
| 130 |
cv.width = Math.round(size * dpr)
|
| 131 |
+
cv.height = Math.round(height * dpr)
|
| 132 |
const ctx = cv.getContext("2d")!
|
| 133 |
const n = layout.pos.length
|
| 134 |
if (cur.current.length !== 2 * n) cur.current = new Float32Array(2 * n)
|
| 135 |
+
if (proj.current.length !== 3 * n) proj.current = new Float32Array(3 * n)
|
| 136 |
+
const order = Array.from({ length: n }, (_, i) => i)
|
| 137 |
const rho = new Float32Array(n), theta = new Float32Array(n)
|
| 138 |
const ph = new Float32Array(n), fq = new Float32Array(n), amp = new Float32Array(n)
|
| 139 |
const maxR = Math.max(1, ...layout.pos.map((p) => p.r))
|
|
|
|
| 144 |
fq[i] = 0.55 + hash(p.id + "f") * 0.6 // radians per second
|
| 145 |
amp[i] = (1.2 + 2.6 * (1 - p.r / maxR)) / k // small bubbles wander more
|
| 146 |
})
|
|
|
|
|
|
|
| 147 |
|
| 148 |
const still = matchMedia("(prefers-reduced-motion: reduce)").matches
|
| 149 |
let visible = true
|
| 150 |
const io = new IntersectionObserver(([e]) => (visible = e.isIntersecting))
|
| 151 |
io.observe(cv)
|
| 152 |
+
const cs = getComputedStyle(stage)
|
| 153 |
+
const colors = Object.fromEntries(ORDER.map((r) => [r, cs.getPropertyValue(`--rel-${r}`).trim() || "#888"]))
|
| 154 |
+
let clock = 0, last = performance.now(), raf = 0, born = -1
|
| 155 |
+
const v = view.current
|
| 156 |
+
const D = DIST * E
|
| 157 |
|
| 158 |
const frame = (now: number) => {
|
| 159 |
raf = requestAnimationFrame(frame)
|
| 160 |
const dt = Math.min(0.05, (now - last) / 1000)
|
| 161 |
last = now
|
|
|
|
| 162 |
if (!visible) return
|
| 163 |
+
if (born < 0) born = now
|
| 164 |
+
const hovering = hoverRef.current != null
|
| 165 |
if (!still && !hovering) clock += dt
|
| 166 |
+
if (!v.drag) {
|
| 167 |
+
v.psi += dt * ((still || hovering ? 0 : SPIN) + v.vel)
|
| 168 |
+
v.vel *= Math.pow(0.04, dt) // a flick coasts to a stop in about a second
|
|
|
|
| 169 |
}
|
| 170 |
+
// entrance: the disc swings round into place while it fades in
|
| 171 |
+
const e = still ? 1 : Math.min(1, (now - born) / 2200)
|
| 172 |
+
const ease = 1 - Math.pow(1 - e, 3)
|
| 173 |
+
const psi = v.psi - 1.4 * (1 - ease)
|
| 174 |
+
const cP = Math.cos(psi), sP = Math.sin(psi)
|
| 175 |
+
|
| 176 |
const t = clock
|
| 177 |
+
const c = cur.current, P = proj.current
|
| 178 |
for (let i = 0; i < n; i++) {
|
| 179 |
const ring = layout.pos[i].ring
|
| 180 |
const sway = 0.022 * (ring % 2 ? 1 : -1) * Math.sin((t * 2 * Math.PI) / 16 + ring * 0.9)
|
| 181 |
const a = theta[i] + sway
|
| 182 |
+
const x = rho[i] * Math.cos(a) + amp[i] * Math.sin(t * fq[i] + ph[i])
|
| 183 |
+
const y = rho[i] * Math.sin(a) + amp[i] * Math.cos(t * fq[i] * 0.83 + ph[i] * 1.7)
|
| 184 |
+
c[2 * i] = x
|
| 185 |
+
c[2 * i + 1] = y
|
| 186 |
+
const xr = x * cP - y * sP, yr = x * sP + y * cP
|
| 187 |
+
const sc = D / (D - yr * sinT)
|
| 188 |
+
P[3 * i] = cx + xr * sc * k
|
| 189 |
+
P[3 * i + 1] = cy + yr * cosT * sc * k
|
| 190 |
+
P[3 * i + 2] = sc
|
| 191 |
}
|
| 192 |
+
order.sort((i, j) => P[3 * i + 2] - P[3 * j + 2]) // far first
|
| 193 |
+
const depth = (sc: number) => 0.3 + 0.7 * Math.min(1, Math.max(0, (sc - sFar) / (sNear - sFar)))
|
| 194 |
|
| 195 |
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0)
|
| 196 |
+
ctx.clearRect(0, 0, size, height)
|
| 197 |
+
ctx.globalAlpha = ease
|
| 198 |
|
| 199 |
+
// the orbits: each generation's band and its dashed rim, in perspective
|
| 200 |
+
const orbit = (R: number) => {
|
| 201 |
ctx.beginPath()
|
| 202 |
+
for (let s = 0; s <= 120; s++) {
|
| 203 |
+
const q = (s / 120) * Math.PI * 2, yr = R * Math.sin(q), sc = D / (D - yr * sinT)
|
| 204 |
+
const X = cx + R * Math.cos(q) * sc * k, Y = cy + yr * cosT * sc * k
|
| 205 |
+
if (s) ctx.lineTo(X, Y)
|
| 206 |
+
else ctx.moveTo(X, Y)
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
for (const g of layout.rings) {
|
| 210 |
+
orbit((g.inner + g.outer) / 2)
|
| 211 |
+
ctx.strokeStyle = "rgba(255,255,255,0.03)"
|
| 212 |
+
ctx.lineWidth = (g.outer - g.inner + 16) * k * cosT
|
| 213 |
ctx.setLineDash([])
|
| 214 |
ctx.stroke()
|
| 215 |
+
orbit(g.outer + 8)
|
| 216 |
+
ctx.strokeStyle = "rgba(255,255,255,0.16)"
|
| 217 |
+
ctx.lineWidth = 1
|
| 218 |
+
ctx.setLineDash([2, 6])
|
|
|
|
| 219 |
ctx.stroke()
|
| 220 |
}
|
| 221 |
ctx.setLineDash([])
|
| 222 |
|
| 223 |
const L2 = litRef.current
|
| 224 |
const hv = hoverRef.current
|
| 225 |
+
const hi = hv ? index.get(hv) : undefined
|
| 226 |
if (hv && L2) {
|
| 227 |
+
const ax = hi == null ? cx : P[3 * hi], ay = hi == null ? cy : P[3 * hi + 1]
|
| 228 |
+
ctx.strokeStyle = "rgba(255,255,255,0.6)"
|
| 229 |
+
ctx.lineWidth = 1.3
|
|
|
|
| 230 |
ctx.beginPath()
|
| 231 |
const link = (bx: number, by: number) => {
|
| 232 |
ctx.moveTo(ax, ay)
|
| 233 |
+
ctx.quadraticCurveTo(cx + ((ax + bx) / 2 - cx) * 0.82, cy + ((ay + by) / 2 - cy) * 0.82, bx, by)
|
| 234 |
}
|
| 235 |
+
for (const j of L2) if (j !== hi) link(P[3 * j], P[3 * j + 1])
|
| 236 |
+
if (hi != null && index.get(layout.pos[hi].repo.up) == null) link(cx, cy) // built on the official model
|
| 237 |
ctx.stroke()
|
| 238 |
}
|
| 239 |
|
| 240 |
+
for (const i of order) {
|
| 241 |
+
const sc = P[3 * i + 2]
|
| 242 |
+
ctx.globalAlpha = ease * depth(sc) * (L2 && !L2.has(i) ? 0.14 : 1)
|
| 243 |
+
ctx.fillStyle = colors[layout.pos[i].repo.rel]
|
| 244 |
+
ctx.beginPath()
|
| 245 |
+
ctx.arc(P[3 * i], P[3 * i + 1], Math.max(0.6, layout.pos[i].r * k * sc), 0, Math.PI * 2)
|
| 246 |
+
ctx.fill()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
}
|
| 248 |
+
ctx.globalAlpha = ease
|
|
|
|
| 249 |
if (hi != null) {
|
| 250 |
ctx.beginPath()
|
| 251 |
+
ctx.arc(P[3 * hi], P[3 * hi + 1], layout.pos[hi].r * k * P[3 * hi + 2] + 1.5, 0, Math.PI * 2)
|
| 252 |
ctx.strokeStyle = "#fff"
|
| 253 |
+
ctx.lineWidth = 2
|
| 254 |
ctx.stroke()
|
| 255 |
}
|
| 256 |
|
| 257 |
+
// generation names on the far rim of each orbit, bubble names on the near half
|
|
|
|
| 258 |
ctx.font = LABEL_FONT
|
| 259 |
ctx.textAlign = "center"
|
| 260 |
ctx.textBaseline = "middle"
|
| 261 |
+
const pill = (text: string, x: number, y: number, lw: number, ink: string) => {
|
|
|
|
|
|
|
| 262 |
ctx.beginPath()
|
| 263 |
ctx.roundRect(x - lw / 2, y, lw, 26, 13)
|
| 264 |
+
ctx.fillStyle = "rgba(10,10,12,0.86)"
|
| 265 |
ctx.fill()
|
| 266 |
ctx.strokeStyle = "rgba(255,255,255,0.12)"
|
| 267 |
ctx.lineWidth = 1
|
| 268 |
ctx.stroke()
|
| 269 |
+
ctx.fillStyle = ink
|
| 270 |
+
ctx.fillText(text, x, y + 13.5)
|
| 271 |
+
}
|
| 272 |
+
if (size >= 480)
|
| 273 |
+
for (const g of layout.rings) {
|
| 274 |
+
const R = g.outer + 8, sc = D / (D + R * sinT)
|
| 275 |
+
const text = RING_NAME[g.ring]
|
| 276 |
+
ctx.globalAlpha = ease * 0.9
|
| 277 |
+
pill(text, cx, cy - R * cosT * sc * k - 13, ctx.measureText(text).width + 24, "rgba(255,255,255,0.62)")
|
| 278 |
+
}
|
| 279 |
+
const placed: number[][] = []
|
| 280 |
+
for (const { i, w: lw } of labels) {
|
| 281 |
+
const sc = P[3 * i + 2]
|
| 282 |
+
const front = (sc - 1) / (sNear - 1) // 0 at the sides, 1 at the near rim
|
| 283 |
+
if (front <= 0.05) continue
|
| 284 |
+
const x = P[3 * i], y = P[3 * i + 1] + layout.pos[i].r * k * sc + 6
|
| 285 |
+
const box = [x - lw / 2 - 6, x + lw / 2 + 6, y - 4, y + 30]
|
| 286 |
+
if (placed.some((q) => box[0] < q[1] && box[1] > q[0] && box[2] < q[3] && box[3] > q[2])) continue
|
| 287 |
+
placed.push(box)
|
| 288 |
+
ctx.globalAlpha = ease * Math.min(1, front * 2.5) * (L2 && !L2.has(i) ? 0.2 : 1)
|
| 289 |
+
pill(layout.pos[i].id, x, y, lw, "#fff")
|
| 290 |
}
|
| 291 |
ctx.globalAlpha = 1
|
| 292 |
}
|
|
|
|
| 295 |
cancelAnimationFrame(raf)
|
| 296 |
io.disconnect()
|
| 297 |
}
|
| 298 |
+
}, [layout, size, height, k, labels, index, cx, cy, sinT, cosT, sNear, sFar, E])
|
| 299 |
|
| 300 |
+
// Nearest bubble under the pointer, front ones first; the middle is the official model.
|
| 301 |
const hit = (e: React.PointerEvent) => {
|
| 302 |
if (!layout) return
|
| 303 |
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect()
|
| 304 |
+
const px = e.clientX - rect.left, py = e.clientY - rect.top
|
| 305 |
+
const P = proj.current
|
| 306 |
+
let best = -1, bs = -1
|
|
|
|
| 307 |
for (let i = 0; i < layout.pos.length; i++) {
|
| 308 |
+
const sc = P[3 * i + 2]
|
| 309 |
+
if (Math.hypot(P[3 * i] - px, P[3 * i + 1] - py) < layout.pos[i].r * k * sc + 4 && sc > bs) { best = i; bs = sc }
|
| 310 |
}
|
| 311 |
+
if (best >= 0) return setHover(layout.pos[best].id)
|
| 312 |
+
setHover(Math.hypot((px - cx) / 1, (py - cy) / cosT) < CENTER_R * k ? L.base : null)
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
// Dragging sideways turns the disc; a flick keeps it turning for a moment.
|
| 316 |
+
const drag = useRef({ x: 0, t: 0, moved: 0, down: false })
|
| 317 |
+
const onDown = (e: React.PointerEvent) => {
|
| 318 |
+
drag.current = { x: e.clientX, t: performance.now(), moved: 0, down: true }
|
| 319 |
+
view.current.drag = true
|
| 320 |
+
view.current.vel = 0
|
| 321 |
+
}
|
| 322 |
+
const onDrag = (e: React.PointerEvent) => {
|
| 323 |
+
const d = drag.current
|
| 324 |
+
if (!d.down) return false
|
| 325 |
+
const dx = e.clientX - d.x, now = performance.now()
|
| 326 |
+
d.moved += Math.abs(dx)
|
| 327 |
+
if (d.moved > 4) {
|
| 328 |
+
view.current.psi += dx * 0.006
|
| 329 |
+
view.current.vel = (dx * 0.006) / Math.max(0.008, (now - d.t) / 1000)
|
| 330 |
+
}
|
| 331 |
+
d.x = e.clientX
|
| 332 |
+
d.t = now
|
| 333 |
+
return d.moved > 4
|
| 334 |
+
}
|
| 335 |
+
const onUp = () => {
|
| 336 |
+
drag.current.down = false
|
| 337 |
+
view.current.drag = false
|
| 338 |
+
view.current.vel = Math.max(-2, Math.min(2, view.current.vel))
|
| 339 |
}
|
| 340 |
|
| 341 |
const present = ORDER.filter((r) => repos.some((x) => x.rel === r))
|
| 342 |
const center = hover === L.base
|
| 343 |
const hi = hover && !center ? index.get(hover) : undefined
|
| 344 |
const hp = hi != null ? layout!.pos[hi] : null
|
| 345 |
+
const hpos = hi != null ? { x: proj.current[3 * hi], y: proj.current[3 * hi + 1], s: proj.current[3 * hi + 2] } : null
|
| 346 |
+
const icon = Math.max(30, CENTER_R * k * 1.6)
|
| 347 |
|
| 348 |
return (
|
| 349 |
+
<div ref={stageRef} className="dark stage relative isolate overflow-hidden rounded-[28px] px-4 pt-8 pb-6 sm:px-8 sm:pt-10">
|
| 350 |
+
<div aria-hidden className="pointer-events-none absolute top-[55%] left-1/2 -z-10 h-[60%] w-[80%] -translate-x-1/2 -translate-y-1/2 rounded-full opacity-25 blur-[120px]"
|
| 351 |
+
style={{ background: `radial-gradient(ellipse, ${catTo(cat)}, transparent 70%)` }} />
|
| 352 |
<DownloadButton target={stageRef} name={`${name} galaxy`} tone="stage" className="absolute top-[26px] right-4 z-20 sm:top-[34px] sm:right-8" />
|
| 353 |
<RelLegend rels={present} className="pr-12 text-white/70" />
|
| 354 |
<div ref={box} className="w-full">
|
| 355 |
+
<div className="relative mx-auto touch-pan-y select-none" style={{ width: size, height, cursor: hover ? "pointer" : "grab" }}
|
| 356 |
+
onPointerMove={(e) => {
|
| 357 |
+
if (onDrag(e)) return setHover(null)
|
| 358 |
+
if (e.pointerType === "mouse") hit(e)
|
| 359 |
+
}}
|
| 360 |
+
onPointerDown={(e) => {
|
| 361 |
+
typeRef.current = e.pointerType
|
| 362 |
+
onDown(e)
|
| 363 |
+
if (e.pointerType !== "mouse") { tapRef.current = hover; hit(e) }
|
| 364 |
+
}}
|
| 365 |
+
onPointerUp={onUp}
|
| 366 |
+
onPointerCancel={onUp}
|
| 367 |
+
onPointerLeave={(e) => { onUp(); if (e.pointerType === "mouse") setHover(null) }}
|
| 368 |
onClick={() => {
|
| 369 |
+
if (drag.current.moved > 4) return
|
| 370 |
const touch = typeRef.current !== "mouse"
|
| 371 |
if (hover && (!touch || tapRef.current === hover)) window.open(hfUrl(hover), "_blank", "noopener")
|
| 372 |
}}
|
| 373 |
role="img" aria-label={`${full(L.n_models)} community models around ${name}`}>
|
| 374 |
{size > 0 && (
|
| 375 |
<div aria-hidden className="pointer-events-none absolute rounded-full blur-[30px]"
|
| 376 |
+
style={{ left: cx - icon, top: cy - icon * 0.8, width: icon * 2, height: icon * 1.6,
|
| 377 |
+
background: `radial-gradient(ellipse, ${catTo(cat)}, ${catFrom(cat)} 45%, transparent 70%)`,
|
| 378 |
opacity: 0.8, animation: "breathe 4s ease-in-out infinite" }} />
|
| 379 |
)}
|
| 380 |
+
<canvas ref={canvas} className="absolute inset-0" style={{ width: size, height }} />
|
|
|
|
|
|
|
|
|
|
| 381 |
{size > 0 && (
|
| 382 |
<div className="pointer-events-none absolute" title={name}
|
| 383 |
+
style={{ left: cx - icon / 2, top: cy - icon * 0.62, opacity: hover && !center ? 0.5 : 1,
|
| 384 |
animation: "pop 900ms cubic-bezier(.34,1.56,.64,1) 300ms both" }}>
|
| 385 |
<Octopus size={icon} />
|
| 386 |
</div>
|
| 387 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
{!layout && size > 0 && (
|
| 389 |
<div className="absolute inset-0 grid place-items-center text-[15px] text-white/60">Placing {full(repos.length)} models…</div>
|
| 390 |
)}
|
| 391 |
{hover && (center || (hp && hpos)) && (
|
| 392 |
+
<Card pos={center ? { x: cx, y: cy, r: icon / 2 } : { x: hpos!.x, y: hpos!.y, r: hp!.r * k * hpos!.s }} size={size} height={height}>
|
| 393 |
{center ? <Official L={L} authors={authors} kidsN={L.n_models} /> : <Model p={hp!} authors={authors} />}
|
| 394 |
</Card>
|
| 395 |
)}
|
|
|
|
| 399 |
)
|
| 400 |
}
|
| 401 |
|
| 402 |
+
function Card({ pos, size, height, children }: { pos: { x: number; y: number; r: number }; size: number; height: number; children: React.ReactNode }) {
|
| 403 |
const W = 300
|
| 404 |
const right = pos.x + pos.r + 14 + W < size
|
| 405 |
const left = right ? pos.x + pos.r + 14 : Math.max(0, pos.x - pos.r - 14 - W)
|
| 406 |
+
const top = Math.min(Math.max(0, pos.y - 70), Math.max(0, height - 250))
|
| 407 |
return (
|
| 408 |
<div className="pointer-events-none absolute z-10 rounded-2xl border border-white/12 bg-[#15151c]/92 p-4 text-[15px] text-white shadow-[0_18px_40px_rgba(0,0,0,0.5)] backdrop-blur-md"
|
| 409 |
style={{ left, top, width: W }}>
|
code/web/src/components/layout.tsx
CHANGED
|
@@ -1,35 +1,37 @@
|
|
| 1 |
import { useEffect, useRef, useState } from "react"
|
| 2 |
-
import { catColor } from "@/lib/category"
|
| 3 |
import { DownloadButton } from "@/components/download-button"
|
| 4 |
|
|
|
|
| 5 |
export function Section({ title, children, className = "" }: { title?: string; children: React.ReactNode; className?: string }) {
|
| 6 |
return (
|
| 7 |
-
<section className={`mt-24 ${className}`}>
|
| 8 |
-
{title && <h2 className="mb-
|
| 9 |
{children}
|
| 10 |
</section>
|
| 11 |
)
|
| 12 |
}
|
| 13 |
|
| 14 |
-
/** A card. With `download` (the file name) it gets a download button
|
|
|
|
| 15 |
export function Panel({ title, download, children }: { title?: string; download?: string; children: React.ReactNode }) {
|
| 16 |
const ref = useRef<HTMLDivElement>(null)
|
|
|
|
|
|
|
| 17 |
if (!download)
|
| 18 |
return (
|
| 19 |
-
<div className=
|
| 20 |
-
{
|
| 21 |
{children}
|
| 22 |
</div>
|
| 23 |
)
|
| 24 |
return (
|
| 25 |
-
<div ref={ref} className=
|
| 26 |
{title ? (
|
| 27 |
<div className="mb-6 flex items-center justify-between gap-4">
|
| 28 |
-
|
| 29 |
<DownloadButton target={ref} name={download} />
|
| 30 |
</div>
|
| 31 |
) : (
|
| 32 |
-
// level with the legend row; the legend leaves room for it
|
| 33 |
<DownloadButton target={ref} name={download} className="absolute top-3.5 right-5 sm:top-[26px] sm:right-8" />
|
| 34 |
)}
|
| 35 |
<div className={title ? undefined : "[&>:first-child]:pr-12"}>{children}</div>
|
|
@@ -37,26 +39,6 @@ export function Panel({ title, download, children }: { title?: string; download?
|
|
| 37 |
)
|
| 38 |
}
|
| 39 |
|
| 40 |
-
/** Soft colour light behind the dark stage; `cats` picks the hues. */
|
| 41 |
-
export function Glow({ cats }: { cats: string[] }) {
|
| 42 |
-
const spots = [
|
| 43 |
-
{ left: "62%", top: "-18%", size: 620, o: 0.42 },
|
| 44 |
-
{ left: "-12%", top: "8%", size: 520, o: 0.3 },
|
| 45 |
-
{ left: "30%", top: "46%", size: 560, o: 0.22 },
|
| 46 |
-
{ left: "84%", top: "52%", size: 420, o: 0.2 },
|
| 47 |
-
]
|
| 48 |
-
return (
|
| 49 |
-
<div aria-hidden className="pointer-events-none absolute inset-0 -z-10 overflow-hidden">
|
| 50 |
-
{spots.map((s, i) => (
|
| 51 |
-
<div key={i} className="absolute rounded-full blur-[120px]"
|
| 52 |
-
style={{ left: s.left, top: s.top, width: s.size, height: s.size, opacity: s.o,
|
| 53 |
-
background: catColor(cats[i % cats.length]) }} />
|
| 54 |
-
))}
|
| 55 |
-
<div className="absolute inset-0 bg-[radial-gradient(rgba(255,255,255,0.07)_1px,transparent_1px)] [background-size:28px_28px] [mask-image:linear-gradient(180deg,#000,transparent_85%)]" />
|
| 56 |
-
</div>
|
| 57 |
-
)
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
/** A number that counts up once when it first appears. */
|
| 61 |
export function CountUp({ value, format, ms = 1600 }: { value: number; format: (n: number) => string; ms?: number }) {
|
| 62 |
const [v, setV] = useState(0)
|
|
@@ -77,15 +59,21 @@ export function CountUp({ value, format, ms = 1600 }: { value: number; format: (
|
|
| 77 |
raf = requestAnimationFrame(tick)
|
| 78 |
return () => cancelAnimationFrame(raf)
|
| 79 |
}, [value, ms])
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
-
/**
|
| 84 |
export function Stat({ value, label }: { value: React.ReactNode; label: string }) {
|
| 85 |
return (
|
| 86 |
<div className="min-w-0">
|
| 87 |
-
<div className="font-
|
| 88 |
-
<div className="mt-
|
| 89 |
</div>
|
| 90 |
)
|
| 91 |
}
|
|
|
|
| 1 |
import { useEffect, useRef, useState } from "react"
|
|
|
|
| 2 |
import { DownloadButton } from "@/components/download-button"
|
| 3 |
|
| 4 |
+
/** A part of a page under a centred heading, as minimax.io sets its sections. */
|
| 5 |
export function Section({ title, children, className = "" }: { title?: string; children: React.ReactNode; className?: string }) {
|
| 6 |
return (
|
| 7 |
+
<section className={`mt-24 sm:mt-28 ${className}`}>
|
| 8 |
+
{title && <h2 className="mb-10 text-center font-display text-[30px] leading-tight font-semibold tracking-[-0.01em] sm:text-[36px]">{title}</h2>}
|
| 9 |
{children}
|
| 10 |
</section>
|
| 11 |
)
|
| 12 |
}
|
| 13 |
|
| 14 |
+
/** A white card with a hairline border. With `download` (the file name) it gets a download button
|
| 15 |
+
* on its title row (or top right, level with the legend, when untitled). */
|
| 16 |
export function Panel({ title, download, children }: { title?: string; download?: string; children: React.ReactNode }) {
|
| 17 |
const ref = useRef<HTMLDivElement>(null)
|
| 18 |
+
const head = title && <h3 className="font-display text-[19px] leading-tight font-semibold">{title}</h3>
|
| 19 |
+
const card = "relative min-w-0 rounded-[20px] border border-border bg-card p-5 shadow-[var(--shadow-card)] sm:p-8"
|
| 20 |
if (!download)
|
| 21 |
return (
|
| 22 |
+
<div className={card}>
|
| 23 |
+
{head && <div className="mb-6">{head}</div>}
|
| 24 |
{children}
|
| 25 |
</div>
|
| 26 |
)
|
| 27 |
return (
|
| 28 |
+
<div ref={ref} className={card}>
|
| 29 |
{title ? (
|
| 30 |
<div className="mb-6 flex items-center justify-between gap-4">
|
| 31 |
+
{head}
|
| 32 |
<DownloadButton target={ref} name={download} />
|
| 33 |
</div>
|
| 34 |
) : (
|
|
|
|
| 35 |
<DownloadButton target={ref} name={download} className="absolute top-3.5 right-5 sm:top-[26px] sm:right-8" />
|
| 36 |
)}
|
| 37 |
<div className={title ? undefined : "[&>:first-child]:pr-12"}>{children}</div>
|
|
|
|
| 39 |
)
|
| 40 |
}
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
/** A number that counts up once when it first appears. */
|
| 43 |
export function CountUp({ value, format, ms = 1600 }: { value: number; format: (n: number) => string; ms?: number }) {
|
| 44 |
const [v, setV] = useState(0)
|
|
|
|
| 59 |
raf = requestAnimationFrame(tick)
|
| 60 |
return () => cancelAnimationFrame(raf)
|
| 61 |
}, [value, ms])
|
| 62 |
+
// Serif figures are proportional: the final value, hidden, holds the width while it counts.
|
| 63 |
+
return (
|
| 64 |
+
<span className="inline-grid">
|
| 65 |
+
<span aria-hidden className="invisible col-start-1 row-start-1">{format(value)}</span>
|
| 66 |
+
<span className="col-start-1 row-start-1">{format(v)}</span>
|
| 67 |
+
</span>
|
| 68 |
+
)
|
| 69 |
}
|
| 70 |
|
| 71 |
+
/** A number over what it counts: serif figures, as minimax.io sets its company numbers. */
|
| 72 |
export function Stat({ value, label }: { value: React.ReactNode; label: string }) {
|
| 73 |
return (
|
| 74 |
<div className="min-w-0">
|
| 75 |
+
<div className="font-serif text-[30px] leading-none tracking-[-0.01em] whitespace-nowrap sm:text-[36px]">{value}</div>
|
| 76 |
+
<div className="mt-3 text-[15px] leading-snug text-muted-foreground sm:text-base">{label}</div>
|
| 77 |
</div>
|
| 78 |
)
|
| 79 |
}
|
code/web/src/components/lockup.tsx
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Model names set the way minimax.io sets them. `MarkLockup` is the card picture: "MiniMax" in
|
| 3 |
+
* Outfit over the mark in Abhaya Libre ExtraBold ("M3.1", "H3"; a word model stacks its word,
|
| 4 |
+
* "Speech" over "2.8"), and a trailing word in Libre Baskerville italic ("flash", "image").
|
| 5 |
+
* `TitleLockup` is the headline over a hero: one line of Outfit with that italic word.
|
| 6 |
+
*/
|
| 7 |
+
const split = (name: string) => {
|
| 8 |
+
const m = /^MiniMax-(.+?)(?:-([A-Za-z]{3,}))?$/.exec(name)
|
| 9 |
+
if (!m) return null
|
| 10 |
+
const word = /^([A-Za-z]{3,})-?([0-9.]+)$/.exec(m[1]) // Music3, Text-01
|
| 11 |
+
return { token: m[1], word: word?.[1], mark: word ? word[2] : m[1], tail: m[2]?.toLowerCase() }
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
export function MarkLockup({ name }: { name: string }) {
|
| 15 |
+
const p = split(name)
|
| 16 |
+
if (!p) return <span className="text-center font-numeral text-[44px] leading-[0.9] font-extrabold">{name}</span>
|
| 17 |
+
return (
|
| 18 |
+
<span role="img" aria-label={name} className="flex flex-col items-center text-center">
|
| 19 |
+
<span aria-hidden className="font-display text-[24px] leading-none font-semibold tracking-[-0.01em]">MiniMax</span>
|
| 20 |
+
{p.word && <span aria-hidden className="mt-1 font-numeral text-[34px] leading-[0.9] font-extrabold">{p.word}</span>}
|
| 21 |
+
<span aria-hidden className={`font-numeral leading-[0.82] font-extrabold tracking-[-0.01em] ${p.mark.length > 4 ? "text-[62px]" : "text-[80px]"}`}>{p.mark}</span>
|
| 22 |
+
{p.tail && <span aria-hidden className="-mt-1 font-serif text-[30px] leading-none italic">{p.tail}</span>}
|
| 23 |
+
</span>
|
| 24 |
+
)
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
export function TitleLockup({ name }: { name: string }) {
|
| 28 |
+
const p = split(name)
|
| 29 |
+
if (!p) return <>{name}</>
|
| 30 |
+
return (
|
| 31 |
+
<>
|
| 32 |
+
MiniMax {p.token}
|
| 33 |
+
{p.tail && <span className="ml-[0.18em] font-serif font-normal italic tracking-[-0.02em]">{p.tail}</span>}
|
| 34 |
+
</>
|
| 35 |
+
)
|
| 36 |
+
}
|
code/web/src/components/logo.tsx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/** The MiniMax logo (mark and wordmark), traced from the brand book's one-colour version: white
|
| 2 |
+
* on the gradient or on black is how the brand book shows it there. Takes the text colour. */
|
| 3 |
+
const PATH =
|
| 4 |
+
"M56.66 9.9C56.66 7.54 54.75 5.63 52.4 5.63C50.05 5.63 48.13 7.55 48.13 9.9L48.13 80.61C48.13 86.09 43.68 90.54 38.21 90.54C32.73 90.54 28.28 86.09 28.28 80.61L28.28 35.25C28.28 32.89 26.36 30.98 24.01 30.98C21.66 30.98 19.75 32.89 19.75 35.25L19.75 54.47C19.75 59.95 15.29 64.4 9.82 64.4C4.35 64.4 -0.11 59.95 -0.11 54.47L-0.11 47.5C-0.11 45.94 1.15 44.67 2.72 44.67C4.28 44.67 5.55 45.94 5.55 47.5L5.55 54.47C5.55 56.83 7.46 58.74 9.81 58.74C12.16 58.74 14.08 56.82 14.08 54.47L14.08 35.24C14.08 29.77 18.53 25.32 24 25.32C29.48 25.32 33.93 29.77 33.93 35.24L33.93 80.61C33.93 82.96 35.85 84.88 38.2 84.88C40.55 84.88 42.46 82.96 42.46 80.61L42.46 52.87L42.46 9.9C42.46 4.43 46.92 -0.03 52.39 -0.03C57.86 -0.03 62.32 4.43 62.32 9.9L62.32 68.45C62.32 70.02 61.05 71.28 59.49 71.28C57.92 71.28 56.66 70.02 56.66 68.45L56.66 9.9L56.66 9.9M109.17 25.32C103.7 25.32 99.25 29.77 99.25 35.25L99.25 73.14C99.25 75.5 97.33 77.41 94.98 77.41C92.63 77.41 90.71 75.49 90.71 73.14L90.71 9.9C90.71 4.43 86.26 -0.03 80.79 -0.03C75.31 -0.03 70.86 4.43 70.86 9.9L70.86 90.18C70.86 92.53 68.95 94.44 66.59 94.44C64.24 94.44 62.33 92.53 62.33 90.18L62.33 80.24C62.33 78.68 61.06 77.41 59.5 77.41C57.94 77.41 56.67 78.68 56.67 80.24L56.67 90.18C56.67 95.65 61.12 100.1 66.59 100.1C72.07 100.1 76.52 95.65 76.52 90.18L76.52 9.9C76.52 7.54 78.44 5.63 80.79 5.63C83.14 5.63 85.05 7.55 85.05 9.9L85.05 73.14C85.05 78.61 89.51 83.07 94.98 83.07C100.45 83.07 104.91 78.61 104.91 73.14L104.91 35.25C104.91 32.89 106.82 30.98 109.17 30.98C111.52 30.98 113.44 32.89 113.44 35.25L113.44 68.45C113.44 70.02 114.71 71.28 116.27 71.28C117.83 71.28 119.1 70.02 119.1 68.45L119.1 35.25C119.1 29.77 114.64 25.32 109.17 25.32M211.39 31.42C211.21 31.42 211.06 31.49 210.93 31.61L210.93 31.6C210.8 31.73 210.74 31.88 210.74 32.06L210.8 54.4C210.8 54.54 210.76 54.62 210.69 54.64C210.62 54.66 210.55 54.61 210.48 54.5L196.76 31.84C196.61 31.56 196.36 31.42 196.01 31.42L190 31.42C189.82 31.42 189.67 31.48 189.55 31.6C189.42 31.73 189.36 31.88 189.36 32.06L189.36 68.02C189.36 68.19 189.42 68.35 189.55 68.47C189.67 68.59 189.82 68.66 190 68.66L196.22 68.66C196.4 68.66 196.55 68.59 196.68 68.47C196.8 68.34 196.86 68.19 196.86 68.02L196.76 45.57C196.76 45.43 196.79 45.35 196.86 45.33C196.93 45.31 197.01 45.36 197.08 45.46L210.86 68.23C211 68.52 211.24 68.66 211.6 68.66L217.61 68.66C217.79 68.66 217.94 68.6 218.07 68.47C218.19 68.35 218.25 68.2 218.25 68.02L218.25 32.06C218.25 31.88 218.19 31.73 218.07 31.61C217.94 31.48 217.79 31.42 217.61 31.42L211.39 31.42M162.03 31.42L168.25 31.42C168.43 31.42 168.58 31.48 168.71 31.61C168.83 31.73 168.89 31.88 168.89 32.06L168.89 68.02C168.89 68.2 168.83 68.35 168.71 68.47C168.58 68.6 168.43 68.66 168.25 68.66L162.03 68.66C161.85 68.66 161.7 68.6 161.57 68.47C161.45 68.35 161.39 68.2 161.39 68.02L161.39 44.56C161.39 44.43 161.35 44.35 161.28 44.35C161.21 44.35 161.14 44.4 161.07 44.51L155.43 53.34C155.25 53.62 155.01 53.77 154.69 53.77L151.55 53.77C151.23 53.77 150.98 53.63 150.8 53.34L145.17 44.51C145.1 44.41 145.02 44.36 144.95 44.38C144.88 44.39 144.85 44.48 144.85 44.62L144.85 68.02C144.85 68.2 144.79 68.35 144.66 68.47C144.54 68.6 144.39 68.66 144.21 68.66L137.98 68.66C137.8 68.66 137.66 68.6 137.53 68.47C137.4 68.35 137.34 68.2 137.34 68.02L137.34 32.06C137.34 31.88 137.4 31.73 137.53 31.61C137.66 31.48 137.8 31.42 137.98 31.42L144.21 31.42C144.53 31.42 144.77 31.57 144.95 31.85L152.93 44.24C153.04 44.46 153.15 44.46 153.25 44.24L161.28 31.85C161.46 31.57 161.71 31.42 162.03 31.42M175.56 68.47C175.43 68.35 175.37 68.2 175.37 68.02L175.37 32.06C175.37 31.88 175.43 31.73 175.56 31.61C175.69 31.48 175.83 31.42 176.01 31.42L182.24 31.42C182.42 31.42 182.57 31.48 182.69 31.61C182.81 31.73 182.88 31.88 182.88 32.06L182.88 68.02C182.88 68.2 182.82 68.35 182.69 68.47C182.57 68.6 182.42 68.66 182.24 68.66L176.01 68.66C175.83 68.66 175.69 68.6 175.56 68.47M224.93 68.47C224.8 68.35 224.74 68.2 224.74 68.02L224.74 32.06C224.74 31.88 224.8 31.73 224.93 31.61C225.05 31.48 225.2 31.42 225.38 31.42L231.61 31.42C231.78 31.42 231.93 31.48 232.06 31.61C232.18 31.73 232.25 31.88 232.25 32.06L232.25 68.02C232.25 68.2 232.18 68.35 232.06 68.47C231.93 68.6 231.78 68.66 231.61 68.66L225.38 68.66C225.2 68.66 225.05 68.6 224.93 68.47M269.64 31.42L263.41 31.42C263.09 31.42 262.84 31.57 262.67 31.85L254.63 44.24C254.53 44.46 254.42 44.46 254.32 44.24L246.34 31.85C246.16 31.57 245.91 31.42 245.59 31.42L239.37 31.42C239.19 31.42 239.04 31.48 238.91 31.61C238.79 31.73 238.73 31.88 238.73 32.06L238.73 68.02C238.73 68.2 238.79 68.35 238.91 68.47C239.04 68.6 239.19 68.66 239.37 68.66L245.59 68.66C245.77 68.66 245.92 68.6 246.04 68.47C246.17 68.35 246.23 68.2 246.23 68.02L246.23 44.62C246.23 44.48 246.27 44.39 246.34 44.38C246.41 44.36 246.48 44.41 246.55 44.51L252.19 53.34C252.37 53.63 252.61 53.77 252.93 53.77L256.07 53.77C256.39 53.77 256.64 53.62 256.81 53.34L262.45 44.51C262.52 44.4 262.6 44.35 262.67 44.35C262.74 44.35 262.77 44.43 262.77 44.56L262.77 68.02C262.77 68.2 262.83 68.35 262.96 68.47C263.08 68.6 263.23 68.66 263.41 68.66L269.64 68.66C269.81 68.66 269.96 68.6 270.09 68.47C270.21 68.35 270.28 68.2 270.28 68.02L270.28 32.06C270.28 31.88 270.21 31.73 270.09 31.61C269.96 31.48 269.81 31.42 269.64 31.42M299.74 68.13L298.14 62.91C298.07 62.78 297.98 62.7 297.88 62.7L284.79 62.7C284.68 62.7 284.59 62.77 284.52 62.91L282.98 68.13C282.88 68.48 282.65 68.66 282.29 68.66L275.53 68.66C275.32 68.66 275.16 68.6 275.05 68.47C274.95 68.35 274.93 68.16 275 67.91L286.49 31.95C286.6 31.6 286.83 31.42 287.18 31.42L295.53 31.42C295.89 31.42 296.12 31.6 296.23 31.95L307.71 67.91C307.75 67.98 307.77 68.07 307.77 68.18C307.77 68.5 307.57 68.66 307.18 68.66L300.43 68.66C300.07 68.66 299.84 68.48 299.73 68.13L299.74 68.13M286.66 56.9L296.02 56.9C296.23 56.9 296.3 56.8 296.23 56.58L291.45 40.79C291.41 40.65 291.36 40.58 291.28 40.6C291.21 40.62 291.16 40.68 291.12 40.79L286.44 56.58C286.41 56.8 286.48 56.9 286.66 56.9M310.91 67.91C310.77 68.13 310.75 68.31 310.86 68.45L310.85 68.45C310.96 68.59 311.13 68.66 311.38 68.66L318.09 68.66C318.44 68.66 318.71 68.52 318.88 68.23L325.85 56.1C325.96 55.89 326.07 55.89 326.17 56.1L333.09 68.23C333.26 68.52 333.52 68.66 333.88 68.66L340.59 68.66C340.97 68.66 341.17 68.52 341.17 68.23L341.07 67.91L330.75 50.2C330.71 50.1 330.71 49.99 330.75 49.88L341.07 32.17C341.2 31.95 341.22 31.78 341.12 31.64C341.01 31.49 340.83 31.42 340.59 31.42L333.88 31.42C333.53 31.42 333.26 31.57 333.09 31.85L326.17 44.03C326.07 44.24 325.96 44.24 325.85 44.03L318.94 31.85C318.76 31.57 318.5 31.42 318.14 31.42L311.39 31.42C311 31.42 310.8 31.57 310.8 31.85L310.91 32.17L321.23 49.88C321.3 49.99 321.3 50.1 321.23 50.2L310.91 67.91"
|
| 5 |
+
|
| 6 |
+
export function Logo({ className = "" }: { className?: string }) {
|
| 7 |
+
return (
|
| 8 |
+
<svg viewBox="0 0 341.22 100.1" role="img" aria-label="MiniMax" className={className}>
|
| 9 |
+
<path d={PATH} fill="currentColor" />
|
| 10 |
+
</svg>
|
| 11 |
+
)
|
| 12 |
+
}
|
code/web/src/components/media.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useRef } from "react"
|
| 2 |
+
import { useLoop } from "@/hooks/motion"
|
| 3 |
+
import { MarkLockup } from "@/components/lockup"
|
| 4 |
+
|
| 5 |
+
/** Footage from minimax.io, one subject per modality: the M3.1 flower, the H3 jellyfish, the
|
| 6 |
+
* H3-Image coral, the Speech manta for music. Each fades to white at its foot. */
|
| 7 |
+
const media = (kind: "hero" | "tile", cat: string) => {
|
| 8 |
+
const c = ["language", "video", "image", "music"].includes(cat) ? cat : "language"
|
| 9 |
+
return { src: `media/${kind}-${c}.mp4`, poster: `media/${kind}-${c}.jpg` }
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
/** The moving background at the top of a page, as on minimax.io: full width, taller than the
|
| 13 |
+
* first screen, fading into the white page. Purely decorative. */
|
| 14 |
+
export function HeroVideo({ cat }: { cat: string }) {
|
| 15 |
+
const ref = useRef<HTMLVideoElement>(null)
|
| 16 |
+
useLoop(ref)
|
| 17 |
+
const m = media("hero", cat)
|
| 18 |
+
return (
|
| 19 |
+
<div aria-hidden className="pointer-events-none absolute inset-x-0 top-0 -z-10 h-[clamp(820px,104vw,1500px)] overflow-hidden">
|
| 20 |
+
<video ref={ref} key={cat} src={m.src} poster={m.poster} muted loop playsInline preload="auto"
|
| 21 |
+
className="size-full object-cover object-top" />
|
| 22 |
+
{/* the footage ends a shade off white; this closes the seam */}
|
| 23 |
+
<div className="absolute inset-x-0 bottom-0 h-[22%] bg-gradient-to-b from-white/0 to-white" />
|
| 24 |
+
</div>
|
| 25 |
+
)
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/** A model card's picture, as on minimax.io: its modality's footage with the model mark on it. */
|
| 29 |
+
export function Tile({ name, cat }: { name: string; cat: string }) {
|
| 30 |
+
const ref = useRef<HTMLVideoElement>(null)
|
| 31 |
+
useLoop(ref)
|
| 32 |
+
const m = media("tile", cat)
|
| 33 |
+
return (
|
| 34 |
+
<div className="relative isolate aspect-[5/4] overflow-hidden rounded-[14px]">
|
| 35 |
+
<video ref={ref} src={m.src} poster={m.poster} muted loop playsInline preload="metadata" aria-hidden
|
| 36 |
+
className="absolute inset-0 -z-10 size-full scale-[1.02] object-cover" />
|
| 37 |
+
<div className="grid size-full place-items-center px-3 text-white">
|
| 38 |
+
<MarkLockup name={name} />
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
)
|
| 42 |
+
}
|
code/web/src/components/release-rail.tsx
CHANGED
|
@@ -1,17 +1,16 @@
|
|
| 1 |
import { useEffect, useRef, useState } from "react"
|
| 2 |
import { ArrowLeft, ArrowRight, ArrowUpRight } from "lucide-react"
|
| 3 |
import type { Release, Site } from "@/lib/types"
|
| 4 |
-
import { catColor } from "@/lib/category"
|
| 5 |
import { full, hfUrl, mdy, num } from "@/lib/format"
|
| 6 |
import { href } from "@/lib/route"
|
| 7 |
-
import {
|
| 8 |
|
| 9 |
-
/** Every
|
|
|
|
| 10 |
export function ReleaseRail({ site }: { site: Site }) {
|
| 11 |
const rail = useRef<HTMLOListElement>(null)
|
| 12 |
const [edge, setEdge] = useState({ start: true, end: false })
|
| 13 |
const rels = [...site.releases].sort((a, b) => a.date.localeCompare(b.date))
|
| 14 |
-
const catName = (k: string) => site.categories.find((c) => c.key === k)?.name ?? k
|
| 15 |
|
| 16 |
const sync = () => {
|
| 17 |
const el = rail.current
|
|
@@ -27,59 +26,51 @@ export function ReleaseRail({ site }: { site: Site }) {
|
|
| 27 |
const page = (dir: number) => rail.current?.scrollBy({ left: dir * rail.current.clientWidth * 0.8, behavior: "smooth" })
|
| 28 |
|
| 29 |
return (
|
| 30 |
-
<
|
| 31 |
-
<div className="mb-
|
| 32 |
-
<h2 className="font-display text-[30px] leading-tight font-semibold tracking-[-0.01em]
|
| 33 |
-
<div className="hidden gap-2 sm:flex">
|
| 34 |
{[-1, 1].map((d) => (
|
| 35 |
<button key={d} type="button" onClick={() => page(d)} disabled={d < 0 ? edge.start : edge.end}
|
| 36 |
aria-label={d < 0 ? "Earlier releases" : "Later releases"}
|
| 37 |
-
className="grid size-10 place-items-center rounded-full border border-white
|
| 38 |
{d < 0 ? <ArrowLeft className="size-4" /> : <ArrowRight className="size-4" />}
|
| 39 |
</button>
|
| 40 |
))}
|
| 41 |
</div>
|
| 42 |
</div>
|
| 43 |
<ol ref={rail} onScroll={sync}
|
| 44 |
-
className="-mx-4 flex snap-x snap-mandatory scroll-px-4 gap-
|
| 45 |
-
|
| 46 |
-
{rels.map((r, i) => <Card key={r.key} r={r} cat={catName(r.cat)} today={site.today} i={i} />)}
|
| 47 |
</ol>
|
| 48 |
-
</
|
| 49 |
)
|
| 50 |
}
|
| 51 |
|
| 52 |
-
function Card({ r
|
| 53 |
const external = !r.page
|
| 54 |
return (
|
| 55 |
-
<li className="w-[
|
| 56 |
<a href={external ? hfUrl(r.base) : href(r.cat, r.key)} target={external ? "_blank" : undefined} rel={external ? "noopener" : undefined}
|
| 57 |
-
className="group
|
| 58 |
-
<
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
<span className="
|
| 62 |
-
|
| 63 |
-
</span>
|
| 64 |
</div>
|
| 65 |
-
<div className="mt-
|
| 66 |
-
|
| 67 |
-
{external && <ArrowUpRight className="mt-1 size-4 shrink-0 text-white/40" />}
|
| 68 |
-
</div>
|
| 69 |
-
<div className="mt-4 grid grid-cols-2 gap-3">
|
| 70 |
<div>
|
| 71 |
-
<div className="font-
|
| 72 |
-
<div className="mt-
|
| 73 |
</div>
|
| 74 |
<div>
|
| 75 |
-
<div className="font-
|
| 76 |
-
<div className="mt-
|
| 77 |
</div>
|
| 78 |
</div>
|
| 79 |
</div>
|
| 80 |
-
<div className="mt-auto">
|
| 81 |
-
<Spark events={r.growth} from={r.date} to={today} cat={r.cat} height={56} ring="var(--stage)" />
|
| 82 |
-
</div>
|
| 83 |
</a>
|
| 84 |
</li>
|
| 85 |
)
|
|
|
|
| 1 |
import { useEffect, useRef, useState } from "react"
|
| 2 |
import { ArrowLeft, ArrowRight, ArrowUpRight } from "lucide-react"
|
| 3 |
import type { Release, Site } from "@/lib/types"
|
|
|
|
| 4 |
import { full, hfUrl, mdy, num } from "@/lib/format"
|
| 5 |
import { href } from "@/lib/route"
|
| 6 |
+
import { Tile } from "@/components/media"
|
| 7 |
|
| 8 |
+
/** Every release in order, as minimax.io shows its flagship models: a card with the model's
|
| 9 |
+
* picture, its name and date, and the community it has today. */
|
| 10 |
export function ReleaseRail({ site }: { site: Site }) {
|
| 11 |
const rail = useRef<HTMLOListElement>(null)
|
| 12 |
const [edge, setEdge] = useState({ start: true, end: false })
|
| 13 |
const rels = [...site.releases].sort((a, b) => a.date.localeCompare(b.date))
|
|
|
|
| 14 |
|
| 15 |
const sync = () => {
|
| 16 |
const el = rail.current
|
|
|
|
| 26 |
const page = (dir: number) => rail.current?.scrollBy({ left: dir * rail.current.clientWidth * 0.8, behavior: "smooth" })
|
| 27 |
|
| 28 |
return (
|
| 29 |
+
<section className="relative mx-auto w-full max-w-[1200px] px-4 sm:px-8">
|
| 30 |
+
<div className="relative mb-8 flex items-center justify-center">
|
| 31 |
+
<h2 className="text-center font-display text-[30px] leading-tight font-semibold tracking-[-0.01em] sm:text-[36px]">Every release</h2>
|
| 32 |
+
<div className="absolute right-0 hidden gap-2 sm:flex">
|
| 33 |
{[-1, 1].map((d) => (
|
| 34 |
<button key={d} type="button" onClick={() => page(d)} disabled={d < 0 ? edge.start : edge.end}
|
| 35 |
aria-label={d < 0 ? "Earlier releases" : "Later releases"}
|
| 36 |
+
className="grid size-10 place-items-center rounded-full border border-border bg-white text-foreground transition-colors hover:bg-muted disabled:opacity-35">
|
| 37 |
{d < 0 ? <ArrowLeft className="size-4" /> : <ArrowRight className="size-4" />}
|
| 38 |
</button>
|
| 39 |
))}
|
| 40 |
</div>
|
| 41 |
</div>
|
| 42 |
<ol ref={rail} onScroll={sync}
|
| 43 |
+
className="-mx-4 flex snap-x snap-mandatory scroll-px-4 gap-4 overflow-x-auto scroll-smooth px-4 pt-1 pb-6 [scrollbar-width:none] sm:-mx-8 sm:scroll-px-8 sm:px-8 [&::-webkit-scrollbar]:hidden">
|
| 44 |
+
{rels.map((r) => <Card key={r.key} r={r} />)}
|
|
|
|
| 45 |
</ol>
|
| 46 |
+
</section>
|
| 47 |
)
|
| 48 |
}
|
| 49 |
|
| 50 |
+
function Card({ r }: { r: Release }) {
|
| 51 |
const external = !r.page
|
| 52 |
return (
|
| 53 |
+
<li className="w-[256px] shrink-0 snap-start sm:w-[272px]">
|
| 54 |
<a href={external ? hfUrl(r.base) : href(r.cat, r.key)} target={external ? "_blank" : undefined} rel={external ? "noopener" : undefined}
|
| 55 |
+
className="group flex h-full flex-col rounded-[20px] border border-border bg-white p-2 shadow-[var(--shadow-card)] transition-[transform,box-shadow] duration-300 ease-[cubic-bezier(.22,.61,.36,1)] hover:-translate-y-1 hover:shadow-[0_24px_48px_-20px_rgba(23,23,23,0.28)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring">
|
| 56 |
+
<Tile name={r.name} cat={r.cat} />
|
| 57 |
+
<div className="px-3 pt-4 pb-3">
|
| 58 |
+
<div className="flex items-start justify-between gap-2">
|
| 59 |
+
<span className="font-display text-[19px] leading-snug font-semibold">{r.name.replace(/-/g, " ")}</span>
|
| 60 |
+
{external && <ArrowUpRight className="mt-1 size-4 shrink-0 text-muted-foreground" />}
|
|
|
|
| 61 |
</div>
|
| 62 |
+
<div className="mt-1 text-[15px] text-muted-foreground">{mdy(r.date)}</div>
|
| 63 |
+
<div className="mt-5 grid grid-cols-2 gap-3">
|
|
|
|
|
|
|
|
|
|
| 64 |
<div>
|
| 65 |
+
<div className="font-serif text-[24px] leading-none">{full(r.n)}</div>
|
| 66 |
+
<div className="mt-2 text-[15px] text-muted-foreground">community</div>
|
| 67 |
</div>
|
| 68 |
<div>
|
| 69 |
+
<div className="font-serif text-[24px] leading-none">{num(r.official.dlall)}</div>
|
| 70 |
+
<div className="mt-2 text-[15px] text-muted-foreground">downloads</div>
|
| 71 |
</div>
|
| 72 |
</div>
|
| 73 |
</div>
|
|
|
|
|
|
|
|
|
|
| 74 |
</a>
|
| 75 |
</li>
|
| 76 |
)
|
code/web/src/components/segmented.tsx
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
-
/** Two-way switch on
|
| 2 |
export function Segmented<T extends string>({ value, options, onChange, label }: {
|
| 3 |
value: T; options: [{ value: T; label: string }, { value: T; label: string }]; onChange: (v: T) => void; label: string
|
| 4 |
}) {
|
| 5 |
const i = options.findIndex((o) => o.value === value)
|
| 6 |
return (
|
| 7 |
<div role="radiogroup" aria-label={label}
|
| 8 |
-
className="relative grid h-10 shrink-0 grid-cols-2 rounded-full
|
| 9 |
-
<span aria-hidden className="absolute inset-y-1 left-1 w-[calc(50%-4px)] rounded-full bg-
|
| 10 |
style={{ transform: `translateX(${i * 100}%)` }} />
|
| 11 |
{options.map((o) => {
|
| 12 |
const on = o.value === value
|
| 13 |
return (
|
| 14 |
<button key={o.value} type="button" role="radio" aria-checked={on} onClick={() => onChange(o.value)}
|
| 15 |
-
className={`relative z-10 rounded-full px-4 text-[15px] font-medium transition-colors duration-300 focus-visible:outline-2 focus-visible:outline-
|
| 16 |
{o.label}
|
| 17 |
</button>
|
| 18 |
)
|
|
|
|
| 1 |
+
/** Two-way switch on a white card: the chosen option is a black pill, as on minimax.io's tabs. */
|
| 2 |
export function Segmented<T extends string>({ value, options, onChange, label }: {
|
| 3 |
value: T; options: [{ value: T; label: string }, { value: T; label: string }]; onChange: (v: T) => void; label: string
|
| 4 |
}) {
|
| 5 |
const i = options.findIndex((o) => o.value === value)
|
| 6 |
return (
|
| 7 |
<div role="radiogroup" aria-label={label}
|
| 8 |
+
className="relative grid h-10 shrink-0 grid-cols-2 rounded-full bg-muted p-1">
|
| 9 |
+
<span aria-hidden className="absolute inset-y-1 left-1 w-[calc(50%-4px)] rounded-full bg-[#171717] transition-transform duration-300 ease-[cubic-bezier(.22,.61,.36,1)]"
|
| 10 |
style={{ transform: `translateX(${i * 100}%)` }} />
|
| 11 |
{options.map((o) => {
|
| 12 |
const on = o.value === value
|
| 13 |
return (
|
| 14 |
<button key={o.value} type="button" role="radio" aria-checked={on} onClick={() => onChange(o.value)}
|
| 15 |
+
className={`relative z-10 rounded-full px-4 text-[15px] font-medium transition-colors duration-300 focus-visible:outline-2 focus-visible:outline-ring ${on ? "text-white" : "text-muted-foreground hover:text-foreground"}`}>
|
| 16 |
{o.label}
|
| 17 |
</button>
|
| 18 |
)
|
code/web/src/components/site-header.tsx
CHANGED
|
@@ -7,54 +7,52 @@ import type { Site } from "@/lib/types"
|
|
| 7 |
import { catColor } from "@/lib/category"
|
| 8 |
import { full } from "@/lib/format"
|
| 9 |
import { href } from "@/lib/route"
|
|
|
|
| 10 |
|
| 11 |
-
/** Sits on the
|
| 12 |
export function SiteHeader({ site }: { site: Site }) {
|
| 13 |
const rel = (k: string) => site.releases.find((r) => r.key === k)!
|
| 14 |
return (
|
| 15 |
<header className="relative z-20 mx-auto flex w-full max-w-[1200px] items-center justify-between gap-4 px-4 py-5 sm:px-8 sm:py-6">
|
| 16 |
-
<a href={href()} className="
|
| 17 |
-
|
| 18 |
-
<span className="font-display text-[18px] leading-none font-semibold tracking-[-0.01em] whitespace-nowrap sm:text-[20px]">
|
| 19 |
-
MiniMax
|
| 20 |
-
</span>
|
| 21 |
</a>
|
| 22 |
<DropdownMenu modal={false}>
|
| 23 |
-
<DropdownMenuTrigger className="group inline-flex h-10 items-center gap-
|
| 24 |
Models
|
| 25 |
<ChevronDown className="size-4 transition-transform duration-200 group-data-[state=open]:rotate-180" />
|
| 26 |
</DropdownMenuTrigger>
|
| 27 |
<DropdownMenuContent align="end" sideOffset={10}
|
| 28 |
-
className="
|
| 29 |
{site.categories.map((c, i) => {
|
| 30 |
const pages = c.releases.map(rel).filter((r) => r.page)
|
| 31 |
const total = c.releases.reduce((a, k) => a + rel(k).n, 0)
|
| 32 |
return (
|
| 33 |
<DropdownMenuGroup key={c.key}>
|
| 34 |
-
{i > 0 && <DropdownMenuSeparator className="my-1.5 bg-
|
| 35 |
-
<DropdownMenuItem asChild className="rounded-lg px-2.5 py-2 text-[15px] focus:bg-
|
| 36 |
<a href={href(c.key)} className="flex items-center gap-2.5">
|
| 37 |
<span className="size-2.5 rounded-full" style={{ background: catColor(c.key) }} />
|
| 38 |
<span className="font-semibold">{c.name}</span>
|
| 39 |
-
<span className="ml-auto font-display text-
|
| 40 |
</a>
|
| 41 |
</DropdownMenuItem>
|
| 42 |
{pages.length > 1 && pages.map((r) => (
|
| 43 |
-
<DropdownMenuItem key={r.key} asChild className="rounded-lg py-1.5 pr-2.5 pl-7 text-[15px] text-
|
| 44 |
<a href={href(c.key, r.key)} className="flex items-center">
|
| 45 |
{r.name}
|
| 46 |
-
<span className="ml-auto font-display text-
|
| 47 |
</a>
|
| 48 |
</DropdownMenuItem>
|
| 49 |
))}
|
| 50 |
</DropdownMenuGroup>
|
| 51 |
)
|
| 52 |
})}
|
| 53 |
-
<DropdownMenuSeparator className="my-1.5 bg-
|
| 54 |
<DropdownMenuLabel className="sr-only">Elsewhere</DropdownMenuLabel>
|
| 55 |
-
<DropdownMenuItem asChild className="rounded-lg px-2.5 py-2 text-[15px] text-
|
| 56 |
<a href="https://huggingface.co/MiniMaxAI" target="_blank" rel="noopener" className="flex items-center gap-2">
|
| 57 |
-
MiniMaxAI on Hugging Face <ArrowUpRight className="ml-auto size-4 text-
|
| 58 |
</a>
|
| 59 |
</DropdownMenuItem>
|
| 60 |
</DropdownMenuContent>
|
|
|
|
| 7 |
import { catColor } from "@/lib/category"
|
| 8 |
import { full } from "@/lib/format"
|
| 9 |
import { href } from "@/lib/route"
|
| 10 |
+
import { Logo } from "@/components/logo"
|
| 11 |
|
| 12 |
+
/** Sits on the hero video of every page: the MiniMax logo home, and every model page in a menu. */
|
| 13 |
export function SiteHeader({ site }: { site: Site }) {
|
| 14 |
const rel = (k: string) => site.releases.find((r) => r.key === k)!
|
| 15 |
return (
|
| 16 |
<header className="relative z-20 mx-auto flex w-full max-w-[1200px] items-center justify-between gap-4 px-4 py-5 sm:px-8 sm:py-6">
|
| 17 |
+
<a href={href()} className="-m-1.5 rounded-lg p-1.5 text-white focus-visible:outline-2 focus-visible:outline-white">
|
| 18 |
+
<Logo className="h-8 w-auto sm:h-9" />
|
|
|
|
|
|
|
|
|
|
| 19 |
</a>
|
| 20 |
<DropdownMenu modal={false}>
|
| 21 |
+
<DropdownMenuTrigger className="group inline-flex h-10 items-center gap-1.5 rounded-full bg-white px-4.5 text-[15px] font-medium text-[#171717] transition-colors hover:bg-border5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white data-[state=open]:bg-border5">
|
| 22 |
Models
|
| 23 |
<ChevronDown className="size-4 transition-transform duration-200 group-data-[state=open]:rotate-180" />
|
| 24 |
</DropdownMenuTrigger>
|
| 25 |
<DropdownMenuContent align="end" sideOffset={10}
|
| 26 |
+
className="w-[300px] rounded-2xl border border-border bg-white p-2 text-foreground shadow-[0_24px_60px_-12px_rgba(23,23,23,0.25)]">
|
| 27 |
{site.categories.map((c, i) => {
|
| 28 |
const pages = c.releases.map(rel).filter((r) => r.page)
|
| 29 |
const total = c.releases.reduce((a, k) => a + rel(k).n, 0)
|
| 30 |
return (
|
| 31 |
<DropdownMenuGroup key={c.key}>
|
| 32 |
+
{i > 0 && <DropdownMenuSeparator className="my-1.5 bg-border" />}
|
| 33 |
+
<DropdownMenuItem asChild className="rounded-lg px-2.5 py-2 text-[15px] focus:bg-muted">
|
| 34 |
<a href={href(c.key)} className="flex items-center gap-2.5">
|
| 35 |
<span className="size-2.5 rounded-full" style={{ background: catColor(c.key) }} />
|
| 36 |
<span className="font-semibold">{c.name}</span>
|
| 37 |
+
<span className="ml-auto font-display text-muted-foreground tabular-nums">{full(total)}</span>
|
| 38 |
</a>
|
| 39 |
</DropdownMenuItem>
|
| 40 |
{pages.length > 1 && pages.map((r) => (
|
| 41 |
+
<DropdownMenuItem key={r.key} asChild className="rounded-lg py-1.5 pr-2.5 pl-7 text-[15px] text-foreground/80 focus:bg-muted focus:text-foreground">
|
| 42 |
<a href={href(c.key, r.key)} className="flex items-center">
|
| 43 |
{r.name}
|
| 44 |
+
<span className="ml-auto font-display text-muted-foreground tabular-nums">{full(r.n)}</span>
|
| 45 |
</a>
|
| 46 |
</DropdownMenuItem>
|
| 47 |
))}
|
| 48 |
</DropdownMenuGroup>
|
| 49 |
)
|
| 50 |
})}
|
| 51 |
+
<DropdownMenuSeparator className="my-1.5 bg-border" />
|
| 52 |
<DropdownMenuLabel className="sr-only">Elsewhere</DropdownMenuLabel>
|
| 53 |
+
<DropdownMenuItem asChild className="rounded-lg px-2.5 py-2 text-[15px] text-foreground/80 focus:bg-muted focus:text-foreground">
|
| 54 |
<a href="https://huggingface.co/MiniMaxAI" target="_blank" rel="noopener" className="flex items-center gap-2">
|
| 55 |
+
MiniMaxAI on Hugging Face <ArrowUpRight className="ml-auto size-4 text-muted-foreground" />
|
| 56 |
</a>
|
| 57 |
</DropdownMenuItem>
|
| 58 |
</DropdownMenuContent>
|
code/web/src/hooks/motion.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useEffect, useState, type RefObject } from "react"
|
| 2 |
+
|
| 3 |
+
/** Whether the visitor asked for less motion (videos then hold their first frame). */
|
| 4 |
+
export function useReducedMotion() {
|
| 5 |
+
const q = "(prefers-reduced-motion: reduce)"
|
| 6 |
+
const [on, setOn] = useState(() => matchMedia(q).matches)
|
| 7 |
+
useEffect(() => {
|
| 8 |
+
const mq = matchMedia(q)
|
| 9 |
+
const f = () => setOn(mq.matches)
|
| 10 |
+
mq.addEventListener("change", f)
|
| 11 |
+
return () => mq.removeEventListener("change", f)
|
| 12 |
+
}, [])
|
| 13 |
+
return on
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
/** Plays a muted loop only while it is on screen and motion is welcome. */
|
| 17 |
+
export function useLoop(ref: RefObject<HTMLVideoElement | null>) {
|
| 18 |
+
const still = useReducedMotion()
|
| 19 |
+
useEffect(() => {
|
| 20 |
+
const v = ref.current
|
| 21 |
+
if (!v) return
|
| 22 |
+
if (still) {
|
| 23 |
+
v.pause()
|
| 24 |
+
return
|
| 25 |
+
}
|
| 26 |
+
const io = new IntersectionObserver(([e]) => (e.isIntersecting ? v.play().catch(() => {}) : v.pause()), { rootMargin: "120px" })
|
| 27 |
+
io.observe(v)
|
| 28 |
+
return () => io.disconnect()
|
| 29 |
+
}, [ref, still])
|
| 30 |
+
}
|
code/web/src/index.css
CHANGED
|
@@ -1,7 +1,13 @@
|
|
| 1 |
@import "tailwindcss";
|
| 2 |
@import "tw-animate-css";
|
| 3 |
@import "shadcn/tailwind.css";
|
| 4 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
@import "@fontsource-variable/outfit/index.css";
|
| 6 |
@import "@fontsource-variable/dm-sans/index.css";
|
| 7 |
|
|
@@ -11,6 +17,8 @@
|
|
| 11 |
--font-heading: var(--font-sans);
|
| 12 |
--font-sans: "DM Sans Variable", system-ui, -apple-system, "Segoe UI", "PingFang SC", sans-serif;
|
| 13 |
--font-display: "Outfit Variable", "DM Sans Variable", system-ui, sans-serif;
|
|
|
|
|
|
|
| 14 |
--color-sidebar-ring: var(--sidebar-ring);
|
| 15 |
--color-sidebar-border: var(--sidebar-border);
|
| 16 |
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
@@ -51,8 +59,9 @@
|
|
| 51 |
--radius-4xl: calc(var(--radius) * 2.6);
|
| 52 |
}
|
| 53 |
|
| 54 |
-
/*
|
| 55 |
-
|
|
|
|
| 56 |
:root {
|
| 57 |
--background: #ffffff;
|
| 58 |
--foreground: #171717;
|
|
@@ -68,74 +77,75 @@
|
|
| 68 |
--muted-foreground: #666666;
|
| 69 |
--accent: #f5f5f5;
|
| 70 |
--accent-foreground: #171717;
|
| 71 |
-
--destructive: #
|
| 72 |
--border: #e9e9e9;
|
| 73 |
--input: #e9e9e9;
|
| 74 |
-
--ring: #
|
| 75 |
--radius: 12px;
|
| 76 |
-
--chart-1: #
|
| 77 |
--sidebar: #ffffff; --sidebar-foreground: #171717; --sidebar-primary: #171717; --sidebar-primary-foreground: #ffffff;
|
| 78 |
-
--sidebar-accent: #f5f5f5; --sidebar-accent-foreground: #171717; --sidebar-border: #e9e9e9; --sidebar-ring: #
|
| 79 |
|
| 80 |
-
--brand: #
|
| 81 |
-
--brand-from: #
|
| 82 |
-
--brand-to: #
|
| 83 |
-
--
|
| 84 |
-
--rel-
|
| 85 |
-
--rel-
|
| 86 |
-
--rel-
|
| 87 |
-
--rel-
|
| 88 |
-
--rel-merge: #0077d9;
|
| 89 |
--rel-mirror: #b7bacc;
|
| 90 |
-
--rel-component: #
|
| 91 |
--neutral-series: #b7bacc;
|
| 92 |
-
--galaxy-bg: #
|
| 93 |
-
--ring-band: rgba(
|
| 94 |
|
| 95 |
-
/* modalities, in stack order
|
| 96 |
-
--cat-language: #
|
| 97 |
-
--cat-video: #
|
| 98 |
-
--cat-music: #
|
| 99 |
-
--cat-image: #
|
| 100 |
-
--stage: #
|
|
|
|
| 101 |
}
|
| 102 |
|
| 103 |
.dark {
|
| 104 |
-
--background: #
|
| 105 |
-
--foreground: #
|
| 106 |
-
--card: #
|
| 107 |
-
--card-foreground: #
|
| 108 |
-
--popover: #
|
| 109 |
-
--popover-foreground: #
|
| 110 |
--primary: #ffffff;
|
| 111 |
-
--primary-foreground: #
|
| 112 |
-
--secondary: #
|
| 113 |
-
--secondary-foreground: #
|
| 114 |
-
--muted: #
|
| 115 |
-
--muted-foreground: #
|
| 116 |
-
--accent: #
|
| 117 |
-
--accent-foreground: #
|
| 118 |
-
--destructive: #
|
| 119 |
-
--border: #
|
| 120 |
-
--input: #
|
| 121 |
-
--ring: #
|
| 122 |
-
--chart-1: #
|
| 123 |
-
--sidebar: #
|
| 124 |
-
--sidebar-accent: #
|
| 125 |
|
| 126 |
-
--brand: #
|
| 127 |
-
--rel-adapter: #
|
| 128 |
-
--rel-finetune: #
|
| 129 |
-
--rel-quantized: #
|
| 130 |
-
--rel-repackage: #
|
| 131 |
-
--rel-merge: #
|
| 132 |
--rel-mirror: #6b6f80;
|
| 133 |
-
--rel-component: #
|
| 134 |
--neutral-series: #6b6f80;
|
| 135 |
-
--
|
| 136 |
-
--
|
| 137 |
-
--cat-
|
| 138 |
-
--cat-
|
|
|
|
| 139 |
}
|
| 140 |
|
| 141 |
@layer base {
|
|
@@ -153,10 +163,18 @@
|
|
| 153 |
}
|
| 154 |
}
|
| 155 |
|
| 156 |
-
/* The
|
| 157 |
.stage {
|
| 158 |
background-color: var(--stage);
|
| 159 |
-
color: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
}
|
| 161 |
|
| 162 |
@keyframes rise {
|
|
|
|
| 1 |
@import "tailwindcss";
|
| 2 |
@import "tw-animate-css";
|
| 3 |
@import "shadcn/tailwind.css";
|
| 4 |
+
/* The faces of minimax.io, all OFL: Outfit for headings and numbers, DM Sans for text, Libre
|
| 5 |
+
Baskerville for taglines and the italic word in a model name ("H3 image"), Abhaya Libre
|
| 6 |
+
ExtraBold for the model mark on a tile ("M3.1", "H3"). */
|
| 7 |
+
@import "@fontsource/libre-baskerville/400.css";
|
| 8 |
+
@import "@fontsource/libre-baskerville/400-italic.css";
|
| 9 |
+
@import "@fontsource/libre-baskerville/700.css";
|
| 10 |
+
@import "@fontsource/abhaya-libre/800.css";
|
| 11 |
@import "@fontsource-variable/outfit/index.css";
|
| 12 |
@import "@fontsource-variable/dm-sans/index.css";
|
| 13 |
|
|
|
|
| 17 |
--font-heading: var(--font-sans);
|
| 18 |
--font-sans: "DM Sans Variable", system-ui, -apple-system, "Segoe UI", "PingFang SC", sans-serif;
|
| 19 |
--font-display: "Outfit Variable", "DM Sans Variable", system-ui, sans-serif;
|
| 20 |
+
--font-serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
|
| 21 |
+
--font-numeral: "Abhaya Libre", "Libre Baskerville", Georgia, serif;
|
| 22 |
--color-sidebar-ring: var(--sidebar-ring);
|
| 23 |
--color-sidebar-border: var(--sidebar-border);
|
| 24 |
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
|
|
| 59 |
--radius-4xl: calc(var(--radius) * 2.6);
|
| 60 |
}
|
| 61 |
|
| 62 |
+
/* minimax.io neutrals (its --product-* tokens), the brand gradients for model marks, and modality
|
| 63 |
+
and relation colours from brand hues, checked with the dataviz validator on #fff (modalities in
|
| 64 |
+
stack order, relations all pairs) and on #000 for the galaxy stage. */
|
| 65 |
:root {
|
| 66 |
--background: #ffffff;
|
| 67 |
--foreground: #171717;
|
|
|
|
| 77 |
--muted-foreground: #666666;
|
| 78 |
--accent: #f5f5f5;
|
| 79 |
--accent-foreground: #171717;
|
| 80 |
+
--destructive: #e8204a;
|
| 81 |
--border: #e9e9e9;
|
| 82 |
--input: #e9e9e9;
|
| 83 |
+
--ring: #ff3763;
|
| 84 |
--radius: 12px;
|
| 85 |
+
--chart-1: #ff3763; --chart-2: #ff7038; --chart-3: #b7bacc; --chart-4: #666666; --chart-5: #171717;
|
| 86 |
--sidebar: #ffffff; --sidebar-foreground: #171717; --sidebar-primary: #171717; --sidebar-primary-foreground: #ffffff;
|
| 87 |
+
--sidebar-accent: #f5f5f5; --sidebar-accent-foreground: #171717; --sidebar-border: #e9e9e9; --sidebar-ring: #ff3763;
|
| 88 |
|
| 89 |
+
--brand: #ff3763;
|
| 90 |
+
--brand-from: #ff3763;
|
| 91 |
+
--brand-to: #ff7038;
|
| 92 |
+
--rel-adapter: #ee2a7b;
|
| 93 |
+
--rel-finetune: #d17f05;
|
| 94 |
+
--rel-quantized: #7a27ff;
|
| 95 |
+
--rel-repackage: #9a0010;
|
| 96 |
+
--rel-merge: #0a8ae6;
|
|
|
|
| 97 |
--rel-mirror: #b7bacc;
|
| 98 |
+
--rel-component: #17825b;
|
| 99 |
--neutral-series: #b7bacc;
|
| 100 |
+
--galaxy-bg: #000000;
|
| 101 |
+
--ring-band: rgba(255, 55, 99, 0.07);
|
| 102 |
|
| 103 |
+
/* modalities, in stack order; -from/-to are the gradient of a model mark */
|
| 104 |
+
--cat-language: #ff3763; --cat-language-from: #ff3763; --cat-language-to: #ff7038;
|
| 105 |
+
--cat-video: #7a27ff; --cat-video-from: #7a27ff; --cat-video-to: #a36aff;
|
| 106 |
+
--cat-music: #a8102e; --cat-music-from: #9a0010; --cat-music-to: #e8204a;
|
| 107 |
+
--cat-image: #0a8ae6; --cat-image-from: #0a7fd9; --cat-image-to: #1494ee;
|
| 108 |
+
--stage: #000000;
|
| 109 |
+
--shadow-card: 0 1px 2px rgba(23, 23, 23, 0.04), 0 12px 32px -12px rgba(23, 23, 23, 0.12);
|
| 110 |
}
|
| 111 |
|
| 112 |
.dark {
|
| 113 |
+
--background: #000000;
|
| 114 |
+
--foreground: #f2f2f2;
|
| 115 |
+
--card: #000000;
|
| 116 |
+
--card-foreground: #f2f2f2;
|
| 117 |
+
--popover: #141414;
|
| 118 |
+
--popover-foreground: #f2f2f2;
|
| 119 |
--primary: #ffffff;
|
| 120 |
+
--primary-foreground: #000000;
|
| 121 |
+
--secondary: #161616;
|
| 122 |
+
--secondary-foreground: #f2f2f2;
|
| 123 |
+
--muted: #161616;
|
| 124 |
+
--muted-foreground: #9b9b9b;
|
| 125 |
+
--accent: #161616;
|
| 126 |
+
--accent-foreground: #f2f2f2;
|
| 127 |
+
--destructive: #ff4558;
|
| 128 |
+
--border: #262626;
|
| 129 |
+
--input: #262626;
|
| 130 |
+
--ring: #ff4558;
|
| 131 |
+
--chart-1: #ff4558; --chart-2: #ff7038; --chart-3: #6b6f80; --chart-4: #9b9b9b; --chart-5: #f2f2f2;
|
| 132 |
+
--sidebar: #000000; --sidebar-foreground: #f2f2f2; --sidebar-primary: #ffffff; --sidebar-primary-foreground: #000000;
|
| 133 |
+
--sidebar-accent: #161616; --sidebar-accent-foreground: #f2f2f2; --sidebar-border: #262626; --sidebar-ring: #ff4558;
|
| 134 |
|
| 135 |
+
--brand: #ff4558;
|
| 136 |
+
--rel-adapter: #f0418a;
|
| 137 |
+
--rel-finetune: #e56a06;
|
| 138 |
+
--rel-quantized: #8b4dff;
|
| 139 |
+
--rel-repackage: #b8153f;
|
| 140 |
+
--rel-merge: #1a93ec;
|
| 141 |
--rel-mirror: #6b6f80;
|
| 142 |
+
--rel-component: #1a9367;
|
| 143 |
--neutral-series: #6b6f80;
|
| 144 |
+
--ring-band: rgba(255, 69, 88, 0.09);
|
| 145 |
+
--cat-language: #ff4558;
|
| 146 |
+
--cat-video: #8b4dff;
|
| 147 |
+
--cat-music: #b01a44;
|
| 148 |
+
--cat-image: #1a93ec;
|
| 149 |
}
|
| 150 |
|
| 151 |
@layer base {
|
|
|
|
| 163 |
}
|
| 164 |
}
|
| 165 |
|
| 166 |
+
/* The galaxy is always dark; it carries the .dark class itself. */
|
| 167 |
.stage {
|
| 168 |
background-color: var(--stage);
|
| 169 |
+
color: #f2f2f2;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
/* Brand gradient text, for a model mark on white ("MiniMax M3" on minimax.io). */
|
| 173 |
+
.gradient-text {
|
| 174 |
+
background: linear-gradient(100deg, var(--from, #ff3763), var(--to, #ff7038));
|
| 175 |
+
-webkit-background-clip: text;
|
| 176 |
+
background-clip: text;
|
| 177 |
+
color: transparent;
|
| 178 |
}
|
| 179 |
|
| 180 |
@keyframes rise {
|
code/web/src/lib/category.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
/** Each modality keeps one colour everywhere (validated in this stack order, light and dark).
|
| 2 |
-
*
|
| 3 |
export const CAT_ORDER = ["language", "video", "music", "image", "audio"]
|
| 4 |
|
| 5 |
export const catColor = (c: string) => `var(--cat-${c}, var(--neutral-series))`
|
|
|
|
| 1 |
/** Each modality keeps one colour everywhere (validated in this stack order, light and dark).
|
| 2 |
+
* Brand hues: language the orange-red, video the multimodal purple, image the blue, music the wine accent. */
|
| 3 |
export const CAT_ORDER = ["language", "video", "music", "image", "audio"]
|
| 4 |
|
| 5 |
export const catColor = (c: string) => `var(--cat-${c}, var(--neutral-series))`
|
code/web/src/main.tsx
CHANGED
|
@@ -3,11 +3,7 @@ import { createRoot } from "react-dom/client"
|
|
| 3 |
import "./index.css"
|
| 4 |
import App from "./App.tsx"
|
| 5 |
|
| 6 |
-
//
|
| 7 |
-
const mq = matchMedia("(prefers-color-scheme: dark)")
|
| 8 |
-
const apply = () => document.documentElement.classList.toggle("dark", mq.matches)
|
| 9 |
-
apply()
|
| 10 |
-
mq.addEventListener("change", apply)
|
| 11 |
|
| 12 |
// If the page and its data file ever disagree, say so instead of showing a blank page.
|
| 13 |
class Fallback extends Component<{ children: ReactNode }, { failed: boolean }> {
|
|
|
|
| 3 |
import "./index.css"
|
| 4 |
import App from "./App.tsx"
|
| 5 |
|
| 6 |
+
// Light only, as minimax.io is; the galaxy carries its own .dark stage.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
// If the page and its data file ever disagree, say so instead of showing a blank page.
|
| 9 |
class Fallback extends Component<{ children: ReactNode }, { failed: boolean }> {
|
code/web/src/pages/category.tsx
CHANGED
|
@@ -1,11 +1,13 @@
|
|
| 1 |
import { useEffect, useMemo, useState } from "react"
|
| 2 |
import { ArrowUpRight } from "lucide-react"
|
| 3 |
import type { Data, Site } from "@/lib/types"
|
| 4 |
-
import { catColor
|
| 5 |
import { full, hfUrl, num } from "@/lib/format"
|
| 6 |
import { href } from "@/lib/route"
|
| 7 |
import { SiteHeader } from "@/components/site-header"
|
| 8 |
-
import { CountUp,
|
|
|
|
|
|
|
| 9 |
import { GrowthLines, WeeklyBars } from "@/components/growth"
|
| 10 |
import { DailyLines } from "@/components/daily"
|
| 11 |
import { DownloadHistory } from "@/components/downloads"
|
|
@@ -46,51 +48,53 @@ export function CategoryPage({ site, cat, rel }: { site: Site; cat: string; rel:
|
|
| 46 |
|
| 47 |
return (
|
| 48 |
<>
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
<SiteHeader site={site} />
|
| 52 |
-
<section className="mx-auto w-full max-w-[1200px] px-4 pt-
|
| 53 |
-
|
| 54 |
-
<
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
{tabs.length > 1 && (
|
| 58 |
-
<nav className="-mx-4 mt-
|
| 59 |
{tabs.map((r) => {
|
| 60 |
const on = r.key === lineage
|
| 61 |
-
const cls = `inline-flex h-10 shrink-0 items-center gap-
|
| 62 |
return r.page ? (
|
| 63 |
<a key={r.key} href={href(cat, r.key)} aria-current={on ? "page" : undefined} className={cls}>{r.name}</a>
|
| 64 |
) : (
|
| 65 |
<a key={r.key} href={hfUrl(r.base)} target="_blank" rel="noopener" className={cls}>
|
| 66 |
-
{r.name}<ArrowUpRight className="size-4
|
| 67 |
</a>
|
| 68 |
)
|
| 69 |
})}
|
| 70 |
</nav>
|
| 71 |
)}
|
|
|
|
|
|
|
|
|
|
| 72 |
{L && release && (
|
| 73 |
-
<div key={lineage}
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
community models built on {release.name}
|
| 80 |
-
</span>
|
| 81 |
-
</h1>
|
| 82 |
-
<div className="mt-12 grid grid-cols-2 gap-x-8 gap-y-8 lg:grid-cols-4" style={{ animation: "rise 700ms cubic-bezier(.22,.61,.36,1) 150ms both" }}>
|
| 83 |
-
<Stat value={full(builders)} label="builders" />
|
| 84 |
-
<Stat value={num(L.dlall)} label="community downloads" />
|
| 85 |
-
<Stat value={num(L.dl30)} label="community downloads, 30 days" />
|
| 86 |
-
<Stat value={num(L.official.dlall)} label={`${release.name} downloads`} />
|
| 87 |
-
</div>
|
| 88 |
</div>
|
| 89 |
)}
|
| 90 |
-
</
|
| 91 |
</div>
|
| 92 |
|
| 93 |
-
<main className="mx-auto w-full max-w-[1200px] px-4 pb-28 sm:px-8">
|
| 94 |
{failed && <p className="mt-20 text-lg">The data did not load. Try refreshing the page.</p>}
|
| 95 |
{data && L && lineage && release && (
|
| 96 |
<div key={lineage}>
|
|
|
|
| 1 |
import { useEffect, useMemo, useState } from "react"
|
| 2 |
import { ArrowUpRight } from "lucide-react"
|
| 3 |
import type { Data, Site } from "@/lib/types"
|
| 4 |
+
import { catColor } from "@/lib/category"
|
| 5 |
import { full, hfUrl, num } from "@/lib/format"
|
| 6 |
import { href } from "@/lib/route"
|
| 7 |
import { SiteHeader } from "@/components/site-header"
|
| 8 |
+
import { CountUp, Panel, Section, Stat } from "@/components/layout"
|
| 9 |
+
import { TitleLockup } from "@/components/lockup"
|
| 10 |
+
import { HeroVideo } from "@/components/media"
|
| 11 |
import { GrowthLines, WeeklyBars } from "@/components/growth"
|
| 12 |
import { DailyLines } from "@/components/daily"
|
| 13 |
import { DownloadHistory } from "@/components/downloads"
|
|
|
|
| 48 |
|
| 49 |
return (
|
| 50 |
<>
|
| 51 |
+
{/* As a model page on minimax.io: the modality's footage behind the top, the model's name
|
| 52 |
+
in white on it, then white cards. */}
|
| 53 |
+
<div className="relative isolate">
|
| 54 |
+
<HeroVideo cat={cat} />
|
| 55 |
<SiteHeader site={site} />
|
| 56 |
+
<section className="mx-auto w-full max-w-[1200px] px-4 pt-6 pb-4 text-center text-white sm:px-8 sm:pt-10">
|
| 57 |
+
{L && release && (
|
| 58 |
+
<h1 key={lineage} className="anim-rise">
|
| 59 |
+
<span className="block font-display text-[56px] leading-[1.02] font-semibold tracking-[-0.03em] sm:text-[104px]">
|
| 60 |
+
<TitleLockup name={release.name} />
|
| 61 |
+
</span>
|
| 62 |
+
<span className="mt-3 block font-serif text-[22px] leading-snug sm:mt-4 sm:text-[28px]">
|
| 63 |
+
<CountUp value={L.n_models} format={(v) => full(Math.round(v))} ms={1200} /> community models
|
| 64 |
+
</span>
|
| 65 |
+
</h1>
|
| 66 |
+
)}
|
| 67 |
{tabs.length > 1 && (
|
| 68 |
+
<nav className="-mx-4 mt-8 flex gap-2 overflow-x-auto px-4 pb-1 [scrollbar-width:none] sm:mx-0 sm:flex-wrap sm:justify-center sm:px-0 [&::-webkit-scrollbar]:hidden">
|
| 69 |
{tabs.map((r) => {
|
| 70 |
const on = r.key === lineage
|
| 71 |
+
const cls = `inline-flex h-10 shrink-0 items-center gap-1.5 rounded-full px-4 text-[15px] font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white ${on ? "bg-white text-[#171717]" : "bg-white/20 text-white backdrop-blur-sm hover:bg-white/30"}`
|
| 72 |
return r.page ? (
|
| 73 |
<a key={r.key} href={href(cat, r.key)} aria-current={on ? "page" : undefined} className={cls}>{r.name}</a>
|
| 74 |
) : (
|
| 75 |
<a key={r.key} href={hfUrl(r.base)} target="_blank" rel="noopener" className={cls}>
|
| 76 |
+
{r.name}<ArrowUpRight className="size-4 opacity-75" />
|
| 77 |
</a>
|
| 78 |
)
|
| 79 |
})}
|
| 80 |
</nav>
|
| 81 |
)}
|
| 82 |
+
</section>
|
| 83 |
+
|
| 84 |
+
<div className="mx-auto w-full max-w-[1200px] px-4 sm:px-8">
|
| 85 |
{L && release && (
|
| 86 |
+
<div key={lineage} className="mt-10 grid grid-cols-2 gap-x-8 gap-y-8 rounded-[24px] border border-white/60 bg-white p-6 shadow-[0_30px_80px_-30px_rgba(40,10,80,0.35)] sm:mt-14 sm:p-10 lg:grid-cols-4"
|
| 87 |
+
style={{ animation: "rise 800ms cubic-bezier(.22,.61,.36,1) 150ms both" }}>
|
| 88 |
+
<Stat value={full(builders)} label="builders" />
|
| 89 |
+
<Stat value={num(L.dlall)} label="community downloads" />
|
| 90 |
+
<Stat value={num(L.dl30)} label="community downloads, 30 days" />
|
| 91 |
+
<Stat value={num(L.official.dlall)} label={`${release.name} downloads`} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
</div>
|
| 93 |
)}
|
| 94 |
+
</div>
|
| 95 |
</div>
|
| 96 |
|
| 97 |
+
<main className="relative mx-auto w-full max-w-[1200px] px-4 pb-28 sm:px-8">
|
| 98 |
{failed && <p className="mt-20 text-lg">The data did not load. Try refreshing the page.</p>}
|
| 99 |
{data && L && lineage && release && (
|
| 100 |
<div key={lineage}>
|
code/web/src/pages/home.tsx
CHANGED
|
@@ -8,7 +8,8 @@ import { CommunityChart, type Metric, useDownloadSeries, useSeries } from "@/com
|
|
| 8 |
import { Segmented } from "@/components/segmented"
|
| 9 |
import { ReleaseRail } from "@/components/release-rail"
|
| 10 |
import { CategoryBlocks } from "@/components/category-blocks"
|
| 11 |
-
import { CountUp,
|
|
|
|
| 12 |
import { DownloadButton } from "@/components/download-button"
|
| 13 |
|
| 14 |
export function Home({ site }: { site: Site }) {
|
|
@@ -33,69 +34,72 @@ export function Home({ site }: { site: Site }) {
|
|
| 33 |
|
| 34 |
return (
|
| 35 |
<>
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
| 38 |
<SiteHeader site={site} />
|
| 39 |
-
{/* The first screen holds the headline, the numbers and the whole chart: the chart takes what
|
| 40 |
-
height is left of the viewport, within bounds. */}
|
| 41 |
<section className="mx-auto w-full max-w-[1200px] px-4 pt-6 sm:px-8 sm:pt-8">
|
| 42 |
-
<
|
| 43 |
-
<
|
| 44 |
-
<
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
<Stat value={<CountUp value={commDl} format={num} />} label="community downloads" />
|
| 53 |
<Stat value={<CountUp value={offDl} format={num} />} label="MiniMax model downloads" />
|
| 54 |
<Stat value={<CountUp value={site.builders} format={(v) => full(Math.round(v))} />} label="builders" />
|
| 55 |
<Stat value={full(repos)} label="open models" />
|
| 56 |
</div>
|
| 57 |
</div>
|
| 58 |
-
|
| 59 |
-
<div ref={chartRef} className="mt-8 sm:mt-10">
|
| 60 |
-
{/* phones: the switch and the download button on a row of their own, above the chips */}
|
| 61 |
-
<div className="flex flex-wrap items-center justify-between gap-3" style={{ animation: "rise 700ms cubic-bezier(.22,.61,.36,1) 250ms both" }}>
|
| 62 |
-
<div className="order-2 flex flex-wrap gap-2 sm:order-1">
|
| 63 |
-
{CAT_ORDER.filter((c) => cats.includes(c)).reverse().map((c) => {
|
| 64 |
-
const off = hidden.has(c)
|
| 65 |
-
const name = site.categories.find((x) => x.key === c)!.name
|
| 66 |
-
return (
|
| 67 |
-
<button key={c} type="button" aria-pressed={!off} onClick={() => toggle(c)}
|
| 68 |
-
className={`inline-flex h-10 items-center gap-2 rounded-full border px-3.5 text-[15px] transition-colors sm:gap-2.5 sm:px-4 ${off ? "border-white/10 text-white/40" : "border-white/15 bg-white/[0.06] text-white hover:bg-white/10"}`}>
|
| 69 |
-
<span className="size-2.5 rounded-full" style={off ? { boxShadow: "inset 0 0 0 1.5px rgba(255,255,255,.4)" } : { background: catColor(c) }} />
|
| 70 |
-
<span className={off ? "line-through" : ""}>{name}</span>
|
| 71 |
-
<span className="font-display text-white/55 tabular-nums">{metric === "models" ? full(now[c]) : num(now[c])}</span>
|
| 72 |
-
</button>
|
| 73 |
-
)
|
| 74 |
-
})}
|
| 75 |
-
</div>
|
| 76 |
-
<div className="order-1 flex w-full items-center justify-between gap-2 sm:order-2 sm:w-auto">
|
| 77 |
-
{downloads && (
|
| 78 |
-
<Segmented label="Chart" value={metric} onChange={setMetric}
|
| 79 |
-
options={[{ value: "models", label: "Models" }, { value: "downloads", label: "Downloads" }]} />
|
| 80 |
-
)}
|
| 81 |
-
<DownloadButton target={chartRef} name={metric === "models" ? "MiniMax community models" : "MiniMax downloads"}
|
| 82 |
-
tone="stage" pad={32} big />
|
| 83 |
-
</div>
|
| 84 |
-
</div>
|
| 85 |
-
<CommunityChart site={site} series={series} metric={metric} hidden={hidden}
|
| 86 |
-
className="mt-4 h-[340px] sm:h-[clamp(360px,calc(100svh-524px),560px)] lg:h-[clamp(320px,calc(100svh-412px),560px)]"
|
| 87 |
-
onPick={(r) => {
|
| 88 |
-
if (r.page) location.hash = href(r.cat, r.key)
|
| 89 |
-
else window.open(hfUrl(r.base), "_blank", "noopener")
|
| 90 |
-
}} />
|
| 91 |
-
</div>
|
| 92 |
</section>
|
| 93 |
-
|
|
|
|
| 94 |
<ReleaseRail site={site} />
|
| 95 |
</div>
|
| 96 |
</div>
|
| 97 |
|
| 98 |
-
<main className="mx-auto w-full max-w-[1200px] px-4 pt-20 pb-28 sm:px-8 sm:pt-24">
|
|
|
|
| 99 |
<CategoryBlocks site={site} />
|
| 100 |
</main>
|
| 101 |
</>
|
|
|
|
| 8 |
import { Segmented } from "@/components/segmented"
|
| 9 |
import { ReleaseRail } from "@/components/release-rail"
|
| 10 |
import { CategoryBlocks } from "@/components/category-blocks"
|
| 11 |
+
import { CountUp, Stat } from "@/components/layout"
|
| 12 |
+
import { HeroVideo } from "@/components/media"
|
| 13 |
import { DownloadButton } from "@/components/download-button"
|
| 14 |
|
| 15 |
export function Home({ site }: { site: Site }) {
|
|
|
|
| 34 |
|
| 35 |
return (
|
| 36 |
<>
|
| 37 |
+
{/* As on minimax.io: the M3.1 footage behind the top of the page, white type on it, and
|
| 38 |
+
everything with small text in white cards. */}
|
| 39 |
+
<div className="relative isolate">
|
| 40 |
+
<HeroVideo cat="language" />
|
| 41 |
<SiteHeader site={site} />
|
|
|
|
|
|
|
| 42 |
<section className="mx-auto w-full max-w-[1200px] px-4 pt-6 sm:px-8 sm:pt-8">
|
| 43 |
+
<h1 className="anim-rise text-center text-white">
|
| 44 |
+
<span className="block font-display text-[84px] leading-[0.95] font-semibold tracking-[-0.03em] sm:text-[112px]">
|
| 45 |
+
<CountUp value={total} format={(v) => full(Math.round(v))} />
|
| 46 |
+
</span>
|
| 47 |
+
<span className="mt-3 block font-serif text-[22px] leading-snug sm:mt-4 sm:text-[28px]">
|
| 48 |
+
community models built on MiniMax
|
| 49 |
+
</span>
|
| 50 |
+
</h1>
|
| 51 |
+
|
| 52 |
+
<div className="mt-10 rounded-[24px] border border-white/60 bg-white p-4 shadow-[0_30px_80px_-30px_rgba(60,10,20,0.35)] sm:mt-12 sm:p-8"
|
| 53 |
+
style={{ animation: "rise 800ms cubic-bezier(.22,.61,.36,1) 150ms both" }}>
|
| 54 |
+
<div ref={chartRef} className="bg-white">
|
| 55 |
+
{/* phones: the switch and the download button on a row of their own, above the chips */}
|
| 56 |
+
<div className="flex flex-wrap items-center justify-between gap-3">
|
| 57 |
+
<div className="order-2 flex flex-wrap gap-2 sm:order-1">
|
| 58 |
+
{CAT_ORDER.filter((c) => cats.includes(c)).reverse().map((c) => {
|
| 59 |
+
const off = hidden.has(c)
|
| 60 |
+
const name = site.categories.find((x) => x.key === c)!.name
|
| 61 |
+
return (
|
| 62 |
+
<button key={c} type="button" aria-pressed={!off} onClick={() => toggle(c)}
|
| 63 |
+
className={`inline-flex h-10 items-center gap-2 rounded-full border px-3.5 text-[15px] transition-colors sm:gap-2.5 sm:px-4 ${off ? "border-border text-muted-foreground" : "border-border bg-white text-foreground hover:bg-muted"}`}>
|
| 64 |
+
<span className="size-2.5 rounded-full" style={off ? { boxShadow: "inset 0 0 0 1.5px var(--muted-foreground)" } : { background: catColor(c) }} />
|
| 65 |
+
<span className={off ? "line-through" : ""}>{name}</span>
|
| 66 |
+
<span className="text-muted-foreground tabular-nums">{metric === "models" ? full(now[c]) : num(now[c])}</span>
|
| 67 |
+
</button>
|
| 68 |
+
)
|
| 69 |
+
})}
|
| 70 |
+
</div>
|
| 71 |
+
<div className="order-1 flex w-full items-center justify-between gap-2 sm:order-2 sm:w-auto">
|
| 72 |
+
{downloads && (
|
| 73 |
+
<Segmented label="Chart" value={metric} onChange={setMetric}
|
| 74 |
+
options={[{ value: "models", label: "Models" }, { value: "downloads", label: "Downloads" }]} />
|
| 75 |
+
)}
|
| 76 |
+
<DownloadButton target={chartRef} name={metric === "models" ? "MiniMax community models" : "MiniMax downloads"}
|
| 77 |
+
pad={32} big />
|
| 78 |
+
</div>
|
| 79 |
+
</div>
|
| 80 |
+
<CommunityChart site={site} series={series} metric={metric} hidden={hidden}
|
| 81 |
+
className="mt-4 h-[340px] sm:h-[clamp(360px,calc(100svh-500px),520px)]"
|
| 82 |
+
onPick={(r) => {
|
| 83 |
+
if (r.page) location.hash = href(r.cat, r.key)
|
| 84 |
+
else window.open(hfUrl(r.base), "_blank", "noopener")
|
| 85 |
+
}} />
|
| 86 |
+
</div>
|
| 87 |
+
<div className="mt-8 grid grid-cols-2 gap-x-8 gap-y-7 border-t border-border pt-7 sm:grid-cols-4">
|
| 88 |
<Stat value={<CountUp value={commDl} format={num} />} label="community downloads" />
|
| 89 |
<Stat value={<CountUp value={offDl} format={num} />} label="MiniMax model downloads" />
|
| 90 |
<Stat value={<CountUp value={site.builders} format={(v) => full(Math.round(v))} />} label="builders" />
|
| 91 |
<Stat value={full(repos)} label="open models" />
|
| 92 |
</div>
|
| 93 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
</section>
|
| 95 |
+
|
| 96 |
+
<div className="mt-24 sm:mt-28">
|
| 97 |
<ReleaseRail site={site} />
|
| 98 |
</div>
|
| 99 |
</div>
|
| 100 |
|
| 101 |
+
<main className="relative mx-auto w-full max-w-[1200px] px-4 pt-20 pb-28 sm:px-8 sm:pt-24">
|
| 102 |
+
<h2 className="mb-10 text-center font-display text-[30px] leading-tight font-semibold tracking-[-0.01em] sm:text-[36px]">By modality</h2>
|
| 103 |
<CategoryBlocks site={site} />
|
| 104 |
</main>
|
| 105 |
</>
|