@simon-says-build/ssb-overlay 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/SsbHost.js +2 -2
- package/src/core.js +13 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simon-says-build/ssb-overlay",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "SSB inside a native app SimonSays controls: the SSB button for the people who change the app (screenshot, mark, ask for a change), and Help for everyone who uses it.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
package/src/SsbHost.js
CHANGED
|
@@ -692,8 +692,8 @@ function Panel({ gate, chat, work, elsewhere, onDemo, screen, insets, draft, set
|
|
|
692
692
|
r.any ? h(View, { style: s.sessDot }) : null,
|
|
693
693
|
h(Text, { style: s.workTitle, numberOfLines: 2 }, r.title),
|
|
694
694
|
h(Text, { style: s.sessAgo }, r.ago)),
|
|
695
|
-
r.
|
|
696
|
-
r.
|
|
695
|
+
r.pills.length || r.news.length ? h(View, { style: s.sessChips },
|
|
696
|
+
...r.pills.map((p, i) => h(Text, { key: `p${i}`, style: [s.state, s[`sess_${p.state}`]], testID: i ? `ssb-session-state-${r.id}-${i}` : `ssb-session-state-${r.id}` }, p.word)),
|
|
697
697
|
...r.news.map((n) => h(Text, { key: n, style: s.sessNews }, n))) : null);
|
|
698
698
|
})) : null;
|
|
699
699
|
|
package/src/core.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export const DEFAULT_API = 'https://simonsays.build';
|
|
6
6
|
// What this overlay is, said when it registers for pushes (clientInfo below).
|
|
7
7
|
// Kept equal to package.json by test/core.test.mjs.
|
|
8
|
-
export const OVERLAY_VERSION = '0.10.
|
|
8
|
+
export const OVERLAY_VERSION = '0.10.1';
|
|
9
9
|
export const HOST = 5;
|
|
10
10
|
export const TEXT = 6;
|
|
11
11
|
const PIN_SLOP = 12; // a drag shorter than this is a tap: a pin, not a box
|
|
@@ -321,18 +321,27 @@ export const SESSION_STATE_WORD = Object.freeze({
|
|
|
321
321
|
/** Sessions worth an index: yours, not released. */
|
|
322
322
|
export const openSessionsOf = (list) => (Array.isArray(list) ? list : []).filter((x) => x && x.mine !== false && !x.done);
|
|
323
323
|
|
|
324
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* One row of the index: its name, where it is, and what is new in it for you.
|
|
326
|
+
* `pills`: where it is — one per app when it spans several (2026-10-28, per
|
|
327
|
+
* platform: web's Guided Review can be ready while the phone's work builds).
|
|
328
|
+
*/
|
|
325
329
|
export function sessionRow(x, now = Date.now()) {
|
|
326
330
|
const u = x?.updates || {};
|
|
327
331
|
const st = x?.status?.state || null;
|
|
328
332
|
const word = SESSION_STATE_WORD[st] || null;
|
|
329
|
-
const
|
|
333
|
+
const inOf = (s, a) => (s === 'building' && a?.total ? ` · ${a.landed} of ${a.total} in` : '');
|
|
334
|
+
const count = inOf(st, x?.status);
|
|
335
|
+
const apps = Array.isArray(x?.status?.apps) ? x.status.apps.filter((a) => SESSION_STATE_WORD[a.state]) : [];
|
|
336
|
+
const pills = apps.length > 1
|
|
337
|
+
? apps.map((a) => ({ state: a.state, word: `${a.name || 'An app'}: ${SESSION_STATE_WORD[a.state]}${inOf(a.state, a)}` }))
|
|
338
|
+
: word ? [{ state: st, word: `${word}${count}` }] : [];
|
|
330
339
|
const news = [
|
|
331
340
|
u.replied ? 'SSB replied' : null,
|
|
332
341
|
u.waiting ? `${u.waiting} draft${u.waiting === 1 ? '' : 's'} waiting` : null,
|
|
333
342
|
u.live ? `${u.live} live` : null,
|
|
334
343
|
].filter(Boolean);
|
|
335
|
-
return { id: x.id, title: x.title || x.preview || 'A session', state: st, stateWord: word ? `${word}${count}` : null, news, any: !!u.any, ago: agoOf(x.lastMessageAt, now) };
|
|
344
|
+
return { id: x.id, title: x.title || x.preview || 'A session', state: st, stateWord: word ? `${word}${count}` : null, pills, news, any: !!u.any, ago: agoOf(x.lastMessageAt, now) };
|
|
336
345
|
}
|
|
337
346
|
export function agoOf(iso, now = Date.now()) {
|
|
338
347
|
const s = (now - Date.parse(iso || '')) / 1000;
|