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.

refactor(dashboard): read skill labels from the shared module

nirholas738a15961a46
diff --git a/src/dashboard-next/pages/monetize.js b/src/dashboard-next/pages/monetize.js
index a2e6f4d7d..3c068eb60 100644
--- a/src/dashboard-next/pages/monetize.js
+++ b/src/dashboard-next/pages/monetize.js
@@ -7,6 +7,7 @@
import { mountShell } from '../shell.js';
import { requireUser, get, post, put, del, esc, relTime, formatUsdc, ApiError } from '../api.js';
import { errorStateHTML, ensureStateKitStyles } from '../../shared/state-kit.js';
+import { skillLabel } from '../../shared/skill-label.js';
const USDC_MINTS = {
solana: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
@@ -902,7 +903,7 @@ function renderSkillLegend(bySkill) {
const pct = ((Number(r.net_total || 0) / total) * 100).toFixed(0);
return `<span style="display:inline-flex;align-items:center;gap:7px">
<span style="width:9px;height:9px;border-radius:2px;background:${swatches[i % swatches.length]}"></span>
- <span style="color:var(--nxt-ink)">${esc(humanizeSkill(r.skill))}</span>
+ <span style="color:var(--nxt-ink)">${esc(revenueSourceLabel(r.skill))}</span>
<span style="color:var(--nxt-ink-fade)">${esc(formatUsdc(r.net_total))} · ${pct}%</span>
</span>`;
})
@@ -928,16 +929,19 @@ function formatUsd(amount) {
return n.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
}
-function humanizeSkill(skill) {
- if (!skill) return 'Other';
- const map = {
- 'subscription': 'Subscriptions',
- 'api': 'API calls',
- 'tip': 'Tips',
- 'skill_unlock': 'Skill unlocks',
- 'token_royalty': 'Token royalties',
+// The revenue breakdown mixes platform revenue KINDS with real skill names in
+// one column, so the named kinds keep their own plural labels and anything else
+// falls through to the shared skill formatter (which was not applied here
+// before, so a skill named `nft-lookup` rendered as its raw slug).
+function revenueSourceLabel(source) {
+ const kinds = {
+ subscription: 'Subscriptions',
+ api: 'API calls',
+ tip: 'Tips',
+ skill_unlock: 'Skill unlocks',
+ token_royalty: 'Token royalties',
};
- return map[skill] || skill.replace(/_/g, ' ');
+ return kinds[source] || skillLabel(source, 'Other');
}
// -- Recent payments --
diff --git a/src/dashboard-next/pages/transactions.js b/src/dashboard-next/pages/transactions.js
index 108131d5c..957837bdb 100644
--- a/src/dashboard-next/pages/transactions.js
+++ b/src/dashboard-next/pages/transactions.js
@@ -12,6 +12,7 @@
import { mountShell } from '../shell.js';
import { requireUser, get, esc, relTime, ApiError } from '../api.js';
import { errorStateHTML, emptyStateHTML, ensureStateKitStyles } from '../../shared/state-kit.js';
+import { skillLabel } from '../../shared/skill-label.js';
const FETCH_LIMIT = 200; // endpoint hard cap; we paginate the rest client-side
const PAGE_SIZE = 25;
@@ -193,7 +194,7 @@ function rowHtml(r) {
const agentName = r.agent_name ? esc(r.agent_name) : 'Unknown agent';
const agentCell = r.agent_id && r.agent_name
- ? `<a class="tx-agent" href="/agent/${encodeURIComponent(r.agent_id)}">${agentName}</a>`
+ ? `<a class="tx-agent" href="/agents/${encodeURIComponent(r.agent_id)}">${agentName}</a>`
: `<span class="tx-agent tx-agent--muted">${agentName}</span>`;
// Buyer pays out (−), seller takes home (+). Sellers also see gross + fee.
@@ -210,7 +211,7 @@ function rowHtml(r) {
</td>
<td>${typeTag}</td>
<td>
- <div class="tx-skill">${esc(humanizeSkill(r.skill))}</div>
+ <div class="tx-skill">${esc(skillLabel(r.skill))}</div>
<div class="tx-sub">${agentCell}${r.skill_nft_mint ? ' · <span class="tx-nft">NFT</span>' : ''}</div>
</td>
<td style="text-align:right;white-space:nowrap">${amountCell}</td>
@@ -329,11 +330,6 @@ function formatDate(iso) {
return d.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' });
}
-function humanizeSkill(skill) {
- if (!skill) return 'Skill';
- return String(skill).replace(/[_-]+/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
-}
-
// ── Skeletons ─────────────────────────────────────────────────────────────────
function summarySkeleton() {