@milesroxas/design-hub 0.12.0 → 0.14.0
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/README.md +5 -5
- package/core/prototype.test.ts +12 -1
- package/core/prototype.ts +21 -2
- package/core/review/model.ts +71 -6
- package/core/review/service.test.ts +575 -39
- package/core/review/service.ts +452 -25
- package/core/review/store.ts +47 -6
- package/core/review/suite-kv.ts +17 -0
- package/dist/core/prototype.d.ts +20 -2
- package/dist/core/prototype.js +17 -2
- package/dist/core/review/model.d.ts +42 -3
- package/dist/core/review/model.js +52 -3
- package/dist/core/review/service.d.ts +81 -7
- package/dist/core/review/service.js +407 -23
- package/dist/core/review/store.d.ts +29 -2
- package/dist/core/review/store.js +6 -2
- package/dist/core/review/suite-kv.d.ts +7 -0
- package/dist/core/review/suite-kv.js +12 -0
- package/dist/scripts/client.d.ts +1 -1
- package/dist/scripts/client.js +4 -4
- package/dist/scripts/lib/cli.js +5 -0
- package/dist/scripts/lib/dns.d.ts +16 -2
- package/dist/scripts/lib/dns.js +66 -3
- package/dist/scripts/lib/fake-host.d.ts +17 -3
- package/dist/scripts/lib/fake-host.js +56 -10
- package/dist/scripts/lib/host.d.ts +15 -25
- package/dist/scripts/lib/host.js +15 -324
- package/dist/scripts/lib/resend.d.ts +36 -0
- package/dist/scripts/lib/resend.js +66 -0
- package/dist/scripts/lib/studio-deps.d.ts +23 -0
- package/dist/scripts/lib/studio-deps.js +46 -16
- package/dist/scripts/lib/studios.d.ts +16 -6
- package/dist/scripts/lib/studios.js +28 -10
- package/dist/scripts/lib/vercel-host.d.ts +17 -0
- package/dist/scripts/lib/vercel-host.js +416 -0
- package/dist/scripts/people.d.ts +16 -4
- package/dist/scripts/people.js +67 -17
- package/dist/scripts/share.js +3 -2
- package/dist/scripts/studio.d.ts +26 -4
- package/dist/scripts/studio.js +364 -19
- package/dist/server/api.d.ts +20 -7
- package/dist/server/api.js +83 -27
- package/dist/server/dev.js +21 -1
- package/dist/server/gate.d.ts +120 -0
- package/dist/server/gate.js +808 -0
- package/dist/server/mailer.d.ts +60 -0
- package/dist/server/mailer.js +104 -0
- package/dist/server/mailers/fake.d.ts +8 -0
- package/dist/server/mailers/fake.js +16 -0
- package/dist/server/mailers/resend.d.ts +21 -0
- package/dist/server/mailers/resend.js +49 -0
- package/dist/server/mark.d.ts +17 -0
- package/dist/server/mark.js +46 -1
- package/dist/server/session.d.ts +2 -1
- package/dist/server/session.js +6 -3
- package/dist/server/stores/backends.d.ts +22 -0
- package/dist/server/stores/backends.js +96 -0
- package/dist/server/{fake-upstash.js → stores/fake-upstash.js} +1 -1
- package/dist/server/stores/index.d.ts +41 -0
- package/dist/server/stores/index.js +63 -0
- package/dist/server/stores/pglite.d.ts +16 -0
- package/dist/server/stores/pglite.js +98 -0
- package/dist/server/stores/postgres.d.ts +63 -0
- package/dist/server/stores/postgres.js +153 -0
- package/dist/server/{upstash.d.ts → stores/upstash.d.ts} +1 -1
- package/dist/vercel/files.js +1 -1
- package/dist/vercel/proxy.d.ts +6 -82
- package/dist/vercel/proxy.js +24 -524
- package/dist/vite/plugin.js +4 -2
- package/kit/ui/Menu.tsx +29 -18
- package/kit/ui/layer.ts +41 -0
- package/package.json +3 -1
- package/shell/review/Bar.tsx +1 -0
- package/shell/review/Card.tsx +17 -7
- package/shell/review/People.tsx +908 -134
- package/shell/review/Review.tsx +2 -2
- package/shell/review/anchor.ts +6 -1
- package/shell/review/client.ts +41 -7
- package/shell/review/menu-place.test.ts +41 -0
- package/shell/review/place.test.ts +26 -1
- package/shell/review/place.ts +17 -0
- package/shell/review/review.css +97 -11
- package/shell/review/view.test.ts +115 -1
- package/shell/review/view.ts +92 -2
- package/shell/studio/StudioHub.tsx +1 -0
- package/shell/studio/hub.css +99 -13
- package/skills/miles-deploy/SKILL.md +26 -4
- package/templates/studio/.env.example +9 -0
- package/templates/studio/README.md +13 -0
- package/templates/studio/package.json +1 -1
- /package/dist/server/{fake-upstash.d.ts → stores/fake-upstash.d.ts} +0 -0
- /package/dist/server/{upstash.js → stores/upstash.js} +0 -0
package/shell/review/Review.tsx
CHANGED
|
@@ -294,7 +294,7 @@ function Commenting({ store, s: real, v, dispatch, url, where, states, roots }:
|
|
|
294
294
|
|
|
295
295
|
function PeopleCard({ store, s, onClose }: { store: ReviewStore; s: State; onClose: () => void }) {
|
|
296
296
|
return (
|
|
297
|
-
<Card at={null} label="People" onDismiss={onClose}>
|
|
297
|
+
<Card at={null} by=".rv-bar-more" label="People" onDismiss={onClose}>
|
|
298
298
|
<header className="rv-card-head">
|
|
299
299
|
<h2 className="rv-title">People</h2>
|
|
300
300
|
<span className="rv-spacer" />
|
|
@@ -307,7 +307,7 @@ function PeopleCard({ store, s, onClose }: { store: ReviewStore; s: State; onClo
|
|
|
307
307
|
onClick={onClose}
|
|
308
308
|
/>
|
|
309
309
|
</header>
|
|
310
|
-
<People store={store} me={s.me} people={s.people} access={s.access} />
|
|
310
|
+
<People store={store} me={s.me} people={s.people} access={s.access} mail={s.mail} />
|
|
311
311
|
</Card>
|
|
312
312
|
);
|
|
313
313
|
}
|
package/shell/review/anchor.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// tag:nth-of-type steps, stopping at a stable id, because prototype markup
|
|
4
4
|
// rarely carries test ids and a pin must survive a reload.
|
|
5
5
|
import { restoreDials, snapshotDials } from '@kit/dials';
|
|
6
|
-
import type
|
|
6
|
+
import { type Anchor, isSitePath } from '../../core/review/model';
|
|
7
7
|
|
|
8
8
|
const RESTORE_KEY = 'hub-review-restore';
|
|
9
9
|
const RESTORE_WAIT_MS = 3000;
|
|
@@ -104,6 +104,11 @@ function settleDials(dials: Anchor['dials'], then: (missing: string[]) => void)
|
|
|
104
104
|
*/
|
|
105
105
|
export function openAnchor(anchor: Anchor, commentId: string, done: (missing: string[]) => void): void {
|
|
106
106
|
const url = new URL(anchor.url, location.origin);
|
|
107
|
+
// Someone else wrote the URL: open it only on this site, inside this project's base.
|
|
108
|
+
if (!isSitePath(anchor.url) || !url.pathname.startsWith(import.meta.env.BASE_URL)) {
|
|
109
|
+
done([]);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
107
112
|
if (url.pathname !== location.pathname || url.search !== location.search) {
|
|
108
113
|
try {
|
|
109
114
|
sessionStorage.setItem(RESTORE_KEY, JSON.stringify({ id: commentId, dials: anchor.dials }));
|
package/shell/review/client.ts
CHANGED
|
@@ -11,6 +11,11 @@ import { afterFailure, signedOutState } from './view';
|
|
|
11
11
|
|
|
12
12
|
export type Me = Omit<Person, 'epoch'>;
|
|
13
13
|
|
|
14
|
+
/** How sign-in mail stands, for Studio: off with no mail key, failing while the last send failed. */
|
|
15
|
+
export type MailState = 'off' | 'on' | 'failing';
|
|
16
|
+
/** What an add says of the invite: Resend took it, refused it, did not answer, or none was sent. */
|
|
17
|
+
export type Mailed = 'sent' | 'refused' | 'down' | 'off';
|
|
18
|
+
|
|
14
19
|
/**
|
|
15
20
|
* The scope the page judges its own controls in: the client this page is
|
|
16
21
|
* in, as `me` names it. Studio has no client of its own, so its person's
|
|
@@ -30,6 +35,8 @@ type State = {
|
|
|
30
35
|
people: Me[] | null;
|
|
31
36
|
/** The project default access length, loaded with the people. */
|
|
32
37
|
access: Access | null;
|
|
38
|
+
/** How sign-in mail stands, loaded with the people. */
|
|
39
|
+
mail: MailState | null;
|
|
33
40
|
error: string | null;
|
|
34
41
|
};
|
|
35
42
|
|
|
@@ -119,6 +126,7 @@ export function createReviewStore(prototype: string, client?: string) {
|
|
|
119
126
|
comments: [],
|
|
120
127
|
people: null,
|
|
121
128
|
access: null,
|
|
129
|
+
mail: null,
|
|
122
130
|
error: null,
|
|
123
131
|
};
|
|
124
132
|
const listeners = new Set<() => void>();
|
|
@@ -253,16 +261,37 @@ export function createReviewStore(prototype: string, client?: string) {
|
|
|
253
261
|
|
|
254
262
|
loadPeople: () =>
|
|
255
263
|
attempt(async () => {
|
|
256
|
-
const [{ people }, { access }] = await Promise.all([
|
|
264
|
+
const [{ people }, { access, mail }] = await Promise.all([
|
|
257
265
|
call<{ people: Me[] }>('people', undefined, at),
|
|
258
|
-
call<{ access: Access }>('access', undefined, at),
|
|
266
|
+
call<{ access: Access; mail: MailState | null }>('access', undefined, at),
|
|
259
267
|
]);
|
|
260
|
-
set({ people, access });
|
|
268
|
+
set({ people, access, mail });
|
|
261
269
|
}),
|
|
262
|
-
/**
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
270
|
+
/**
|
|
271
|
+
* A new person; `access` null takes the default for their kind, `email`
|
|
272
|
+
* null is links only, `mail` false sends them no invite. Resolves to their
|
|
273
|
+
* link and what became of the invite, which also says how mail stands now.
|
|
274
|
+
* The server names their team: the studio's for Studio, the client's for a Client.
|
|
275
|
+
*/
|
|
276
|
+
addPerson: async (
|
|
277
|
+
name: string,
|
|
278
|
+
kind: PersonKind,
|
|
279
|
+
access: Access | null,
|
|
280
|
+
email: string | null,
|
|
281
|
+
mail: boolean,
|
|
282
|
+
) => {
|
|
283
|
+
const pending = call<{ person: Me; link: string; mailed: Mailed }>('people.add', {
|
|
284
|
+
name,
|
|
285
|
+
kind,
|
|
286
|
+
...(access ? { access } : {}),
|
|
287
|
+
...(email ? { email, mail } : {}),
|
|
288
|
+
...at,
|
|
289
|
+
});
|
|
290
|
+
const href = await linkOf(pending);
|
|
291
|
+
const { mailed } = await pending;
|
|
292
|
+
if (mailed !== 'off' && state.mail !== 'off') set({ mail: mailed === 'sent' ? 'on' : 'failing' });
|
|
293
|
+
return { href, mailed };
|
|
294
|
+
},
|
|
266
295
|
/** Another one-time link, for another device. */
|
|
267
296
|
newLink: (id: string) => linkOf(call('people.link', { id, ...at })),
|
|
268
297
|
/** Ends every session and unused link; resolves to the one new link. */
|
|
@@ -271,6 +300,11 @@ export function createReviewStore(prototype: string, client?: string) {
|
|
|
271
300
|
attempt(async () =>
|
|
272
301
|
mergePerson((await call<{ person: Me }>('people.access', { id, access, ...at })).person),
|
|
273
302
|
),
|
|
303
|
+
/** Sets or changes the address they sign in with by email; null clears it, links only. */
|
|
304
|
+
setEmail: (id: string, email: string | null) =>
|
|
305
|
+
attempt(async () =>
|
|
306
|
+
mergePerson((await call<{ person: Me }>('people.email', { id, email, ...at })).person),
|
|
307
|
+
),
|
|
274
308
|
revoke: (id: string) =>
|
|
275
309
|
attempt(async () => mergePerson((await call<{ person: Me }>('people.revoke', { id, ...at })).person)),
|
|
276
310
|
clearError: () => set({ error: null }),
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { test } from 'node:test';
|
|
3
|
+
import { placeMenu } from '../../kit/ui/layer.ts';
|
|
4
|
+
|
|
5
|
+
const vp = { width: 1280, height: 800 };
|
|
6
|
+
const menu = { width: 200, height: 160 };
|
|
7
|
+
const box = (left: number, top: number, w = 32, h = 32) => ({ left, top, right: left + w, bottom: top + h });
|
|
8
|
+
|
|
9
|
+
test('a menu opens below its trigger when it fits, and grows from the trigger', () => {
|
|
10
|
+
const at = placeMenu(box(600, 100), menu, vp, 'end');
|
|
11
|
+
assert.deepEqual(at, { side: 'below', top: 136, left: 432, origin: '200px top' });
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('a menu opens above when below would leave the viewport', () => {
|
|
15
|
+
const at = placeMenu(box(600, 700), menu, vp, 'start');
|
|
16
|
+
assert.deepEqual(at, { side: 'above', top: 536, left: 600, origin: '0px bottom' });
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('a menu the viewport pushed sideways still grows from its trigger', () => {
|
|
20
|
+
const at = placeMenu(box(40, 100), menu, vp, 'end');
|
|
21
|
+
assert.equal(at.left, 8);
|
|
22
|
+
assert.equal(at.origin, '64px top');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('a menu stays inside its card: above, when below would leave the card', () => {
|
|
26
|
+
const card = { left: 900, right: 1220, top: 300, bottom: 620 };
|
|
27
|
+
const at = placeMenu(box(1180, 560), menu, vp, 'end', card);
|
|
28
|
+
assert.equal(at.side, 'above');
|
|
29
|
+
assert.equal(at.origin, '200px bottom');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('a menu that fits its card on neither side takes the side that leaves it least', () => {
|
|
33
|
+
const card = { left: 900, right: 1220, top: 500, bottom: 620 };
|
|
34
|
+
assert.equal(placeMenu(box(1180, 510), menu, vp, 'end', card).side, 'below');
|
|
35
|
+
assert.equal(placeMenu(box(1180, 580), menu, vp, 'end', card).side, 'above');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('a card never sends a menu off the viewport', () => {
|
|
39
|
+
const card = { left: 900, right: 1220, top: 20, bottom: 300 };
|
|
40
|
+
assert.equal(placeMenu(box(1180, 60), menu, vp, 'end', card).side, 'below');
|
|
41
|
+
});
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import assert from 'node:assert/strict';
|
|
2
2
|
import { test } from 'node:test';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
besideButton,
|
|
5
|
+
besidePoint,
|
|
6
|
+
besideTrigger,
|
|
7
|
+
distanceToRect,
|
|
8
|
+
dragOffset,
|
|
9
|
+
nearest,
|
|
10
|
+
shouldDismiss,
|
|
11
|
+
} from './place.ts';
|
|
4
12
|
|
|
5
13
|
const vp = { width: 1280, height: 800 };
|
|
6
14
|
const button = (left: number, top: number) => ({ left, top, right: left + 40, bottom: top + 40 });
|
|
@@ -70,3 +78,20 @@ test('a click near a pin lands on the closest pin within reach, or none', () =>
|
|
|
70
78
|
assert.equal(nearest(110, 160, [a, b], 16), null);
|
|
71
79
|
assert.equal(nearest(110, 110, [], 16), null);
|
|
72
80
|
});
|
|
81
|
+
|
|
82
|
+
test('by the control that opened it: above a bar at the bottom, its end on the control, growing from it', () => {
|
|
83
|
+
// The control spans 600 to 632 across; the bar it sits in spans 740 to 784 down.
|
|
84
|
+
const at = besideTrigger({ left: 600, right: 632, top: 740, bottom: 784 }, 200, vp);
|
|
85
|
+
assert.deepEqual(at, { left: 312, top: 528, origin: '304px bottom' });
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('by a control at the top: below it', () => {
|
|
89
|
+
const at = besideTrigger({ left: 600, right: 632, top: 16, bottom: 60 }, 200, vp);
|
|
90
|
+
assert.deepEqual(at, { left: 312, top: 72, origin: '304px top' });
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('by a control near the left edge: kept on screen, still growing from the control', () => {
|
|
94
|
+
const at = besideTrigger({ left: 40, right: 72, top: 740, bottom: 784 }, 200, vp);
|
|
95
|
+
assert.equal(at.left, 16);
|
|
96
|
+
assert.equal(at.origin, '40px bottom');
|
|
97
|
+
});
|
package/shell/review/place.ts
CHANGED
|
@@ -50,6 +50,23 @@ export function besideButton(b: Rect, h: number, vp: Viewport): Placement {
|
|
|
50
50
|
return middle ? besideMiddle(b, onRight, h, vp) : besideCorner(b, onRight, h, vp);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* By the control that opened it, as a menu would be: above it at the bottom of
|
|
55
|
+
* the page and below it at the top, its end edge on the control's, kept on
|
|
56
|
+
* screen. It grows from the control. `b` is the control across and the bar it
|
|
57
|
+
* sits in up and down, so the card clears the whole bar.
|
|
58
|
+
*/
|
|
59
|
+
export function besideTrigger(b: Rect, h: number, vp: Viewport): Placement {
|
|
60
|
+
const below = (b.top + b.bottom) / 2 < vp.height / 2;
|
|
61
|
+
const left = Math.min(Math.max(EDGE, b.right - CARD_WIDTH), vp.width - CARD_WIDTH - EDGE);
|
|
62
|
+
const x = Math.min(Math.max(0, (b.left + b.right) / 2 - left), CARD_WIDTH);
|
|
63
|
+
return {
|
|
64
|
+
left,
|
|
65
|
+
top: clampTop(below ? b.bottom + AWAY : b.top - AWAY - h, h, vp),
|
|
66
|
+
origin: `${x}px ${below ? 'top' : 'bottom'}`,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
53
70
|
/** How far a dragged sheet moves for a finger `dy` from where it started: freely down, and only a little up, against resistance. */
|
|
54
71
|
export const dragOffset = (dy: number) => (dy >= 0 ? dy : -Math.sqrt(-dy) * 2);
|
|
55
72
|
|
package/shell/review/review.css
CHANGED
|
@@ -60,7 +60,12 @@
|
|
|
60
60
|
--button-tertiary-bg_hover: var(--rv-fill-hover);
|
|
61
61
|
--shadow-xs: none;
|
|
62
62
|
--shadow-md: var(--rv-raised);
|
|
63
|
-
--focus
|
|
63
|
+
--rv-focus: oklch(1 0 0 / 0.7);
|
|
64
|
+
--focus-ring: 0 0 0 2px var(--harness-bg), 0 0 0 4px var(--rv-focus);
|
|
65
|
+
/* An ended access's badge: system.css's dark warning tones, since the panel is always the dark material. */
|
|
66
|
+
--utility-warning-50: oklch(0.279 0.077 45.635);
|
|
67
|
+
--utility-warning-200: oklch(0.414 0.112 45.904);
|
|
68
|
+
--utility-warning-700: oklch(0.879 0.169 91.605);
|
|
64
69
|
--radius-xs: 4px;
|
|
65
70
|
--radius-sm: 8px;
|
|
66
71
|
--radius-md: 12px;
|
|
@@ -543,24 +548,105 @@
|
|
|
543
548
|
/* ---------- people ---------- */
|
|
544
549
|
.rv-card .rv-body { display: flex; flex-direction: column; gap: 12px; padding: 14px; overflow-y: auto; overscroll-behavior: contain; }
|
|
545
550
|
.rv-card .rv-body > * { flex-shrink: 0; }
|
|
546
|
-
.
|
|
547
|
-
|
|
551
|
+
/* Add person, a quiet row at the end of the list. Its fill runs the row's width and 8px past the text on both sides,
|
|
552
|
+
and the plus is set by eye on the names' left edge (its arms start 3px inside its box); 10px is the card's 16px radius less the 6px left to its edge. */
|
|
553
|
+
.rv .rv-body .btn.rv-add-person:not(.btn-icon) { justify-content: flex-start; width: calc(100% + 16px); height: 32px; margin-inline: -8px; padding: 0 8px 0 5px; border-radius: 10px; }
|
|
554
|
+
.rv-invite { display: flex; flex-direction: column; gap: 12px; }
|
|
555
|
+
/* Open, the form keeps its distance from the list it adds to. */
|
|
556
|
+
.rv-body > .rv-invite, .rv-body > .rv-share { margin-top: 8px; }
|
|
557
|
+
/* Options: kind and access keep their defaults until asked for. The chevron turns to say open. */
|
|
558
|
+
.rv-options { display: flex; flex-direction: column; gap: 8px; }
|
|
559
|
+
.rv-options > .rv-disclose { align-self: flex-start; margin-inline-start: -9px; gap: 2px; padding-inline-end: 4px; }
|
|
560
|
+
.rv .btn.rv-disclose .btn-chevron { width: 16px; height: 16px; }
|
|
561
|
+
/* Open is said by the chevron alone: no resting fill, the fill only under the pointer and on press. */
|
|
562
|
+
.rv .btn.rv-disclose[aria-expanded="true"]:not(:active) { background: transparent; }
|
|
563
|
+
@media (hover: hover) and (pointer: fine) { .rv .btn.rv-disclose[aria-expanded="true"]:hover:not(:active) { background: var(--button-tertiary-bg_hover); } }
|
|
564
|
+
:root[data-motion="reduce"] .rv .btn.rv-disclose .btn-chevron { transition: none; }
|
|
565
|
+
.rv-options-fields { display: flex; flex-direction: column; gap: 12px; }
|
|
566
|
+
.rv-form-actions { gap: 4px; }
|
|
567
|
+
/* A field scrolled to after a refusal keeps a margin, so its refusal never sits on the card's edge. */
|
|
568
|
+
.rv-invite .field { scroll-margin-block: 16px; }
|
|
569
|
+
/* Email them the link: the box, its words and the gap between are one hit area. The box takes the panel's accent. */
|
|
570
|
+
.rv-check-row { display: flex; align-self: flex-start; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; color: var(--harness-fg); }
|
|
571
|
+
.rv .rv-check-row .checkbox:checked { background: var(--rv-accent); border-color: var(--rv-accent); color: var(--rv-on-accent); }
|
|
572
|
+
@media (pointer: coarse) { .rv-check-row { min-height: 44px; } }
|
|
573
|
+
/* Before an invite goes: the question and the address as one group, then the answer. Focus lands on the group, for a screen reader. */
|
|
574
|
+
.rv-check { min-width: 0; margin: 0; padding: 0; border: 0; }
|
|
575
|
+
.rv-check:focus-visible { outline: none; box-shadow: none; }
|
|
576
|
+
.rv-check-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
577
|
+
.rv-check-question { color: var(--harness-fg); }
|
|
578
|
+
.rv-check-address { color: var(--rv-fg-strong); font-weight: 600; overflow-wrap: anywhere; }
|
|
579
|
+
/* How people sign in, over the list: one line, and while email is off the quiet action that copies the prompt,
|
|
580
|
+
its text on the line's left edge. While the last sign-in email failed, a second line in the tone that asks for attention. */
|
|
581
|
+
.rv-mail { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
|
|
582
|
+
.rv-mail > .rv-mail-copy { margin-inline-start: -9px; }
|
|
583
|
+
@media (pointer: coarse) { .rv .btn.rv-mail-copy::before { inset: -8px -2px; } }
|
|
584
|
+
.rv-mail > .rv-mail-prompt { align-self: stretch; margin-top: 4px; }
|
|
585
|
+
.rv-mail-failing { color: var(--utility-warning-700); }
|
|
548
586
|
.rv-share { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; background: var(--rv-fill); }
|
|
549
587
|
.rv-share-row { display: flex; gap: 6px; }
|
|
550
588
|
.rv-share-row .input { flex: 1; min-width: 0; }
|
|
551
589
|
/* Copy and Copied are one width, so the row holds still when the word changes. */
|
|
552
590
|
.rv .btn.rv-copy { flex: none; width: 68px; padding: 0; }
|
|
553
|
-
/*
|
|
591
|
+
/* Small print: how links behave, what an empty address means. */
|
|
554
592
|
.rv-disclosure { font-size: 12px; line-height: 16px; }
|
|
593
|
+
/* The list: a row is a person, parted from the next by one hairline. The name and address on the left, the
|
|
594
|
+
badges under them, the one menu at the right edge; what a row opens spans the row under it. */
|
|
555
595
|
.rv-people { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
|
|
556
|
-
|
|
557
|
-
.rv-
|
|
558
|
-
.rv-
|
|
559
|
-
.rv-
|
|
560
|
-
|
|
596
|
+
/* A group: its heading close over its rows, Show more under them. Groups part by space, never a line. */
|
|
597
|
+
.rv-group { display: flex; flex-direction: column; }
|
|
598
|
+
.rv-group + .rv-group { margin-top: 8px; }
|
|
599
|
+
.rv-group-title { margin: 0; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--harness-fg-muted); }
|
|
600
|
+
/* Show more: its text on the names' left edge, as Options' is; open is said by the chevron alone (.rv-disclose). */
|
|
601
|
+
.rv-group > .rv-more { align-self: flex-start; margin-inline-start: -9px; gap: 2px; padding-inline-end: 4px; }
|
|
602
|
+
@media (pointer: coarse) { .rv .btn.rv-more::before { inset: -8px -2px; } }
|
|
603
|
+
.rv-people li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; align-items: start; padding: 10px 0; }
|
|
604
|
+
.rv-people li + li { border-top: 1px solid var(--harness-border); }
|
|
605
|
+
.rv-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
606
|
+
.rv-name { color: var(--rv-fg-strong); font-weight: 600; overflow-wrap: anywhere; }
|
|
607
|
+
.rv-email { min-width: 0; overflow-wrap: anywhere; }
|
|
608
|
+
.rv-people [data-revoked] .rv-who { opacity: 0.55; }
|
|
609
|
+
.rv-tags { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px; }
|
|
610
|
+
/* What the badges say sits at the row's inner spacing, 2px under the address as the address sits under the name. */
|
|
611
|
+
.rv-people .rv-tags { margin-top: -4px; }
|
|
612
|
+
.rv-people .rv-until { line-height: 18px; }
|
|
613
|
+
/* A revoked row has no menu: its badge takes the menu's slot on the name's line, ending on the menus' edge, so the
|
|
614
|
+
row stays one line. The name cuts before the badge, never wrapping under it. */
|
|
615
|
+
.rv-people [data-revoked] .rv-tags { grid-column: 2; grid-row: 1; margin-top: -1px; }
|
|
616
|
+
.rv-people [data-revoked] .rv-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
617
|
+
.rv .badge { height: 20px; padding: 0 6px; border-radius: 6px; font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; }
|
|
618
|
+
/* A running end date is words, not a chip: the badges' size and line, the quiet tone, set a step apart from a badge before it. */
|
|
619
|
+
.rv-until { font-size: 12px; line-height: 20px; color: var(--harness-fg-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
620
|
+
.rv-tags .badge + .rv-until { margin-inline-start: 4px; }
|
|
621
|
+
/* The menu's 32px button centres on the name's 18px line, its glyph on the row's right edge. */
|
|
622
|
+
.rv .btn.rv-row-menu { grid-column: 2; grid-row: 1; margin: -7px -6px -7px 0; color: var(--harness-fg-muted); }
|
|
623
|
+
/* A row with one action shows it by name, its text ending on the edge the menus end on. */
|
|
624
|
+
.rv .btn.rv-row-act { grid-column: 2; grid-row: 1; margin: -5px -8px -5px 0; }
|
|
625
|
+
@media (pointer: coarse) { .rv .btn.rv-row-menu::before { inset: -6px; } }
|
|
561
626
|
.rv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
562
|
-
|
|
563
|
-
|
|
627
|
+
/* A ghost button's padding and border sit left of its text, so a line that starts with one steps back by both
|
|
628
|
+
(8px + 1px) and its text lines up with the name above. */
|
|
629
|
+
.rv-inline .rv-row:has(> .rv-act:first-child), .rv-form-actions:has(> .rv-act:first-child) { margin-inline-start: -9px; }
|
|
630
|
+
.rv-optional { color: var(--harness-fg-muted); font-weight: 400; }
|
|
631
|
+
/* What a row opens (an editor, a question, a new link) spans the row, under the name. */
|
|
632
|
+
.rv-inline { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
|
|
633
|
+
.rv-inline .rv-confirm { margin: 0; color: var(--rv-fg-strong); }
|
|
634
|
+
.rv-inline .select { width: auto; min-width: 160px; }
|
|
635
|
+
.rv-email-edit { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
|
|
636
|
+
.rv-email-edit .rv-row { gap: 4px; }
|
|
637
|
+
/* A refusal, under the field it names, at the hint's size: a one-line refusal swaps for the hint and moves nothing. */
|
|
638
|
+
.rv-form-error { font-size: 12px; line-height: 16px; color: var(--rv-danger); }
|
|
639
|
+
.rv .input[aria-invalid="true"] { border-color: var(--rv-danger); }
|
|
640
|
+
/* A focused field says so with its edge alone, one step brighter (4.7:1 against the resting edge), no ring: the
|
|
641
|
+
ring stays on buttons and menu items, where the keyboard reaches. Asked for more contrast, fields get it too;
|
|
642
|
+
in forced colours the kit's transparent outline is drawn in the system colour. */
|
|
643
|
+
.rv .input:focus-visible { box-shadow: none; border-color: var(--rv-focus); }
|
|
644
|
+
.rv .input[aria-invalid="true"]:focus-visible { border-color: var(--rv-danger); }
|
|
645
|
+
@media (prefers-contrast: more) { .rv .input:focus-visible { box-shadow: var(--focus-ring); } }
|
|
646
|
+
/* Every button shows the ring to the keyboard, the primary too, whose own shadow would otherwise win. */
|
|
647
|
+
.rv-body .btn:focus-visible { box-shadow: var(--focus-ring); }
|
|
648
|
+
/* iOS zooms into any field under 16px: the panel's 13px fields step up where the pointer is a finger. */
|
|
649
|
+
@media (pointer: coarse) { .rv .input { font-size: 16px; } }
|
|
564
650
|
|
|
565
651
|
/* ---------- a phone ---------- */
|
|
566
652
|
/* The card becomes a bottom sheet: docked to the edge, a grab handle on top,
|
|
@@ -2,15 +2,24 @@ import assert from 'node:assert/strict';
|
|
|
2
2
|
import { test } from 'node:test';
|
|
3
3
|
import {
|
|
4
4
|
afterFailure,
|
|
5
|
+
CHECK_SETTLE_MS,
|
|
6
|
+
checkSettled,
|
|
5
7
|
type Draft,
|
|
6
8
|
draftOf,
|
|
7
9
|
filtered,
|
|
8
10
|
filterNote,
|
|
11
|
+
formFailure,
|
|
12
|
+
GROUP_SHOWN,
|
|
13
|
+
groupPeople,
|
|
9
14
|
initialView,
|
|
10
15
|
lensOf,
|
|
16
|
+
menuActions,
|
|
17
|
+
openAfterAdd,
|
|
11
18
|
roundOf,
|
|
12
19
|
scopeOf,
|
|
20
|
+
shownOf,
|
|
13
21
|
signedOutState,
|
|
22
|
+
stateBadge,
|
|
14
23
|
stepFrom,
|
|
15
24
|
stepTarget,
|
|
16
25
|
threadOf,
|
|
@@ -234,13 +243,118 @@ test('an action that meets the end of the session signs the panel out, as a load
|
|
|
234
243
|
assert.deepEqual(afterFailure({ status: 401, message, problems: [] }), signedOutState());
|
|
235
244
|
assert.equal(signedOutState().status, 'guest');
|
|
236
245
|
assert.deepEqual(
|
|
237
|
-
afterFailure({
|
|
246
|
+
afterFailure({
|
|
247
|
+
status: 422,
|
|
248
|
+
message: 'Some fields are not valid.',
|
|
249
|
+
problems: ['body: empty', 'too long'],
|
|
250
|
+
}),
|
|
238
251
|
{
|
|
239
252
|
error: 'body: empty. too long',
|
|
240
253
|
},
|
|
241
254
|
);
|
|
255
|
+
// A refusal with words of its own says them, not the field it names.
|
|
256
|
+
assert.deepEqual(
|
|
257
|
+
afterFailure({
|
|
258
|
+
status: 422,
|
|
259
|
+
message: 'Someone here already signs in with that address.',
|
|
260
|
+
problems: ['email: another person’s here'],
|
|
261
|
+
}),
|
|
262
|
+
{ error: 'Someone here already signs in with that address.' },
|
|
263
|
+
);
|
|
242
264
|
assert.deepEqual(afterFailure({ status: 403, message: 'Not yours.', problems: [] }), {
|
|
243
265
|
error: 'Not yours.',
|
|
244
266
|
});
|
|
245
267
|
assert.deepEqual(afterFailure({ message: 'Failed to fetch' }), { error: 'Failed to fetch' });
|
|
246
268
|
});
|
|
269
|
+
|
|
270
|
+
test('a form’s failure is shown beside it: the words the panel would show, and the field the server named first', () => {
|
|
271
|
+
assert.deepEqual(
|
|
272
|
+
formFailure({
|
|
273
|
+
status: 422,
|
|
274
|
+
message: 'Someone here already signs in with that address.',
|
|
275
|
+
problems: ['email: another person’s here'],
|
|
276
|
+
}),
|
|
277
|
+
{ text: 'Someone here already signs in with that address.', field: 'email' },
|
|
278
|
+
);
|
|
279
|
+
assert.deepEqual(
|
|
280
|
+
formFailure({
|
|
281
|
+
status: 422,
|
|
282
|
+
message: 'Some fields are not valid.',
|
|
283
|
+
problems: ['name: required', 'email: x'],
|
|
284
|
+
}),
|
|
285
|
+
{ text: 'name: required. email: x', field: 'name' },
|
|
286
|
+
);
|
|
287
|
+
// No field named, or no answer at all: the words alone.
|
|
288
|
+
assert.deepEqual(formFailure({ status: 503, message: 'The review store did not answer.' }), {
|
|
289
|
+
text: 'The review store did not answer.',
|
|
290
|
+
field: null,
|
|
291
|
+
});
|
|
292
|
+
assert.deepEqual(formFailure({ message: 'Failed to fetch' }), { text: 'Failed to fetch', field: null });
|
|
293
|
+
// A 401 is the session that ended: the panel signs out, and no form shows it.
|
|
294
|
+
assert.equal(formFailure({ status: 401, message: 'Sign in first.', problems: [] }), null);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
test('the People list: Client people first, then Studio, an empty group left out, each in the order given', () => {
|
|
298
|
+
const p = (id: string, kind: 'client' | 'studio') => ({ id, kind });
|
|
299
|
+
assert.deepEqual(
|
|
300
|
+
groupPeople([p('s1', 'studio'), p('c1', 'client'), p('s2', 'studio'), p('c2', 'client')]),
|
|
301
|
+
[
|
|
302
|
+
{ kind: 'client', people: [p('c1', 'client'), p('c2', 'client')] },
|
|
303
|
+
{ kind: 'studio', people: [p('s1', 'studio'), p('s2', 'studio')] },
|
|
304
|
+
],
|
|
305
|
+
);
|
|
306
|
+
assert.deepEqual(groupPeople([p('s1', 'studio')]), [{ kind: 'studio', people: [p('s1', 'studio')] }]);
|
|
307
|
+
assert.deepEqual(groupPeople([p('c1', 'client')]), [{ kind: 'client', people: [p('c1', 'client')] }]);
|
|
308
|
+
assert.deepEqual(groupPeople([]), []);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
test('a group of more than 3 shows its first 3 until it is opened; a group of 3 or fewer shows all and has nothing more', () => {
|
|
312
|
+
const five = ['a', 'b', 'c', 'd', 'e'];
|
|
313
|
+
assert.equal(GROUP_SHOWN, 3);
|
|
314
|
+
assert.deepEqual(shownOf(five, false), { shown: ['a', 'b', 'c'], more: 2 });
|
|
315
|
+
assert.deepEqual(shownOf(five, true), { shown: five, more: 2 });
|
|
316
|
+
assert.deepEqual(shownOf(['a', 'b', 'c'], false), { shown: ['a', 'b', 'c'], more: 0 });
|
|
317
|
+
assert.deepEqual(shownOf(['a'], true), { shown: ['a'], more: 0 });
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
test('adding a person opens their group, so the new row shows even when the group was folded; the other group stays as it was', () => {
|
|
321
|
+
assert.deepEqual(openAfterAdd({ client: false, studio: false }, 'client'), { client: true, studio: false });
|
|
322
|
+
assert.deepEqual(openAfterAdd({ client: false, studio: true }, 'client'), { client: true, studio: true });
|
|
323
|
+
assert.deepEqual(openAfterAdd({ client: true, studio: false }, 'studio'), { client: true, studio: true });
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
test('a row’s state: nothing while access is open and live, the end date as plain text while it runs, Ended and Revoked as badges', () => {
|
|
327
|
+
const now = '2030-01-01T00:00:00.000Z';
|
|
328
|
+
const at = (endsAt: string | null, revoked = false) => stateBadge({ endsAt, revoked, now }, '1 Mar 2030');
|
|
329
|
+
assert.equal(at(null), null);
|
|
330
|
+
// A running end date is a fact about the row, not something to act on: words, no chip (Miles).
|
|
331
|
+
assert.deepEqual(at('2030-03-01T00:00:00.000Z'), { text: 'Until 1 Mar 2030', tone: null, chip: false });
|
|
332
|
+
assert.deepEqual(at('2029-12-01T00:00:00.000Z'), { text: 'Ended', tone: 'warning', chip: true });
|
|
333
|
+
assert.deepEqual(at(now), { text: 'Ended', tone: 'warning', chip: true });
|
|
334
|
+
assert.deepEqual(at(null, true), { text: 'Revoked', tone: null, chip: true });
|
|
335
|
+
assert.deepEqual(at('2030-03-01T00:00:00.000Z', true), { text: 'Revoked', tone: null, chip: true });
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
test('a row’s menu: a new link first, the address, access, sign out, Revoke last; ended access leads with its fix; your own row only your address', () => {
|
|
339
|
+
assert.deepEqual(menuActions({ own: false, ended: false }), [
|
|
340
|
+
'link',
|
|
341
|
+
'email',
|
|
342
|
+
'access',
|
|
343
|
+
'signOut',
|
|
344
|
+
'revoke',
|
|
345
|
+
]);
|
|
346
|
+
// A link would open nothing once access has ended, and there is no session to end.
|
|
347
|
+
assert.deepEqual(menuActions({ own: false, ended: true }), ['access', 'email', 'revoke']);
|
|
348
|
+
assert.deepEqual(menuActions({ own: true, ended: false }), ['email']);
|
|
349
|
+
assert.deepEqual(menuActions({ own: true, ended: true }), ['email']);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
test('the address check ignores a press that lands within the settle time, so a double press on Create link never sends', () => {
|
|
353
|
+
const opened = 10_000;
|
|
354
|
+
// The second press of a double click: a few hundred milliseconds after the check opened under it.
|
|
355
|
+
for (const after of [0, 120, 300, 500])
|
|
356
|
+
assert.equal(checkSettled(opened, opened + after), false, String(after));
|
|
357
|
+
assert.ok(CHECK_SETTLE_MS > 500, 'longer than a slow double click');
|
|
358
|
+
assert.equal(checkSettled(opened, opened + CHECK_SETTLE_MS), true);
|
|
359
|
+
assert.equal(checkSettled(opened, opened + 2_000), true);
|
|
360
|
+
});
|
package/shell/review/view.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// What the review layer shows. Pure, so node:test runs it: no React, no DOM
|
|
2
2
|
// beyond the Element type a draft points at.
|
|
3
3
|
|
|
4
|
+
// A .ts path, so node:test runs this file as it is.
|
|
5
|
+
import { NOT_VALID } from '../../core/review/model.ts';
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* A new comment being placed: the element it is about and where on it, as
|
|
6
9
|
* fractions of its box, or neither for the whole page. `body` is words given
|
|
@@ -178,11 +181,98 @@ export const signedOutState = () => ({
|
|
|
178
181
|
/** A failed call, as the store reads it. `status` is absent when no answer came back at all. */
|
|
179
182
|
export type Failure = { status?: number; message: string; problems?: string[] };
|
|
180
183
|
|
|
184
|
+
/**
|
|
185
|
+
* How long the address check ignores a pointer press after it opens. The
|
|
186
|
+
* check opens where Create link was, so the second press of a double press
|
|
187
|
+
* would land on Send link and mail the link before the address was read.
|
|
188
|
+
* Longer than a slow double click.
|
|
189
|
+
*/
|
|
190
|
+
export const CHECK_SETTLE_MS = 600;
|
|
191
|
+
|
|
192
|
+
/** Whether a press at `at` counts on an address check that opened at `openedAt` (both in ms, one clock). */
|
|
193
|
+
export const checkSettled = (openedAt: number, at: number) => at - openedAt >= CHECK_SETTLE_MS;
|
|
194
|
+
|
|
181
195
|
/**
|
|
182
196
|
* What an action's failure leaves in the store. A 401 is the session that
|
|
183
197
|
* ended, whether the review API sent it in JSON or the gate in front of it
|
|
184
198
|
* sent its plain text: read by status, never by body. Anything else is the
|
|
185
|
-
* error the panel shows,
|
|
199
|
+
* error the panel shows: the server's own sentence, or, when it says only
|
|
200
|
+
* that fields are not valid, the problems it named.
|
|
186
201
|
*/
|
|
187
202
|
export const afterFailure = (f: Failure) =>
|
|
188
|
-
f.status === 401
|
|
203
|
+
f.status === 401
|
|
204
|
+
? signedOutState()
|
|
205
|
+
: { error: f.problems?.length && f.message === NOT_VALID ? f.problems.join('. ') : f.message };
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* A failure shown beside the form that met it, so the person reads it where
|
|
209
|
+
* they typed: the words the panel would show (afterFailure), and the field
|
|
210
|
+
* the server named first, which the form marks. Null for a 401: the session
|
|
211
|
+
* ended, and the panel signs out instead.
|
|
212
|
+
*/
|
|
213
|
+
export function formFailure(f: Failure): { text: string; field: string | null } | null {
|
|
214
|
+
if (f.status === 401) return null;
|
|
215
|
+
const first = f.problems?.[0];
|
|
216
|
+
return { text: (afterFailure(f) as { error: string }).error, field: first ? first.split(':')[0] : null };
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** A kind of person, as the People list groups them. */
|
|
220
|
+
type Kind = 'client' | 'studio';
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The People list as groups, Client people first, then Studio, each in the
|
|
224
|
+
* order the server gave and left out when it has nobody: the group says what
|
|
225
|
+
* a role badge on every row used to.
|
|
226
|
+
*/
|
|
227
|
+
export function groupPeople<T extends { kind: Kind }>(people: T[]): { kind: Kind; people: T[] }[] {
|
|
228
|
+
return (['client', 'studio'] as const)
|
|
229
|
+
.map((kind) => ({ kind, people: people.filter((p) => p.kind === kind) }))
|
|
230
|
+
.filter((g) => g.people.length > 0);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** Which groups are open once a person of `kind` is added: theirs, so the new row is never folded away; the rest as they were. */
|
|
234
|
+
export const openAfterAdd = (open: Record<Kind, boolean>, kind: Kind): Record<Kind, boolean> => ({
|
|
235
|
+
...open,
|
|
236
|
+
[kind]: true,
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
/** How many of a group show before it is opened. */
|
|
240
|
+
export const GROUP_SHOWN = 3;
|
|
241
|
+
|
|
242
|
+
/** The rows a group shows, and how many wait behind its disclosure (none for a group of GROUP_SHOWN or fewer). */
|
|
243
|
+
export function shownOf<T>(people: T[], open: boolean): { shown: T[]; more: number } {
|
|
244
|
+
const more = Math.max(0, people.length - GROUP_SHOWN);
|
|
245
|
+
return { shown: open ? people : people.slice(0, GROUP_SHOWN), more };
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Where a person's access stands, or nothing while it is open and live.
|
|
250
|
+
* `day` is the end date as the page writes it. Only an access that ended asks
|
|
251
|
+
* for attention; revoked is said plainly, the row itself recedes. Both are
|
|
252
|
+
* badges (`chip`); a running end date is a plain fact, words with no chip.
|
|
253
|
+
*/
|
|
254
|
+
export function stateBadge(
|
|
255
|
+
{ endsAt, revoked, now }: { endsAt: string | null; revoked: boolean; now: string },
|
|
256
|
+
day: string,
|
|
257
|
+
): { text: string; tone: 'warning' | null; chip: boolean } | null {
|
|
258
|
+
if (revoked) return { text: 'Revoked', tone: null, chip: true };
|
|
259
|
+
if (endsAt === null) return null;
|
|
260
|
+
return endsAt <= now
|
|
261
|
+
? { text: 'Ended', tone: 'warning', chip: true }
|
|
262
|
+
: { text: `Until ${day}`, tone: null, chip: false };
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** What a person's row can do. */
|
|
266
|
+
export type RowAction = 'link' | 'email' | 'access' | 'signOut' | 'revoke';
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* A row's menu, in order: a new link, their address, access, sign out
|
|
270
|
+
* everywhere, then Revoke, set apart. Once access has ended a link would
|
|
271
|
+
* open nothing and no session is left to end, so the fix leads. Your own
|
|
272
|
+
* row holds only your address: nobody revokes, signs out or limits
|
|
273
|
+
* themselves here.
|
|
274
|
+
*/
|
|
275
|
+
export function menuActions({ own, ended }: { own: boolean; ended: boolean }): RowAction[] {
|
|
276
|
+
if (own) return ['email'];
|
|
277
|
+
return ended ? ['access', 'email', 'revoke'] : ['link', 'email', 'access', 'signOut', 'revoke'];
|
|
278
|
+
}
|