Skip to content

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.

feat: agent detail page, home dashboard refresh, marketplace + cron fixes, review migration

nirholas53301cfd77a6
diff --git a/api/_lib/migrations/20260527010000_agent_reviews_body_column.sql b/api/_lib/migrations/20260527010000_agent_reviews_body_column.sql
new file mode 100644
index 000000000..5f6dd6dc3
--- /dev/null
+++ b/api/_lib/migrations/20260527010000_agent_reviews_body_column.sql
@@ -0,0 +1,19 @@
+-- Rename agent_reviews.review → body to match the reviews API.
+-- The CREATE TABLE used "review text" but api/marketplace/reviews.js
+-- references the column as "body" throughout. This is the idempotent fix.
+
+DO $$ BEGIN
+ IF NOT EXISTS (
+ SELECT 1 FROM information_schema.columns
+ WHERE table_name = 'agent_reviews' AND column_name = 'body'
+ ) THEN
+ IF EXISTS (
+ SELECT 1 FROM information_schema.columns
+ WHERE table_name = 'agent_reviews' AND column_name = 'review'
+ ) THEN
+ ALTER TABLE agent_reviews RENAME COLUMN review TO body;
+ ELSE
+ ALTER TABLE agent_reviews ADD COLUMN body text;
+ END IF;
+ END IF;
+END $$;
diff --git a/api/cron/[name].js b/api/cron/[name].js
index 88521964c..bc6ab4f0b 100644
--- a/api/cron/[name].js
+++ b/api/cron/[name].js
@@ -2887,16 +2887,33 @@ function ymdUTC(d) { return `${d.getUTCFullYear()}-${String(d.getUTCMonth()+1).
// pending-review queue for the user to approve (auto_publish=false).
async function enqueueTriggerPost(t, text) {
if (t.auto_publish === false) {
+ try {
+ await sql`
+ insert into x_pending_reviews (user_id, trigger_id, agent_id, text)
+ values (${t.user_id}, ${t.id}, ${t.agent_id}, ${text})
+ `;
+ } catch (err) {
+ if (err.code !== '42703') throw err;
+ // agent_id column not yet present — insert without it
+ await sql`
+ insert into x_pending_reviews (user_id, trigger_id, text)
+ values (${t.user_id}, ${t.id}, ${text})
+ `;
+ }
+ return;
+ }
+ try {
await sql`
- insert into x_pending_reviews (user_id, trigger_id, agent_id, text)
- values (${t.user_id}, ${t.id}, ${t.agent_id}, ${text})
+ insert into x_scheduled_posts (user_id, agent_id, text, scheduled_at)
+ values (${t.user_id}, ${t.agent_id}, ${text}, now())
+ `;
+ } catch (err) {
+ if (err.code !== '42703') throw err;
+ await sql`
+ insert into x_scheduled_posts (user_id, text, scheduled_at)
+ values (${t.user_id}, ${text}, now())
`;
- return;
}
- await sql`
- insert into x_scheduled_posts (user_id, agent_id, text, scheduled_at)
- values (${t.user_id}, ${t.agent_id}, ${text}, now())
- `;
}
async function setTriggerState(t, state) {
diff --git a/api/marketplace/[action].js b/api/marketplace/[action].js
index 53ce0c55a..549712f39 100644
--- a/api/marketplace/[action].js
+++ b/api/marketplace/[action].js
@@ -197,7 +197,8 @@ async function handleTheme(req, res) {
LIMIT 8
`;
} catch (err) {
- if (err.code === '42P01') {
+ // 42P01 = table does not exist, 42703 = column does not exist
+ if (err.code === '42P01' || err.code === '42703') {
rows = await sql`
SELECT a.id, a.name, a.description, a.category, a.tags, a.skills,
a.views_count, a.forks_count,
diff --git a/pages/agent-detail.html b/pages/agent-detail.html
index 07d494bd3..2e80391dd 100644
--- a/pages/agent-detail.html
+++ b/pages/agent-detail.html
@@ -291,6 +291,33 @@
<div id="ad-embed-policy"></div>
</section>
+ <section class="ad-card" id="ad-reviews-card" aria-labelledby="ad-reviews-heading">
+ <div class="ad-card-head">
+ <span class="ad-bullet ad-bullet-amber"></span>
+ <h2 id="ad-reviews-heading">REVIEWS</h2>
+ <span class="ad-pill ad-pill-muted" id="ad-reviews-count" aria-live="polite"></span>
+ </div>
+ <div id="ad-reviews-body" aria-live="polite">
+ <div class="ad-reviews-skeleton" aria-hidden="true">
+ <div class="ad-review-skel-row">
+ <div class="ad-review-skel-avatar skeleton"></div>
+ <div class="ad-review-skel-lines">
+ <div class="ad-review-skel-line short skeleton"></div>
+ <div class="ad-review-skel-line long skeleton"></div>
+ <div class="ad-review-skel-line med skeleton"></div>
+ </div>
+ </div>
+ <div class="ad-review-skel-row">
+ <div class="ad-review-skel-avatar skeleton"></div>
+ <div class="ad-review-skel-lines">
+ <div class="ad-review-skel-line short skeleton"></div>
+ <div class="ad-review-skel-line med skeleton"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </section>
+
<details class="ad-card ad-collapse">
<summary>
<span class="ad-bullet ad-bullet-muted"></span>
diff --git a/src/agent-detail.css b/src/agent-detail.css
index f510abeee..1aacd1db8 100644
--- a/src/agent-detail.css
+++ b/src/agent-detail.css
@@ -399,6 +399,298 @@ a { color: inherit; text-decoration: none; }
.ad-resolved.warn { color: #ff8a80; }
.ad-resolved.loading { color: var(--ad-muted); font-style: italic; }
+/* ── Reviews ─────────────────────────────────────────────────────────────── */
+
+.ad-reviews-summary {
+ display: flex;
+ gap: 24px;
+ align-items: center;
+ padding: 16px 0 20px;
+ border-bottom: 1px solid var(--ad-line);
+ margin-bottom: 20px;
+}
+.ad-reviews-score {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ min-width: 80px;
+}
+.ad-reviews-avg {
+ font-size: 40px;
+ font-weight: 700;
+ line-height: 1;
+ letter-spacing: -0.03em;
+}
+.ad-reviews-stars {
+ display: flex;
+ gap: 2px;
+ margin-top: 6px;
+}
+.ad-reviews-total {
+ font-size: 12px;
+ color: var(--ad-muted);
+ margin-top: 4px;
+}
+.ad-reviews-bars {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+}
+.ad-reviews-bar-row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ font-size: 12px;
+}
+.ad-reviews-bar-label {
+ color: var(--ad-muted);
+ min-width: 14px;
+ text-align: right;
+}
+.ad-reviews-bar-track {
+ flex: 1;
+ height: 6px;
+ background: rgba(255,255,255,0.08);
+ border-radius: 3px;
+ overflow: hidden;
+}
+.ad-reviews-bar-fill {
+ height: 100%;
+ background: var(--ad-amber);
+ border-radius: 3px;
+ transition: width 0.4s ease;
+}
+.ad-reviews-bar-count {
+ min-width: 20px;
+ color: var(--ad-muted);
+}
+
+/* star widget */
+.ad-star {
+ font-size: 16px;
+ color: rgba(255,255,255,0.2);
+ transition: color 0.1s;
+ user-select: none;
+}
+.ad-star.filled { color: var(--ad-amber); }
+.ad-star.half { color: var(--ad-amber); }
+
+/* write-review form */
+.ad-review-form {
+ background: var(--ad-bg-2);
+ border: 1px solid var(--ad-line);
+ border-radius: 10px;
+ padding: 16px;
+ margin-bottom: 20px;
+}
+.ad-review-form-title {
+ font-size: 13px;
+ font-weight: 600;
+ margin-bottom: 12px;
+}
+.ad-review-star-picker {
+ display: flex;
+ gap: 4px;
+ margin-bottom: 12px;
+ cursor: pointer;
+}
+.ad-review-star-picker .ad-star {
+ font-size: 24px;
+ cursor: pointer;
+ transition: transform 0.1s, color 0.1s;
+}
+.ad-review-star-picker .ad-star:hover { transform: scale(1.15); }
+.ad-review-textarea {
+ width: 100%;
+ background: var(--ad-bg);
+ border: 1px solid var(--ad-line);
+ color: var(--ad-text);
+ border-radius: 8px;
+ padding: 10px 12px;
+ font-family: inherit;
+ font-size: 13px;
+ resize: vertical;
+ min-height: 80px;
+ box-sizing: border-box;
+ transition: border-color 0.15s;
+}
+.ad-review-textarea:focus { outline: none; border-color: var(--ad-line-2); }
+.ad-review-form-footer {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-top: 10px;
+}
+.ad-review-char-count {
+ font-size: 11px;
+ color: var(--ad-muted);
+}
+.ad-review-form-actions {
+ display: flex;
+ gap: 8px;
+}
+.ad-review-submit {
+ background: #fff;
+ color: #000;
+ border: none;
+ border-radius: 8px;
+ padding: 7px 16px;
+ font-family: inherit;
+ font-size: 13px;
+ font-weight: 600;
+ cursor: pointer;
+ transition: opacity 0.15s;
+}
+.ad-review-submit:disabled { opacity: 0.45; cursor: default; }
+.ad-review-submit:not(:disabled):hover { opacity: 0.88; }
+.ad-review-delete {
+ background: transparent;
+ color: var(--ad-muted);
+ border: 1px solid var(--ad-line);
+ border-radius: 8px;
+ padding: 7px 12px;
+ font-family: inherit;
+ font-size: 13px;
+ cursor: pointer;
+}
+.ad-review-delete:hover { color: #ff8a80; border-color: #ff8a80; }
+
+/* review list */
+.ad-review-item {
+ padding: 16px 0;
+ border-bottom: 1px solid var(--ad-line);
+}
+.ad-review-item:last-child { border-bottom: none; }
+.ad-review-item-head {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ margin-bottom: 8px;
+}
+.ad-review-avatar {
+ width: 32px;
+ height: 32px;
+ border-radius: 50%;
+ object-fit: cover;
+ background: var(--ad-bg-2);
+ border: 1px solid var(--ad-line);
+ flex-shrink: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 13px;
+ font-weight: 600;
+}
+.ad-review-meta {
+ flex: 1;
+ min-width: 0;
+}
+.ad-review-author {
+ font-size: 13px;
+ font-weight: 600;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.ad-review-date {
+ font-size: 11px;
+ color: var(--ad-muted);
+}
+.ad-review-item-stars {
+ display: flex;
+ gap: 2px;
+}
+.ad-review-item-stars .ad-star { font-size: 13px; }
+.ad-review-body {
+ font-size: 13px;
+ color: var(--ad-text);
+ line-height: 1.55;
+ margin-top: 4px;
+ white-space: pre-wrap;
+ word-break: break-word;
+}
+.ad-review-mine-actions {
+ display: flex;
+ gap: 8px;
+ margin-top: 8px;
+}
+.ad-review-mine-btn {
+ background: none;
+ border: 1px solid var(--ad-line);
+ color: var(--ad-muted);
+ border-radius: 6px;
+ padding: 3px 10px;
+ font-size: 11px;
+ font-family: inherit;
+ cursor: pointer;
+}
+.ad-review-mine-btn:hover { color: var(--ad-text); border-color: var(--ad-line-2); }
+.ad-review-mine-btn.danger:hover { color: #ff8a80; border-color: #ff8a80; }
+
+.ad-reviews-empty {
+ padding: 28px 0;
+ text-align: center;
+ color: var(--ad-muted);
+ font-size: 14px;
+}
+.ad-reviews-empty strong {
+ display: block;
+ font-size: 16px;
+ margin-bottom: 6px;
+ color: var(--ad-text);
+}
+.ad-reviews-error {
+ padding: 12px;
+ color: #ff8a80;
+ font-size: 13px;
+ text-align: center;
+}
+.ad-reviews-signin-prompt {
+ background: var(--ad-bg-2);
+ border: 1px solid var(--ad-line);
+ border-radius: 10px;
+ padding: 14px 16px;
+ font-size: 13px;
+ color: var(--ad-muted);
+ margin-bottom: 20px;
+ text-align: center;
+}
+.ad-reviews-signin-prompt a {
+ color: var(--ad-violet);
+ text-decoration: underline;
+}
+
+/* skeleton shimmer for reviews */
+.ad-reviews-skeleton {
+ padding: 12px 0;
+}
+.ad-review-skel-row {
+ display: flex;
+ gap: 10px;
+ align-items: flex-start;
+ margin-bottom: 20px;
+}
+.ad-review-skel-avatar {
+ width: 32px;
+ height: 32px;
+ border-radius: 50%;
+ flex-shrink: 0;
+}
+.ad-review-skel-lines {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+.ad-review-skel-line {
+ height: 12px;
+ border-radius: 6px;
+}
+.ad-review-skel-line.short { width: 40%; }
+.ad-review-skel-line.med { width: 70%; }
+.ad-review-skel-line.long { width: 90%; }
+
.ad-modal-footer {
display: flex;
justify-content: flex-end;
diff --git a/src/dashboard-next/pages/home.js b/src/dashboard-next/pages/home.js
index dc05f5ef7..70a894218 100644
--- a/src/dashboard-next/pages/home.js
+++ b/src/dashboard-next/pages/home.js
@@ -89,6 +89,15 @@ const STATE = {
if (STATE.pollHandle) clearInterval(STATE.pollHandle);
if (STATE.relTimeHandle) clearInterval(STATE.relTimeHandle);
});
+
+ main.addEventListener('click', (e) => {
+ const link = e.target.closest('a[href]');
+ if (!link) return;
+ const href = link.getAttribute('href');
+ if (href && href.startsWith('/') && !href.startsWith('//')) {
+ trackVisit(href.split('?')[0].split('#')[0]);
+ }
+ });
})().catch((err) => {
if (err?.message === 'redirecting') return;
const main = document.querySelector('.dn-main-inner') || document.body;
@@ -113,15 +122,17 @@ function renderSkeletons(main) {
<div class="dn-skeleton" style="height:28px;width:100px;margin-bottom:10px"></div>
<div class="dn-skeleton" style="height:36px;width:100%"></div></div>
`).join('');
- main.querySelector('[data-slot="quick"]').innerHTML = Array.from({ length: 4 }, () => `
- <div class="dn-panel" style="display:flex;align-items:center;gap:14px;padding:16px">
- <div class="dn-skeleton" style="width:40px;height:40px;border-radius:10px;flex-shrink:0"></div>
- <div style="flex:1;min-width:0">
- <div class="dn-skeleton" style="height:13px;width:60%;margin-bottom:6px"></div>
- <div class="dn-skeleton" style="height:11px;width:40%"></div>
+ main.querySelector('[data-slot="quick"]').innerHTML = `
+ <div style="margin-bottom:12px"><div class="dn-skeleton" style="height:14px;width:90px;margin-bottom:6px"></div><div class="dn-skeleton" style="height:11px;width:200px"></div></div>
+ <div style="display:grid;grid-template-columns:repeat(2,1fr);gap:10px">${Array.from({ length: 6 }, () => `
+ <div class="dn-panel" style="display:flex;align-items:center;gap:12px;padding:14px">
+ <div class="dn-skeleton" style="width:36px;height:36px;border-radius:10px;flex-shrink:0"></div>
+ <div style="flex:1;min-width:0">
+ <div class="dn-skeleton" style="height:13px;width:65%;margin-bottom:5px"></div>
+ <div class="dn-skeleton" style="height:11px;width:45%"></div>
+ </div>
</div>
- </div>
- `).join('');
+ `).join('')}</div>`;
main.querySelector('[data-slot="activity"]').innerHTML = `
<div class="dn-panel">
<div class="dn-panel-title">Recent activity</div>
@@ -466,58 +477,83 @@ function renderOnboarding(host, { avatars, agents, widgets }) {
});
}
-// ── Quick actions ─────────────────────────────────────────────────────────
+// ── Shortcuts (quick actions) ─────────────────────────────────────────────
+
+function categoryFor(href) {
+ for (const s of DIRECTORY) {
+ if (s.items.some((i) => i.href === href)) return s.group;
+ }
+ return 'Account & Settings';
+}
function renderQuickActions(host, { avatars = [], agents = [] } = {}) {
const firstAvatar = avatars[0];
const firstAgent = agents[0];
+ const pins = getPins();
- const actions = [];
-
+ const defaults = [];
if (firstAvatar) {
- actions.push({
- href: `/agent-next?id=${encodeURIComponent(firstAvatar.id)}`,
- title: 'View live agent page',
- sub: 'See how visitors experience your agent',
- icon: '▶',
- });
+ defaults.push({ href: `/agent-next?id=${encodeURIComponent(firstAvatar.id)}`, title: 'View live agent page', sub: 'See how visitors experience your agent', iconKey: '/dashboard/agents', cat: 'Agents & Identity' });
} else {
- actions.push({ href: '/create', title: 'Create avatar from selfie', sub: 'Snap → 3D agent in 60s', icon: '+' });
+ defaults.push({ href: '/create', title: 'Create avatar from selfie', sub: 'Snap a photo, get a 3D agent in 60 seconds', iconKey: '/create', cat: 'Create & Build' });
}
-
if (firstAgent) {
- actions.push({
- href: `/app?agent=${encodeURIComponent(firstAgent.id)}`,
- title: 'Open 3D studio',
- sub: 'Edit, animate, and customize in 3D',
- icon: '◇',
- });
+ defaults.push({ href: `/app?agent=${encodeURIComponent(firstAgent.id)}`, title: 'Open 3D studio', sub: 'Edit, animate, and customize in 3D', iconKey: '/app', cat: '3D & Immersive' });
} else {
- actions.push({ href: '/dashboard/agents', title: 'Create an agent', sub: 'On-chain identity with wallet and skills', icon: '⬡' });
+ defaults.push({ href: '/dashboard/agents', title: 'Create an agent', sub: 'On-chain identity with wallet and skills', iconKey: '/dashboard/agents', cat: 'Agents & Identity' });
}
-
const repHref = (firstAvatar?.owner_wallet || firstAvatar?.owner_address)
? `/reputation?address=${encodeURIComponent(firstAvatar.owner_wallet || firstAvatar.owner_address)}`
: '/reputation';
-
- actions.push(
- { href: '/gallery-picker', title: 'Browse avatar gallery', sub: 'Explore public 3D avatars', icon: '▣' },
- { href: '/dashboard/widgets', title: 'Embed an agent', sub: 'Drop-in widget for any site', icon: '◧' },
- { href: '/voice', title: 'Voice Lab', sub: 'Clone your voice for avatars and agents', icon: '◉' },
- { href: repHref, title: 'Reputation', sub: 'On-chain reviews and attestations for your agent', icon: '★' },
- { href: '/dashboard/api', title: 'Open API keys', sub: 'REST + MCP for your agents', icon: '⌘' },
- { href: '/brain', title: 'Brain — Persona + Playground', sub: 'Build a persona, compare models, test your agent voice', icon: '◎' },
+ defaults.push(
+ { href: '/gallery-picker', title: 'Browse avatar gallery', sub: 'Explore public 3D avatars', iconKey: '/gallery-picker', cat: 'Create & Build' },
+ { href: '/dashboard/widgets', title: 'Embed an agent', sub: 'Drop-in chat widget for any site', iconKey: '/dashboard/widgets', cat: 'Distribute & Embed' },
+ { href: '/voice', title: 'Voice Lab', sub: 'Clone your voice for avatars', iconKey: '/voice', cat: 'Create & Build' },
+ { href: repHref, title: 'Reputation', sub: 'On-chain reviews and attestations', iconKey: '/reputation', cat: 'Agents & Identity' },
+ { href: '/dashboard/api', title: 'API keys', sub: 'REST + MCP for your agents', iconKey: '/dashboard/api', cat: 'Distribute & Embed' },
+ { href: '/brain', title: 'Brain', sub: 'Persona builder and model playground', iconKey: '/brain', cat: 'Create & Build' },
);
- host.innerHTML = actions.map((a) => `
- <a class="dn-panel dnx-quick-card" href="${a.href}">
- <div class="dnx-quick-icon">${a.icon}</div>
- <div>
- <div class="dn-panel-title" style="margin:0 0 2px">${esc(a.title)}</div>
- <div class="dn-panel-sub" style="margin:0">${esc(a.sub)}</div>
- </div>
- </a>
- `).join('');
+ const used = new Set();
+ const actions = [];
+ for (const href of pins) {
+ if (actions.length >= 8) break;
+ const item = lookupItem(href);
+ if (!item) continue;
+ actions.push({ href: item.href, title: item.title, sub: item.sub, iconKey: item.href, cat: categoryFor(item.href), pinned: true });
+ used.add(item.href);
+ }
+ for (const d of defaults) {
+ if (actions.length >= 8) break;
+ const base = d.href.split('?')[0];
+ if (used.has(base) || used.has(d.href)) continue;
+ actions.push(d);
+ used.add(d.href);
+ }
+
+ const hasPins = pins.length > 0;
+
+ host.innerHTML = `
+ <div class="dnx-shortcuts-head">
+ <h2 class="dnx-shortcuts-title">Shortcuts</h2>
+ <p class="dnx-shortcuts-sub">${hasPins ? `${pins.length} pinned` : 'Pin pages from the directory below to customize'}</p>
+ </div>
+ <div class="dnx-shortcuts-grid" role="list">
+ ${actions.map((a) => {
+ const icon = DIR_ICONS[a.iconKey] || DIR_ICONS['/create'] || '';
+ const cc = CATEGORY_COLORS[a.cat] || CATEGORY_COLORS['Account & Settings'];
+ return `
+ <a class="dn-panel dnx-quick-card" href="${a.href}" role="listitem">
+ <span class="dnx-quick-icon" style="background:rgba(${cc.accent},0.12);color:${cc.label}" aria-hidden="true">${icon}</span>
+ <div class="dnx-quick-text">
+ <span class="dnx-quick-title">${esc(a.title)}</span>
+ <span class="dnx-quick-sub">${esc(a.sub)}</span>
+ </div>
+ ${a.pinned ? '<span class="dnx-quick-pin-badge" aria-hidden="true"><svg viewBox="0 0 14 14" width="10" height="10" fill="currentColor"><path d="M5 1l1 4-3 2v1h4.5L8 13l.5-5H13v-1l-3-2 1-4z"/></svg></span>' : ''}
+ </a>`;
+ }).join('')}
+ </div>
+ `;
}
// ── Feature directory ─────────────────────────────────────────────────────
@@ -693,11 +729,17 @@ function lookupItem(href) {
}
function trackVisit(href) {
- const recents = getRecents().filter((r) => r !== href);
- recents.unshift(href);
+ const base = href.split('?')[0].split('#')[0];
+ const recents = getRecents().filter((r) => r !== base);
+ recents.unshift(base);
localStorage.setItem(RECENTS_KEY, JSON.stringify(recents.slice(0, 20)));
}
+function debounce(fn, ms) {
+ let id;
+ return (...args) => { clearTimeout(id); id = setTimeout(() => fn(...args), ms); };
+}
+
function renderDirectory(host) {
const DIR_COLLAPSED_KEY = 'twx_dir_collapsed';
const collapsed = localStorage.getItem(DIR_COLLAPSED_KEY) === '1';
@@ -767,9 +809,10 @@ function renderDirectory(host) {
<svg viewBox="0 0 12 12" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 4.5l3 3 3-3"/></svg>
</span>
</button>
- <div class="dnx-dir-search-wrap">
+ <div class="dnx-dir-search-wrap" role="search" aria-label="Filter pages">
<svg class="dnx-dir-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="4.5"/><path d="M13 13l-3-3"/></svg>
- <input type="text" class="dnx-dir-search" placeholder="Filter pages..." data-action="dir-search" autocomplete="off" spellcheck="false" />
+ <input type="text" class="dnx-dir-search" placeholder="Filter pages..." data-action="dir-search" autocomplete="off" spellcheck="false" aria-label="Filter pages" aria-controls="dnx-dir-body" />
+ <span class="dnx-dir-search-count" aria-live="polite" data-slot="search-count"></span>
</div>
</div>
<div class="dnx-dir-body${collapsed ? ' is-collapsed' : ''}" data-slot="dir-body">
@@ -799,7 +842,9 @@ function renderDirectory(host) {
});
const searchInput = host.querySelector('[data-action="dir-search"]');
- searchInput.addEventListener('input', () => {
+ const searchCount = host.querySelector('[data-slot="search-count"]');
+
+ function runFilter() {
const q = searchInput.value.trim().toLowerCase();
const body = host.querySelector('[data-slot="dir-body"]');
const items = body.querySelectorAll('.dnx-dir-item');
@@ -808,9 +853,10 @@ function renderDirectory(host) {
let visibleCount = 0;
if (!q) {
- items.forEach((el) => el.style.display = '');
+ items.forEach((el) => { el.style.display = ''; el.style.opacity = ''; });
sections.forEach((el) => el.style.display = '');
noResults.style.display = 'none';
+ searchCount.textContent = '';
if (body.classList.contains('is-collapsed')) {
body.classList.remove('is-collapsed');
host.querySelector('[data-action="dir-toggle"]').setAttribute('aria-expanded', 'true');
@@ -838,6 +884,18 @@ function renderDirectory(host) {
});
noResults.style.display = visibleCount === 0 ? '' : 'none';
+ searchCount.textContent = q ? `${visibleCount} result${visibleCount !== 1 ? 's' : ''}` : '';
+ }
+
+ const debouncedFilter = debounce(runFilter, 120);
+ searchInput.addEventListener('input', debouncedFilter);
+
+ searchInput.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape') {
+ searchInput.value = '';
+ runFilter();
+ searchInput.blur();
+ }
});
host.addEventListener('click', (e) => {
@@ -1046,35 +1104,55 @@ function injectStyles() {
.dnx-kpi-spark { height: 38px; }
.dnx-kpi-empty { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
- .dnx-quick {
+ /* ── Shortcuts ── */
+ .dnx-quick { display: flex; flex-direction: column; }
+ .dnx-shortcuts-head { margin-bottom: 12px; }
+ .dnx-shortcuts-title {
+ font-size: 15px; font-weight: 600; color: var(--nxt-ink);
+ margin: 0 0 2px; line-height: 1.3;
+ }
+ .dnx-shortcuts-sub {
+ font-size: 12.5px; color: var(--nxt-ink-fade); margin: 0;
+ }
+ .dnx-shortcuts-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
- gap: 14px;
+ gap: 10px;
}
- @media (max-width: 620px) { .dnx-quick { grid-template-columns: 1fr; } }
+ @media (max-width: 620px) { .dnx-shortcuts-grid { grid-template-columns: 1fr; } }
.dnx-quick-card {
- display: flex;
- align-items: center;
- gap: 14px;
- padding: 16px;
- cursor: pointer;
- transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
+ display: flex; align-items: center; gap: 12px;
+ padding: 13px 14px; cursor: pointer; position: relative;
+ transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
+ }
+ .dnx-quick-card:hover {
+ border-color: var(--nxt-stroke-strong);
+ transform: translateY(-2px);
+ box-shadow: 0 6px 20px -8px rgba(0,0,0,0.3);
+ }
+ .dnx-quick-card:focus-visible {
+ outline: 2px solid var(--nxt-ink-dim);
+ outline-offset: 2px;
}
- .dnx-quick-card:hover { border-color: var(--nxt-stroke-strong); transform: translateY(-2px); }
.dnx-quick-icon {
- width: 40px; height: 40px; border-radius: 10px;
- background: rgba(255,255,255,0.05);
- border: 1px solid var(--nxt-stroke);
- color: var(--nxt-ink-dim);
- display: grid; place-items: center;
- font-size: 18px; font-weight: 600;
- flex-shrink: 0;
- transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
+ width: 36px; height: 36px; border-radius: 10px;
+ display: grid; place-items: center; flex-shrink: 0;
+ transition: transform 0.14s ease;
}
- .dnx-quick-card:hover .dnx-quick-icon {
- background: rgba(255,255,255,0.08);
- border-color: var(--nxt-stroke-strong);
- color: var(--nxt-ink);
+ .dnx-quick-icon svg { width: 18px; height: 18px; }
+ .dnx-quick-card:hover .dnx-quick-icon { transform: scale(1.1); }
+ .dnx-quick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
+ .dnx-quick-title {
+ font-size: 13.5px; font-weight: 550; color: var(--nxt-ink);
+ line-height: 1.3;
+ }
+ .dnx-quick-sub {
+ font-size: 12px; color: var(--nxt-ink-fade);
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
+ }
+ .dnx-quick-pin-badge {
+ position: absolute; top: 7px; right: 7px;
+ color: #fbbf24; opacity: 0.5;
}
.dnx-activity { min-width: 0; position: sticky; top: calc(var(--dn-topbar-h) + 16px); }
@@ -1093,6 +1171,7 @@ function injectStyles() {
}
.dnx-activity-list li:first-child .dnx-activity-row { border-top: none; }
.dnx-activity-row:hover { background: rgba(255,255,255,0.04); color: var(--nxt-ink); }
+ .dnx-activity-row:focus-visible { outline: 2px solid var(--nxt-ink-dim); outline-offset: -2px; border-radius: 8px; }
.dnx-activity-icon { color: var(--nxt-ink-fade); display: inline-grid; place-items: center; }
.dnx-activity-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dnx-activity-time { color: var(--nxt-ink-fade); font-size: 12px; font-variant-numeric: tabular-nums; }
@@ -1194,6 +1273,11 @@ function injectStyles() {
border-color: var(--nxt-stroke-strong);
background: rgba(255,255,255,0.06);
}
+ .dnx-dir-search-count {
+ position: absolute; right: 32px; top: 50%; transform: translateY(calc(-50% - 6px));
+ font-size: 11px; color: var(--nxt-ink-fade);
+ pointer-events: none; font-variant-numeric: tabular-nums;
+ }
.dnx-dir-body {
padding: 0 20px 20px;
display: flex; flex-direction: column; gap: 20px;
@@ -1232,6 +1316,10 @@ function injectStyles() {
background: rgba(255,255,255,0.04);
transform: translateY(-1px);
}
+ .dnx-dir-item:focus-visible {
+ outline: 2px solid var(--nxt-ink-dim);
+ outline-offset: 2px;
+ }
.dnx-dir-item-row {
display: flex; align-items: flex-start; gap: 10px;
}