@milesroxas/design-hub 0.8.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 +13 -2
- package/core/review/service.test.ts +56 -12
- package/core/review/service.ts +21 -3
- package/core/review/store.ts +4 -1
- package/dist/core/review/model.d.ts +11 -2
- package/dist/core/review/model.js +7 -0
- package/dist/core/review/service.d.ts +1 -1
- package/dist/core/review/service.js +19 -3
- package/dist/core/review/store.d.ts +4 -1
- package/dist/core/review/store.js +4 -1
- package/dist/scripts/comments.js +4 -3
- package/package.json +1 -1
- package/shell/review/Pins.tsx +8 -6
- package/shell/review/Review.tsx +8 -4
- package/shell/review/ThreadCard.tsx +6 -14
- package/shell/review/review.css +37 -24
- package/skills/miles-review/SKILL.md +1 -1
package/core/review/model.ts
CHANGED
|
@@ -119,12 +119,23 @@ export type Comment = {
|
|
|
119
119
|
/** The thread's audience. Set on the root when it is made and copied onto every reply; never changed. */
|
|
120
120
|
audience: Audience;
|
|
121
121
|
/**
|
|
122
|
-
* The thread's number on its prototype, from 1, copied onto every reply.
|
|
123
|
-
*
|
|
122
|
+
* The thread's number on its prototype and audience, from 1, copied onto every reply.
|
|
123
|
+
* Internal and client-facing threads count apart, so a Client's numbers run 1, 2, 3 with no
|
|
124
|
+
* gap where an internal thread sits; `threadLabel` tells the two apart. Never reused, so a
|
|
125
|
+
* deleted thread moves no other number. 0 for a thread stored before numbers existed.
|
|
124
126
|
*/
|
|
125
127
|
number: number;
|
|
126
128
|
};
|
|
127
129
|
|
|
130
|
+
/**
|
|
131
|
+
* How a thread is named in words, for a screen reader and an agent: `I2` for internal thread 2,
|
|
132
|
+
* `2` for client-facing thread 2, '' for a thread stored before numbers. The pin, the card
|
|
133
|
+
* and `comments pull` use it, so "fix I2" names one thread. The pin and the card's badge show
|
|
134
|
+
* the bare number; their amber says internal.
|
|
135
|
+
*/
|
|
136
|
+
export const threadLabel = (c: Pick<Comment, 'audience' | 'number'>): string =>
|
|
137
|
+
!c.number ? '' : c.audience === 'internal' ? `I${c.number}` : String(c.number);
|
|
138
|
+
|
|
128
139
|
/**
|
|
129
140
|
* A stored comment as the rules read it. A record with no audience, or one
|
|
130
141
|
* that is not a known value, is internal: a missing field never shows a
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'node:assert/strict';
|
|
2
2
|
import { beforeEach, test } from 'node:test';
|
|
3
|
-
import { type Anchor, accessEnd, type Person } from './model.ts';
|
|
3
|
+
import { type Anchor, accessEnd, type Comment, type Person, threadLabel } from './model.ts';
|
|
4
4
|
import { createReview, type Review, ReviewError } from './service.ts';
|
|
5
5
|
import { KEY, type KV, memoryKV, type Snapshot } from './store.ts';
|
|
6
6
|
|
|
@@ -678,29 +678,73 @@ test('a Client still works on client-facing threads, Studio’s replies included
|
|
|
678
678
|
assert.deepEqual(await review.remove(client, { ...at, id: t.clientReply.id }), [t.clientReply.id]);
|
|
679
679
|
});
|
|
680
680
|
|
|
681
|
-
test('numbers are fixed:
|
|
681
|
+
test('numbers are fixed: internal and client-facing threads count apart, and none moves or is reused', async () => {
|
|
682
682
|
const t = await twoThreads();
|
|
683
683
|
const third = await review.add(client, { body: 'Third', anchor });
|
|
684
|
-
|
|
684
|
+
const ours = await review.add(studio, { body: 'Ours too', anchor });
|
|
685
|
+
assert.deepEqual(
|
|
686
|
+
[t.internal, t.shared, third, ours].map((c) => [c.audience, c.number]),
|
|
687
|
+
[
|
|
688
|
+
['internal', 1],
|
|
689
|
+
['client', 1],
|
|
690
|
+
['client', 2],
|
|
691
|
+
['internal', 2],
|
|
692
|
+
],
|
|
693
|
+
);
|
|
694
|
+
assert.deepEqual([t.internal, t.shared, third, ours].map(threadLabel), ['I1', '1', '2', 'I2']);
|
|
685
695
|
// Replies carry their thread's number.
|
|
686
|
-
assert.deepEqual([t.internalReply.number, t.studioReply.number], [1,
|
|
687
|
-
// A Client sees
|
|
688
|
-
const roots = (cs:
|
|
689
|
-
|
|
690
|
-
assert.deepEqual(roots(await review.listComments(client, 'sample-list')), [2, 3]);
|
|
696
|
+
assert.deepEqual([t.internalReply.number, t.studioReply.number], [1, 1]);
|
|
697
|
+
// A Client sees 1 and 2: no gap where an internal thread sits.
|
|
698
|
+
const roots = (cs: Comment[]) => cs.filter((c) => c.id === c.thread).map(threadLabel);
|
|
699
|
+
assert.deepEqual(roots(await review.listComments(client, 'sample-list')), ['1', '2']);
|
|
691
700
|
await review.remove(studio, { prototype: 'sample-list', id: t.shared.id });
|
|
692
|
-
assert.deepEqual(roots(await review.listComments(studio, 'sample-list')), [
|
|
693
|
-
assert.deepEqual(roots(await review.listComments(client, 'sample-list')), [
|
|
694
|
-
assert.equal((await review.add(client, { body: 'Fourth', anchor })).number,
|
|
701
|
+
assert.deepEqual(roots(await review.listComments(studio, 'sample-list')), ['I1', '2', 'I2']);
|
|
702
|
+
assert.deepEqual(roots(await review.listComments(client, 'sample-list')), ['2']);
|
|
703
|
+
assert.equal((await review.add(client, { body: 'Fourth', anchor })).number, 3);
|
|
695
704
|
});
|
|
696
705
|
|
|
697
706
|
test('numbers count per prototype', async () => {
|
|
698
707
|
const a = await review.add(client, { body: 'A1', anchor });
|
|
699
708
|
const b = await review.add(client, { body: 'B1', anchor: { ...anchor, prototype: 'other' } });
|
|
700
|
-
const a2 = await review.add(studio, { body: 'A2', anchor });
|
|
709
|
+
const a2 = await review.add(studio, { body: 'A2', anchor, audience: 'client' });
|
|
701
710
|
assert.deepEqual([a.number, b.number, a2.number], [1, 1, 2]);
|
|
702
711
|
});
|
|
703
712
|
|
|
713
|
+
test('the internal count starts past internal threads numbered while the two shared one count', async () => {
|
|
714
|
+
const kv = memoryKV();
|
|
715
|
+
const r = createReview(kv);
|
|
716
|
+
const root = { ...studio, id: 'cli' };
|
|
717
|
+
// Under one shared count: internal 1, client-facing 2, internal 3.
|
|
718
|
+
const shared = [
|
|
719
|
+
{ id: 'a', audience: 'internal', number: 1 },
|
|
720
|
+
{ id: 'b', audience: 'client', number: 2 },
|
|
721
|
+
{ id: 'c', audience: 'internal', number: 3 },
|
|
722
|
+
];
|
|
723
|
+
await kv.sadd(KEY.prototypes, 'sample-list');
|
|
724
|
+
await kv.hset(KEY.counters, 'sample-list', '3');
|
|
725
|
+
for (const c of shared)
|
|
726
|
+
await kv.hset(
|
|
727
|
+
KEY.comments('sample-list'),
|
|
728
|
+
c.id,
|
|
729
|
+
JSON.stringify({
|
|
730
|
+
...c,
|
|
731
|
+
thread: c.id,
|
|
732
|
+
author: { id: 'cli', name: 'Ed', team: 'Studio' },
|
|
733
|
+
body: 'Before',
|
|
734
|
+
createdAt: '2030-01-01T00:00:00Z',
|
|
735
|
+
editedAt: null,
|
|
736
|
+
anchor,
|
|
737
|
+
status: 'open',
|
|
738
|
+
resolvedBy: null,
|
|
739
|
+
triage: null,
|
|
740
|
+
}),
|
|
741
|
+
);
|
|
742
|
+
const next = await r.add(root, { body: 'After', anchor });
|
|
743
|
+
assert.deepEqual([next.audience, next.number], ['internal', 4]);
|
|
744
|
+
assert.equal((await r.add(root, { body: 'Again', anchor })).number, 5);
|
|
745
|
+
assert.equal((await r.add(root, { body: 'For them', anchor, audience: 'client' })).number, 4);
|
|
746
|
+
});
|
|
747
|
+
|
|
704
748
|
test('a stored comment without an audience is internal, and one without a number has none', async () => {
|
|
705
749
|
const kv = memoryKV();
|
|
706
750
|
const r = createReview(kv);
|
package/core/review/service.ts
CHANGED
|
@@ -188,6 +188,24 @@ export function createReview(kv: KV, overrides: Partial<Deps> = {}) {
|
|
|
188
188
|
|
|
189
189
|
// Every comment read goes through readComment, so a record with no audience reads as internal.
|
|
190
190
|
// Unfiltered: nothing below hands these out without visibleTo or seen.
|
|
191
|
+
/**
|
|
192
|
+
* The next thread number for an audience on a prototype. Atomic and only raised: two threads at
|
|
193
|
+
* once get two numbers, and a failed save skips one. Client-facing threads keep the field
|
|
194
|
+
* numbers always had. Internal threads count in their own, which starts past any internal
|
|
195
|
+
* thread numbered before the two counted apart, so no internal number is given twice.
|
|
196
|
+
*/
|
|
197
|
+
const nextNumber = async (prototype: string, audience: Audience): Promise<number> => {
|
|
198
|
+
if (audience === 'client') return kv.hincrby(KEY.counters, prototype, 1);
|
|
199
|
+
const field = `${prototype}:internal`;
|
|
200
|
+
const n = await kv.hincrby(KEY.counters, field, 1);
|
|
201
|
+
if (n !== 1) return n;
|
|
202
|
+
const before = Math.max(
|
|
203
|
+
0,
|
|
204
|
+
...(await commentsOf(prototype)).filter((c) => c.audience === 'internal').map((c) => c.number),
|
|
205
|
+
);
|
|
206
|
+
return before ? kv.hincrby(KEY.counters, field, before) : n;
|
|
207
|
+
};
|
|
208
|
+
|
|
191
209
|
const commentsOf = async (prototype: string) =>
|
|
192
210
|
Object.values(await kv.hgetall(KEY.comments(prototype)))
|
|
193
211
|
.map(readComment)
|
|
@@ -377,7 +395,7 @@ export function createReview(kv: KV, overrides: Partial<Deps> = {}) {
|
|
|
377
395
|
/**
|
|
378
396
|
* A new thread. A Client's is client-facing whatever the input says;
|
|
379
397
|
* Studio's is internal unless `audience` is 'client'. Its number is the
|
|
380
|
-
* prototype
|
|
398
|
+
* next of its audience on the prototype, never one used before.
|
|
381
399
|
*/
|
|
382
400
|
async add(
|
|
383
401
|
actor: Person | null,
|
|
@@ -408,9 +426,9 @@ export function createReview(kv: KV, overrides: Partial<Deps> = {}) {
|
|
|
408
426
|
resolvedBy: null,
|
|
409
427
|
triage,
|
|
410
428
|
audience: audienceFor(actor, asked),
|
|
411
|
-
|
|
412
|
-
number: await kv.hincrby(KEY.counters, anchor.prototype, 1),
|
|
429
|
+
number: 0,
|
|
413
430
|
};
|
|
431
|
+
c.number = await nextNumber(anchor.prototype, c.audience);
|
|
414
432
|
await kv.sadd(KEY.prototypes, anchor.prototype);
|
|
415
433
|
await saveComment(anchor.prototype, c);
|
|
416
434
|
return c;
|
package/core/review/store.ts
CHANGED
|
@@ -34,7 +34,10 @@ export const KEY = {
|
|
|
34
34
|
/** Project settings, one field each: `access` is the default access length. */
|
|
35
35
|
settings: `${PREFIX}settings`,
|
|
36
36
|
prototypes: `${PREFIX}prototypes`,
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* The last thread number given on each prototype, only ever raised by HINCRBY: field
|
|
39
|
+
* `<prototype>` counts client-facing threads, `<prototype>:internal` internal ones.
|
|
40
|
+
*/
|
|
38
41
|
counters: `${PREFIX}counters`,
|
|
39
42
|
comments: (prototype: string) => `${PREFIX}comments:${prototype}`,
|
|
40
43
|
} as const;
|
|
@@ -96,11 +96,20 @@ export type Comment = {
|
|
|
96
96
|
/** The thread's audience. Set on the root when it is made and copied onto every reply; never changed. */
|
|
97
97
|
audience: Audience;
|
|
98
98
|
/**
|
|
99
|
-
* The thread's number on its prototype, from 1, copied onto every reply.
|
|
100
|
-
*
|
|
99
|
+
* The thread's number on its prototype and audience, from 1, copied onto every reply.
|
|
100
|
+
* Internal and client-facing threads count apart, so a Client's numbers run 1, 2, 3 with no
|
|
101
|
+
* gap where an internal thread sits; `threadLabel` tells the two apart. Never reused, so a
|
|
102
|
+
* deleted thread moves no other number. 0 for a thread stored before numbers existed.
|
|
101
103
|
*/
|
|
102
104
|
number: number;
|
|
103
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* How a thread is named in words, for a screen reader and an agent: `I2` for internal thread 2,
|
|
108
|
+
* `2` for client-facing thread 2, '' for a thread stored before numbers. The pin, the card
|
|
109
|
+
* and `comments pull` use it, so "fix I2" names one thread. The pin and the card's badge show
|
|
110
|
+
* the bare number; their amber says internal.
|
|
111
|
+
*/
|
|
112
|
+
export declare const threadLabel: (c: Pick<Comment, 'audience' | 'number'>) => string;
|
|
104
113
|
/**
|
|
105
114
|
* A stored comment as the rules read it. A record with no audience, or one
|
|
106
115
|
* that is not a known value, is internal: a missing field never shows a
|
|
@@ -46,6 +46,13 @@ export const LIMITS = {
|
|
|
46
46
|
states: 50,
|
|
47
47
|
stateName: 120,
|
|
48
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* How a thread is named in words, for a screen reader and an agent: `I2` for internal thread 2,
|
|
51
|
+
* `2` for client-facing thread 2, '' for a thread stored before numbers. The pin, the card
|
|
52
|
+
* and `comments pull` use it, so "fix I2" names one thread. The pin and the card's badge show
|
|
53
|
+
* the bare number; their amber says internal.
|
|
54
|
+
*/
|
|
55
|
+
export const threadLabel = (c) => !c.number ? '' : c.audience === 'internal' ? `I${c.number}` : String(c.number);
|
|
49
56
|
/**
|
|
50
57
|
* A stored comment as the rules read it. A record with no audience, or one
|
|
51
58
|
* that is not a known value, is internal: a missing field never shows a
|
|
@@ -64,7 +64,7 @@ export declare function createReview(kv: KV, overrides?: Partial<Deps>): {
|
|
|
64
64
|
/**
|
|
65
65
|
* A new thread. A Client's is client-facing whatever the input says;
|
|
66
66
|
* Studio's is internal unless `audience` is 'client'. Its number is the
|
|
67
|
-
* prototype
|
|
67
|
+
* next of its audience on the prototype, never one used before.
|
|
68
68
|
*/
|
|
69
69
|
add(actor: Person | null, input: {
|
|
70
70
|
body?: unknown;
|
|
@@ -135,6 +135,22 @@ export function createReview(kv, overrides = {}) {
|
|
|
135
135
|
}
|
|
136
136
|
// Every comment read goes through readComment, so a record with no audience reads as internal.
|
|
137
137
|
// Unfiltered: nothing below hands these out without visibleTo or seen.
|
|
138
|
+
/**
|
|
139
|
+
* The next thread number for an audience on a prototype. Atomic and only raised: two threads at
|
|
140
|
+
* once get two numbers, and a failed save skips one. Client-facing threads keep the field
|
|
141
|
+
* numbers always had. Internal threads count in their own, which starts past any internal
|
|
142
|
+
* thread numbered before the two counted apart, so no internal number is given twice.
|
|
143
|
+
*/
|
|
144
|
+
const nextNumber = async (prototype, audience) => {
|
|
145
|
+
if (audience === 'client')
|
|
146
|
+
return kv.hincrby(KEY.counters, prototype, 1);
|
|
147
|
+
const field = `${prototype}:internal`;
|
|
148
|
+
const n = await kv.hincrby(KEY.counters, field, 1);
|
|
149
|
+
if (n !== 1)
|
|
150
|
+
return n;
|
|
151
|
+
const before = Math.max(0, ...(await commentsOf(prototype)).filter((c) => c.audience === 'internal').map((c) => c.number));
|
|
152
|
+
return before ? kv.hincrby(KEY.counters, field, before) : n;
|
|
153
|
+
};
|
|
138
154
|
const commentsOf = async (prototype) => Object.values(await kv.hgetall(KEY.comments(prototype)))
|
|
139
155
|
.map(readComment)
|
|
140
156
|
.sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id));
|
|
@@ -302,7 +318,7 @@ export function createReview(kv, overrides = {}) {
|
|
|
302
318
|
/**
|
|
303
319
|
* A new thread. A Client's is client-facing whatever the input says;
|
|
304
320
|
* Studio's is internal unless `audience` is 'client'. Its number is the
|
|
305
|
-
* prototype
|
|
321
|
+
* next of its audience on the prototype, never one used before.
|
|
306
322
|
*/
|
|
307
323
|
async add(actor, input) {
|
|
308
324
|
allow(actor, 'comment');
|
|
@@ -326,9 +342,9 @@ export function createReview(kv, overrides = {}) {
|
|
|
326
342
|
resolvedBy: null,
|
|
327
343
|
triage,
|
|
328
344
|
audience: audienceFor(actor, asked),
|
|
329
|
-
|
|
330
|
-
number: await kv.hincrby(KEY.counters, anchor.prototype, 1),
|
|
345
|
+
number: 0,
|
|
331
346
|
};
|
|
347
|
+
c.number = await nextNumber(anchor.prototype, c.audience);
|
|
332
348
|
await kv.sadd(KEY.prototypes, anchor.prototype);
|
|
333
349
|
await saveComment(anchor.prototype, c);
|
|
334
350
|
return c;
|
|
@@ -21,7 +21,10 @@ export declare const KEY: {
|
|
|
21
21
|
/** Project settings, one field each: `access` is the default access length. */
|
|
22
22
|
readonly settings: "hub3:settings";
|
|
23
23
|
readonly prototypes: "hub3:prototypes";
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* The last thread number given on each prototype, only ever raised by HINCRBY: field
|
|
26
|
+
* `<prototype>` counts client-facing threads, `<prototype>:internal` internal ones.
|
|
27
|
+
*/
|
|
25
28
|
readonly counters: "hub3:counters";
|
|
26
29
|
readonly comments: (prototype: string) => string;
|
|
27
30
|
};
|
|
@@ -20,7 +20,10 @@ export const KEY = {
|
|
|
20
20
|
/** Project settings, one field each: `access` is the default access length. */
|
|
21
21
|
settings: `${PREFIX}settings`,
|
|
22
22
|
prototypes: `${PREFIX}prototypes`,
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* The last thread number given on each prototype, only ever raised by HINCRBY: field
|
|
25
|
+
* `<prototype>` counts client-facing threads, `<prototype>:internal` internal ones.
|
|
26
|
+
*/
|
|
24
27
|
counters: `${PREFIX}counters`,
|
|
25
28
|
comments: (prototype) => `${PREFIX}comments:${prototype}`,
|
|
26
29
|
};
|
package/dist/scripts/comments.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
7
7
|
import { join, relative } from 'node:path';
|
|
8
8
|
import { featureTitle } from '../core/feature.js';
|
|
9
|
-
import { KINDS } from '../core/review/model.js';
|
|
9
|
+
import { KINDS, threadLabel } from '../core/review/model.js';
|
|
10
10
|
import { jevTriager } from '../core/review/triage.js';
|
|
11
11
|
import { checks } from '../server/checks.js';
|
|
12
12
|
import { readEnv } from '../server/env.js';
|
|
@@ -47,8 +47,9 @@ function threadLines(root, comments) {
|
|
|
47
47
|
: '';
|
|
48
48
|
const resolved = root.status === 'resolved' ? ' Resolved.' : '';
|
|
49
49
|
const replies = comments.filter((c) => c.thread === root.id && !isRoot(c));
|
|
50
|
-
// The
|
|
51
|
-
const
|
|
50
|
+
// The label the panel shows (I2 internal, 2 client-facing, none before numbers), then who it is for.
|
|
51
|
+
const label = threadLabel(root);
|
|
52
|
+
const head = `${label ? `#${label} ` : ''}(${AUDIENCE_WORD[root.audience]})`;
|
|
52
53
|
return [
|
|
53
54
|
`- ${head} ${line(root)}${where}${resolved} id \`${root.id}\``,
|
|
54
55
|
...replies.map((r) => ` - ${line(r)}`),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milesroxas/design-hub",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "The Design Hub product: the hub that lists and serves prototypes, the review panel and its API, the sign-in gate, the kit, and the design-hub CLI. A project installs it and keeps only its prototypes, kit materials and docs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
package/shell/review/Pins.tsx
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
// button in the tab order. The button is the hit area and never changes size;
|
|
4
4
|
// the face inside it is what presses and lifts, so a press near the edge
|
|
5
5
|
// still ends on the pin. An open thread's pin is solid and numbered; an
|
|
6
|
-
// open internal one is numbered
|
|
7
|
-
// resolved one is pale and carries a check.
|
|
8
|
-
// never its place in the list.
|
|
6
|
+
// open internal one is numbered on amber, the colour of an internal note, its
|
|
7
|
+
// colour alone telling it apart; a resolved one is pale and carries a check.
|
|
8
|
+
// The number is the thread's own, never its place in the list. The label read
|
|
9
|
+
// out (Comment I2) keeps the I, so two threads never sound alike.
|
|
9
10
|
import { Icon } from '@kit/Icon';
|
|
10
11
|
import { useEffect, useRef } from 'react';
|
|
11
|
-
import type
|
|
12
|
+
import { type Comment, threadLabel } from '../../core/review/model';
|
|
12
13
|
import { pinPoint } from './anchor';
|
|
13
14
|
import { draftPoint } from './PickLayer';
|
|
14
15
|
import type { Draft } from './view';
|
|
@@ -18,10 +19,11 @@ const moveTo = (el: HTMLElement, at: { x: number; y: number } | null) => {
|
|
|
18
19
|
if (at) el.style.transform = `translate(${at.x}px, ${at.y}px)`;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
/** "Comment
|
|
22
|
+
/** "Comment I3, internal, resolved, by Rae": the label when it has one, then what the face shows. */
|
|
22
23
|
function pinLabel(c: Comment): string {
|
|
24
|
+
const label = threadLabel(c);
|
|
23
25
|
const words = [
|
|
24
|
-
|
|
26
|
+
label ? `Comment ${label}` : 'Comment',
|
|
25
27
|
c.audience === 'internal' && 'internal',
|
|
26
28
|
c.status === 'resolved' && 'resolved',
|
|
27
29
|
];
|
package/shell/review/Review.tsx
CHANGED
|
@@ -382,7 +382,7 @@ const AUDIENCES: { value: Audience; label: string; title: string }[] = [
|
|
|
382
382
|
{ value: 'client', label: 'Client-facing', title: 'Everyone sees it, the client included' },
|
|
383
383
|
];
|
|
384
384
|
|
|
385
|
-
/** Studio's choice on a new thread. Fixed once posted: to tell the client later, write a new one. */
|
|
385
|
+
/** Studio's choice on a new thread, in the head beside the title. Fixed once posted: to tell the client later, write a new one. */
|
|
386
386
|
function AudienceChoice({ value, onChange }: { value: Audience; onChange: (a: Audience) => void }) {
|
|
387
387
|
return (
|
|
388
388
|
// biome-ignore lint/a11y/useSemanticElements: a fieldset brings a border and a legend the card does not want
|
|
@@ -420,10 +420,15 @@ function DraftCard({
|
|
|
420
420
|
const [chosen, setChosen] = useState<Audience>('internal');
|
|
421
421
|
const sent = audience === 'choose' ? chosen : audience;
|
|
422
422
|
return (
|
|
423
|
-
|
|
423
|
+
// The highlight shows sighted people what it is on; the label tells everyone else.
|
|
424
|
+
<Card
|
|
425
|
+
at={draftPoint(draft)}
|
|
426
|
+
label={`New comment on ${describe(draft.target)}`}
|
|
427
|
+
onDismiss={() => dispatch({ type: 'close' })}
|
|
428
|
+
>
|
|
424
429
|
<header className="rv-card-head">
|
|
425
430
|
<h2 className="rv-title">New comment</h2>
|
|
426
|
-
<
|
|
431
|
+
{audience === 'choose' && <AudienceChoice value={chosen} onChange={setChosen} />}
|
|
427
432
|
<span className="rv-spacer" />
|
|
428
433
|
<Button
|
|
429
434
|
kind="tertiary"
|
|
@@ -434,7 +439,6 @@ function DraftCard({
|
|
|
434
439
|
onClick={() => dispatch({ type: 'close' })}
|
|
435
440
|
/>
|
|
436
441
|
</header>
|
|
437
|
-
{audience === 'choose' && <AudienceChoice value={chosen} onChange={setChosen} />}
|
|
438
442
|
<div className="rv-card-foot">
|
|
439
443
|
<Field
|
|
440
444
|
label="New comment"
|
|
@@ -8,12 +8,11 @@
|
|
|
8
8
|
import { Icon } from '@kit/Icon';
|
|
9
9
|
import { Button, type MenuEntry, useMenu } from '@kit/ui';
|
|
10
10
|
import { type KeyboardEvent, useEffect, useState } from 'react';
|
|
11
|
-
import { type Audience, type Comment, KINDS, type Kind, LIMITS } from '../../core/review/model';
|
|
11
|
+
import { type Audience, type Comment, KINDS, type Kind, LIMITS, threadLabel } from '../../core/review/model';
|
|
12
12
|
import { can } from '../../core/review/policy';
|
|
13
13
|
import { Action, Card } from './Card';
|
|
14
14
|
import { act, type Me, type ReviewStore } from './client';
|
|
15
15
|
import { Field, useTextBox } from './Field';
|
|
16
|
-
import { describe } from './PickLayer';
|
|
17
16
|
|
|
18
17
|
const KIND_LABEL: Record<Kind, string> = { bug: 'Bug', taste: 'Taste', copy: 'Copy' };
|
|
19
18
|
const AUDIENCE_LABEL: Record<Audience, string> = { internal: 'Internal', client: 'Client-facing' };
|
|
@@ -33,14 +32,6 @@ function ago(iso: string): string {
|
|
|
33
32
|
return 'just now';
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
/** What the comment is on, in a few words. */
|
|
37
|
-
function about(root: Comment): string {
|
|
38
|
-
const target = root.anchor?.target;
|
|
39
|
-
if (!target) return 'On the page';
|
|
40
|
-
const el = document.querySelector(target);
|
|
41
|
-
return el ? `On ${describe(el)}` : 'On another view';
|
|
42
|
-
}
|
|
43
|
-
|
|
44
35
|
function Avatar({ name }: { name: string }) {
|
|
45
36
|
const initials = name
|
|
46
37
|
.split(/[\s-]+/)
|
|
@@ -398,7 +389,7 @@ type HeadProps = {
|
|
|
398
389
|
onDelete: () => void;
|
|
399
390
|
};
|
|
400
391
|
|
|
401
|
-
/**
|
|
392
|
+
/** Its number and who it is for, then its one decision and the rest. The pin beside the card already shows what it is on. */
|
|
402
393
|
function ThreadHead({
|
|
403
394
|
store,
|
|
404
395
|
root,
|
|
@@ -416,15 +407,15 @@ function ThreadHead({
|
|
|
416
407
|
}: HeadProps) {
|
|
417
408
|
return (
|
|
418
409
|
<header className="rv-card-head">
|
|
419
|
-
<span className="rv-no" aria-hidden="true">
|
|
410
|
+
<span className="rv-no" data-audience={root.audience} aria-hidden="true">
|
|
420
411
|
{root.status === 'resolved' ? <Icon name="check" size={12} /> : root.number || null}
|
|
421
412
|
</span>
|
|
422
|
-
<span className="rv-about rv-ellipsis">{about(root)}</span>
|
|
423
413
|
{mark && (
|
|
424
414
|
<span className="rv-aud" data-audience={root.audience}>
|
|
425
415
|
{AUDIENCE_LABEL[root.audience]}
|
|
426
416
|
</span>
|
|
427
417
|
)}
|
|
418
|
+
<span className="rv-spacer" />
|
|
428
419
|
<Stepper index={index} total={total} onStep={onStep} />
|
|
429
420
|
{canResolve && <ResolveButton store={store} root={root} />}
|
|
430
421
|
<ThreadMenu
|
|
@@ -477,7 +468,8 @@ export function ThreadCard({
|
|
|
477
468
|
}) {
|
|
478
469
|
const [confirming, setConfirming] = useState(false);
|
|
479
470
|
const resolved = root.status === 'resolved';
|
|
480
|
-
const
|
|
471
|
+
const label = threadLabel(root);
|
|
472
|
+
const words = [label ? `Comment ${label}` : 'Comment', mark && AUDIENCE_LABEL[root.audience]];
|
|
481
473
|
return (
|
|
482
474
|
<Card
|
|
483
475
|
at={at}
|
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 ---------- */
|
|
@@ -301,16 +304,16 @@
|
|
|
301
304
|
.rv-alert.rv-viewing .icon { flex: none; color: var(--harness-fg-muted); }
|
|
302
305
|
|
|
303
306
|
/* ---------- pins ---------- */
|
|
304
|
-
/* Open: solid and numbered. Internal (Studio only): numbered
|
|
305
|
-
|
|
306
|
-
pale, a check where the number was. The open card's pin
|
|
307
|
-
face, so it reads as selected. */
|
|
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. */
|
|
308
311
|
.rv-pins { position: fixed; inset: 0; z-index: var(--rv-z-page); pointer-events: none; }
|
|
309
312
|
.rv-pin {
|
|
310
313
|
position: absolute;
|
|
311
314
|
top: -24px;
|
|
312
315
|
left: 0;
|
|
313
|
-
width: 24px;
|
|
316
|
+
min-width: 24px;
|
|
314
317
|
height: 24px;
|
|
315
318
|
padding: 0;
|
|
316
319
|
border: 0;
|
|
@@ -322,11 +325,14 @@
|
|
|
322
325
|
.rv-pin::before { content: ''; position: absolute; inset: -10px; }
|
|
323
326
|
.rv-pin[hidden] { display: none; }
|
|
324
327
|
.rv-pin:focus-visible { outline: none; }
|
|
328
|
+
/* Grows from its tip for a longer number (128), never shrinks below a circle. */
|
|
325
329
|
.rv-pin-face {
|
|
330
|
+
box-sizing: border-box;
|
|
326
331
|
display: grid;
|
|
327
332
|
place-items: center;
|
|
328
|
-
width:
|
|
333
|
+
min-width: 24px;
|
|
329
334
|
height: 100%;
|
|
335
|
+
padding: 0 5px;
|
|
330
336
|
border: 2px solid oklch(1 0 0);
|
|
331
337
|
border-radius: 12px 12px 12px 3px;
|
|
332
338
|
background: var(--rv-pin);
|
|
@@ -344,11 +350,14 @@
|
|
|
344
350
|
.rv-pin:active .rv-pin-face { scale: 0.94; }
|
|
345
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); }
|
|
346
352
|
.rv-pin[data-active] .rv-pin-face { background: oklch(1 0 0); color: var(--rv-pin); border-color: var(--rv-pin); }
|
|
347
|
-
.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; }
|
|
348
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); }
|
|
349
356
|
.rv-pin[data-resolved][data-active] .rv-pin-face { background: var(--rv-pin); color: var(--rv-done); border-color: oklch(1 0 0); }
|
|
350
|
-
.rv-pin[data-internal]:not([data-resolved]) .rv-pin-face { background:
|
|
351
|
-
.rv-pin[data-internal]
|
|
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); }
|
|
352
361
|
.rv-pin[data-new] { pointer-events: none; }
|
|
353
362
|
.rv-pin[data-new] .rv-pin-face { background: oklch(1 0 0); border-color: var(--rv-pin); }
|
|
354
363
|
|
|
@@ -369,7 +378,7 @@
|
|
|
369
378
|
}
|
|
370
379
|
@starting-style { .rv-card { opacity: 0; transform: scale(0.97); } }
|
|
371
380
|
|
|
372
|
-
/* 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. */
|
|
373
382
|
.rv-card-head {
|
|
374
383
|
display: flex;
|
|
375
384
|
flex: none;
|
|
@@ -378,14 +387,17 @@
|
|
|
378
387
|
min-height: 44px;
|
|
379
388
|
padding: 6px 6px 0 14px;
|
|
380
389
|
}
|
|
381
|
-
.rv-card-head .rv-title
|
|
382
|
-
.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; }
|
|
383
391
|
.rv-step { margin: 0 2px; font-size: 12px; }
|
|
384
|
-
/* Who the thread is for, Studio only: a hairline tag, quieter than kind and state.
|
|
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; }
|
|
385
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; }
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
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; }
|
|
389
401
|
.rv-no {
|
|
390
402
|
display: inline-grid;
|
|
391
403
|
flex: none;
|
|
@@ -400,7 +412,7 @@
|
|
|
400
412
|
font-weight: 700;
|
|
401
413
|
font-variant-numeric: tabular-nums;
|
|
402
414
|
}
|
|
403
|
-
/* 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. */
|
|
404
416
|
.rv .btn.rv-resolve { height: 28px; padding: 0 10px 0 8px; color: var(--harness-fg); background: var(--rv-fill); }
|
|
405
417
|
.rv .btn.rv-resolve .icon { color: var(--rv-done); }
|
|
406
418
|
.rv .btn.rv-resolve.is-done .icon { color: var(--harness-fg-muted); }
|
|
@@ -415,6 +427,7 @@
|
|
|
415
427
|
.rv-card-foot.rv-confirm { transition: opacity var(--dur-menu) var(--ease-out); }
|
|
416
428
|
|
|
417
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); }
|
|
418
431
|
.rv-card[data-resolved] .rv-no { background: var(--rv-fill-open); color: var(--rv-done); }
|
|
419
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); }
|
|
420
433
|
@starting-style { .rv-band { opacity: 0; translate: 0 -4px; } }
|
|
@@ -571,8 +584,8 @@
|
|
|
571
584
|
.rv-card[data-sheet][data-dragging] { transition: none; }
|
|
572
585
|
.rv-card[data-sheet][data-leaving] { transition: transform 200ms var(--ease-out); }
|
|
573
586
|
.rv-card[data-sheet] .rv-card-head { touch-action: none; min-height: 44px; padding-top: 4px; }
|
|
574
|
-
|
|
575
|
-
.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; }
|
|
576
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; }
|
|
577
590
|
.rv-card[data-sheet] .rv-card-body { padding-inline: 16px; }
|
|
578
591
|
.rv-card[data-sheet] .rv-card-foot { padding: 0 12px 12px; }
|
|
@@ -589,9 +602,9 @@
|
|
|
589
602
|
}
|
|
590
603
|
@starting-style { .rv-bar { opacity: 1; transform: translateY(100%); } }
|
|
591
604
|
.rv-bar { transition: transform var(--dur-sheet, 320ms) var(--ease-drawer), opacity var(--dur-dialog) var(--ease-out); }
|
|
592
|
-
.rv-toggle { height: 40px; border-radius: 20px; margin-right: auto; }
|
|
605
|
+
.rv-bar .rv-toggle { height: 40px; border-radius: 20px; margin-right: auto; }
|
|
593
606
|
.rv-bar-rule { display: none; }
|
|
594
|
-
.rv-toggle button { height: 36px; border-radius: 18px; }
|
|
607
|
+
.rv-bar .rv-toggle button { height: 36px; border-radius: 18px; }
|
|
595
608
|
.rv-bar .btn { width: 40px; height: 40px; border-radius: 20px; }
|
|
596
609
|
.rv-stepper-count { min-width: 52px; }
|
|
597
610
|
.rv-alert { margin: 0 12px 8px; max-width: none; }
|
|
@@ -600,7 +613,7 @@
|
|
|
600
613
|
|
|
601
614
|
/* The narrowest phones: the toggle keeps its icons, its words go to the screen reader. */
|
|
602
615
|
@media (max-width: 400px) {
|
|
603
|
-
.rv-toggle button { width: 44px; padding: 0; justify-content: center; }
|
|
616
|
+
.rv-bar .rv-toggle button { width: 44px; padding: 0; justify-content: center; }
|
|
604
617
|
.rv-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
605
618
|
.rv-stepper-count { min-width: 44px; }
|
|
606
619
|
}
|
|
@@ -7,7 +7,7 @@ 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
|
|
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
11
|
|
|
12
12
|
## Working from comments
|
|
13
13
|
|