openvibers/openvibe.bot Commits

/robots' Have a robot? card offers the blank microSD card path too (#154)

OP OpenVibers committed 20 days ago · 32d608d464 · 2 files, +3 −2

Changes

ddiff --git a/server/web/directory.js b/server/web/directory.js
iindex 6e3b487..4a6db44 100644
---- a/server/web/directory.js
++++ b/server/web/directory.js
@@@ -147,8 +147,8 @@ const DEMO_CARD = '<li class="dir-card"><a class="dir-card-link" href="/try"><sp
// ── GET /robots ─────────────────────────────────────────────────────────────────────────────────────
function renderDirectory({ config, listed = [], mine = null, models = [], signedIn = false }) {
const yours = !signedIn ? `<section class="dir-sec dir-cta"><h2>Have a robot?</h2>
--<p class="muted">Sign in to add it and pair it with one pasted command, or drive a simulated rover first, no account needed.</p>
--<p class="dir-actions">${link('/try', 'Try the panel', 'dir-btn dir-primary')} ${link('/auth/login?next=%2Frobots%2Fnew', 'Sign in and add a robot', 'dir-btn')}</p></section>`
++<p class="muted">Sign in to add it and pair it with one pasted command. A Raspberry Pi robot can start from a blank microSD card, with nothing to type on the robot. Or drive a simulated rover first, no account needed.</p>
++<p class="dir-actions">${link('/try', 'Try the panel', 'dir-btn dir-primary')} ${link('/auth/login?next=%2Frobots%2Fnew', 'Sign in and add a robot', 'dir-btn')} ${link('/setup/sd-card', 'From a blank microSD card', 'dir-btn')}</p></section>`
: `<section class="dir-sec" aria-labelledby="yours-h"><div class="dir-sec-head"><h2 id="yours-h">Your robots</h2>${link('/machines', 'Your machines', 'dir-btn')}${link('/robots/new', 'Add a robot', 'dir-btn dir-primary')}</div>
${mine && mine.length ? `<ul class="dir-list">${mine.map((r) => `<li class="dir-row"><a href="/panel/${esc(r.id)}"><b>${esc(r.name)}</b></a><span class="muted">${esc(r.model_name)}</span>`
+ `${r.listed ? `<a class="dir-pill" href="/r/${esc(r.id)}">Listed</a>` : '<span class="dir-pill dir-quiet">Not listed</span>'}`
ddiff --git a/test/directory.test.js b/test/directory.test.js
iindex 667f916..5aba238 100644
---- a/test/directory.test.js
++++ b/test/directory.test.js
@@@ -27,6 +27,7 @@ const { loadProfiles } = require('../server/profiles');
assert.ok(html.includes('<h1>Robots</h1>') && html.includes('navbar-mount') && html.includes('/directory.css'));
for (const p of profiles) assert.ok(html.includes(`href="/models/${p.id}"`), p.id);
assert.ok(html.includes('href="/try"') && html.includes('Sign in and add a robot'));
++ assert.ok(html.includes('href="/setup/sd-card"'), 'a signed-out visitor sees the blank microSD card path');
assert.ok(!html.includes('Your robots') && !html.includes('Garage rover'), 'an unlisted robot is nobody else\'s business');
assert.ok(html.includes('<a class="dir-card-link" href="/try"><span class="dir-card-head"><b>Simulated rover</b>'), 'the simulated rover is always the first robot to drive');
});