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
feat: refactor login method tabs to use "or" divider and update wallet chain selection
nirholas47c9bb39b438
diff --git a/api/_lib/demo-avatars.js b/api/_lib/demo-avatars.jsnew file mode 100644index 000000000..eca160647--- /dev/null+++ b/api/_lib/demo-avatars.js@@ -0,0 +1,57 @@+/**+ * Demo avatar fixtures for /api/explore.+ * These appear on the discover page when no real public avatars exist yet,+ * using static GLB files already served from /public.+ * IDs prefixed with `avatar_demo_` so they never collide with DB UUIDs.+ */++import { env } from './env.js';++function demoItem({ id, slug, name, description, tags, glbPath, sortDate }) {+ const origin = env.APP_ORIGIN;+ const glbUrl = `${origin}${glbPath}`;+ return {+ kind: 'avatar',+ sortDate,+ avatarId: id,+ slug,+ name,+ description,+ image: null,+ glbUrl,+ has3d: true,+ tags,+ createdAt: sortDate,+ viewerUrl: `/#model=${encodeURIComponent(glbUrl)}`,+ };+}++export const DEMO_AVATARS = [+ demoItem({+ id: 'avatar_demo_cz',+ slug: 'demo-cz',+ name: 'CZ',+ description: 'Humanoid avatar with idle animation support.',+ tags: ['humanoid', 'demo'],+ glbPath: '/avatars/cz.glb',+ sortDate: '2025-01-03T00:00:00Z',+ }),+ demoItem({+ id: 'avatar_demo_robot',+ slug: 'demo-robot',+ name: 'Robot',+ description: 'Expressive robot character with multiple animation clips.',+ tags: ['robot', 'animated', 'demo'],+ glbPath: '/animations/robotexpressive.glb',+ sortDate: '2025-01-02T00:00:00Z',+ }),+ demoItem({+ id: 'avatar_demo_soldier',+ slug: 'demo-soldier',+ name: 'Soldier',+ description: 'Fully rigged soldier model ready for animation.',+ tags: ['humanoid', 'animated', 'demo'],+ glbPath: '/animations/soldier.glb',+ sortDate: '2025-01-01T00:00:00Z',+ }),+];diff --git a/api/explore.js b/api/explore.jsindex 7c1cf1eb3..9f988ed87 100644--- a/api/explore.js+++ b/api/explore.js@@ -15,6 +15,7 @@ import { cors, json, method, wrap, error } from './_lib/http.js';import { limits, clientIp } from './_lib/rate-limit.js';import { CHAIN_BY_ID, tokenExplorerUrl, addressExplorerUrl } from './_lib/erc8004-chains.js';import { publicUrl } from './_lib/r2.js';+import { DEMO_AVATARS } from './_lib/demo-avatars.js';export default wrap(async (req, res) => {if (cors(req, res, { methods: 'GET,OPTIONS' })) return;@@ -125,6 +126,20 @@ export default wrap(async (req, res) => {};});+ // Inject demo avatars on the first page when the source allows avatars.+ // Filter by query if one is set so search still feels correct.+ if (includeAvatars && !cursorDate) {+ const qLower = q.toLowerCase();+ const matching = q+ ? DEMO_AVATARS.filter(+ (a) =>+ a.name.toLowerCase().includes(qLower) ||+ a.description.toLowerCase().includes(qLower),+ )+ : DEMO_AVATARS;+ avatarItems.push(...matching);+ }+// Merge by date desc and trim to page size; cursor is the date of the last item.const merged = [...onchainItems, ...avatarItems].sort((a, b) => new Date(b.sortDate).getTime() - new Date(a.sortDate).getTime(),@@ -143,8 +158,9 @@ export default wrap(async (req, res) => {const [{ total: avatarTotal }] = await sql`SELECT count(*)::text as total FROM avatars WHERE deleted_at IS NULL AND visibility = 'public'`;- const allTotal = Number(onchainTotal) + Number(avatarTotal);- const threeDTotal = Number(onchain3d) + Number(avatarTotal);+ const avatarCount = Number(avatarTotal) + DEMO_AVATARS.length;+ const allTotal = Number(onchainTotal) + avatarCount;+ const threeDTotal = Number(onchain3d) + avatarCount;return json(res, 200, {items,@@ -153,7 +169,7 @@ export default wrap(async (req, res) => {all: allTotal,threeD: threeDTotal,onchain: Number(onchainTotal),- avatars: Number(avatarTotal),+ avatars: avatarCount,},});});diff --git a/public/features/features.css b/public/features/features.cssindex eacf4ed4b..a853f8c97 100644--- a/public/features/features.css+++ b/public/features/features.css@@ -159,6 +159,52 @@background: linear-gradient(to bottom, rgba(6, 7, 11, 1) 0%, rgba(110, 231, 183, 0.04) 60%, transparent 100%);}+/* ── Scroll hint ────────────────────────────────────────────────────────── */++.scroll-hint {+ position: fixed;+ bottom: 2rem;+ left: 50%;+ transform: translateX(-50%);+ z-index: 100;+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 6px;+ opacity: 1;+ transition: opacity 0.6s ease;+ pointer-events: none;+}++.scroll-hint[hidden] {+ display: none;+}++.scroll-hint--hidden {+ opacity: 0;+}++.scroll-hint-label {+ font-family: 'Space Grotesk', sans-serif;+ font-size: 10px;+ font-weight: 500;+ letter-spacing: 0.18em;+ text-transform: uppercase;+ color: rgba(255, 255, 255, 0.35);+}++.scroll-hint-chevron {+ width: 20px;+ height: 20px;+ color: rgba(255, 255, 255, 0.3);+ animation: scroll-hint-bounce 1.6s ease-in-out infinite;+}++@keyframes scroll-hint-bounce {+ 0%, 100% { transform: translateY(0); opacity: 0.3; }+ 50% { transform: translateY(5px); opacity: 0.7; }+}+/* ── Section progress dots (fixed right rail) ───────────────────────────── */.act-nav {@@ -955,6 +1001,7 @@}.act-nav { display: none; }+ .scroll-hint { display: none; }.layer-stars-canvas {animation: none;diff --git a/public/features/index.html b/public/features/index.htmlindex 0b23d365b..3652873eb 100644--- a/public/features/index.html+++ b/public/features/index.html@@ -505,12 +505,32 @@</footer></main>+ <div class="scroll-hint" aria-hidden="true" data-role="scroll-hint">+ <span class="scroll-hint-label">Scroll</span>+ <svg class="scroll-hint-chevron" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5">+ <polyline points="4,7 10,13 16,7"/>+ </svg>+ </div>+<nav class="act-nav" aria-label="Section navigation"><a href="#main-content" class="act-dot" data-act="1" data-active="true" aria-label="Act 1: Live 3D"></a><a href="#act-empathy" class="act-dot" data-act="2" aria-label="Act 2: Empathy layer"></a><a href="#act-onchain" class="act-dot" data-act="3" aria-label="Act 3: On-chain identity"></a></nav>+ <script>+ (function () {+ const hint = document.querySelector('[data-role="scroll-hint"]');+ if (!hint) return;+ const container = document.querySelector('.parallax') || window;+ function hide() {+ hint.classList.add('scroll-hint--hidden');+ hint.addEventListener('transitionend', () => { hint.hidden = true; }, { once: true });+ container.removeEventListener('scroll', hide);+ }+ container.addEventListener('scroll', hide, { passive: true });+ })();+ </script><script type="module" src="/features/features.js"></script><script>try {diff --git a/public/login.html b/public/login.htmlindex a1661d190..a1daf4dd5 100644--- a/public/login.html+++ b/public/login.html@@ -342,49 +342,22 @@margin: 6px 0 0;text-align: right;}- /* ── Top-level method tabs (Email / Wallet) ── */- .method-tabs {+ /* ── "or" divider between wallet and email ── */+ .or-divider {display: flex;- gap: 3px;- background: #060606;- border: 1px solid rgba(255, 255, 255, 0.06);- border-radius: 10px;- padding: 3px;- margin: 0 0 16px;+ align-items: center;+ gap: 10px;+ margin: 18px 0;+ color: #333;+ font-size: 12px;+ letter-spacing: 0.04em;}- .method-tab {+ .or-divider::before,+ .or-divider::after {+ content: '';flex: 1;- margin-top: 0;- padding: 9px 10px;- border: 1px solid transparent;- border-radius: 7px;- background: transparent;- color: #555;- font-size: 14px;- font-weight: 500;- cursor: pointer;- transition: background 0.1s, color 0.1s, transform 0.08s cubic-bezier(0.34, 1.56, 0.64, 1);- width: auto;- }- .method-tab.active {- background: #1a1a1a;- color: #f0f0f0;- border-color: rgba(255, 255, 255, 0.08);- }- .method-tab:hover:not(.active) {- color: #aaa;- }- .method-tab:active {- transform: scale(0.97);- }- .method-panel { display: none; }- .method-panel.active {- display: block;- animation: panel-fade-in 0.18s ease-out both;- }- @keyframes panel-fade-in {- from { opacity: 0; transform: translateY(4px); }- to { opacity: 1; transform: translateY(0); }+ height: 1px;+ background: rgba(255, 255, 255, 0.06);}.chain-tab[disabled] {opacity: 0.4;@@ -405,7 +378,6 @@100% { background-position: -200% 0; }}@media (prefers-reduced-motion: reduce) {- .method-panel.active,#wallet-mount:empty::before,#solana-wallet-mount:empty::before {animation: none;@@ -531,57 +503,50 @@<h1>Welcome back</h1><p class="sub">Sign in to manage your avatars.</p>- <div class="method-tabs" role="tablist" aria-label="Sign-in method">- <button type="button" class="method-tab active" data-method="email" role="tab" aria-selected="true" aria-controls="email-panel">Email</button>- <button type="button" class="method-tab" data-method="wallet" role="tab" aria-selected="false" aria-controls="wallet-panel">Wallet</button>+ <div class="chain-tabs" role="tablist" aria-label="Wallet chain">+ <button type="button" class="chain-tab active" data-chain="evm" role="tab" aria-selected="true" aria-controls="evm-panel">EVM</button>+ <button type="button" class="chain-tab" data-chain="solana" role="tab" aria-selected="false" aria-controls="solana-panel">Solana</button></div>+ <div id="evm-panel" class="chain-panel active" role="tabpanel">+ <div id="wallet-mount"></div>+ </div>+ <div id="solana-panel" class="chain-panel" role="tabpanel">+ <div id="solana-wallet-mount"></div>+ </div>+ <p class="wallet-step-hint" title="Your wallet will prompt twice — once to connect, once to sign.">Wallet prompts to connect, then to sign.</p>- <div id="email-panel" class="method-panel active" role="tabpanel">- <label for="email">Email or username</label>- <input id="email" name="username" type="text" inputmode="email" autocapitalize="none" autocomplete="username email" autofocus required aria-describedby="email-err" />- <p class="field-err" id="email-err" role="alert"></p>+ <div class="or-divider">or</div>- <label for="password">Password</label>- <div class="password-wrap">- <input- id="password"- name="password"- type="password"- autocomplete="current-password"- required- minlength="10"- aria-describedby="password-err caps-warn"- />- <button type="button" class="password-toggle" id="password-toggle" aria-label="Show password" aria-pressed="false">- <svg id="eye-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">- <path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z" />- <circle cx="12" cy="12" r="3" />- </svg>- </button>- </div>- <p class="caps-warn" id="caps-warn">Caps Lock is on</p>- <p class="field-err" id="password-err" role="alert"></p>+ <label for="email">Email or username</label>+ <input id="email" name="username" type="text" inputmode="email" autocapitalize="none" autocomplete="username email" autofocus required aria-describedby="email-err" />+ <p class="field-err" id="email-err" role="alert"></p>- <div class="remember-row">- <label><input type="checkbox" id="remember" /> Remember me</label>- <a href="/forgot-password" class="forgot">Forgot password?</a>- </div>- <button id="submit" type="submit">Sign in</button>+ <label for="password">Password</label>+ <div class="password-wrap">+ <input+ id="password"+ name="password"+ type="password"+ autocomplete="current-password"+ required+ minlength="10"+ aria-describedby="password-err caps-warn"+ />+ <button type="button" class="password-toggle" id="password-toggle" aria-label="Show password" aria-pressed="false">+ <svg id="eye-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z" />+ <circle cx="12" cy="12" r="3" />+ </svg>+ </button></div>+ <p class="caps-warn" id="caps-warn">Caps Lock is on</p>+ <p class="field-err" id="password-err" role="alert"></p>- <div id="wallet-panel" class="method-panel" role="tabpanel">- <div class="chain-tabs" role="tablist" aria-label="Wallet chain">- <button type="button" class="chain-tab active" data-chain="evm" role="tab" aria-selected="true" aria-controls="evm-panel">EVM</button>- <button type="button" class="chain-tab" data-chain="solana" role="tab" aria-selected="false" aria-controls="solana-panel">Solana</button>- </div>- <div id="evm-panel" class="chain-panel active" role="tabpanel">- <div id="wallet-mount"></div>- </div>- <div id="solana-panel" class="chain-panel" role="tabpanel">- <div id="solana-wallet-mount"></div>- </div>- <p class="wallet-step-hint" title="Your wallet will prompt twice — once to connect, once to sign.">Wallet prompts to connect, then to sign.</p>+ <div class="remember-row">+ <label><input type="checkbox" id="remember" /> Remember me</label>+ <a href="/forgot-password" class="forgot">Forgot password?</a></div>+ <button id="submit" type="submit">Sign in</button><div class="err" id="err" role="alert" aria-live="polite"></div><p class="foot">No account? <a href="/register">Create one</a></p>@@ -736,42 +701,6 @@const capsWarn = document.getElementById('caps-warn');const pwToggle = document.getElementById('password-toggle');- // ── Method tabs (Email / Wallet) ──- const methodTabs = document.querySelectorAll('.method-tab');- const methodPanels = {- email: document.getElementById('email-panel'),- wallet: document.getElementById('wallet-panel'),- };- let activeMethod = 'email';- const METHOD_KEY = '3dagent:login-method';- function setMethod(name, persist = true) {- if (!methodPanels[name]) return;- activeMethod = name;- methodTabs.forEach((t) => {- const on = t.dataset.method === name;- t.classList.toggle('active', on);- t.setAttribute('aria-selected', on ? 'true' : 'false');- });- Object.entries(methodPanels).forEach(([k, el]) => {- el.classList.toggle('active', k === name);- });- // Toggle required so wallet-tab Enter doesn't trip browser validation.- const emailActive = name === 'email';- emailInput.required = emailActive;- passwordInput.required = emailActive;- if (persist) {- try { localStorage.setItem(METHOD_KEY, name); } catch { /* ignore */ }- }- if (emailActive && !emailInput.value) emailInput.focus();- }- methodTabs.forEach((t) =>- t.addEventListener('click', () => setMethod(t.dataset.method)),- );- try {- const saved = localStorage.getItem(METHOD_KEY);- if (saved === 'wallet') setMethod('wallet', false);- } catch { /* ignore */ }-// ── Wallet chain tabs ──const solanaTab = document.querySelector('.chain-tab[data-chain="solana"]');const hasSolana = !!(window.solana || window.phantom?.solana || window.backpack || window.solflare);@@ -868,7 +797,6 @@// ── Submit ──form.addEventListener('submit', async (e) => {e.preventDefault();- if (activeMethod !== 'email') return;err.style.display = 'none';setFieldError(emailInput, emailErr, '');setFieldError(passwordInput, passwordErr, '');