Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

feat(view): make the sharing invitation dismissible [N26,H5]

Corey Olsone58b41172bef
diff --git a/src/cockpit.js b/src/cockpit.js
index 094f987f..da16b1b0 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -102,6 +102,7 @@ export function cockpitPage(key = '', { snapshot = false, readOnly = false, requ
<div class="side-body" id="side-body">
<div class="label">Projects</div>
<nav id="proj-list" aria-label="Projects on this machine"></nav>
+ <button class="share-again" id="share-again" type="button" hidden>Link boards to pullboard.dev&hellip;</button>
<section class="products" id="products" aria-label="Products" hidden><div class="label">Products</div><div id="prod-list"></div></section>
</div>
</aside>
@@ -124,7 +125,7 @@ export function cockpitPage(key = '', { snapshot = false, readOnly = false, requ
</section>
<p class="empty" id="project-loading" role="status" hidden>Loading project…</p>
${hostedMarkup('http://127.0.0.1:4890', { looking: Boolean(hostedLocal) && !snapshot, signIn })}
- <p class="side-hint" id="share-note" hidden>See these boards from any device: link them to pullboard.dev <button class="ghost" id="share-start" type="button">Sign in with GitHub</button></p>
+ <div class="share-card" id="share-note" hidden><span class="share-ic" aria-hidden="true"><svg viewBox="0 0 24 24" width="17" height="17" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="13" height="10" rx="1.5"/><path d="M7 18h5M9.5 14v4"/><rect x="17" y="9" width="5" height="10" rx="1"/></svg></span><span class="share-txt"><b>See these boards from any device</b><span>Link them to pullboard.dev with your GitHub account.</span></span><button class="ob-gh share-gh" id="share-start" type="button"><svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg>Sign in with GitHub</button><button class="share-x" id="share-hide" type="button" aria-label="Hide this; bring it back from the projects list" title="Hide this; bring it back from the projects list">&times;</button></div>
<section class="card-panel" id="share-panel" aria-label="Link these boards" hidden>
<p id="share-status" role="status" aria-live="polite"></p>
<button class="ghost" id="share-pair" type="button" hidden>Pair a device</button>
@@ -1111,16 +1112,24 @@ let sharing = { state: 'idle', intentId: null, popup: null, timer: null, closing
/** Show the opt-in once after a real local read; quiet boards do not acquire another polling loop. */
async function sharingInvitation() {
if (!$('share-note') || snapshot || (hosted.local ? !localSession : pageReadOnly || configuredTransportModule)) return;
- try { $('share-note').hidden = !(await sharingApi()).available; }
- catch { $('share-note').hidden = true; }
+ let available = false;
+ try { available = Boolean((await sharingApi()).available); } catch { available = false; }
+ const hiddenByPerson = keep('pb.share') === 'hidden';
+ $('share-note').hidden = !available || hiddenByPerson;
+ if ($('share-again')) $('share-again').hidden = !available || !hiddenByPerson;
}
+$('share-hide')?.addEventListener('click', () => { keep('pb.share', 'hidden'); $('share-note').hidden = true; if ($('share-again')) $('share-again').hidden = false; });
+$('share-again')?.addEventListener('click', () => { keep('pb.share', 'shown'); $('share-again').hidden = true; $('share-note').hidden = false; });
/** Render names and reasons as text, without exposing machine paths or private sign-in material. */
function sharingProgress(status) {
sharing.state = status.state;
sharing.boards = status.boards || [];
const linked = sharing.boards.filter(board => board.outcome === 'linked');
- if (linked.length) $('share-note').hidden = true;
+ if (linked.length) {
+ $('share-note').hidden = true;
+ if ($('share-again')) $('share-again').hidden = true;
+ }
const lines = sharing.boards.map(board => board.outcome === 'linked' ? 'Linked ' + board.name + '.'
: 'Did not link ' + board.name + ': ' + board.reason);
if (status.error) lines.push(status.error.message);
diff --git a/src/view.css b/src/view.css
index 8f00a4d0..76a4b508 100644
--- a/src/view.css
+++ b/src/view.css
@@ -940,3 +940,26 @@ code.inline.long { white-space: break-spaces; overflow-wrap: anywhere; }
.roadmap-step.free { background: var(--violet); }
.roadmap-arrow { color: var(--ink-faint); }
.roadmap-items { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 12.5px; }
+
+/* Prototype (18 Oct): the link-to-pullboard.dev invitation as a calm, closable card. */
+.share-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 10px 10px 14px; margin: 0 0 14px; }
+.share-card[hidden], .share-again[hidden] { display: none; }
+.share-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
+.share-txt { flex: 1; min-width: 0; font-size: 13px; line-height: 1.45; color: var(--ink-muted); }
+.share-txt b { display: block; color: var(--ink); font-weight: 600; font-size: 13.5px; }
+.share-gh { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 7px 11px; border-radius: 8px; white-space: nowrap; border: 0; cursor: pointer; }
+.share-x { width: 28px; height: 28px; border: 0; background: none; color: var(--ink-faint); border-radius: 6px; cursor: pointer; font-size: 18px; line-height: 1; flex-shrink: 0; }
+.share-x:hover { background: var(--shade); color: var(--ink); }
+.share-again { display: block; margin: 10px 12px 0; padding: 6px 8px; border: 0; background: none; color: var(--accent-strong); font-size: 12.5px; cursor: pointer; text-align: left; border-radius: 6px; }
+.share-again:hover { background: var(--shade); }
+
+/* Keep the approved invitation readable and its controls reachable at phone widths. */
+.share-gh, .share-again { min-height: var(--tap); }
+.share-x { min-width: var(--tap); min-height: var(--tap); }
+@media (width < 600px) {
+ .share-card { display: grid; grid-template-columns: 30px minmax(0, 1fr) var(--tap); align-items: start; }
+ .share-ic { margin-top: 4px; }
+ .share-txt { grid-column: 2; }
+ .share-x { grid-column: 3; grid-row: 1; }
+ .share-gh { grid-column: 2 / 4; justify-self: start; }
+}
diff --git a/test/cockpit/open-board.test.js b/test/cockpit/open-board.test.js
index ebbc1451..d87bb39c 100644
--- a/test/cockpit/open-board.test.js
+++ b/test/cockpit/open-board.test.js
@@ -405,3 +405,92 @@ test('the page moves on by itself when the view starts [N26,H5]', { timeout: 120
}
}
});
+
+
+test('the link invitation closes, stays closed and comes back [N26,H5]', async t => {
+ const executable = chromeExecutable();
+ if (!executable) return t.skip('Install Chrome for the real link invitation check.');
+ const box = machine();
+ const demo = project(box, 'link-invitation');
+ box.run(demo.repo, 'milestone', 'add', 'Delivery');
+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-link-invitation-'));
+ let view; let chrome; let available = true;
+ const failures = [];
+ try {
+ view = await startView(box);
+ chrome = await openSnapshotChrome(executable, 'about:blank', profile);
+ // Only availability is supplied; the board, rendering, storage and all clicks are real.
+ chrome.socket.addEventListener('message', ({ data }) => {
+ const message = JSON.parse(String(data));
+ if (message.method !== 'Fetch.requestPaused') return;
+ chrome.send('Fetch.fulfillRequest', { requestId: message.params.requestId, responseCode: 200,
+ responseHeaders: [{ name: 'Content-Type', value: 'application/json' }],
+ body: Buffer.from(JSON.stringify({ version: 1, available })).toString('base64') }).catch(error => failures.push(error.message));
+ });
+ await chrome.send('Fetch.enable', { patterns: [{ urlPattern: view.base + '/api/v1/view-link', requestStage: 'Request' }] });
+ await chrome.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });
+ await chrome.send('Page.navigate', { url: view.link.href });
+ await chrome.waitFor("data?.project?.root && !document.body.classList.contains('loading')");
+ await chrome.stable('sharingReady');
+ assert.equal(await chrome.stable("document.querySelector('#share-note b')?.textContent"), 'See these boards from any device');
+ assert.equal(await chrome.stable("document.querySelector('#share-note .share-txt > span')?.textContent"), 'Link them to pullboard.dev with your GitHub account.');
+ assert.equal(await chrome.stable("document.querySelector('#share-start').textContent.trim()"), 'Sign in with GitHub');
+ assert.equal(await chrome.stable("Boolean(document.querySelector('#share-start svg') && document.querySelector('#share-note .share-ic svg'))"), true);
+ assert.equal(await chrome.stable("document.querySelector('#share-hide')?.getAttribute('aria-label')"), 'Hide this; bring it back from the projects list');
+ assert.equal(await chrome.stable("document.querySelector('#share-again')?.hidden"), true, 'no redundant entry while the card shows');
+ await press(chrome, "document.querySelector('#share-hide')");
+ assert.equal(await chrome.stable("document.querySelector('#share-note').hidden"), true);
+ assert.equal(await chrome.stable("document.querySelector('#share-again').hidden"), false);
+ await chrome.send('Page.reload');
+ await chrome.waitFor("data?.project?.root && !document.body.classList.contains('loading')");
+ await chrome.stable('sharingReady');
+ assert.equal(await chrome.stable("document.querySelector('#share-note').hidden"), true, 'the machine remembers dismissal after reload');
+ assert.equal(await chrome.stable("document.querySelector('#share-again').textContent"), 'Link boards to pullboard.dev…');
+ await press(chrome, "document.querySelector('#share-again')");
+ assert.equal(await chrome.stable("document.querySelector('#share-note').hidden"), false);
+ assert.equal(await chrome.stable("document.querySelector('#share-again').hidden"), true);
+ const backgrounds = new Set();
+ for (const width of [1280, 390]) {
+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });
+ await press(chrome, "document.querySelector('[data-tab=roadmap]')");
+ await chrome.waitFor("document.querySelector('.roadmap-list') && document.querySelector('.roadmap-panel')");
+ for (const theme of ['light', 'dark']) {
+ await chrome.stable(`document.documentElement.dataset.theme = '${theme}'`);
+ const measured = JSON.parse(await chrome.stable(`JSON.stringify((() => {
+ const card = document.querySelector('#share-note'), rect = card.getBoundingClientRect();
+ const parts = [...document.querySelectorAll('.roadmap-list, .roadmap-panel')].map(part => part.getBoundingClientRect());
+ const button = document.querySelector('#share-start');
+ return { left: rect.left, right: rect.right, columnsLeft: Math.min(...parts.map(part => part.left)),
+ columnsRight: Math.max(...parts.map(part => part.right)), background: getComputedStyle(card).backgroundColor,
+ githubBackground: getComputedStyle(button).backgroundColor, overflow: document.documentElement.scrollWidth > innerWidth,
+ buttonFits: button.getBoundingClientRect().right <= rect.right,
+ closeWidth: document.querySelector('#share-hide').getBoundingClientRect().width,
+ closeHeight: document.querySelector('#share-hide').getBoundingClientRect().height,
+ buttonHeight: button.getBoundingClientRect().height };
+ })())`));
+ assert.ok(Math.abs(measured.left - measured.columnsLeft) < 1 && Math.abs(measured.right - measured.columnsRight) < 1,
+ `${width}/${theme}: the full card spans both Roadmap and Releases columns`);
+ assert.equal(measured.githubBackground, 'rgb(31, 35, 40)', 'the existing GitHub style stays dark');
+ assert.equal(measured.overflow, false, `${width}/${theme}: no horizontal overflow`);
+ assert.equal(measured.buttonFits, true);
+ const target = width < 900 ? 44 : 32;
+ assert.ok(measured.closeWidth >= target && measured.closeHeight >= target && measured.buttonHeight >= target,
+ `${width}/${theme}: close and sign-in retain the view's existing tap target`);
+ backgrounds.add(measured.background);
+ }
+ await proofShot(chrome, 'link-invitation', width);
+ }
+ assert.equal(backgrounds.size, 2, 'the card uses the light and dark surface tokens');
+ available = false;
+ await chrome.send('Page.reload');
+ await chrome.waitFor("data?.project?.root && !document.body.classList.contains('loading')");
+ await chrome.stable('sharingReady');
+ assert.equal(await chrome.stable("document.querySelector('#share-note').hidden"), true);
+ assert.equal(await chrome.stable("document.querySelector('#share-again').hidden"), true, 'no entry when sharing is unavailable');
+ assert.deepEqual(failures, []);
+ } finally {
+ if (chrome) await closeSnapshotChrome(chrome);
+ if (view) await view.stop();
+ rmSync(profile, { recursive: true, force: true });
+ }
+});
diff --git a/test/cockpit/relay.test.js b/test/cockpit/relay.test.js
index e1de85cd..cfb8d4a6 100644
--- a/test/cockpit/relay.test.js
+++ b/test/cockpit/relay.test.js
@@ -2147,7 +2147,8 @@ process.stdout.write(JSON.stringify({other}));
await chrome.stable("typeof sharingReady === 'undefined' ? null : sharingReady");
assert.equal(await chrome.stable("document.querySelector('#share-note')?.hidden === false"), true,
'the real local view offers one quiet invitation before any board is linked');
- assert.equal(await chrome.stable("document.querySelector('#share-note')?.textContent.includes('See these boards from any device: link them to pullboard.dev')"), true);
+ assert.equal(await chrome.stable("document.querySelector('#share-note b')?.textContent"), 'See these boards from any device');
+ assert.equal(await chrome.stable("document.querySelector('#share-note .share-txt > span')?.textContent"), 'Link them to pullboard.dev with your GitHub account.');
const starts = box.providerCalls.filter(call => call.path === '/login/device/code').length;
await press(chrome, "document.querySelector('#share-start')");
// The real GitHub popup hides this tab; foreground the owned view before measuring its progress.
@@ -2157,6 +2158,11 @@ process.stdout.write(JSON.stringify({other}));
'one native person click starts exactly one real device sign-in for every board');
assert.equal(await chrome.stable("document.querySelector('#share-status')?.textContent.includes('TEST-ONLY')"), true,
'the view displays the public GitHub code');
+ if (mode === 'linked') {
+ await press(chrome, "document.querySelector('#share-hide')");
+ assert.equal(await chrome.stable("document.querySelector('#share-again').hidden"), false,
+ 'dismissing while sign-in waits offers the restore entry');
+ }
if (mode === 'closed') {
const targets = await chrome.send('Target.getTargets');
const popup = targets.targetInfos.find(target => target.type === 'page' && target.url.endsWith('/login/device'));
@@ -2189,6 +2195,7 @@ process.stdout.write(JSON.stringify({other}));
if (mode === 'linked') assert.match(text, /Linked second-view-board/u);
else assert.match(text, /Did not link second-view-board: .+/u, 'a refused board is named with its actual reason');
assert.equal(await chrome.stable("document.querySelector('#share-note').hidden"), true, 'the invitation disappears after linking');
+ assert.equal(await chrome.stable("document.querySelector('#share-again').hidden"), true, 'linking also removes a previously dismissed restore entry');
await press(chrome, "document.querySelector('#share-close')");
await chrome.stable('sharingTask');
assert.deepEqual(links.map(existsSync), mode === 'linked' ? [true,true] : [true,false], 'stopping phone pairing preserves completed board links');