openvibers/openvibe.inventory Commits
Inventory: the home's kind count matches the kinds it shows (said 6 over 4 cards) (#40)
Changes
@@@ -96,7 +96,9 @@ function createPageRoutes(ctx) {body: html`${raw(hero)}${raw(showcase.features({title: 'What you can collect',-- lede: `${plural(defs.length, 'item', 'items')} in ${plural(kinds.length, 'kind', 'kinds')} today. Each kind knows where it shows, so a new kind is all it takes for a new site or game to join.`,++ // The count is of the kinds shown: an empty kind (no issuer has defined anything in it yet) is neither a card++ // nor counted, so "in 4 kinds" sits over four cards.++ lede: `${plural(defs.length, 'item', 'items')} in ${plural(kinds.filter((k) => (byKind.get(k.id) || []).length).length, 'kind', 'kinds')} today. Each kind knows where it shows, so a new kind is all it takes for a new site or game to join.`,// Kinds that have items, the biggest first; an empty kind waits until an issuer defines something in it.items: kinds.filter((k) => (byKind.get(k.id) || []).length).sort((a, b) => byKind.get(b.id).length - byKind.get(a.id).length).map((k) => ({ icon: KIND_ICON[k.id] || 'ov:ov', title: `${k.name} · ${(byKind.get(k.id) || []).length}`, text: `${k.description || ''} Shows in ${k.surfaces.map((s) => surfaceLabel(s.surface)).join(', ')}.`, href: `/items?kind=${encodeURIComponent(k.id)}` })),}))}@@@ -63,6 +63,10 @@ const BOOST = /<script src="\/shared\/boost\.js\?v=[0-9a-f]{12}" data-main="#maiassert.ok(r.text.includes('OpenVibe.Inventory'), 'the service name is on the page');assert.ok(r.text.includes('Your items, on every OpenVibe site.'), 'the tagline is on the page');assert.ok(r.text.includes('/shared/showcase.css'), 'the showcase stylesheet');++ // "N items in K kinds" counts the kinds it shows: an empty kind is neither a card nor counted.++ const collect = (/<section class="sc-sec"[^>]*aria-labelledby="sc-what-you-can-collect"[\s\S]*?<\/section>/.exec(r.text) || [''])[0];++ const said = /in (\d+) kinds? today/.exec(collect);++ if (said) assert.strictEqual((collect.match(/class="sc-card"/g) || []).length, Number(said[1]), collect.slice(0, 400));assert.ok(!r.text.includes('/home/') && !r.text.includes('/mnt/'), 'no local filesystem path on the page');});
@@ -96,7 +96,9 @@ function createPageRoutes(ctx) {
@@ -96,7 +96,9 @@ function createPageRoutes(ctx) {
body: html`${raw(hero)}
body: html`${raw(hero)}
${raw(showcase.features({
${raw(showcase.features({
title: 'What you can collect',
title: 'What you can collect',
- lede: `${plural(defs.length, 'item', 'items')} in ${plural(kinds.length, 'kind', 'kinds')} today. Each kind knows where it shows, so a new kind is all it takes for a new site or game to join.`,
+ // The count is of the kinds shown: an empty kind (no issuer has defined anything in it yet) is neither a card
+ // nor counted, so "in 4 kinds" sits over four cards.
+ lede: `${plural(defs.length, 'item', 'items')} in ${plural(kinds.filter((k) => (byKind.get(k.id) || []).length).length, 'kind', 'kinds')} today. Each kind knows where it shows, so a new kind is all it takes for a new site or game to join.`,
// Kinds that have items, the biggest first; an empty kind waits until an issuer defines something in it.
// Kinds that have items, the biggest first; an empty kind waits until an issuer defines something in it.
items: kinds.filter((k) => (byKind.get(k.id) || []).length).sort((a, b) => byKind.get(b.id).length - byKind.get(a.id).length).map((k) => ({ icon: KIND_ICON[k.id] || 'ov:ov', title: `${k.name} · ${(byKind.get(k.id) || []).length}`, text: `${k.description || ''} Shows in ${k.surfaces.map((s) => surfaceLabel(s.surface)).join(', ')}.`, href: `/items?kind=${encodeURIComponent(k.id)}` })),
items: kinds.filter((k) => (byKind.get(k.id) || []).length).sort((a, b) => byKind.get(b.id).length - byKind.get(a.id).length).map((k) => ({ icon: KIND_ICON[k.id] || 'ov:ov', title: `${k.name} · ${(byKind.get(k.id) || []).length}`, text: `${k.description || ''} Shows in ${k.surfaces.map((s) => surfaceLabel(s.surface)).join(', ')}.`, href: `/items?kind=${encodeURIComponent(k.id)}` })),
}))}
}))}
@@ -63,6 +63,10 @@ const BOOST = /<script src="\/shared\/boost\.js\?v=[0-9a-f]{12}" data-main="#mai
@@ -63,6 +63,10 @@ const BOOST = /<script src="\/shared\/boost\.js\?v=[0-9a-f]{12}" data-main="#mai
assert.ok(r.text.includes('OpenVibe.Inventory'), 'the service name is on the page');
assert.ok(r.text.includes('OpenVibe.Inventory'), 'the service name is on the page');
assert.ok(r.text.includes('Your items, on every OpenVibe site.'), 'the tagline is on the page');
assert.ok(r.text.includes('Your items, on every OpenVibe site.'), 'the tagline is on the page');
assert.ok(r.text.includes('/shared/showcase.css'), 'the showcase stylesheet');
assert.ok(r.text.includes('/shared/showcase.css'), 'the showcase stylesheet');
+ // "N items in K kinds" counts the kinds it shows: an empty kind is neither a card nor counted.
+ const collect = (/<section class="sc-sec"[^>]*aria-labelledby="sc-what-you-can-collect"[\s\S]*?<\/section>/.exec(r.text) || [''])[0];
+ const said = /in (\d+) kinds? today/.exec(collect);
+ if (said) assert.strictEqual((collect.match(/class="sc-card"/g) || []).length, Number(said[1]), collect.slice(0, 400));
assert.ok(!r.text.includes('/home/') && !r.text.includes('/mnt/'), 'no local filesystem path on the page');
assert.ok(!r.text.includes('/home/') && !r.text.includes('/mnt/'), 'no local filesystem path on the page');
});
});