Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
chore: add public gallery, home polish, dashboard + studio refinements
nirholase71e51ba73fa
diff --git a/CLAUDE.md b/CLAUDE.mdindex 8dc0a6965..c0a7963fc 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -5,6 +5,8 @@ These rules OVERRIDE defaults. Every agent in this workspace must follow them.## Prime directive**Execute. Do not interview the user.** Pick the most reasonable interpretation and ship a complete feature. Questions waste the user's time.+**Do what's proper and professional, always. Never take shortcuts. Always wire completely. Never use mocks or fake data. Always build real implementations and integrations and use real APIs.**+## Hard rules (non-negotiable)1. **No mocks. No fake data. No placeholders.** Use real APIs, real endpoints, real data. If credentials are missing, locate them in `.env`, `vercel env`, or ask once — then proceed.diff --git a/create.html b/create.htmlindex 6be73d73a..0548b6be8 100644--- a/create.html+++ b/create.html@@ -7,7 +7,7 @@<link rel="icon" href="/favicon.ico" /><metaname="description"- content="Create a 3D avatar. Use our web editor, upload a GLB, or generate from a selfie."+ content="Create a 3D avatar. Start from a ready-made template in our web editor or upload your own GLB."/><meta name="robots" content="noindex" />@@ -15,17 +15,18 @@<meta property="og:site_name" content="three.ws"><meta property="og:url" content="https://three.ws/create"><meta property="og:title" content="Create avatar · three.ws">- <meta property="og:description" content="Create a 3D avatar. Use our web editor, upload a GLB, or generate from a selfie.">+ <meta property="og:description" content="Create a 3D avatar. Start from a ready-made template in our web editor or upload your own GLB."><meta property="og:image" content="https://three.ws/assets/og-image.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="Create avatar · three.ws">- <meta name="twitter:description" content="Create a 3D avatar. Use our web editor, upload a GLB, or generate from a selfie.">+ <meta name="twitter:description" content="Create a 3D avatar. Start from a ready-made template in our web editor or upload your own GLB."><meta name="twitter:image" content="https://three.ws/assets/og-image.png"><style>- #page-loading {+ #page-loading,+ #save-loading {position: fixed;inset: 0;z-index: 9999;@@ -36,17 +37,33 @@justify-content: center;gap: 20px;}- #page-loading img {+ #page-loading img,+ #save-loading img {width: 64px;height: 64px;animation: page-loading-pulse 1.6s ease-in-out infinite;}- #page-loading .dots {+ #page-loading .dots,+ #save-loading .dots {color: rgba(255, 255, 255, 0.6);font-size: 24px;letter-spacing: 4px;font-family: -apple-system, system-ui, sans-serif;}+ #save-loading .label {+ color: rgba(255, 255, 255, 0.82);+ font-size: 15px;+ font-weight: 500;+ letter-spacing: -0.005em;+ font-family: -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;+ margin-top: 4px;+ }+ #save-loading .sublabel {+ color: rgba(255, 255, 255, 0.42);+ font-size: 12.5px;+ font-family: -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;+ margin-top: -8px;+ }@keyframes page-loading-pulse {0%, 100% { opacity: 0.55; transform: scale(1); }50% { opacity: 1; transform: scale(1.06); }@@ -123,12 +140,12 @@margin: 0 0 48px;}- /* ── 3-card grid ──────────────────────────────────────────────────── */+ /* ── card grid ────────────────────────────────────────────────────── */.card-grid {display: grid;- grid-template-columns: repeat(3, 1fr);+ grid-template-columns: repeat(2, 1fr);gap: 20px;- max-width: 920px;+ max-width: 720px;margin: 0 auto;}@@ -136,7 +153,7 @@position: relative;display: flex;flex-direction: column;- padding: 28px 24px 22px;+ padding: 24px 24px 22px;border-radius: 18px;background: var(--panel);border: 1.5px solid var(--border);@@ -153,14 +170,61 @@outline: 2px solid var(--accent);outline-offset: 2px;}- .create-card:hover:not([aria-disabled='true']) {+ .create-card:hover {transform: translateY(-2px);border-color: #2c2d3d;box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);}- .create-card[aria-disabled='true'] {- cursor: default;- opacity: 0.52;++ .create-card.is-recommended {+ border-color: rgba(214, 255, 61, 0.35);+ background:+ radial-gradient(+ 420px 240px at 50% -20px,+ rgba(214, 255, 61, 0.08) 0,+ transparent 70%+ ),+ var(--panel);+ }+ .create-card.is-recommended:hover {+ border-color: rgba(214, 255, 61, 0.6);+ }++ .recommended-badge {+ position: absolute;+ top: 14px;+ right: 14px;+ padding: 3px 9px;+ border-radius: 20px;+ background: rgba(214, 255, 61, 0.12);+ border: 1px solid rgba(214, 255, 61, 0.35);+ font-size: 10.5px;+ font-weight: 600;+ letter-spacing: 0.06em;+ color: var(--accent);+ text-transform: uppercase;+ }++ .card-preview {+ width: 100%;+ height: 220px;+ border-radius: 12px;+ background:+ radial-gradient(+ circle at 50% 30%,+ rgba(214, 255, 61, 0.08) 0,+ transparent 60%+ ),+ rgba(255, 255, 255, 0.02);+ border: 1px solid var(--border);+ margin-bottom: 18px;+ overflow: hidden;+ flex: 0 0 auto;+ }+ .card-preview model-viewer {+ width: 100%;+ height: 100%;+ --poster-color: transparent;}.card-icon {@@ -179,6 +243,24 @@width: 24px;height: 24px;}+ .card-icon-row {+ display: flex;+ align-items: center;+ gap: 14px;+ margin-bottom: 16px;+ }+ .card-icon-row .card-icon {+ margin-bottom: 0;+ width: 40px;+ height: 40px;+ }+ .card-icon-row .card-icon svg {+ width: 20px;+ height: 20px;+ }+ .card-icon-row .card-title {+ margin: 0;+ }.card-title {font-size: 17px;@@ -214,13 +296,15 @@border-color 0.15s;align-self: flex-start;}- .create-card:hover:not([aria-disabled='true']) .card-cta {+ .create-card:hover .card-cta {background: var(--accent);border-color: transparent;color: var(--accent-ink);}- .create-card[aria-disabled='true'] .card-cta {- cursor: default;+ .create-card.is-recommended .card-cta {+ background: var(--accent);+ border-color: transparent;+ color: var(--accent-ink);}.card-tooltip {@@ -238,21 +322,6 @@color: var(--text);}- .coming-soon-badge {- position: absolute;- top: 16px;- right: 16px;- padding: 3px 9px;- border-radius: 20px;- background: rgba(255, 255, 255, 0.06);- border: 1px solid var(--border);- font-size: 11px;- font-weight: 600;- letter-spacing: 0.04em;- color: var(--muted);- text-transform: uppercase;- }-/* ── Status toast ─────────────────────────────────────────────────── */.status-toast {position: fixed;@@ -293,6 +362,9 @@grid-template-columns: 1fr;max-width: 420px;}+ .card-preview {+ height: 180px;+ }}/* ── Avatar creator modal ─────────────────────────────────────────── */@@ -612,31 +684,53 @@<p class="picker-sub">Choose how you want to create your 3D avatar.</p><div class="card-grid" role="group" aria-label="Choose avatar creation method">- <!-- Card 1: Default editor -->+ <!-- Card 1: Default editor (recommended) --><div- class="create-card"+ class="create-card is-recommended"id="card-default-editor"role="button"tabindex="0"- aria-label="Open avatar web editor"+ aria-label="Open avatar web editor (recommended)">- <div class="card-icon" aria-hidden="true">- <svg- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- stroke-width="1.7"- stroke-linecap="round"- stroke-linejoin="round"- >- <circle cx="12" cy="8" r="3.5" />- <path d="M5 20c0-3.87 3.13-7 7-7s7 3.13 7 7" />- <path d="M18 3l3 3-9 9-4 1 1-4 9-9z" />- </svg>+ <span class="recommended-badge" aria-hidden="true">Recommended</span>+ <div class="card-preview" aria-hidden="true">+ <model-viewer+ src="/avatars/default.glb"+ auto-rotate+ auto-rotate-delay="0"+ rotation-per-second="18deg"+ interaction-prompt="none"+ camera-controls="false"+ disable-zoom+ shadow-intensity="0.4"+ shadow-softness="0.8"+ exposure="0.95"+ environment-image="neutral"+ camera-orbit="20deg 80deg 2.6m"+ field-of-view="28deg"+ loading="eager"+ ></model-viewer>+ </div>+ <div class="card-icon-row">+ <div class="card-icon" aria-hidden="true">+ <svg+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="1.7"+ stroke-linecap="round"+ stroke-linejoin="round"+ >+ <circle cx="12" cy="8" r="3.5" />+ <path d="M5 20c0-3.87 3.13-7 7-7s7 3.13 7 7" />+ <path d="M18 3l3 3-9 9-4 1 1-4 9-9z" />+ </svg>+ </div>+ <h2 class="card-title">Start with a template</h2></div>- <h2 class="card-title">Use default avatar</h2><p class="card-subtitle">- Edit a ready-made avatar in our web editor. No download required.+ Pick a ready-made character and customize it in our web editor. No+ download required.</p><span class="card-cta">Open editor@@ -665,21 +759,44 @@tabindex="0"aria-label="Upload a GLB file">- <div class="card-icon" aria-hidden="true">+ <div+ class="card-preview"+ aria-hidden="true"+ style="display: flex; align-items: center; justify-content: center;"+ ><svgviewBox="0 0 24 24"+ width="56"+ height="56"fill="none"- stroke="currentColor"- stroke-width="1.7"+ stroke="rgba(255,255,255,0.5)"+ stroke-width="1.2"stroke-linecap="round"stroke-linejoin="round"+ aria-hidden="true"><polyline points="16 16 12 12 8 16" /><line x1="12" y1="12" x2="12" y2="21" /><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" /></svg></div>- <h2 class="card-title">Upload your own GLB</h2>+ <div class="card-icon-row">+ <div class="card-icon" aria-hidden="true">+ <svg+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="1.7"+ stroke-linecap="round"+ stroke-linejoin="round"+ >+ <polyline points="16 16 12 12 8 16" />+ <line x1="12" y1="12" x2="12" y2="21" />+ <path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" />+ </svg>+ </div>+ <h2 class="card-title">Upload your own GLB</h2>+ </div><p class="card-subtitle">Drop a <code style="font-size: 11px; opacity: 0.7">.glb</code> file. Workswith any glTF 2.0 model.@@ -707,58 +824,6 @@<a href="https://www.mixamo.com" target="_blank" rel="noopener">Mixamo</a>.</p></div>-- <!-- Card 3: From selfie (disabled) -->- <div- class="create-card"- id="card-selfie"- role="button"- aria-disabled="true"- aria-label="From a selfie (coming soon)"- tabindex="-1"- >- <span class="coming-soon-badge" aria-hidden="true">Coming Soon</span>- <div- class="card-icon"- aria-hidden="true"- style="opacity: 0.5; filter: grayscale(1)"- >- <svg- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- stroke-width="1.7"- stroke-linecap="round"- stroke-linejoin="round"- >- <path- d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"- />- <circle cx="12" cy="13" r="4" />- </svg>- </div>- <h2 class="card-title">From a selfie</h2>- <p class="card-subtitle">- Turn a photo into a rigged 3D avatar. Powered by AI.- </p>- <span class="card-cta" aria-hidden="true">- Take selfie- <svg- width="13"- height="13"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- stroke-width="2.2"- stroke-linecap="round"- stroke-linejoin="round"- aria-hidden="true"- >- <line x1="5" y1="12" x2="19" y2="12" />- <polyline points="12 5 19 12 12 19" />- </svg>- </span>- </div></div></main>diff --git a/home.html b/home.htmlindex 8c3ed10d4..e7b9e568f 100644--- a/home.html+++ b/home.html@@ -40,8 +40,10 @@<link rel="stylesheet" href="/style.css" /><link rel="stylesheet" href="/nav.css" /><link rel="stylesheet" href="/home.css" />+ <link rel="stylesheet" href="/home-polish.css" /><link rel="stylesheet" href="/footer.css" /><script defer src="/footer-newsletter.js"></script>+ <script defer src="/home-polish.js"></script><linkhref="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400&family=Space+Grotesk:wght@500;600;700&display=swap"rel="stylesheet"@@ -118,10 +120,6 @@class="h-avatar-viewer"aria-label="three.ws — interactive 3D agent. Click for surprises."></canvas>- <div class="h-avatar-badge">- <span class="h-avatar-badge-label">live agent</span>- <span>0x3d…a9f</span>- </div></div></div></div>@@ -168,6 +166,7 @@<section class="h-pillars" aria-label="What you get"><div class="h-pillars-inner"><article class="h-pillar h-reveal">+ <span class="h-pillar-num">01 / Identity</span><h3>A 3D body for any agent</h3><p>Drop any GLB into the browser and your AI agent appears as a fully@@ -176,6 +175,7 @@</p></article><article class="h-pillar h-reveal">+ <span class="h-pillar-num">02 / Intelligence</span><h3>Your stack, your brain</h3><p>Connect any LLM via MCP or A2A — Claude, GPT, Gemini, or your own.@@ -184,6 +184,7 @@</p></article><article class="h-pillar h-reveal">+ <span class="h-pillar-num">03 / Ownership</span><h3>Owned, on-chain, portable</h3><p>Register your agent on 20+ EVM chains via ERC-8004 — a verifiable,diff --git a/public/dashboard/dashboard.js b/public/dashboard/dashboard.jsindex 1663a0a3f..115b46433 100644--- a/public/dashboard/dashboard.js+++ b/public/dashboard/dashboard.js@@ -74,9 +74,40 @@ export function signOut() {});}-export function navigate(tab) {- // Support #edit/<id> sub-routes for per-avatar edit screens.- const [base, ...rest] = (tab || 'avatars').split('/');+const KNOWN_TABS = [+ 'avatars',+ 'create',+ 'edit',+ 'upload',+ 'animations',+ 'widgets',+ 'embed',+ 'keys',+ 'mcp',+ 'monetization',+ 'payments',+ 'subscriptions',+ 'billing',+ 'revenue',+ 'earnings',+ 'account',+];++// Read the current dashboard route from the URL. Path-based URLs+// (/dashboard/<tab>[/<param>]) are canonical; legacy #hash URLs are+// honored for back-compat and rewritten to the canonical path.+export function currentRoute() {+ const path = location.pathname.replace(/\/+$/, '');+ const m = path.match(/^\/dashboard(?:\/(.+))?$/);+ if (m && m[1]) return m[1];+ const hash = location.hash.slice(1);+ if (hash) return hash;+ return 'avatars';+}++// Render a route into <main>. Does not touch the URL.+function renderRoute(route) {+ const [base, ...rest] = (route || 'avatars').split('/');document.querySelectorAll('aside a').forEach((a) => a.classList.toggle('active', a.dataset.tab === base));@@ -86,6 +117,67 @@ export function navigate(tab) {renderer(main, rest);}+// Programmatic navigation: pushes /dashboard/<route> into history and renders.+// Use this instead of `location.hash = ...`.+export function goto(route) {+ const clean = (route || 'avatars').replace(/^#?\/+|\/+$/g, '').replace(/^#/, '');+ const target = '/dashboard/' + clean;+ if (location.pathname + location.search !== target) {+ history.pushState({ route: clean }, '', target);+ }+ renderRoute(clean);+}++// Initial-load entry: derive route from URL, rewrite legacy hash to path, render.+export function navigate(routeOrNull) {+ const route = routeOrNull || currentRoute();+ if (location.hash) {+ const clean = route.replace(/^\/+|\/+$/g, '');+ history.replaceState({ route: clean }, '', '/dashboard/' + clean);+ }+ renderRoute(route);+}++// Install one-time global handlers for in-app navigation. Idempotent.+let __dashRoutingInstalled = false;+export function installRouting() {+ if (__dashRoutingInstalled) return;+ __dashRoutingInstalled = true;++ // Intercept clicks on in-app links so they use pushState instead of reloading.+ document.addEventListener('click', (e) => {+ if (e.defaultPrevented || e.button !== 0) return;+ if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;+ const a = e.target.closest('a');+ if (!a) return;+ if (a.target && a.target !== '_self') return;+ const href = a.getAttribute('href');+ if (!href) return;++ // Legacy hash links inside the dashboard.+ if (href.startsWith('#')) {+ const route = href.slice(1);+ if (route && (KNOWN_TABS.includes(route.split('/')[0]) || route === '')) {+ e.preventDefault();+ goto(route);+ }+ return;+ }++ // Same-origin /dashboard/<tab> links.+ if (href.startsWith('/dashboard/')) {+ const tab = href.slice('/dashboard/'.length).split(/[?#]/)[0];+ const base = tab.split('/')[0];+ if (KNOWN_TABS.includes(base)) {+ e.preventDefault();+ goto(tab);+ }+ }+ });++ window.addEventListener('popstate', () => renderRoute(currentRoute()));+}+const tabs = {avatars: renderAvatars,create: renderCreate,@@ -150,7 +242,19 @@ async function renderAvatars(root) {try {const data = await api.listAvatars();if (!data.avatars.length) {- list.innerHTML = `<div class="empty">No avatars yet. <a href="#create">Take a selfie</a>, <a href="#upload">upload a .glb</a>, or <a href="/deploy">deploy a metadata-only agent on-chain</a>.</div>`;+ list.innerHTML = `+ <div class="empty" style="grid-column:1/-1; padding:48px 28px; text-align:center;">+ <div style="font-size:48px; line-height:1; margin-bottom:14px;" aria-hidden="true">👤</div>+ <h2 style="margin:0 0 8px; font-size:20px; color:#eee;">Create your first agent</h2>+ <p style="margin:0 0 22px; color:#888; max-width:440px; margin-left:auto; margin-right:auto;">+ Turn a selfie into a 3D avatar, upload an existing .glb, or deploy a metadata-only agent on-chain. Each gets a stable URL you can embed anywhere.+ </p>+ <div style="display:flex; gap:10px; justify-content:center; flex-wrap:wrap;">+ <a href="/create" class="btn-primary">Take a selfie →</a>+ <a href="/dashboard/upload" class="btn-primary" style="background:#222230; color:#ddd;">Upload .glb</a>+ <a href="/deploy" class="btn-primary" style="background:#222230; color:#ddd;">Deploy on-chain</a>+ </div>+ </div>`;return;}appendPage(data, true);@@ -170,7 +274,7 @@ function avatarCard(a) {<div class="footer"><select data-vis aria-label="Visibility">${['private', 'unlisted', 'public'].map((v) => `<option ${v === a.visibility ? 'selected' : ''} value="${v}">${v}</option>`).join('')}</select><div class="actions">- <a class="btn sec" href="#edit/${encodeURIComponent(a.id)}">Edit</a>+ <a class="btn sec" href="/dashboard/edit/${encodeURIComponent(a.id)}">Edit</a><button class="btn sec" data-replace>Replace GLB</button><a class="btn sec" href="/deploy?avatar=${encodeURIComponent(a.id)}" title="Mint as ERC-8004 agent">Deploy on-chain</a><button class="btn sec danger" data-del>Delete</button>@@ -528,8 +632,8 @@ function renderUpload(root) {source: 'upload',source_meta: {},});- progress.innerHTML = `Uploaded! <a href="#avatars">View</a>`;- location.hash = 'avatars';+ progress.innerHTML = `Uploaded! <a href="/dashboard/avatars">View</a>`;+ goto('avatars');} catch (err) {progress.textContent = '';alert(err.message);@@ -577,7 +681,7 @@ function renderCreate(root) {<p style="margin:0 0 20px; color:#888; max-width:380px; margin-left:auto; margin-right:auto; font-size:14px">Avatar creation from a selfie is under development. In the meantime you can upload an existing .glb file.</p>- <a href="#upload" class="btn">Upload a .glb instead</a>+ <a href="/dashboard/upload" class="btn">Upload a .glb instead</a></div>`;}@@ -651,7 +755,7 @@ async function attachAvatarToDefaultAgent(avatarId) {async function renderEdit(root, params = []) {const id = params[0];if (!id) {- location.hash = 'avatars';+ goto('avatars');return;}@@ -661,7 +765,7 @@ async function renderEdit(root, params = []) {<h1>Edit avatar</h1><p class="sub">Update the details that appear in MCP results and the public gallery.</p></div>- <a class="btn sec" href="#avatars">Back</a>+ <a class="btn sec" href="/dashboard/avatars">Back</a></div><div id="edit-body"><div class="muted">Loading…</div>@@ -951,7 +1055,7 @@ async function renderEmbed(root) {if (!agent) {body.innerHTML = `<div class="empty">- You don't have an agent yet. <a href="#create">Create one from a selfie</a> first.+ You don't have an agent yet. <a href="/dashboard/create">Create one from a selfie</a> first.</div>`;return;@@ -3145,7 +3249,7 @@ async function renderAnimations(root) {const res = await api.getAgentMe();agent = res?.agent;if (!agent) {- body.innerHTML = `<div class="empty">No agent found. <a href="#create">Create one first.</a></div>`;+ body.innerHTML = `<div class="empty">No agent found. <a href="/dashboard/create">Create one first.</a></div>`;return;}if (agent.avatar_id) {diff --git a/public/dashboard/index.html b/public/dashboard/index.htmlindex de9fd53ca..ec4e4b7e5 100644--- a/public/dashboard/index.html+++ b/public/dashboard/index.html@@ -1128,21 +1128,21 @@</header><div class="layout"><aside>- <a href="#avatars" class="active" data-tab="avatars">Avatars</a>- <a href="#create" data-tab="create">Create from selfie</a>- <a href="#upload" data-tab="upload">Upload</a>- <a href="#animations" data-tab="animations">Animations</a>- <a href="#widgets" data-tab="widgets">Widgets</a>- <a href="#embed" data-tab="embed">Embed</a>- <a href="#keys" data-tab="keys">API keys</a>- <a href="#mcp" data-tab="mcp">MCP</a>- <a href="#monetization" data-tab="monetization">Monetization</a>- <a href="#payments" data-tab="payments">Payments</a>- <a href="#subscriptions" data-tab="subscriptions">Subscriptions</a>- <a href="#billing" data-tab="billing">Plan & usage</a>- <a href="#revenue" data-tab="revenue">Revenue</a>- <a href="#earnings" data-tab="earnings">Earnings</a>- <a href="#account" data-tab="account">Account</a>+ <a href="/dashboard/avatars" class="active" data-tab="avatars">Avatars</a>+ <a href="/dashboard/create" data-tab="create">Create from selfie</a>+ <a href="/dashboard/upload" data-tab="upload">Upload</a>+ <a href="/dashboard/animations" data-tab="animations">Animations</a>+ <a href="/dashboard/widgets" data-tab="widgets">Widgets</a>+ <a href="/dashboard/embed" data-tab="embed">Embed</a>+ <a href="/dashboard/keys" data-tab="keys">API keys</a>+ <a href="/dashboard/mcp" data-tab="mcp">MCP</a>+ <a href="/dashboard/monetization" data-tab="monetization">Monetization</a>+ <a href="/dashboard/payments" data-tab="payments">Payments</a>+ <a href="/dashboard/subscriptions" data-tab="subscriptions">Subscriptions</a>+ <a href="/dashboard/billing" data-tab="billing">Plan & usage</a>+ <a href="/dashboard/revenue" data-tab="revenue">Revenue</a>+ <a href="/dashboard/earnings" data-tab="earnings">Earnings</a>+ <a href="/dashboard/account" data-tab="account">Account</a><a href="/dashboard/wallets">Wallets</a><a href="/vanity-wallet">Vanity wallet ✦</a><a href="/eth-vanity">ETH vanity (CREATE2) ✦</a>@@ -1241,7 +1241,7 @@</footer><script type="module">- import { state, api, navigate, signOut } from '/dashboard/dashboard.js';+ import { state, api, navigate, installRouting, signOut } from '/dashboard/dashboard.js';window.signOut = signOut;(async () => {@@ -1253,16 +1253,14 @@}if (!me?.user) {location.href =- '/login?next=' + encodeURIComponent(location.pathname + location.hash);+ '/login?next=' + encodeURIComponent(location.pathname + location.search + location.hash);return;}state.user = me.user;document.getElementById('user-email').textContent = me.user.email;if (me.user.is_admin) document.getElementById('admin-link').style.display = '';- navigate(location.hash.slice(1) || 'avatars');- window.addEventListener('hashchange', () =>- navigate(location.hash.slice(1) || 'avatars'),- );+ installRouting();+ navigate();fetch('/api/agent-3d/versions').then((r) => r.ok ? r.json() : null)diff --git a/public/gallery/gallery.css b/public/gallery/gallery.cssnew file mode 100644index 000000000..1610a8fec--- /dev/null+++ b/public/gallery/gallery.css@@ -0,0 +1,639 @@+/* /gallery — public avatar gallery.+ *+ * Standalone styles. Lives alongside the global /style.css but does not+ * depend on the .explore-* tokens; this lets us tune the page independently+ * if the discover layout drifts.+ */++html:has(body.gallery-page) {+ height: auto;+ overflow: auto;+}++body.gallery-page {+ display: block;+ width: 100%;+ min-height: calc(100vh - var(--header-h, 64px));+ height: auto;+ overflow: visible;+ background:+ radial-gradient(+ ellipse 80% 50% at 50% -10%,+ rgba(99, 102, 241, 0.18),+ transparent 60%+ ),+ radial-gradient(+ ellipse 60% 40% at 90% 30%,+ rgba(236, 72, 153, 0.12),+ transparent 60%+ ),+ #05050b;+ color: #fff;+ padding: 0;+}++.gallery-main {+ max-width: 1280px;+ margin: 0 auto;+ padding: var(--space-xl, 32px) var(--space-lg, 24px) var(--space-2xl, 48px);+}++/* ── Hero ───────────────────────────────────────────────────────────── */+.gallery-hero {+ text-align: center;+ padding: clamp(40px, 6vw, 96px) 0 clamp(24px, 4vw, 48px);+}+.gallery-hero-inner {+ max-width: 760px;+ margin: 0 auto;+}+.gallery-hero-chips {+ display: inline-flex;+ flex-wrap: wrap;+ gap: 10px;+ justify-content: center;+ margin-bottom: 24px;+}+.gallery-hero-chip {+ display: inline-flex;+ align-items: center;+ gap: 8px;+ padding: 6px 14px;+ background: rgba(255, 255, 255, 0.06);+ border: 1px solid rgba(255, 255, 255, 0.2);+ border-radius: 99px;+ color: rgba(255, 255, 255, 0.85);+ font-size: 12px;+ font-weight: 600;+ letter-spacing: 0.04em;+ text-transform: uppercase;+}+.gallery-hero-chip--link {+ text-decoration: none;+ background: transparent;+ border-color: rgba(255, 255, 255, 0.18);+ color: rgba(255, 255, 255, 0.78);+ transition:+ border-color 0.15s ease,+ color 0.15s ease,+ background 0.15s ease;+}+.gallery-hero-chip--link:hover,+.gallery-hero-chip--link:focus-visible {+ border-color: rgba(255, 255, 255, 0.4);+ color: #fff;+ background: rgba(255, 255, 255, 0.08);+}+.gallery-hero-dot {+ width: 7px;+ height: 7px;+ border-radius: 99px;+ background: #34d399;+ box-shadow: 0 0 12px rgba(52, 211, 153, 0.7);+}++.gallery-title {+ font-family: 'Space Grotesk', system-ui, sans-serif;+ font-size: clamp(2.2rem, 5vw, 3.6rem);+ font-weight: 700;+ letter-spacing: -0.025em;+ line-height: 1.05;+ margin: 0 0 14px;+ color: #fff;+ background: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, 0.72) 100%);+ -webkit-background-clip: text;+ background-clip: text;+ -webkit-text-fill-color: transparent;+}+.gallery-sub {+ max-width: 560px;+ margin: 0 auto;+ color: rgba(255, 255, 255, 0.62);+ font-size: 15px;+ line-height: 1.6;+}++.gallery-stats {+ display: flex;+ justify-content: center;+ gap: clamp(20px, 4vw, 56px);+ margin-top: 36px;+}+.gallery-stat {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 4px;+}+.gallery-stat-value {+ font-family: 'Space Grotesk', system-ui, sans-serif;+ font-size: clamp(1.5rem, 3vw, 2.1rem);+ font-weight: 700;+ color: #fff;+ letter-spacing: -0.02em;+ font-variant-numeric: tabular-nums;+}+.gallery-stat-label {+ font-size: 11px;+ font-weight: 600;+ letter-spacing: 0.1em;+ text-transform: uppercase;+ color: rgba(255, 255, 255, 0.45);+}++/* ── Controls ────────────────────────────────────────────────────────── */+.gallery-controls {+ display: flex;+ flex-direction: column;+ gap: 16px;+ margin: 24px 0 28px;+}++.gallery-search {+ position: relative;+ display: flex;+ align-items: center;+ max-width: 560px;+ margin: 0 auto;+ width: 100%;+}+.gallery-search-icon {+ position: absolute;+ left: 16px;+ width: 18px;+ height: 18px;+ color: rgba(255, 255, 255, 0.45);+ pointer-events: none;+}+.gallery-search input[type='search'] {+ width: 100%;+ padding: 14px 44px 14px 44px;+ background: rgba(255, 255, 255, 0.04);+ border: 1px solid rgba(255, 255, 255, 0.1);+ border-radius: 14px;+ color: #fff;+ font-size: 15px;+ font-family: inherit;+ outline: none;+ transition: border-color 0.15s ease, background 0.15s ease;+}+.gallery-search input[type='search']::placeholder {+ color: rgba(255, 255, 255, 0.4);+}+.gallery-search input[type='search']:focus {+ border-color: rgba(165, 180, 252, 0.55);+ background: rgba(255, 255, 255, 0.06);+}+.gallery-search input[type='search']::-webkit-search-cancel-button {+ -webkit-appearance: none;+ appearance: none;+}+.gallery-search-clear {+ position: absolute;+ right: 10px;+ width: 26px;+ height: 26px;+ border-radius: 99px;+ border: 0;+ background: rgba(255, 255, 255, 0.1);+ color: rgba(255, 255, 255, 0.75);+ font-size: 18px;+ line-height: 1;+ cursor: pointer;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ transition: background 0.15s ease, color 0.15s ease;+}+.gallery-search-clear:hover {+ background: rgba(255, 255, 255, 0.18);+ color: #fff;+}++.gallery-tag-wrap {+ display: flex;+ align-items: center;+ gap: 12px;+ flex-wrap: wrap;+ justify-content: center;+}+.gallery-tag-label {+ font-size: 11px;+ font-weight: 600;+ letter-spacing: 0.1em;+ text-transform: uppercase;+ color: rgba(255, 255, 255, 0.45);+}+.gallery-tags {+ display: flex;+ flex-wrap: wrap;+ gap: 8px;+ max-width: 900px;+ justify-content: center;+}+.gallery-tag {+ border: 1px solid rgba(255, 255, 255, 0.14);+ background: rgba(255, 255, 255, 0.03);+ color: rgba(255, 255, 255, 0.78);+ border-radius: 99px;+ padding: 6px 12px;+ font-size: 12.5px;+ font-weight: 500;+ cursor: pointer;+ transition:+ background 0.15s ease,+ border-color 0.15s ease,+ color 0.15s ease;+}+.gallery-tag:hover {+ background: rgba(255, 255, 255, 0.08);+ color: #fff;+}+.gallery-tag.is-active {+ background: rgba(165, 180, 252, 0.18);+ border-color: rgba(165, 180, 252, 0.6);+ color: #fff;+}++/* ── Grid ────────────────────────────────────────────────────────────── */+.gallery-grid-wrap {+ min-height: 200px;+ position: relative;+}+.gallery-grid {+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));+ gap: 18px;+}++.gallery-card {+ position: relative;+ background: rgba(255, 255, 255, 0.025);+ border: 1px solid rgba(255, 255, 255, 0.08);+ border-radius: 16px;+ overflow: hidden;+ display: flex;+ flex-direction: column;+ transition:+ transform 0.18s ease,+ border-color 0.18s ease,+ background 0.18s ease,+ box-shadow 0.18s ease;+}+.gallery-card:hover {+ transform: translateY(-2px);+ border-color: rgba(255, 255, 255, 0.18);+ background: rgba(255, 255, 255, 0.04);+ box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);+}++.gallery-card-thumb {+ position: relative;+ aspect-ratio: 1 / 1;+ display: flex;+ align-items: center;+ justify-content: center;+ overflow: hidden;+ background:+ radial-gradient(circle at 50% 35%, rgba(99, 102, 241, 0.18), transparent 60%),+ linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.25));+ text-decoration: none;+ color: inherit;+}+.gallery-card-thumb img {+ width: 100%;+ height: 100%;+ object-fit: cover;+ transition: transform 0.4s ease;+}+.gallery-card:hover .gallery-card-thumb img {+ transform: scale(1.04);+}+.gallery-card-ph {+ font-size: 56px;+ opacity: 0.55;+ filter: grayscale(0.2);+}+.gallery-card-3dpill {+ position: absolute;+ top: 10px;+ right: 10px;+ font-size: 10px;+ font-weight: 700;+ letter-spacing: 0.1em;+ text-transform: uppercase;+ padding: 4px 8px;+ border-radius: 99px;+ background: rgba(0, 0, 0, 0.55);+ color: #fff;+ backdrop-filter: blur(6px);+ -webkit-backdrop-filter: blur(6px);+ border: 1px solid rgba(255, 255, 255, 0.18);+}+.gallery-card-play {+ position: absolute;+ left: 50%;+ top: 50%;+ transform: translate(-50%, -50%) scale(0.85);+ width: 52px;+ height: 52px;+ border-radius: 99px;+ background: rgba(0, 0, 0, 0.55);+ backdrop-filter: blur(8px);+ -webkit-backdrop-filter: blur(8px);+ display: flex;+ align-items: center;+ justify-content: center;+ color: #fff;+ font-size: 18px;+ opacity: 0;+ transition: opacity 0.18s ease, transform 0.18s ease;+ pointer-events: none;+}+.gallery-card:hover .gallery-card-play {+ opacity: 1;+ transform: translate(-50%, -50%) scale(1);+}++.gallery-card-body {+ display: flex;+ flex-direction: column;+ gap: 10px;+ padding: 14px 16px 16px;+ flex: 1;+}+.gallery-card-name {+ margin: 0;+ font-size: 15px;+ font-weight: 600;+ color: #fff;+ letter-spacing: -0.005em;+ line-height: 1.25;+ overflow: hidden;+ display: -webkit-box;+ -webkit-line-clamp: 1;+ -webkit-box-orient: vertical;+}+.gallery-card-name a {+ color: inherit;+ text-decoration: none;+}+.gallery-card-name a:hover {+ color: rgba(165, 180, 252, 1);+}+.gallery-card-desc {+ margin: 0;+ font-size: 13px;+ line-height: 1.5;+ color: rgba(255, 255, 255, 0.6);+ overflow: hidden;+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+}+.gallery-card-tags {+ display: flex;+ flex-wrap: wrap;+ gap: 6px;+}+.gallery-card-tag {+ font-size: 11px;+ font-weight: 500;+ padding: 3px 8px;+ border-radius: 99px;+ background: rgba(255, 255, 255, 0.06);+ color: rgba(255, 255, 255, 0.7);+ border: 1px solid rgba(255, 255, 255, 0.06);+}+.gallery-card-foot {+ margin-top: auto;+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 10px;+ padding-top: 8px;+ border-top: 1px solid rgba(255, 255, 255, 0.06);+}+.gallery-card-meta {+ font-size: 11px;+ color: rgba(255, 255, 255, 0.4);+ font-variant-numeric: tabular-nums;+}+.gallery-card-actions {+ display: inline-flex;+ gap: 6px;+}+.gallery-card-btn {+ font-size: 12px;+ font-weight: 600;+ padding: 6px 10px;+ border-radius: 8px;+ border: 1px solid rgba(255, 255, 255, 0.12);+ background: rgba(255, 255, 255, 0.04);+ color: rgba(255, 255, 255, 0.85);+ cursor: pointer;+ text-decoration: none;+ display: inline-flex;+ align-items: center;+ gap: 4px;+ transition:+ background 0.15s ease,+ border-color 0.15s ease,+ color 0.15s ease;+}+.gallery-card-btn:hover {+ background: rgba(255, 255, 255, 0.1);+ border-color: rgba(255, 255, 255, 0.24);+ color: #fff;+}+.gallery-card-btn--primary {+ background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);+ border-color: transparent;+ color: #fff;+}+.gallery-card-btn--primary:hover {+ background: linear-gradient(135deg, #7c7ff5 0%, #9f7af2 100%);+ color: #fff;+}++/* ── Skeleton ────────────────────────────────────────────────────────── */+.gallery-card--skel {+ pointer-events: none;+}+.gallery-card--skel .gallery-card-thumb,+.gallery-card--skel .gallery-card-name,+.gallery-card--skel .gallery-card-desc,+.gallery-card--skel .gallery-card-tags {+ background: linear-gradient(+ 90deg,+ rgba(255, 255, 255, 0.04) 0%,+ rgba(255, 255, 255, 0.08) 50%,+ rgba(255, 255, 255, 0.04) 100%+ );+ background-size: 200% 100%;+ animation: gallery-shimmer 1.4s linear infinite;+ color: transparent;+ border-radius: 6px;+}+.gallery-card--skel .gallery-card-thumb {+ aspect-ratio: 1 / 1;+ border-radius: 0;+}+.gallery-card--skel .gallery-card-name {+ height: 14px;+ width: 70%;+}+.gallery-card--skel .gallery-card-desc {+ height: 28px;+ width: 100%;+}+.gallery-card--skel .gallery-card-tags {+ height: 18px;+ width: 60%;+}+@keyframes gallery-shimmer {+ from {+ background-position: 200% 0;+ }+ to {+ background-position: -200% 0;+ }+}++/* ── Status / empty / error ─────────────────────────────────────────── */+.gallery-status {+ min-height: 24px;+ margin-top: 24px;+ text-align: center;+ color: rgba(255, 255, 255, 0.5);+ font-size: 14px;+}+.gallery-empty {+ max-width: 460px;+ margin: 48px auto 24px;+ text-align: center;+ padding: 32px;+ border: 1px dashed rgba(255, 255, 255, 0.12);+ border-radius: 16px;+ background: rgba(255, 255, 255, 0.02);+}+.gallery-empty-art {+ font-size: 36px;+ margin-bottom: 10px;+ opacity: 0.75;+}+.gallery-empty h3 {+ margin: 0 0 6px;+ font-family: 'Space Grotesk', system-ui, sans-serif;+ font-size: 18px;+ color: #fff;+}+.gallery-empty p {+ margin: 0 0 14px;+ font-size: 13.5px;+ color: rgba(255, 255, 255, 0.6);+ line-height: 1.55;+}+.gallery-clear-filters {+ display: inline-flex;+ padding: 8px 14px;+ border-radius: 10px;+ border: 1px solid rgba(255, 255, 255, 0.18);+ background: rgba(255, 255, 255, 0.05);+ color: #fff;+ font-size: 13px;+ font-weight: 600;+ cursor: pointer;+ margin-right: 8px;+ transition: background 0.15s ease, border-color 0.15s ease;+}+.gallery-clear-filters:hover {+ background: rgba(255, 255, 255, 0.1);+ border-color: rgba(255, 255, 255, 0.32);+}+.gallery-empty .gallery-clear-cta {+ display: inline-flex;+ padding: 8px 14px;+ border-radius: 10px;+ border: 0;+ background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);+ color: #fff;+ font-size: 13px;+ font-weight: 600;+ text-decoration: none;+ transition: filter 0.15s ease;+}+.gallery-empty .gallery-clear-cta:hover {+ filter: brightness(1.1);+}+.gallery-error {+ color: #fca5a5;+ padding: 16px;+ border: 1px solid rgba(220, 38, 38, 0.3);+ background: rgba(220, 38, 38, 0.08);+ border-radius: 10px;+ max-width: 560px;+ margin: 16px auto;+ text-align: center;+}++/* ── Load more ──────────────────────────────────────────────────────── */+.gallery-load-more-wrap {+ display: flex;+ justify-content: center;+ margin-top: 32px;+}+.gallery-load-more {+ padding: 12px 24px;+ border-radius: 99px;+ border: 1px solid rgba(255, 255, 255, 0.18);+ background: rgba(255, 255, 255, 0.04);+ color: #fff;+ font-size: 14px;+ font-weight: 600;+ cursor: pointer;+ transition: background 0.15s ease, border-color 0.15s ease;+}+.gallery-load-more:hover {+ background: rgba(255, 255, 255, 0.1);+ border-color: rgba(255, 255, 255, 0.34);+}++.gallery-sentinel {+ height: 1px;+ width: 100%;+}++/* ── Responsive ──────────────────────────────────────────────────────── */+@media (max-width: 720px) {+ .gallery-main {+ padding: 16px 14px 36px;+ }+ .gallery-hero {+ padding: 24px 0 16px;+ }+ .gallery-stats {+ gap: 24px;+ }+ .gallery-grid {+ grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));+ gap: 12px;+ }+ .gallery-card-body {+ padding: 10px 12px 12px;+ gap: 6px;+ }+ .gallery-card-name {+ font-size: 14px;+ }+ .gallery-card-desc {+ display: none;+ }+ .gallery-card-foot {+ padding-top: 6px;+ }+ .gallery-card-btn {+ font-size: 11px;+ padding: 5px 8px;+ }+}diff --git a/public/gallery/gallery.js b/public/gallery/gallery.jsnew file mode 100644index 000000000..2ee56e834--- /dev/null+++ b/public/gallery/gallery.js@@ -0,0 +1,331 @@+/**+ * /gallery — public avatar gallery.+ *+ * Lists every avatar with visibility=public on three.ws via GET /api/avatars/public.+ * Supports debounced search (?q=), tag filter (?tag=), infinite scroll via cursor+ * pagination, and URL state sync so deep links restore filters.+ *+ * Card actions:+ * • Preview → /app#model=<glb-url> (opens in the main viewer)+ * • Studio → /studio?avatar=<id> (preselect in widget studio)+ * • Details → /discover/avatar/<id> (existing avatar detail page)+ * • Embed → /api/avatars/view tracker fires when the link is followed+ */++const els = {+ search: document.querySelector('[data-role="search"]'),+ searchClear: document.querySelector('[data-role="search-clear"]'),+ tagWrap: document.querySelector('[data-role="tag-wrap"]'),+ tags: document.querySelector('[data-role="tags"]'),+ grid: document.querySelector('[data-role="grid"]'),+ status: document.querySelector('[data-role="status"]'),+ loadMore: document.querySelector('[data-role="load-more"]'),+ sentinel: document.querySelector('[data-role="sentinel"]'),+ statCount: document.querySelector('[data-role="stat-count"]'),+ statTags: document.querySelector('[data-role="stat-tags"]'),+ myAvatarsChip: document.querySelector('[data-role="my-avatars-chip"]'),+};++// Hydrate filters from the URL so deep links restore state.+const initialParams = new URLSearchParams(location.search);+const state = {+ query: initialParams.get('q') || '',+ tag: initialParams.get('tag') || '',+ cursor: null,+ loading: false,+ loadedTags: new Set(),+ totalLoaded: 0,+};++if (state.query) els.search.value = state.query;+updateSearchClearVisibility();++// Reveal "My avatars" chip when signed in. Endpoint matches /discover.+fetch('/api/auth/me', { credentials: 'include' })+ .then((r) => (r.ok ? r.json() : null))+ .then((data) => {+ if (data?.user && els.myAvatarsChip) els.myAvatarsChip.hidden = false;+ })+ .catch(() => {});++function updateSearchClearVisibility() {+ if (!els.searchClear) return;+ els.searchClear.hidden = !els.search.value;+}++function syncUrl() {+ const p = new URLSearchParams();+ if (state.query) p.set('q', state.query);+ if (state.tag) p.set('tag', state.tag);+ const qs = p.toString();+ const next = qs ? `${location.pathname}?${qs}` : location.pathname;+ if (next !== location.pathname + location.search) {+ history.replaceState(null, '', next);+ }+}++let searchDebounce;+els.search.addEventListener('input', () => {+ updateSearchClearVisibility();+ clearTimeout(searchDebounce);+ searchDebounce = setTimeout(() => {+ state.query = els.search.value.trim();+ syncUrl();+ resetAndLoad();+ }, 250);+});++els.searchClear.addEventListener('click', () => {+ els.search.value = '';+ state.query = '';+ updateSearchClearVisibility();+ syncUrl();+ resetAndLoad();+ els.search.focus();+});++els.tags.addEventListener('click', (e) => {+ const btn = e.target.closest('[data-tag]');+ if (!btn) return;+ const tag = btn.dataset.tag === state.tag ? '' : btn.dataset.tag;+ state.tag = tag;+ renderTags();+ syncUrl();+ resetAndLoad();+});++els.loadMore.addEventListener('click', () => loadPage());++els.status.addEventListener('click', (e) => {+ if (e.target.closest('[data-role="clear-filters"]')) clearAllFilters();+});++// IntersectionObserver-based infinite scroll. Falls back to the manual+// "Load more" button if IO isn't available.+let io;+if ('IntersectionObserver' in window) {+ io = new IntersectionObserver(+ (entries) => {+ for (const entry of entries) {+ if (entry.isIntersecting && state.cursor && !state.loading) loadPage();+ }+ },+ { rootMargin: '480px 0px' },+ );+ io.observe(els.sentinel);+}++function clearAllFilters() {+ state.query = '';+ state.tag = '';+ els.search.value = '';+ updateSearchClearVisibility();+ renderTags();+ syncUrl();+ resetAndLoad();+}++function resetAndLoad() {+ state.cursor = null;+ state.totalLoaded = 0;+ els.grid.innerHTML = '';+ renderSkeletons(8);+ loadPage();+}++function renderSkeletons(n) {+ const frag = document.createDocumentFragment();+ for (let i = 0; i < n; i++) {+ const card = document.createElement('article');+ card.className = 'gallery-card gallery-card--skel';+ card.innerHTML = `+ <div class="gallery-card-thumb"></div>+ <div class="gallery-card-body">+ <div class="gallery-card-name"> </div>+ <div class="gallery-card-desc"> </div>+ <div class="gallery-card-tags"> </div>+ </div>+ `;+ frag.appendChild(card);+ }+ els.grid.appendChild(frag);+}++function clearSkeletons() {+ for (const node of els.grid.querySelectorAll('.gallery-card--skel')) node.remove();+}++async function loadPage() {+ if (state.loading) return;+ state.loading = true;+ els.loadMore.hidden = true;+ const isFirstPage = !state.cursor;+ if (!isFirstPage) {+ els.status.textContent = 'Loading more…';+ } else if (!els.grid.querySelector('.gallery-card--skel')) {+ els.status.textContent = 'Loading…';+ } else {+ els.status.textContent = '';+ }++ const params = new URLSearchParams();+ if (state.query) params.set('q', state.query);+ if (state.tag) params.set('tag', state.tag);+ if (state.cursor) params.set('cursor', state.cursor);+ params.set('limit', '24');++ try {+ const res = await fetch(`/api/avatars/public?${params.toString()}`);+ if (!res.ok) throw new Error(`HTTP ${res.status}`);+ const data = await res.json();++ clearSkeletons();++ const avatars = Array.isArray(data.avatars) ? data.avatars : [];+ for (const a of avatars) {+ els.grid.appendChild(renderCard(a));+ state.totalLoaded += 1;+ for (const t of a.tags || []) state.loadedTags.add(t);+ }++ // Update stats — these are approximations (loaded so far, not corpus-wide,+ // since the public endpoint doesn't surface totals). Show what we know.+ updateStats();+ renderTags();++ state.cursor = data.next_cursor || null;+ els.loadMore.hidden = !state.cursor;++ if (els.grid.children.length === 0) {+ const filtersActive = !!state.query || !!state.tag;+ els.status.innerHTML = filtersActive+ ? `<div class="gallery-empty">+ <div class="gallery-empty-art">🔍</div>+ <h3>No public avatars match your filters</h3>+ <p>Try clearing the search or tag — or be the first to share one matching this query.</p>+ <button type="button" class="gallery-clear-filters" data-role="clear-filters">Clear filters</button>+ <a class="gallery-clear-cta" href="/dashboard/avatars">Upload yours</a>+ </div>`+ : `<div class="gallery-empty">+ <div class="gallery-empty-art">✨</div>+ <h3>No public avatars yet</h3>+ <p>Be the first — upload a GLB in the dashboard and set its visibility to <strong>public</strong> so it shows up here.</p>+ <a class="gallery-clear-cta" href="/dashboard/avatars">Open dashboard</a>+ </div>`;+ } else {+ els.status.textContent = '';+ }+ } catch (err) {+ clearSkeletons();+ els.status.innerHTML = `<div class="gallery-error">Failed to load avatars: ${escapeHtml(err.message)}</div>`;+ } finally {+ state.loading = false;+ }+}++function updateStats() {+ if (state.cursor) {+ // More pages exist — show a "≥N" hint without lying about a total.+ els.statCount.textContent = state.totalLoaded.toLocaleString() + '+';+ } else {+ els.statCount.textContent = state.totalLoaded.toLocaleString();+ }+ els.statTags.textContent = state.loadedTags.size.toLocaleString();+}++function renderTags() {+ const tags = [...state.loadedTags].sort((a, b) => a.localeCompare(b));+ if (!tags.length && !state.tag) {+ els.tagWrap.hidden = true;+ els.tags.innerHTML = '';+ return;+ }+ els.tagWrap.hidden = false;+ const all = state.tag && !tags.includes(state.tag) ? [state.tag, ...tags] : tags;+ els.tags.innerHTML = all+ .map(+ (t) =>+ `<button type="button" class="gallery-tag${+ t === state.tag ? ' is-active' : ''+ }" data-tag="${escapeAttr(t)}">${escapeHtml(t)}</button>`,+ )+ .join('');+}++function renderCard(a) {+ const card = document.createElement('article');+ card.className = 'gallery-card';++ const glbUrl = a.model_url || '';+ const viewerUrl = glbUrl ? `/app#model=${encodeURIComponent(glbUrl)}` : '#';+ const detailUrl = `/discover/avatar/${a.id}`;+ const studioUrl = `/studio?avatar=${encodeURIComponent(a.id)}`;++ const thumb = a.thumbnail_url+ ? `<img src="${escapeAttr(a.thumbnail_url)}" alt="${escapeAttr(a.name || 'Avatar')}" loading="lazy" decoding="async" />`+ : `<div class="gallery-card-ph">🎭</div>`;++ const tagChips = (a.tags || [])+ .slice(0, 3)+ .map(+ (t) => `<span class="gallery-card-tag">${escapeHtml(t)}</span>`,+ )+ .join('');++ const created = formatRelative(a.created_at);++ card.innerHTML = `+ <a class="gallery-card-thumb" href="${escapeAttr(detailUrl)}" aria-label="${escapeAttr(a.name || 'Avatar')} details">+ ${thumb}+ <span class="gallery-card-3dpill">3D</span>+ <span class="gallery-card-play" aria-hidden="true">▶</span>+ </a>+ <div class="gallery-card-body">+ <h3 class="gallery-card-name"><a href="${escapeAttr(detailUrl)}">${escapeHtml(a.name || 'Untitled')}</a></h3>+ ${a.description ? `<p class="gallery-card-desc">${escapeHtml(a.description)}</p>` : ''}+ ${tagChips ? `<div class="gallery-card-tags">${tagChips}</div>` : ''}+ <div class="gallery-card-foot">+ <span class="gallery-card-meta">${escapeHtml(created)}</span>+ <div class="gallery-card-actions">+ <a class="gallery-card-btn" href="${escapeAttr(viewerUrl)}" title="Open in viewer">View 3D</a>+ <a class="gallery-card-btn gallery-card-btn--primary" href="${escapeAttr(studioUrl)}" title="Use in Widget Studio">Use</a>+ </div>+ </div>+ </div>+ `;+ return card;+}++function formatRelative(iso) {+ if (!iso) return '';+ const then = new Date(iso).getTime();+ if (Number.isNaN(then)) return '';+ const diff = Date.now() - then;+ const s = Math.max(0, Math.floor(diff / 1000));+ if (s < 60) return 'just now';+ const m = Math.floor(s / 60);+ if (m < 60) return `${m}m ago`;+ const h = Math.floor(m / 60);+ if (h < 24) return `${h}h ago`;+ const d = Math.floor(h / 24);+ if (d < 7) return `${d}d ago`;+ const w = Math.floor(d / 7);+ if (w < 5) return `${w}w ago`;+ const mo = Math.floor(d / 30);+ if (mo < 12) return `${mo}mo ago`;+ const y = Math.floor(d / 365);+ return `${y}y ago`;+}++function escapeHtml(s) {+ return String(s ?? '')+ .replace(/&/g, '&')+ .replace(/</g, '<')+ .replace(/>/g, '>')+ .replace(/"/g, '"');+}+function escapeAttr(s) {+ return escapeHtml(s).replace(/'/g, ''');+}++resetAndLoad();diff --git a/public/gallery/index.html b/public/gallery/index.htmlnew file mode 100644index 000000000..dda3fbc70--- /dev/null+++ b/public/gallery/index.html@@ -0,0 +1,140 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />+ <title>Avatar Gallery · three.ws</title>+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />+ <meta+ name="description"+ content="Every public 3D avatar made on three.ws. Browse, preview, embed, or remix — all from one gallery."+ />+ <meta name="theme-color" content="#000000" />+ <link rel="canonical" href="https://three.ws/gallery" />++ <meta property="og:type" content="website" />+ <meta property="og:title" content="Avatar Gallery · three.ws" />+ <meta+ property="og:description"+ content="Every public 3D avatar made on three.ws. Preview, embed, or remix from one place."+ />+ <meta property="og:url" content="https://three.ws/gallery" />+ <meta property="og:image" content="https://three.ws/og-image.png" />+ <meta name="twitter:card" content="summary_large_image" />+ <meta name="twitter:title" content="Avatar Gallery · three.ws" />+ <meta+ name="twitter:description"+ content="Every public 3D avatar made on three.ws."+ />+ <meta name="twitter:image" content="https://three.ws/og-image.png" />++ <link rel="shortcut icon" href="/favicon.ico" />+ <link rel="preconnect" href="https://fonts.googleapis.com" />+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />+ <link rel="stylesheet" href="/style.css" />+ <link rel="stylesheet" href="/nav.css" />+ <link rel="stylesheet" href="/gallery/gallery.css" />+ <link+ href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap"+ rel="stylesheet"+ />+ </head>+ <body class="gallery-page">+ <header>+ <div id="nav-container"></div>+ </header>+ <script src="/nav.js"></script>++ <main class="gallery-main">+ <section class="gallery-hero">+ <div class="gallery-hero-inner">+ <div class="gallery-hero-chips">+ <div class="gallery-hero-chip">+ <span class="gallery-hero-dot"></span>+ <span>Public avatar gallery</span>+ </div>+ <a+ href="/dashboard/avatars"+ class="gallery-hero-chip gallery-hero-chip--link"+ data-role="my-avatars-chip"+ hidden+ >+ <span>My avatars →</span>+ </a>+ </div>+ <h1 class="gallery-title">Every avatar, ever made.</h1>+ <p class="gallery-sub">+ The community-made 3D avatars on three.ws. Click any card to preview in+ the viewer, then embed it anywhere or remix into a new agent.+ </p>++ <div class="gallery-stats" data-role="stats">+ <div class="gallery-stat">+ <div class="gallery-stat-value" data-role="stat-count">—</div>+ <div class="gallery-stat-label">Public avatars</div>+ </div>+ <div class="gallery-stat">+ <div class="gallery-stat-value" data-role="stat-tags">—</div>+ <div class="gallery-stat-label">Tags in use</div>+ </div>+ <div class="gallery-stat">+ <div class="gallery-stat-value">3D</div>+ <div class="gallery-stat-label">glTF / GLB</div>+ </div>+ </div>+ </div>+ </section>++ <section class="gallery-controls">+ <div class="gallery-search">+ <svg+ class="gallery-search-icon"+ viewBox="0 0 20 20"+ fill="none"+ aria-hidden="true"+ >+ <circle cx="9" cy="9" r="6" stroke="currentColor" stroke-width="1.6" />+ <path d="m14 14 4 4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />+ </svg>+ <input+ type="search"+ placeholder="Search by name or description…"+ data-role="search"+ aria-label="Search avatars"+ autocomplete="off"+ spellcheck="false"+ />+ <button+ type="button"+ class="gallery-search-clear"+ data-role="search-clear"+ aria-label="Clear search"+ hidden+ >+ ×+ </button>+ </div>+ <div class="gallery-tag-wrap" data-role="tag-wrap" hidden>+ <div class="gallery-tag-label">Tags</div>+ <div class="gallery-tags" data-role="tags"></div>+ </div>+ </section>++ <section class="gallery-grid-wrap">+ <div class="gallery-grid" data-role="grid"></div>+ <div class="gallery-status" data-role="status"></div>+ <div class="gallery-sentinel" data-role="sentinel" aria-hidden="true"></div>+ <div class="gallery-load-more-wrap">+ <button class="gallery-load-more" data-role="load-more" hidden>+ Load more+ </button>+ </div>+ </section>+ </main>++ <div id="footer-container"></div>+ <script src="/footer.js"></script>++ <script type="module" src="/gallery/gallery.js"></script>+ </body>+</html>diff --git a/public/home-polish.css b/public/home-polish.cssnew file mode 100644index 000000000..905ce18e4--- /dev/null+++ b/public/home-polish.css@@ -0,0 +1,351 @@+/* ───────────────────────────────────────────────────────────────────────────+ home-polish.css — additive professional polish over home.css.+ Loaded AFTER /home.css from home.html. Nothing here removes prior styles;+ it tightens typography, adds a section rail, numbers pillars, glows+ bento cards, refines focus rings, and adds a copy button + scroll bar.+ ─────────────────────────────────────────────────────────────────────────── */++/* ── Typographic polish ─────────────────────────────────────────────────── */++.home-page {+ text-rendering: optimizeLegibility;+ -webkit-font-smoothing: antialiased;+ -moz-osx-font-smoothing: grayscale;+ font-feature-settings:+ 'ss01' on,+ 'cv11' on,+ 'kern' on,+ 'liga' on;+}++.home-page h1,+.home-page h2,+.home-page h3,+.home-page .h-title,+.home-page .h-act-title,+.home-page .h-section-title {+ font-feature-settings:+ 'ss01' on,+ 'cv11' on,+ 'kern' on,+ 'liga' on,+ 'ss02' on;+}++.home-page p,+.home-page li {+ text-wrap: pretty;+}++/* ── Top scroll progress bar ────────────────────────────────────────────── */++.h-scroll-progress {+ position: fixed;+ top: 0;+ left: 0;+ height: 2px;+ width: 0%;+ z-index: 250;+ background: linear-gradient(+ 90deg,+ rgba(255, 215, 106, 0.95) 0%,+ rgba(255, 143, 77, 0.95) 50%,+ rgba(167, 139, 250, 0.95) 100%+ );+ box-shadow:+ 0 0 12px rgba(255, 175, 60, 0.55),+ 0 0 24px rgba(255, 175, 60, 0.25);+ pointer-events: none;+ transition: width 0.08s linear;+ border-bottom-right-radius: 2px;+}++/* ── Right-side chapter rail (anchor nav) ───────────────────────────────── */++.h-chapter-rail {+ position: fixed;+ top: 50%;+ right: clamp(0.85rem, 1.5vw, 1.5rem);+ transform: translateY(-50%);+ z-index: 180;+ display: flex;+ flex-direction: column;+ gap: 0.85rem;+ padding: 0.85rem 0.55rem;+ background: rgba(10, 8, 6, 0.35);+ border: 1px solid rgba(255, 255, 255, 0.06);+ border-radius: 999px;+ backdrop-filter: blur(10px) saturate(140%);+ -webkit-backdrop-filter: blur(10px) saturate(140%);+ pointer-events: auto;+ opacity: 0;+ transform: translateY(-50%) translateX(10px);+ transition:+ opacity 0.4s ease,+ transform 0.4s ease;+}++.h-chapter-rail.is-visible {+ opacity: 1;+ transform: translateY(-50%) translateX(0);+}++.h-chapter-dot {+ position: relative;+ display: block;+ width: 10px;+ height: 10px;+ border-radius: 50%;+ background: rgba(255, 255, 255, 0.18);+ border: 1px solid rgba(255, 255, 255, 0.08);+ cursor: pointer;+ transition:+ background 0.25s ease,+ border-color 0.25s ease,+ transform 0.25s ease,+ box-shadow 0.25s ease;+}++.h-chapter-dot:hover {+ background: rgba(255, 215, 106, 0.7);+ border-color: rgba(255, 215, 106, 0.9);+ transform: scale(1.15);+}++.h-chapter-dot.is-active {+ background: linear-gradient(135deg, #ffd76a, #ff8f4d);+ border-color: rgba(255, 215, 106, 0.95);+ box-shadow:+ 0 0 0 3px rgba(255, 175, 60, 0.18),+ 0 0 14px rgba(255, 143, 77, 0.55);+}++.h-chapter-dot .h-chapter-label {+ position: absolute;+ right: calc(100% + 0.9rem);+ top: 50%;+ transform: translateY(-50%) translateX(6px);+ font-family: 'Space Grotesk', 'Inter', sans-serif;+ font-size: 0.7rem;+ font-weight: 600;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ color: rgba(255, 255, 255, 0.85);+ background: rgba(10, 8, 6, 0.85);+ border: 1px solid rgba(255, 255, 255, 0.08);+ padding: 0.35rem 0.7rem;+ border-radius: 6px;+ white-space: nowrap;+ pointer-events: none;+ opacity: 0;+ transition:+ opacity 0.2s ease,+ transform 0.2s ease;+ backdrop-filter: blur(6px);+ -webkit-backdrop-filter: blur(6px);+}++.h-chapter-dot:hover .h-chapter-label,+.h-chapter-dot:focus-visible .h-chapter-label {+ opacity: 1;+ transform: translateY(-50%) translateX(0);+}++.h-chapter-dot:focus-visible {+ outline: none;+ box-shadow:+ 0 0 0 3px rgba(255, 175, 60, 0.35),+ 0 0 14px rgba(255, 143, 77, 0.55);+}++@media (max-width: 880px) {+ .h-chapter-rail {+ display: none;+ }+}++@media (prefers-reduced-motion: reduce) {+ .h-chapter-rail,+ .h-chapter-dot,+ .h-chapter-dot .h-chapter-label,+ .h-scroll-progress {+ transition: none;+ }+}++/* ── Pillar number badges + card polish ─────────────────────────────────── */++.h-pillar {+ position: relative;+ padding: clamp(1.25rem, 2vw, 1.75rem);+ border: 1px solid rgba(255, 255, 255, 0.06);+ border-radius: 14px;+ background:+ linear-gradient(+ 180deg,+ rgba(255, 215, 106, 0.04) 0%,+ rgba(255, 255, 255, 0.012) 35%,+ rgba(255, 255, 255, 0) 100%+ ),+ rgba(255, 255, 255, 0.015);+ overflow: hidden;+ transition:+ border-color 0.35s cubic-bezier(0.2, 0.9, 0.3, 1),+ transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1),+ box-shadow 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);+}++.h-pillar::before {+ content: '';+ position: absolute;+ top: 0;+ left: 0;+ right: 0;+ height: 1px;+ background: linear-gradient(+ 90deg,+ transparent 0%,+ rgba(255, 215, 106, 0.55) 50%,+ transparent 100%+ );+ opacity: 0.7;+}++.h-pillar:hover {+ border-color: rgba(255, 215, 106, 0.22);+ transform: translateY(-3px);+ box-shadow:+ 0 18px 40px -22px rgba(255, 143, 77, 0.35),+ 0 0 0 1px rgba(255, 215, 106, 0.08) inset;+}++.h-pillar-num {+ display: inline-block;+ font-family: 'JetBrains Mono', monospace;+ font-size: 0.7rem;+ font-weight: 500;+ letter-spacing: 0.14em;+ color: rgba(255, 215, 106, 0.7);+ margin-bottom: 0.85rem;+}++.h-pillar-num::before {+ content: '';+ display: inline-block;+ width: 18px;+ height: 1px;+ background: rgba(255, 215, 106, 0.45);+ vertical-align: middle;+ margin-right: 0.55rem;+ transform: translateY(-1px);+}++/* ── Bento card hover glow ──────────────────────────────────────────────── */++.h-bento-card {+ position: relative;+}++.h-bento-card::after {+ content: '';+ position: absolute;+ inset: 0;+ border-radius: inherit;+ pointer-events: none;+ opacity: 0;+ transition: opacity 0.35s ease;+ background: radial-gradient(+ 380px circle at var(--bx, 50%) var(--by, 0%),+ rgba(255, 175, 60, 0.07) 0%,+ transparent 60%+ );+}++.h-bento-card:hover::after {+ opacity: 1;+}++/* ── Dev code: copy button ──────────────────────────────────────────────── */++.h-dev-code {+ position: relative;+}++.h-dev-copy {+ position: absolute;+ top: 0.55rem;+ right: 0.7rem;+ z-index: 2;+ display: inline-flex;+ align-items: center;+ gap: 0.4em;+ padding: 0.35rem 0.65rem;+ font-family: 'Space Grotesk', 'Inter', sans-serif;+ font-size: 0.68rem;+ font-weight: 600;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ color: rgba(255, 255, 255, 0.6);+ background: rgba(255, 255, 255, 0.04);+ border: 1px solid rgba(255, 255, 255, 0.08);+ border-radius: 6px;+ cursor: pointer;+ transition:+ color 0.2s ease,+ background 0.2s ease,+ border-color 0.2s ease,+ transform 0.2s ease;+}++.h-dev-copy:hover {+ color: #fff;+ background: rgba(255, 215, 106, 0.08);+ border-color: rgba(255, 215, 106, 0.35);+}++.h-dev-copy:active {+ transform: scale(0.97);+}++.h-dev-copy.is-copied {+ color: #6ee7b7;+ background: rgba(110, 231, 183, 0.1);+ border-color: rgba(110, 231, 183, 0.45);+}++.h-dev-copy svg {+ width: 12px;+ height: 12px;+ display: block;+}++/* ── Focus ring polish ──────────────────────────────────────────────────── */++.home-page a:focus-visible,+.home-page button:focus-visible,+.home-page input:focus-visible,+.home-page select:focus-visible,+.home-page textarea:focus-visible {+ outline: none;+ box-shadow:+ 0 0 0 2px rgba(10, 8, 6, 0.9),+ 0 0 0 4px rgba(255, 175, 60, 0.55);+ border-radius: 6px;+}++.home-page .h-btn-primary:focus-visible {+ box-shadow:+ 0 0 0 2px rgba(10, 8, 6, 0.9),+ 0 0 0 4px rgba(255, 175, 60, 0.7),+ 0 6px 24px -8px rgba(255, 143, 77, 0.55);+}++/* ── Section anchor offset so chapter-rail jumps don't hide under header ── */++#pick-animate,+#deploy-act,+.h-bento-section,+.h-dev-section,+.h-cta-section {+ scroll-margin-top: 80px;+}diff --git a/public/home-polish.js b/public/home-polish.jsnew file mode 100644index 000000000..1dd872693--- /dev/null+++ b/public/home-polish.js@@ -0,0 +1,218 @@+/* home-polish.js — enhances home.html with:+ * - top scroll-progress bar+ * - right-side chapter rail with active-section tracking+ * - "Copy" button for the developer code snippet+ * - cursor-tracked radial glow on bento cards+ *+ * Purely additive. Safe to remove without breaking existing functionality.+ */++(function () {+ if (typeof document === 'undefined') return;++ var ready = function (fn) {+ if (document.readyState !== 'loading') fn();+ else document.addEventListener('DOMContentLoaded', fn);+ };++ ready(function () {+ var main = document.querySelector('main.home-parallax');+ if (!main) return;++ mountScrollProgress();+ mountChapterRail(main);+ mountDevCopyButton();+ mountBentoGlow();+ });++ /* ── Scroll progress bar ─────────────────────────────────────────────── */++ function mountScrollProgress() {+ var bar = document.createElement('div');+ bar.className = 'h-scroll-progress';+ bar.setAttribute('aria-hidden', 'true');+ document.body.appendChild(bar);++ var ticking = false;+ var update = function () {+ var doc = document.documentElement;+ var max = doc.scrollHeight - doc.clientHeight;+ var pct = max > 0 ? (doc.scrollTop / max) * 100 : 0;+ bar.style.width = pct.toFixed(2) + '%';+ ticking = false;+ };++ window.addEventListener(+ 'scroll',+ function () {+ if (!ticking) {+ window.requestAnimationFrame(update);+ ticking = true;+ }+ },+ { passive: true },+ );+ update();+ }++ /* ── Chapter rail with IntersectionObserver active-state ─────────────── */++ function mountChapterRail(main) {+ var chapters = [+ { id: 'h-hero-act', label: 'Intro', selector: '.h-hero-act' },+ { id: 'h-pillars', label: 'Pillars', selector: '.h-pillars' },+ { id: 'pick-animate', label: 'Animate', selector: '#pick-animate' },+ { id: 'deploy-act', label: 'Deploy', selector: '#deploy-act' },+ { id: 'h-bento-section', label: 'Features', selector: '.h-bento-section' },+ { id: 'h-dev-section', label: 'Developers', selector: '.h-dev-section' },+ { id: 'h-cta-section', label: 'Start', selector: '.h-cta-section' },+ ];++ var resolved = chapters+ .map(function (c) {+ var el = main.querySelector(c.selector);+ return el ? Object.assign({}, c, { el: el }) : null;+ })+ .filter(Boolean);++ if (resolved.length < 3) return;++ var rail = document.createElement('nav');+ rail.className = 'h-chapter-rail';+ rail.setAttribute('aria-label', 'Page sections');++ var dots = resolved.map(function (c) {+ var dot = document.createElement('a');+ dot.className = 'h-chapter-dot';+ dot.href = '#' + (c.el.id || c.id);+ dot.setAttribute('aria-label', c.label);+ dot.dataset.target = c.id;++ var label = document.createElement('span');+ label.className = 'h-chapter-label';+ label.textContent = c.label;+ dot.appendChild(label);++ dot.addEventListener('click', function (ev) {+ ev.preventDefault();+ c.el.scrollIntoView({ behavior: 'smooth', block: 'start' });+ });++ rail.appendChild(dot);+ return { dot: dot, el: c.el, id: c.id };+ });++ document.body.appendChild(rail);++ // reveal once first section is visible+ window.requestAnimationFrame(function () {+ rail.classList.add('is-visible');+ });++ // Active-state via IntersectionObserver+ var visible = new Map();+ var io = new IntersectionObserver(+ function (entries) {+ entries.forEach(function (entry) {+ if (entry.isIntersecting) visible.set(entry.target, entry.intersectionRatio);+ else visible.delete(entry.target);+ });++ if (visible.size === 0) return;++ var bestEl = null;+ var bestRatio = -1;+ visible.forEach(function (ratio, el) {+ if (ratio > bestRatio) {+ bestRatio = ratio;+ bestEl = el;+ }+ });++ dots.forEach(function (d) {+ if (d.el === bestEl) d.dot.classList.add('is-active');+ else d.dot.classList.remove('is-active');+ });+ },+ { threshold: [0.25, 0.5, 0.75] },+ );++ dots.forEach(function (d) {+ io.observe(d.el);+ });+ }++ /* ── Copy button on developer code snippet ───────────────────────────── */++ function mountDevCopyButton() {+ var container = document.querySelector('.h-dev-code');+ if (!container) return;+ var pre = container.querySelector('pre');+ if (!pre) return;++ var btn = document.createElement('button');+ btn.type = 'button';+ btn.className = 'h-dev-copy';+ btn.setAttribute('aria-label', 'Copy code to clipboard');+ btn.innerHTML =+ '<svg viewBox="0 0 16 16" aria-hidden="true">' ++ '<path fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" ' ++ 'd="M5.5 4.5h6a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1z M3.5 11V4a1 1 0 0 1 1-1h7" />' ++ '</svg><span>Copy</span>';+ container.appendChild(btn);++ btn.addEventListener('click', function () {+ var text = pre.innerText.trim();+ var done = function () {+ btn.classList.add('is-copied');+ btn.querySelector('span').textContent = 'Copied';+ setTimeout(function () {+ btn.classList.remove('is-copied');+ btn.querySelector('span').textContent = 'Copy';+ }, 1600);+ };++ if (navigator.clipboard && navigator.clipboard.writeText) {+ navigator.clipboard.writeText(text).then(done, function () {+ fallbackCopy(text, done);+ });+ } else {+ fallbackCopy(text, done);+ }+ });+ }++ function fallbackCopy(text, done) {+ var ta = document.createElement('textarea');+ ta.value = text;+ ta.setAttribute('readonly', '');+ ta.style.position = 'fixed';+ ta.style.opacity = '0';+ document.body.appendChild(ta);+ ta.select();+ try {+ document.execCommand('copy');+ done();+ } catch (_) {+ /* ignore */+ }+ document.body.removeChild(ta);+ }++ /* ── Cursor-tracked radial glow on bento cards ───────────────────────── */++ function mountBentoGlow() {+ var cards = document.querySelectorAll('.h-bento-card');+ if (!cards.length) return;++ cards.forEach(function (card) {+ card.addEventListener('pointermove', function (ev) {+ var rect = card.getBoundingClientRect();+ var x = ((ev.clientX - rect.left) / rect.width) * 100;+ var y = ((ev.clientY - rect.top) / rect.height) * 100;+ card.style.setProperty('--bx', x + '%');+ card.style.setProperty('--by', y + '%');+ });+ });+ }+})();diff --git a/public/login.html b/public/login.htmlindex e7eafef38..dcb9bc8f6 100644--- a/public/login.html+++ b/public/login.html@@ -782,7 +782,7 @@// ── Auth redirect ──const next =- params.get('next') || sessionStorage.getItem('login_redirect') || '/create';+ params.get('next') || sessionStorage.getItem('login_redirect') || '/dashboard';sessionStorage.removeItem('login_redirect');window.__loginNext = next;const navType = performance.getEntriesByType('navigation')[0]?.type;diff --git a/public/nav.html b/public/nav.htmlindex d9929e475..8fcce230b 100644--- a/public/nav.html+++ b/public/nav.html@@ -51,8 +51,30 @@<li class="nav-item" role="none"><a href="/marketplace" role="menuitem">Marketplace</a></li>- <li class="nav-item" role="none">- <a href="/discover" role="menuitem">Discover</a>+ <li class="nav-item nav-has-menu" role="none">+ <button+ type="button"+ class="nav-trigger"+ aria-haspopup="true"+ aria-expanded="false"+ role="menuitem"+ >+ Discover<span class="nav-caret" aria-hidden="true">▾</span>+ </button>+ <ul class="nav-menu" role="menu" aria-label="Discover">+ <li role="none">+ <a href="/discover" role="menuitem"+ ><span class="nav-mi-title">ERC-8004 Agents</span+ ><span class="nav-mi-sub">On-chain agent directory</span></a+ >+ </li>+ <li role="none">+ <a href="/gallery" role="menuitem"+ ><span class="nav-mi-title">Avatar Gallery</span+ ><span class="nav-mi-sub">Every public 3D avatar</span></a+ >+ </li>+ </ul></li><li class="nav-item nav-has-menu" role="none"><buttondiff --git a/public/studio/index.html b/public/studio/index.htmlindex 8bb1f8309..9fa29777e 100644--- a/public/studio/index.html+++ b/public/studio/index.html@@ -105,7 +105,7 @@<h2 data-tooltip="The 3D model your widget will display. We've pre-loaded a demo agent so you can try the studio right away — sign in to use your own.">1. Pick avatar</h2>- <p class="note">To see your avatar here, make it public or unlisted in your <a href="/dashboard/avatars">avatar dashboard</a>. Or browse <a href="/discover" target="_blank" rel="noopener">community avatars</a>.</p>+ <p class="note">To see your avatar here, make it public or unlisted in your <a href="/dashboard/avatars">avatar dashboard</a>. Or browse the <a href="/gallery" target="_blank" rel="noopener">community gallery</a>.</p><div class="avatar-list" id="avatar-list" aria-busy="true"></div><div class="browse-public"><div class="browse-public-row">diff --git a/public/studio/studio.js b/public/studio/studio.jsindex d1e52c728..45a103fd1 100644--- a/public/studio/studio.js+++ b/public/studio/studio.js@@ -146,6 +146,7 @@ const editId = params.get('edit');const tplId = params.get('template');const pickType = params.get('type');const preModel = params.get('model');+const preAvatarId = params.get('avatar');if (pickType && WIDGET_TYPES[pickType]) state.type = pickType;if (preModel) state.preselectedModel = preModel;@@ -164,6 +165,7 @@ if (preModel) state.preselectedModel = preModel;if (editId) await loadForEdit(editId);else if (tplId) await cloneTemplate(tplId);+ else if (preAvatarId) await selectByAvatarId(preAvatarId);else if (state.preselectedModel) selectByModelUrl(state.preselectedModel);else if (!state.avatarId) selectAvatar(DEMO_AVATAR.id);@@ -471,6 +473,41 @@ function findAvatar(id) {);}+async function selectByAvatarId(id) {+ const existing = findAvatar(id);+ if (existing) return selectAvatar(existing.id);+ try {+ const res = await fetch(`/api/avatars/${encodeURIComponent(id)}`, {+ credentials: 'include',+ });+ if (!res.ok) throw new Error(`avatar ${id}: ${res.status}`);+ const { avatar } = await res.json();+ if (!avatar?.model_url) throw new Error('avatar missing model_url');+ const ownIds = new Set(state.avatars.map((a) => a.id));+ if (!ownIds.has(avatar.id)) {+ state.publicAvatars = [+ {+ id: avatar.id,+ name: avatar.name,+ slug: avatar.slug,+ description: avatar.description,+ tags: avatar.tags || [],+ visibility: avatar.visibility,+ model_url: avatar.model_url,+ thumbnail_url: avatar.thumbnail_url || null,+ },+ ...state.publicAvatars.filter((a) => a.id !== avatar.id),+ ];+ renderPublicAvatarList();+ }+ selectAvatar(avatar.id);+ } catch (err) {+ console.warn('[studio] selectByAvatarId failed', err);+ toast('Pre-selected avatar not available');+ if (!state.avatarId) selectAvatar(DEMO_AVATAR.id);+ }+}+function selectByModelUrl(url) {const urlPath = (() => {try {diff --git a/public/wallet-login.js b/public/wallet-login.jsindex bd93cba86..121565582 100644--- a/public/wallet-login.js+++ b/public/wallet-login.js@@ -5,7 +5,7 @@ import { createConnectWalletButton } from '/wallet/connect-button.js';import { createSolanaWalletButton } from '/wallet/connect-button-solana.js';const params = new URLSearchParams(location.search);-const next = window.__loginNext || params.get('next') || sessionStorage.getItem('login_redirect') || '/create';+const next = window.__loginNext || params.get('next') || sessionStorage.getItem('login_redirect') || '/dashboard';sessionStorage.removeItem('login_redirect');function setErr(m) {diff --git a/src/create.js b/src/create.jsindex 7f724add8..1c62c106c 100644--- a/src/create.js+++ b/src/create.js@@ -82,12 +82,15 @@ async function isAtAvatarLimit() {}async function saveAndRedirect(blob, meta = {}) {- showStatus('Uploading avatar…', 'loading');+ showSaveOverlay('Saving your avatar…', 'This usually takes a few seconds.');try {const avatar = await saveRemoteGlbToAccount(blob, meta);+ updateSaveOverlay('Preparing your agent…');const agent = await attachAvatarToAgent(avatar.id, meta.name);+ updateSaveOverlay('Opening your avatar…');window.location.href = '/app?agent=' + agent.id;} catch (err) {+ hideSaveOverlay();if (err.code === 'not_signed_in') {sessionStorage.setItem('login_redirect', '/create');window.location.replace('/login');@@ -104,6 +107,36 @@ async function saveAndRedirect(blob, meta = {}) {}}+function showSaveOverlay(label, sublabel) {+ let el = document.getElementById('save-loading');+ if (!el) {+ el = document.createElement('div');+ el.id = 'save-loading';+ el.setAttribute('role', 'status');+ el.setAttribute('aria-live', 'polite');+ el.innerHTML = `+ <img src="/three.svg" alt="" />+ <div class="dots">...</div>+ <div class="label"></div>+ <div class="sublabel"></div>+ `;+ document.body.appendChild(el);+ }+ el.querySelector('.label').textContent = label;+ el.querySelector('.sublabel').textContent = sublabel || '';+}++function updateSaveOverlay(label, sublabel) {+ const el = document.getElementById('save-loading');+ if (!el) return;+ el.querySelector('.label').textContent = label;+ if (sublabel !== undefined) el.querySelector('.sublabel').textContent = sublabel;+}++function hideSaveOverlay() {+ document.getElementById('save-loading')?.remove();+}+// Associates the uploaded avatar with the caller's default agent. POST /api/agents// doesn't accept avatar_id, so we get-or-create via /me and then PUT to attach.async function attachAvatarToAgent(avatarId, name) {diff --git a/vercel.json b/vercel.jsonindex 504275250..ea0815934 100644--- a/vercel.json+++ b/vercel.json@@ -214,8 +214,11 @@},{"src": "/dashboard/(avatars|create|upload|animations|widgets|embed|keys|mcp|monetization|payments|subscriptions|billing|revenue|earnings|account)/?",- "status": 308,- "headers": { "Location": "/dashboard#$1" }+ "dest": "/dashboard/index.html"+ },+ {+ "src": "/dashboard/edit/[^/]+/?",+ "dest": "/dashboard/index.html"},{"src": "/dashboard/(.*)",@@ -821,6 +824,18 @@"src": "/widgets/(.*)","dest": "/widgets-gallery/$1"},+ {+ "src": "/gallery",+ "dest": "/gallery/index.html"+ },+ {+ "src": "/gallery/",+ "dest": "/gallery/index.html"+ },+ {+ "src": "/gallery/(.*)",+ "dest": "/gallery/$1"+ },{"src": "/docs","dest": "/docs/index.html"diff --git a/vite.config.js b/vite.config.jsindex 9924574e2..18e8f0194 100644--- a/vite.config.js+++ b/vite.config.js@@ -141,6 +141,7 @@ const appConfig = {// BEGIN:DISCOVER_ROUTE'my-agents': resolve(__dirname, 'public/my-agents/index.html'),discover: resolve(__dirname, 'public/discover/index.html'),+ gallery: resolve(__dirname, 'public/gallery/index.html'),// END:DISCOVER_ROUTE'vanity-wallet': resolve(__dirname, 'public/vanity-wallet.html'),'eth-vanity': resolve(__dirname, 'public/eth-vanity.html'),@@ -183,6 +184,8 @@ const appConfig = {'/my-agents/': resolve(root, 'public/my-agents/index.html'),'/discover': resolve(root, 'public/discover/index.html'),'/discover/': resolve(root, 'public/discover/index.html'),+ '/gallery': resolve(root, 'public/gallery/index.html'),+ '/gallery/': resolve(root, 'public/gallery/index.html'),'/marketplace': resolve(root, 'marketplace.html'),'/marketplace/': resolve(root, 'marketplace.html'),'/pay': resolve(root, 'public/pay/index.html'),@@ -222,6 +225,7 @@ const appConfig = {'/hydrate','/my-agents','/discover',+ '/gallery','/docs',]);server.middlewares.use(async (req, res, next) => {@@ -278,6 +282,16 @@ const appConfig = {// /pay/calls/<base58 tx sig> → permalink for a paid x402 callelse if (!filePath && /^\/pay\/calls\/[1-9A-HJ-NP-Za-km-z]+\/?$/.test(path))filePath = resolve(root, 'public/pay/calls/index.html');+ // /dashboard/<tab> and /dashboard/edit/<id> → SPA index+ else if (+ !filePath &&+ /^\/dashboard\/(?:avatars|create|upload|animations|widgets|embed|keys|mcp|monetization|payments|subscriptions|billing|revenue|earnings|account)\/?$/.test(+ path,+ )+ )+ filePath = resolve(root, 'public/dashboard/index.html');+ else if (!filePath && /^\/dashboard\/edit\/[^/]+\/?$/.test(path))+ filePath = resolve(root, 'public/dashboard/index.html');// Serve the rider webpack app as static files.// /footer-bot.js — serve the Vite-processed src/footer-bot.js at a// stable URL in dev so footer.js can load it without knowing the hash.