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: marketplace gallery updates with tests

nirholas5ad799de62ca
diff --git a/src/marketplace-gallery.js b/src/marketplace-gallery.js
index cbe3100d7..5cd1c30b5 100644
--- a/src/marketplace-gallery.js
+++ b/src/marketplace-gallery.js
@@ -347,7 +347,12 @@ export function createMarketplaceGallery({ scene, getLocalPosition }) {
labelTex.colorSpace = SRGBColorSpace;
const label = new Mesh(
new PlaneGeometry(1.7, 0.58),
- new MeshBasicMaterial({ map: labelTex, transparent: true, toneMapped: false, side: DoubleSide }),
+ new MeshBasicMaterial({
+ map: labelTex,
+ transparent: true,
+ toneMapped: false,
+ side: DoubleSide,
+ }),
);
label.position.set(0, 3.5, 0);
label.rotation.y = faceYaw;
@@ -355,7 +360,12 @@ export function createMarketplaceGallery({ scene, getLocalPosition }) {
const ring = new Mesh(
new RingGeometry(0.74, 0.92, 40),
- new MeshBasicMaterial({ color: 0xffffff, transparent: true, opacity: 0.9, side: DoubleSide }),
+ new MeshBasicMaterial({
+ color: 0xffffff,
+ transparent: true,
+ opacity: 0.9,
+ side: DoubleSide,
+ }),
);
ring.rotation.x = -Math.PI / 2;
ring.position.y = 0.05;
@@ -475,9 +485,7 @@ export function createMarketplaceGallery({ scene, getLocalPosition }) {
}
function activeSources() {
- return filter === 'all'
- ? ['agent', 'avatar', 'skill']
- : [filter];
+ return filter === 'all' ? ['agent', 'avatar', 'skill'] : [filter];
}
function allDone() {
@@ -506,7 +514,7 @@ export function createMarketplaceGallery({ scene, getLocalPosition }) {
}
loadError = false;
hideToast();
- } catch (err) {
+ } catch {
loadError = true;
showToast(`Couldn't load listings`, 'Retry', () => {
loadError = false;
@@ -810,7 +818,10 @@ export function createMarketplaceGallery({ scene, getLocalPosition }) {
}
if (listing.uses) {
const c = fmtCount(listing.uses.count);
- if (c) stats.push(`<span class="mwg-panel-stat"><b>${c}</b> ${escapeHtml(listing.uses.label)}</span>`);
+ if (c)
+ stats.push(
+ `<span class="mwg-panel-stat"><b>${c}</b> ${escapeHtml(listing.uses.label)}</span>`,
+ );
}
const statsRow = stats.length ? `<div class="mwg-panel-stats">${stats.join('')}</div>` : '';
@@ -857,7 +868,9 @@ export function createMarketplaceGallery({ scene, getLocalPosition }) {
e.preventDefault();
navigateActive();
});
- panel.querySelector('.mwg-panel-share')?.addEventListener('click', (e) => shareListing(e.currentTarget, listing));
+ panel
+ .querySelector('.mwg-panel-share')
+ ?.addEventListener('click', (e) => shareListing(e.currentTarget, listing));
panel.setAttribute('data-show', '1');
prompt.querySelector('.mwg-prompt-text').textContent = listing.name;
prompt.setAttribute('data-show', '1');
@@ -937,7 +950,8 @@ export function createMarketplaceGallery({ scene, getLocalPosition }) {
async function setFilter(next) {
if (next === filter) return;
filter = next;
- for (const b of chips.children) b.setAttribute('aria-pressed', String(b.dataset.filter === filter));
+ for (const b of chips.children)
+ b.setAttribute('aria-pressed', String(b.dataset.filter === filter));
syncUrl();
resetStream();
await loadPage();
@@ -989,8 +1003,9 @@ export function createMarketplaceGallery({ scene, getLocalPosition }) {
}
function escapeHtml(s) {
- return String(s ?? '').replace(/[&<>"']/g, (c) =>
- ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]),
+ return String(s ?? '').replace(
+ /[&<>"']/g,
+ (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c],
);
}
function escapeAttr(s) {
diff --git a/tests/marketplace-gallery.test.js b/tests/marketplace-gallery.test.js
index da86968d1..4ba614799 100644
--- a/tests/marketplace-gallery.test.js
+++ b/tests/marketplace-gallery.test.js
@@ -187,7 +187,11 @@ describe('normalizeSkill', () => {
describe('interleave', () => {
it('round-robins across lanes so types alternate', () => {
expect(interleave([['a1', 'a2'], ['b1', 'b2'], ['c1']])).toEqual([
- 'a1', 'b1', 'c1', 'a2', 'b2',
+ 'a1',
+ 'b1',
+ 'c1',
+ 'a2',
+ 'b2',
]);
});