@milesroxas/design-hub 0.7.0 → 0.8.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/core/review/model.ts +53 -0
- package/core/review/policy.test.ts +101 -24
- package/core/review/policy.ts +42 -6
- package/core/review/service.test.ts +217 -7
- package/core/review/service.ts +122 -40
- package/core/review/store.ts +5 -0
- package/dist/core/review/model.d.ts +33 -0
- package/dist/core/review/model.js +39 -0
- package/dist/core/review/policy.d.ts +21 -2
- package/dist/core/review/policy.js +34 -2
- package/dist/core/review/service.d.ts +15 -5
- package/dist/core/review/service.js +99 -42
- package/dist/core/review/store.d.ts +5 -0
- package/dist/core/review/store.js +5 -0
- package/dist/scripts/comments.d.ts +10 -2
- package/dist/scripts/comments.js +20 -8
- package/dist/server/api.js +12 -2
- package/kit/prefs.ts +19 -2
- package/package.json +1 -1
- package/shell/review/Bar.tsx +97 -4
- package/shell/review/Pins.tsx +42 -25
- package/shell/review/Review.tsx +112 -24
- package/shell/review/ThreadCard.tsx +29 -25
- package/shell/review/client.ts +32 -10
- package/shell/review/review.css +41 -16
- package/shell/review/view.test.ts +73 -1
- package/shell/review/view.ts +49 -3
- package/skills/miles-review/SKILL.md +4 -2
package/shell/review/review.css
CHANGED
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
--rv-on-accent: oklch(0.205 0 0);
|
|
21
21
|
--rv-mark: oklch(0.55 0 0); /* on the page: mid grey holds on light and dark */
|
|
22
22
|
--rv-pin: oklch(0.205 0 0);
|
|
23
|
-
--rv-done: oklch(0.8 0.13 155); /* resolved:
|
|
23
|
+
--rv-done: oklch(0.8 0.13 155); /* resolved: green, on its check alone */
|
|
24
|
+
--rv-internal: oklch(0.83 0.15 85); /* internal: the amber of a support tool's internal note */
|
|
25
|
+
--rv-on-internal: oklch(0.3 0.06 85); /* the label on amber, 8:1 */
|
|
26
|
+
--rv-internal-chip: oklch(0.35 0.06 85); /* the Internal tag on the card: a solid low tint, not amber at low opacity */
|
|
27
|
+
--rv-internal-chip-fg: oklch(0.88 0.12 85); /* 8:1 on the chip */
|
|
24
28
|
--rv-danger: oklch(0.779 0.131 23.4);
|
|
25
29
|
--rv-raised: 0 0 0 1px oklch(1 0 0 / 0.09), 0 12px 32px -8px oklch(0 0 0 / 0.5), 0 2px 6px oklch(0 0 0 / 0.25);
|
|
26
30
|
|
|
@@ -77,7 +81,6 @@
|
|
|
77
81
|
.rv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
78
82
|
.rv-muted { color: var(--harness-fg-muted); }
|
|
79
83
|
.rv-spacer { flex: 1; }
|
|
80
|
-
.rv-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
81
84
|
.rv-title { margin: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--rv-fg-strong); white-space: nowrap; }
|
|
82
85
|
|
|
83
86
|
/* ---------- the kit's controls, at the layer's size ---------- */
|
|
@@ -296,16 +299,21 @@
|
|
|
296
299
|
box-shadow: var(--rv-raised);
|
|
297
300
|
color: oklch(0.92 0.04 23);
|
|
298
301
|
}
|
|
302
|
+
/* Client view on: the same pill in the layer's own material, never the error's red. */
|
|
303
|
+
.rv-alert.rv-viewing { background: var(--harness-bg); color: var(--rv-fg-strong); }
|
|
304
|
+
.rv-alert.rv-viewing .icon { flex: none; color: var(--harness-fg-muted); }
|
|
299
305
|
|
|
300
306
|
/* ---------- pins ---------- */
|
|
301
|
-
/* Open: solid and numbered.
|
|
302
|
-
|
|
307
|
+
/* Open: solid and numbered. Internal (Studio only): numbered on amber,
|
|
308
|
+
far lighter than the open face so it reads apart without the hue too.
|
|
309
|
+
Resolved: smaller, pale, a check where the number was. The open card's pin
|
|
310
|
+
turns to its other face, so it reads as selected. */
|
|
303
311
|
.rv-pins { position: fixed; inset: 0; z-index: var(--rv-z-page); pointer-events: none; }
|
|
304
312
|
.rv-pin {
|
|
305
313
|
position: absolute;
|
|
306
314
|
top: -24px;
|
|
307
315
|
left: 0;
|
|
308
|
-
width: 24px;
|
|
316
|
+
min-width: 24px;
|
|
309
317
|
height: 24px;
|
|
310
318
|
padding: 0;
|
|
311
319
|
border: 0;
|
|
@@ -317,11 +325,14 @@
|
|
|
317
325
|
.rv-pin::before { content: ''; position: absolute; inset: -10px; }
|
|
318
326
|
.rv-pin[hidden] { display: none; }
|
|
319
327
|
.rv-pin:focus-visible { outline: none; }
|
|
328
|
+
/* Grows from its tip for a longer number (128), never shrinks below a circle. */
|
|
320
329
|
.rv-pin-face {
|
|
330
|
+
box-sizing: border-box;
|
|
321
331
|
display: grid;
|
|
322
332
|
place-items: center;
|
|
323
|
-
width:
|
|
333
|
+
min-width: 24px;
|
|
324
334
|
height: 100%;
|
|
335
|
+
padding: 0 5px;
|
|
325
336
|
border: 2px solid oklch(1 0 0);
|
|
326
337
|
border-radius: 12px 12px 12px 3px;
|
|
327
338
|
background: var(--rv-pin);
|
|
@@ -339,9 +350,14 @@
|
|
|
339
350
|
.rv-pin:active .rv-pin-face { scale: 0.94; }
|
|
340
351
|
.rv-pin:focus-visible .rv-pin-face { box-shadow: 0 2px 8px oklch(0 0 0 / 0.35), 0 0 0 2px oklch(1 0 0), 0 0 0 4px var(--rv-pin); }
|
|
341
352
|
.rv-pin[data-active] .rv-pin-face { background: oklch(1 0 0); color: var(--rv-pin); border-color: var(--rv-pin); }
|
|
342
|
-
.rv-pin[data-resolved] { width: 20px; height: 20px; top: -20px; }
|
|
353
|
+
.rv-pin[data-resolved] { min-width: 20px; height: 20px; top: -20px; }
|
|
354
|
+
.rv-pin[data-resolved] .rv-pin-face { min-width: 20px; padding: 0; }
|
|
343
355
|
.rv-pin[data-resolved] .rv-pin-face { border-color: oklch(1 0 0 / 0.9); background: oklch(0.88 0 0); color: oklch(0.42 0 0); box-shadow: 0 1px 4px oklch(0 0 0 / 0.25); }
|
|
344
356
|
.rv-pin[data-resolved][data-active] .rv-pin-face { background: var(--rv-pin); color: var(--rv-done); border-color: oklch(1 0 0); }
|
|
357
|
+
.rv-pin[data-internal]:not([data-resolved]) .rv-pin-face { background: var(--rv-internal); color: var(--rv-on-internal); }
|
|
358
|
+
.rv-pin[data-internal]:not([data-resolved]):focus-visible .rv-pin-face { box-shadow: 0 2px 8px oklch(0 0 0 / 0.35), 0 0 0 2px oklch(1 0 0), 0 0 0 4px var(--rv-on-internal); }
|
|
359
|
+
/* Selected: the amber face turns over, as the open one does. */
|
|
360
|
+
.rv-pin[data-internal][data-active]:not([data-resolved]) .rv-pin-face { background: var(--rv-on-internal); color: var(--rv-internal); border-color: oklch(1 0 0); }
|
|
345
361
|
.rv-pin[data-new] { pointer-events: none; }
|
|
346
362
|
.rv-pin[data-new] .rv-pin-face { background: oklch(1 0 0); border-color: var(--rv-pin); }
|
|
347
363
|
|
|
@@ -362,7 +378,7 @@
|
|
|
362
378
|
}
|
|
363
379
|
@starting-style { .rv-card { opacity: 0; transform: scale(0.97); } }
|
|
364
380
|
|
|
365
|
-
/* The head:
|
|
381
|
+
/* The head: number and audience, then its one decision and the rest. 44px, no rule under it: the body's own air separates them. */
|
|
366
382
|
.rv-card-head {
|
|
367
383
|
display: flex;
|
|
368
384
|
flex: none;
|
|
@@ -371,9 +387,17 @@
|
|
|
371
387
|
min-height: 44px;
|
|
372
388
|
padding: 6px 6px 0 14px;
|
|
373
389
|
}
|
|
374
|
-
.rv-card-head .rv-title
|
|
375
|
-
.rv-about { flex: 1; min-width: 0; margin-left: 4px; color: var(--harness-fg-muted); font-size: 12px; }
|
|
390
|
+
.rv-card-head .rv-title { margin-right: 6px; }
|
|
376
391
|
.rv-step { margin: 0 2px; font-size: 12px; }
|
|
392
|
+
/* Who the thread is for, Studio only. Client-facing: a hairline tag, quieter than kind and state.
|
|
393
|
+
Internal: the pin's amber, as a solid chip. */
|
|
394
|
+
.rv-no + .rv-aud { margin-left: 4px; }
|
|
395
|
+
.rv-aud { flex: none; display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 6px; box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.14); color: var(--harness-fg-muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
|
|
396
|
+
.rv-aud[data-audience="internal"] { box-shadow: none; background: var(--rv-internal-chip); color: var(--rv-internal-chip-fg); }
|
|
397
|
+
/* Studio's choice on a new thread: the bar's toggle, small, in the head beside the title.
|
|
398
|
+
A 28px track (radius 14), its halves 2px in (24px, radius 12). */
|
|
399
|
+
.rv-toggle.rv-audience { height: 28px; border-radius: 14px; }
|
|
400
|
+
.rv-toggle.rv-audience button { height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; }
|
|
377
401
|
.rv-no {
|
|
378
402
|
display: inline-grid;
|
|
379
403
|
flex: none;
|
|
@@ -388,7 +412,7 @@
|
|
|
388
412
|
font-weight: 700;
|
|
389
413
|
font-variant-numeric: tabular-nums;
|
|
390
414
|
}
|
|
391
|
-
/* Resolve: the head's one labelled control, quiet until the pointer finds it; done, its check turns
|
|
415
|
+
/* Resolve: the head's one labelled control, quiet until the pointer finds it; done, its check turns green. */
|
|
392
416
|
.rv .btn.rv-resolve { height: 28px; padding: 0 10px 0 8px; color: var(--harness-fg); background: var(--rv-fill); }
|
|
393
417
|
.rv .btn.rv-resolve .icon { color: var(--rv-done); }
|
|
394
418
|
.rv .btn.rv-resolve.is-done .icon { color: var(--harness-fg-muted); }
|
|
@@ -403,6 +427,7 @@
|
|
|
403
427
|
.rv-card-foot.rv-confirm { transition: opacity var(--dur-menu) var(--ease-out); }
|
|
404
428
|
|
|
405
429
|
/* Resolved: the badge becomes a check, a band names who closed it, the words step back. */
|
|
430
|
+
.rv-no[data-audience="internal"] { background: var(--rv-internal); color: var(--rv-on-internal); }
|
|
406
431
|
.rv-card[data-resolved] .rv-no { background: var(--rv-fill-open); color: var(--rv-done); }
|
|
407
432
|
.rv-band { display: flex; align-items: center; gap: 6px; margin: 8px 10px 0; padding: 8px 10px; border-radius: 10px; background: var(--rv-fill); color: var(--harness-fg-muted); transition: opacity var(--dur-dialog) var(--ease-out), translate var(--dur-dialog) var(--ease-out); }
|
|
408
433
|
@starting-style { .rv-band { opacity: 0; translate: 0 -4px; } }
|
|
@@ -559,8 +584,8 @@
|
|
|
559
584
|
.rv-card[data-sheet][data-dragging] { transition: none; }
|
|
560
585
|
.rv-card[data-sheet][data-leaving] { transition: transform 200ms var(--ease-out); }
|
|
561
586
|
.rv-card[data-sheet] .rv-card-head { touch-action: none; min-height: 44px; padding-top: 4px; }
|
|
562
|
-
|
|
563
|
-
.rv-card[data-sheet] .rv-
|
|
587
|
+
.rv-card[data-sheet] .rv-toggle.rv-audience { height: 36px; border-radius: 18px; }
|
|
588
|
+
.rv-card[data-sheet] .rv-toggle.rv-audience button { height: 32px; border-radius: 16px; }
|
|
564
589
|
.rv-grab { display: block; flex: none; width: 36px; height: 4px; margin: 8px auto 0; border-radius: 999px; background: oklch(1 0 0 / 0.25); touch-action: none; }
|
|
565
590
|
.rv-card[data-sheet] .rv-card-body { padding-inline: 16px; }
|
|
566
591
|
.rv-card[data-sheet] .rv-card-foot { padding: 0 12px 12px; }
|
|
@@ -577,9 +602,9 @@
|
|
|
577
602
|
}
|
|
578
603
|
@starting-style { .rv-bar { opacity: 1; transform: translateY(100%); } }
|
|
579
604
|
.rv-bar { transition: transform var(--dur-sheet, 320ms) var(--ease-drawer), opacity var(--dur-dialog) var(--ease-out); }
|
|
580
|
-
.rv-toggle { height: 40px; border-radius: 20px; margin-right: auto; }
|
|
605
|
+
.rv-bar .rv-toggle { height: 40px; border-radius: 20px; margin-right: auto; }
|
|
581
606
|
.rv-bar-rule { display: none; }
|
|
582
|
-
.rv-toggle button { height: 36px; border-radius: 18px; }
|
|
607
|
+
.rv-bar .rv-toggle button { height: 36px; border-radius: 18px; }
|
|
583
608
|
.rv-bar .btn { width: 40px; height: 40px; border-radius: 20px; }
|
|
584
609
|
.rv-stepper-count { min-width: 52px; }
|
|
585
610
|
.rv-alert { margin: 0 12px 8px; max-width: none; }
|
|
@@ -588,7 +613,7 @@
|
|
|
588
613
|
|
|
589
614
|
/* The narrowest phones: the toggle keeps its icons, its words go to the screen reader. */
|
|
590
615
|
@media (max-width: 400px) {
|
|
591
|
-
.rv-toggle button { width: 44px; padding: 0; justify-content: center; }
|
|
616
|
+
.rv-bar .rv-toggle button { width: 44px; padding: 0; justify-content: center; }
|
|
592
617
|
.rv-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
593
618
|
.rv-stepper-count { min-width: 44px; }
|
|
594
619
|
}
|
|
@@ -3,7 +3,10 @@ import { test } from 'node:test';
|
|
|
3
3
|
import {
|
|
4
4
|
type Draft,
|
|
5
5
|
draftOf,
|
|
6
|
+
filtered,
|
|
7
|
+
filterNote,
|
|
6
8
|
initialView,
|
|
9
|
+
lensOf,
|
|
7
10
|
roundOf,
|
|
8
11
|
scopeOf,
|
|
9
12
|
stepFrom,
|
|
@@ -18,8 +21,16 @@ const run = (start: View, ...actions: ViewAction[]) => actions.reduce(view, star
|
|
|
18
21
|
const wholePage: Draft = { target: null, offset: null };
|
|
19
22
|
|
|
20
23
|
test('the layer starts with comment mode off, hidden or not as it was left', () => {
|
|
21
|
-
assert.deepEqual(initialView(false), {
|
|
24
|
+
assert.deepEqual(initialView(false), {
|
|
25
|
+
hidden: false,
|
|
26
|
+
commenting: false,
|
|
27
|
+
card: null,
|
|
28
|
+
resolved: false,
|
|
29
|
+
filter: 'all',
|
|
30
|
+
clientView: false,
|
|
31
|
+
});
|
|
22
32
|
assert.equal(initialView(true).hidden, true);
|
|
33
|
+
assert.equal(initialView(false, true).clientView, true);
|
|
23
34
|
});
|
|
24
35
|
|
|
25
36
|
test('start turns comment mode on with no card; stop turns it off and drops the card', () => {
|
|
@@ -153,3 +164,64 @@ test('the toggle reads Page only while a page comment is being written', () => {
|
|
|
153
164
|
assert.equal(scopeOf({ type: 'draft', draft: { target: {} as Element, offset: { x: 0, y: 0 } } }), 'pin');
|
|
154
165
|
assert.equal(scopeOf({ type: 'thread', id: 'x' }), 'pin');
|
|
155
166
|
});
|
|
167
|
+
|
|
168
|
+
test('the filter narrows by audience and survives the mode turning off and on', () => {
|
|
169
|
+
const state = run(
|
|
170
|
+
initialView(false),
|
|
171
|
+
{ type: 'filter', filter: 'internal' },
|
|
172
|
+
{ type: 'start' },
|
|
173
|
+
{ type: 'open', id: 'c1' },
|
|
174
|
+
{ type: 'stop' },
|
|
175
|
+
);
|
|
176
|
+
assert.equal(state.filter, 'internal');
|
|
177
|
+
assert.equal(view(state, { type: 'filter', filter: 'all' }).filter, 'all');
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test('Client view turns on and off, closes the card and sets the filter back to all', () => {
|
|
181
|
+
const on = run(
|
|
182
|
+
initialView(false),
|
|
183
|
+
{ type: 'start' },
|
|
184
|
+
{ type: 'filter', filter: 'client' },
|
|
185
|
+
{ type: 'open', id: 'c1' },
|
|
186
|
+
{ type: 'clientView', on: true },
|
|
187
|
+
);
|
|
188
|
+
assert.deepEqual([on.clientView, on.card, on.filter, on.commenting], [true, null, 'all', true]);
|
|
189
|
+
const off = view(on, { type: 'clientView', on: false });
|
|
190
|
+
assert.deepEqual([off.clientView, off.card], [false, null]);
|
|
191
|
+
// Hiding comments leaves Client view as it was.
|
|
192
|
+
assert.equal(run(on, { type: 'hide' }, { type: 'show' }).clientView, true);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('the lens: Studio sees as Studio until Client view; a Client never does, whatever was stored', () => {
|
|
196
|
+
assert.deepEqual(lensOf(true, { clientView: false }), { asStudio: true, clientView: false });
|
|
197
|
+
assert.deepEqual(lensOf(true, { clientView: true }), { asStudio: false, clientView: true });
|
|
198
|
+
assert.deepEqual(lensOf(false, { clientView: true }), { asStudio: false, clientView: false });
|
|
199
|
+
assert.deepEqual(lensOf(false, { clientView: false }), { asStudio: false, clientView: false });
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test('filtered lets through all, one audience, or everything the server sent in Client view', () => {
|
|
203
|
+
const threads = [
|
|
204
|
+
{ id: 'i', audience: 'internal' },
|
|
205
|
+
{ id: 'k', audience: 'client' },
|
|
206
|
+
];
|
|
207
|
+
const ids = (cs: { id: string }[]) => cs.map((c) => c.id);
|
|
208
|
+
assert.deepEqual(ids(filtered(threads, { filter: 'all', clientView: false })), ['i', 'k']);
|
|
209
|
+
assert.deepEqual(ids(filtered(threads, { filter: 'internal', clientView: false })), ['i']);
|
|
210
|
+
assert.deepEqual(ids(filtered(threads, { filter: 'client', clientView: false })), ['k']);
|
|
211
|
+
assert.deepEqual(ids(filtered(threads, { filter: 'internal', clientView: true })), ['i', 'k']);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test('the bar names a narrowing filter, and says nothing with All or in Client view', () => {
|
|
215
|
+
assert.equal(filterNote({ filter: 'all', clientView: false }), null);
|
|
216
|
+
assert.equal(filterNote({ filter: 'internal', clientView: false }), 'Internal only');
|
|
217
|
+
assert.equal(filterNote({ filter: 'client', clientView: false }), 'Client-facing only');
|
|
218
|
+
assert.equal(filterNote({ filter: 'internal', clientView: true }), null);
|
|
219
|
+
// Turning Client view on sets the filter back to All, so leaving it shows no stale note.
|
|
220
|
+
const left = run(
|
|
221
|
+
initialView(false),
|
|
222
|
+
{ type: 'filter', filter: 'client' },
|
|
223
|
+
{ type: 'clientView', on: true },
|
|
224
|
+
{ type: 'clientView', on: false },
|
|
225
|
+
);
|
|
226
|
+
assert.equal(filterNote(left), null);
|
|
227
|
+
});
|
package/shell/review/view.ts
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
/** A new comment being placed: the element it is about and where on it, as fractions of its box, or neither for the whole page. */
|
|
5
5
|
export type Draft = { target: Element | null; offset: { x: number; y: number } | null };
|
|
6
6
|
|
|
7
|
+
/** Which threads Studio lists: every one, or one audience. Matches core's Audience values. */
|
|
8
|
+
export type Filter = 'all' | 'internal' | 'client';
|
|
9
|
+
|
|
7
10
|
/** The one card on screen: a thread, a comment being written, or the people. */
|
|
8
11
|
export type Card = { type: 'thread'; id: string } | { type: 'draft'; draft: Draft } | { type: 'people' };
|
|
9
12
|
|
|
@@ -12,13 +15,18 @@ export type Card = { type: 'thread'; id: string } | { type: 'draft'; draft: Draf
|
|
|
12
15
|
* field it touches at once and no two fields can disagree. `commenting` is
|
|
13
16
|
* comment mode: pins on the page and a click anywhere starts a comment. Off,
|
|
14
17
|
* the page carries only the button. `hidden` tucks even the button into the
|
|
15
|
-
* screen's edge
|
|
18
|
+
* screen's edge. `filter` narrows Studio's list by audience, in memory like
|
|
19
|
+
* `resolved`. `clientView` is Studio looking as a Client does: the list is
|
|
20
|
+
* fetched as a Client's and Studio's controls step aside. `hidden` and
|
|
21
|
+
* `clientView` outlive the page (kit/prefs.ts).
|
|
16
22
|
*/
|
|
17
23
|
export type View = {
|
|
18
24
|
hidden: boolean;
|
|
19
25
|
commenting: boolean;
|
|
20
26
|
card: Card | null;
|
|
21
27
|
resolved: boolean;
|
|
28
|
+
filter: Filter;
|
|
29
|
+
clientView: boolean;
|
|
22
30
|
};
|
|
23
31
|
|
|
24
32
|
export type ViewAction =
|
|
@@ -31,13 +39,17 @@ export type ViewAction =
|
|
|
31
39
|
| { type: 'escape' }
|
|
32
40
|
| { type: 'resolved' }
|
|
33
41
|
| { type: 'hide' }
|
|
34
|
-
| { type: 'show' }
|
|
42
|
+
| { type: 'show' }
|
|
43
|
+
| { type: 'filter'; filter: Filter }
|
|
44
|
+
| { type: 'clientView'; on: boolean };
|
|
35
45
|
|
|
36
|
-
export const initialView = (hidden: boolean): View => ({
|
|
46
|
+
export const initialView = (hidden: boolean, clientView = false): View => ({
|
|
37
47
|
hidden,
|
|
38
48
|
commenting: false,
|
|
39
49
|
card: null,
|
|
40
50
|
resolved: false,
|
|
51
|
+
filter: 'all',
|
|
52
|
+
clientView,
|
|
41
53
|
});
|
|
42
54
|
|
|
43
55
|
export function view(state: View, action: ViewAction): View {
|
|
@@ -64,9 +76,43 @@ export function view(state: View, action: ViewAction): View {
|
|
|
64
76
|
return { ...state, hidden: true, commenting: false, card: null };
|
|
65
77
|
case 'show':
|
|
66
78
|
return { ...state, hidden: false };
|
|
79
|
+
case 'filter':
|
|
80
|
+
return { ...state, filter: action.filter };
|
|
81
|
+
// The other view holds other threads: the card closes, and the filter goes back to all, as a Client has none.
|
|
82
|
+
case 'clientView':
|
|
83
|
+
return { ...state, clientView: action.on, filter: 'all', card: null };
|
|
67
84
|
}
|
|
68
85
|
}
|
|
69
86
|
|
|
87
|
+
/**
|
|
88
|
+
* How the layer looks to this person. `studio` is whether the policy gives
|
|
89
|
+
* them Studio's view. As Studio: audience marks, the filter and the choice on
|
|
90
|
+
* a new thread. In Client view, Studio sees none of that, as a Client does.
|
|
91
|
+
*/
|
|
92
|
+
export function lensOf(studio: boolean, v: Pick<View, 'clientView'>) {
|
|
93
|
+
return { asStudio: studio && !v.clientView, clientView: studio && v.clientView };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const FILTER_NOTE = { internal: 'Internal only', client: 'Client-facing only' } as const;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* What the bar says while the filter narrows the list, so Studio never
|
|
100
|
+
* forgets a thread is out of sight; null with All, and in Client view, which
|
|
101
|
+
* has no filter.
|
|
102
|
+
*/
|
|
103
|
+
export function filterNote(v: Pick<View, 'filter' | 'clientView'>): string | null {
|
|
104
|
+
return v.clientView || v.filter === 'all' ? null : FILTER_NOTE[v.filter];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** The threads the filter lets through; in Client view, the list is already a Client's. */
|
|
108
|
+
export function filtered<T extends { audience: string }>(
|
|
109
|
+
roots: T[],
|
|
110
|
+
v: Pick<View, 'filter' | 'clientView'>,
|
|
111
|
+
): T[] {
|
|
112
|
+
if (v.clientView || v.filter === 'all') return roots;
|
|
113
|
+
return roots.filter((c) => c.audience === v.filter);
|
|
114
|
+
}
|
|
115
|
+
|
|
70
116
|
type Thread = { id: string; status: 'open' | 'resolved' };
|
|
71
117
|
|
|
72
118
|
/** The threads comment mode steps through: the open ones, the resolved too when shown, and always the open card's, so resolving it never pulls the card away. */
|
|
@@ -7,6 +7,8 @@ description: "Work from review comments on the deployed prototypes: pull them in
|
|
|
7
7
|
|
|
8
8
|
Each comment is pinned to a prototype, its state (the URL and every dial value) and, usually, an element. The repo gets them as `docs/sprints/<feature>/comments.md`, grouped by README state, then by kind. That file is generated: read it, never edit it, and close comments in the store.
|
|
9
9
|
|
|
10
|
+
Each thread line starts with its label and its audience: `- #I3 (internal) Ed (Studio): ...` or `- #4 (client-facing) Rae (Acme): ...`. Internal and client-facing threads count apart: I1, I2 are internal, 1, 2 client-facing, so `I2` and `2` are different threads. Name a thread by its label exactly. The panel shows both as a bare number; an internal pin is amber, so a person may say "the amber 2" for `I2`. A number is fixed and never reused, so gaps after a delete are normal. An internal thread is the studio's own note and no client ever sees it; a client-facing one is read by everyone, Studio's replies in it included.
|
|
11
|
+
|
|
10
12
|
## Working from comments
|
|
11
13
|
|
|
12
14
|
1. **Pull**, from the project root: `pnpm comments pull`. The JSON's `store` says which store it read: `deployed` when `.env` holds the store's credentials, `local` otherwise. Say which to the user, because local comments are only yours.
|
|
@@ -24,11 +26,11 @@ Each comment is pinned to a prototype, its state (the URL and every dial value)
|
|
|
24
26
|
```
|
|
25
27
|
Why taste waits: one reviewer's preference, built at once, overwrites a decision the team made and the next reviewer argues the other way. The user decides taste; bugs and copy are not taste.
|
|
26
28
|
4. **Resolve** with `pnpm comments resolve <id>`, or in the panel, only once the change is live. Why: a reviewer who opens a resolved comment and still sees the old state stops trusting the list.
|
|
27
|
-
5. **Report** to the user: what was fixed, by comment id; the taste calls waiting for them; any comment with no state.
|
|
29
|
+
5. **Report** to the user: what was fixed, by number and comment id; the taste calls waiting for them; any comment with no state. Say which threads were internal, because the client never saw those.
|
|
28
30
|
|
|
29
31
|
## People
|
|
30
32
|
|
|
31
|
-
- Every person is **Studio** or **Client**. Both comment, reply, edit their own words, and resolve or reopen any thread. Studio also deletes any comment, sorts comments and manages people; a Client deletes only their own. The studio's team are Studio; everyone on the client's side is Client, the default.
|
|
33
|
+
- Every person is **Studio** or **Client**. Both comment, reply, edit their own words, and resolve or reopen any thread they can see. A Client sees client-facing threads only; Studio sees all, internal ones included. A thread's audience never changes: to tell the client what an internal thread says, Studio writes a new client-facing comment in the panel. Never paste internal words into a client-facing one without the user's say. Studio also deletes any comment, sorts comments and manages people; a Client deletes only their own. The studio's team are Studio; everyone on the client's side is Client, the default.
|
|
32
34
|
- **Team** is the company: `Studio`, or the client's name. It shows beside every name, so a reviewer reads who said what.
|
|
33
35
|
- The first Studio person comes from `pnpm people add --name <n> --team <t> --kind studio --site <url>`; after that, Studio adds people from the People tab.
|
|
34
36
|
- A link signs in one device, then stops working; unused, it lasts 14 days. `pnpm people link <id>` gives another for another device, `sign-out <id>` ends every session and gives one new link, and `revoke <id>` ends their access everywhere within five minutes. `miles-deploy` holds the rest: access length, the handover.
|