rvlib-shipkit 2.9.0 → 2.11.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/CHANGELOG.md +23 -0
- package/package.json +1 -1
- package/src/cli/cmd_Media.ts +164 -0
- package/src/cli/cmd_Review.ts +2 -1
- package/src/cli/family-pages.ts +1 -0
- package/src/cli/registry.ts +2 -0
- package/src/collections/pings.ts +6 -4
- package/src/core/app-icon.ts +17 -4
- package/src/core/scratch-objects.ts +56 -0
- package/src/core/trace-audit.ts +13 -1
- package/src/home/home-paths.ts +4 -0
- package/src/home/home-routes.ts +36 -2
- package/src/home/hubs.ts +5 -0
- package/src/home/inbox-shape.ts +182 -0
- package/src/home/inbox.ts +48 -0
- package/src/home/run-daemon.ts +12 -2
- package/src/home/serve-web.ts +155 -16
- package/src/ledger/git-scan.ts +73 -25
- package/src/ledger/repo-view.ts +2 -22
- package/src/media-kinds.ts +7 -0
- package/src/media-store/content.ts +51 -0
- package/src/media-store/daemon.ts +91 -0
- package/src/media-store/db.ts +74 -0
- package/src/media-store/fact.ts +9 -0
- package/src/media-store/kind.ts +44 -0
- package/src/media-store/purge.ts +139 -0
- package/src/media-store/remote.ts +93 -0
- package/src/media-store/space.ts +124 -0
- package/src/media-store/sync.ts +101 -0
- package/src/media-store/upload.ts +98 -0
- package/src/repo-config.ts +4 -0
- package/src/review/anim.ts +6 -5
- package/src/review/cells.ts +552 -0
- package/src/review/format.ts +1 -1
- package/src/review/media-kind.ts +84 -0
- package/src/review/media-read.ts +48 -0
- package/src/review/model.ts +43 -5
- package/src/review/previews.ts +153 -0
- package/src/review/routes.ts +105 -47
- package/src/review/store.ts +106 -45
- package/src/review/trailer-desk.ts +79 -46
- package/src/review/trailer-media.ts +163 -0
- package/src/review/trailer-routes.ts +5 -2
- package/src/serve/hub-app/home-st.ts +39 -9
- package/src/serve/hub-app/home.html +2 -1
- package/src/serve/hub-app/hub-app.tsx +7 -23
- package/src/serve/hub-app/icons.tsx +2 -0
- package/src/serve/hub-app/inbox-st.ts +144 -0
- package/src/serve/hub-app/inbox-view.tsx +205 -0
- package/src/serve/hub-app/inbox.css +73 -0
- package/src/serve/hub-app/item-view.tsx +19 -0
- package/src/serve/hub-app/keys.ts +4 -3
- package/src/serve/hub-app/palette-st.ts +2 -1
- package/src/serve/hub-app/project-list.tsx +1 -0
- package/src/serve/hub-app/projects-svc.ts +1 -1
- package/src/serve/hub-app/repo-st.ts +1 -1
- package/src/serve/hub-app/review/kind-view.tsx +21 -22
- package/src/serve/hub-app/review/kit.tsx +11 -12
- package/src/serve/hub-app/review/review-board.tsx +15 -13
- package/src/serve/hub-app/review/review-cells.tsx +241 -0
- package/src/serve/hub-app/review/review-kit.ts +79 -0
- package/src/serve/hub-app/review/review-list.tsx +87 -122
- package/src/serve/hub-app/review/review-page.tsx +22 -79
- package/src/serve/hub-app/review/review-st.ts +269 -698
- package/src/serve/hub-app/review/review-thread.tsx +302 -0
- package/src/serve/hub-app/review/review-views.tsx +322 -253
- package/src/serve/hub-app/review/thread-st.ts +770 -0
- package/src/serve/hub-app/review.css +235 -91
- package/src/serve/hub-runtime.ts +9 -4
- package/src/serve/serve-hub.ts +4 -1
- package/src/serve/warm-cell.ts +6 -1
- package/src/trailer/footage.ts +6 -2
- package/src/trailer/passage.ts +4 -2
- package/src/trailer/prune.ts +6 -10
- package/src/serve/hub-app/review/review-answer.tsx +0 -249
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// one item of a repo as its own page: the view its collection draws (a check's card, a wiki, the comfy panel, a test,
|
|
2
|
+
// the runs, any other row's card). The repo's page shows it under its tree, the inbox shows it in place
|
|
3
|
+
import { observer } from 'mobx-react-lite'
|
|
4
|
+
import { CheckCard } from './check-view.tsx'
|
|
5
|
+
import { ColCard } from './col-card.tsx'
|
|
6
|
+
import { ComfyView } from './comfy-view.tsx'
|
|
7
|
+
import type { RepoSt } from './repo-st.ts'
|
|
8
|
+
import { TestCard } from './test-view.tsx'
|
|
9
|
+
import { TimelineView } from './timeline-view.tsx'
|
|
10
|
+
import { WIKIS, WikisView } from './wikis-view.tsx'
|
|
11
|
+
|
|
12
|
+
export const ItemView = observer(({ app, col, id }: { app: RepoSt; col: string; id: string }) => {
|
|
13
|
+
if (col === WIKIS) return <WikisView app={app} id={id} />
|
|
14
|
+
if (col === 'comfy') return <ComfyView app={app} id={id} />
|
|
15
|
+
if (col === 'checks') return <div className="stagewrap"><CheckCard app={app} id={id} /></div>
|
|
16
|
+
if (col === 'tests') return <div className="stagewrap"><TestCard app={app} id={id} /></div>
|
|
17
|
+
if (col === 'runs') return <div className="stagewrap"><TimelineView app={app} /></div>
|
|
18
|
+
return <div className="stagewrap"><ColCard app={app} col={col} id={id} /></div>
|
|
19
|
+
})
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// the page's command keys, read the same on every layout: ⌘1 to ⌘9 select the
|
|
2
2
|
// nth repo of the project list, ⌘↑ and ⌘↓ the repo above or below, then the home row under the right hand: ⌘J
|
|
3
|
-
// the picker, ⌘K the overview, ⌘L the activity, ⌘; the insights, ⌘' the plan.
|
|
3
|
+
// the picker, ⌘K the overview, ⌘L the activity, ⌘; the insights, ⌘' the plan, and ⌘I above them the inbox.
|
|
4
4
|
// ⌘B folds the project list to its icon rail and back (layout-st.ts), ⌘⇧B
|
|
5
5
|
// cycles the dock at the bottom of the page (dock-st.ts): the line, slim, open.
|
|
6
6
|
// A digit, the semicolon and the quote are read from the physical key (`code`), so an
|
|
7
7
|
// AZERTY keyboard, where the key under 1 types `&`, selects the same repo. Ctrl stands in for
|
|
8
8
|
// ⌘ off a Mac. The macOS app binds none of these to a menu item, so they
|
|
9
9
|
// reach the page (tests/home-strip.test.tsx reads ShipkitGui.swift).
|
|
10
|
-
export type PageKey = { t: 'repo'; n: number } | { t: 'step'; by: -1 | 1 } | { t: 'home' } | { t: 'planned' } | { t: 'activity' } | { t: 'insights' } | { t: 'picker' } | { t: 'dock' } | { t: 'rail' }
|
|
10
|
+
export type PageKey = { t: 'repo'; n: number } | { t: 'step'; by: -1 | 1 } | { t: 'home' } | { t: 'inbox' } | { t: 'planned' } | { t: 'activity' } | { t: 'insights' } | { t: 'picker' } | { t: 'dock' } | { t: 'rail' }
|
|
11
11
|
|
|
12
12
|
type KeyLike = { key: string; code: string; metaKey: boolean; ctrlKey: boolean; shiftKey: boolean; altKey: boolean }
|
|
13
13
|
|
|
@@ -23,13 +23,14 @@ export function pageKey(e: KeyLike): PageKey | null {
|
|
|
23
23
|
const k = e.key.toLowerCase()
|
|
24
24
|
if (k === 'j') return { t: 'picker' }
|
|
25
25
|
if (k === 'k') return { t: 'home' }
|
|
26
|
+
if (k === 'i') return { t: 'inbox' }
|
|
26
27
|
if (k === 'l') return { t: 'activity' }
|
|
27
28
|
if (k === 'b') return { t: 'rail' }
|
|
28
29
|
return null
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/** the shortcut each place of the home carries on its button */
|
|
32
|
-
export const PLACE_KEY: Record<'overview' | 'planned' | 'activity' | 'insights', string> & Partial<Record<string, string>> = { overview: '⌘K', planned: "⌘'", activity: '⌘L', insights: '⌘;' }
|
|
33
|
+
export const PLACE_KEY: Record<'overview' | 'inbox' | 'planned' | 'activity' | 'insights', string> & Partial<Record<string, string>> = { overview: '⌘K', inbox: '⌘I', planned: "⌘'", activity: '⌘L', insights: '⌘;' }
|
|
33
34
|
/** the picker's shortcut, on the first button, before home */
|
|
34
35
|
export const PICKER_KEY = '⌘J'
|
|
35
36
|
/** the repo above and below, hinted at the project list's foot */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// the one picker of the page (cmd+j, keys.ts), a node of the root: the
|
|
2
|
-
// home's places (home, activity, planned, insights, archived) first, then the shown repo's own jump
|
|
2
|
+
// home's places (inbox, home, activity, planned, insights, archived) first, then the shown repo's own jump
|
|
3
3
|
// targets, then every other house repo as a place to go. Another repo's
|
|
4
4
|
// resources are never listed: a jump to a repo selects it in place, and its
|
|
5
5
|
// own targets are one more cmd+j away.
|
|
@@ -24,6 +24,7 @@ export class PaletteSt {
|
|
|
24
24
|
const st = this.st
|
|
25
25
|
if (st.machine == null) return []
|
|
26
26
|
return [
|
|
27
|
+
{ id: 'place:inbox', label: 'inbox', section: 'place', face: { place: 'inbox' }, run: () => st.navigate('/inbox') },
|
|
27
28
|
{ id: 'place:home', label: 'home', section: 'place', face: { place: 'home' }, run: () => st.navigate('/') },
|
|
28
29
|
{ id: 'place:activity', label: 'activity', section: 'place', face: { place: 'activity' }, run: () => st.navigate('/activity') },
|
|
29
30
|
{ id: 'place:planned', label: 'planned', section: 'place', face: { place: 'planned' }, run: () => st.navigate('/planned') },
|
|
@@ -41,6 +41,7 @@ export type ListHost = { projects: ProjectsSvc; layout?: { folded: boolean; togg
|
|
|
41
41
|
* then the places, each with its shortcut (keys.ts) */
|
|
42
42
|
const PLACES: { id: Place | 'picker'; label: string; title: string }[] = [
|
|
43
43
|
{ id: 'picker', label: 'jump to…', title: 'jump to a page, a repo or one of its resources' },
|
|
44
|
+
{ id: 'inbox', label: 'inbox', title: 'everything that waits on you in every repo: cards, questions, asks and what is red' },
|
|
44
45
|
{ id: 'overview', label: 'overview', title: 'the overview: shipkit, every global process and every repo on this machine' },
|
|
45
46
|
{ id: 'activity', label: 'activity', title: 'what every repo committed lately, what it holds uncommitted, its branch and whether it is pushed' },
|
|
46
47
|
{ id: 'planned', label: 'planned', title: 'every check the machine runs on its own: now, next, late, and why' },
|
|
@@ -187,7 +187,7 @@ export function cardModel(p: Project, now: number): CardModel {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
/** a page of the home that is no repo's */
|
|
190
|
-
export type Place = 'overview' | 'planned' | 'activity' | 'insights'
|
|
190
|
+
export type Place = 'overview' | 'inbox' | 'planned' | 'activity' | 'insights'
|
|
191
191
|
|
|
192
192
|
export class ProjectsSvc {
|
|
193
193
|
/** the last list this browser saw until the first poll answers, so the
|
|
@@ -33,7 +33,7 @@ export type Sel = HashSel | null
|
|
|
33
33
|
|
|
34
34
|
/** one picker target (cmd+j): run() fires the SAME action clicking would */
|
|
35
35
|
/** what a picker entry wears: a repo's own icon, or a place's button icon */
|
|
36
|
-
export type JumpFace = { repo: string } | { place: 'home' | 'planned' | 'activity' | 'insights' | 'archived' }
|
|
36
|
+
export type JumpFace = { repo: string } | { place: 'home' | 'inbox' | 'planned' | 'activity' | 'insights' | 'archived' }
|
|
37
37
|
/** `key`: the shortcut that does the same, printed at the entry's end */
|
|
38
38
|
export type Jump = { id: string; label: string; section: string; run: () => void; face?: JumpFace; key?: string }
|
|
39
39
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// what the repo's review unit says of
|
|
1
|
+
// what the repo's review unit says of one version, drawn from DATA the hub computed (review/project.ts viewOfItem): its
|
|
2
2
|
// kind's facts, links, a text or its change as a diff, its parts (a card each: logo, media beside the text, its change),
|
|
3
3
|
// and « live », the kind's url in a frame, off until he opens it; and a pair's animation to download. The page never
|
|
4
|
-
// runs the repo's code
|
|
4
|
+
// runs the repo's code, and asks for a version's data only once its cell shows
|
|
5
5
|
import { makeAutoObservable, runInAction } from 'mobx'
|
|
6
6
|
import { observer } from 'mobx-react-lite'
|
|
7
7
|
import { useEffect } from 'react'
|
|
8
|
-
import { isGallery, isPair, viewName, type
|
|
8
|
+
import { isGallery, isPair, viewName, type Item } from '../../../review/model.ts'
|
|
9
9
|
import type { PartData } from '../../../review/project.ts'
|
|
10
10
|
import type { Fact, Link, PartTone, ViewText } from '../../../review/unit.ts'
|
|
11
11
|
|
|
@@ -39,19 +39,19 @@ export class KindViewSt {
|
|
|
39
39
|
makeAutoObservable<this, 'st'>(this, { st: false })
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/** the view of item `
|
|
43
|
-
read(
|
|
44
|
-
const key = `${
|
|
42
|
+
/** the view of item `id`, read again when its stamp (its last message) moved */
|
|
43
|
+
read(id: string, stamp: string): void {
|
|
44
|
+
const key = `${id}@${stamp}`
|
|
45
45
|
if (this.views.has(key)) return
|
|
46
46
|
this.views.set(key, { facts: [], links: [], live: null, text: null, parts: [] })
|
|
47
|
-
void fetch(this.st.fileUrl(
|
|
47
|
+
void fetch(this.st.fileUrl(id, 'view'))
|
|
48
48
|
.then(async (r) => (r.ok ? ((await r.json()) as KindData) : { error: ((await r.json().catch(() => ({}))) as { error?: string }).error ?? `HTTP ${r.status}` }))
|
|
49
49
|
.catch((e: Error) => ({ error: e.message }))
|
|
50
50
|
.then((v) => runInAction(() => this.views.set(key, v)))
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
of(
|
|
54
|
-
return this.views.get(`${
|
|
53
|
+
of(id: string, stamp: string): KindData | { error: string } | undefined {
|
|
54
|
+
return this.views.get(`${id}@${stamp}`)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
toggleLive(): void {
|
|
@@ -72,9 +72,9 @@ export class KindViewSt {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
animUrl(
|
|
75
|
+
animUrl(id: string, view: number): string {
|
|
76
76
|
const a = this.anim
|
|
77
|
-
return `${this.st.fileUrl(
|
|
77
|
+
return `${this.st.fileUrl(id, 'anim')}?view=${view}&mode=${a.mode}&format=${a.format}&labels=${a.labels}`
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -112,12 +112,11 @@ const diffWords = (before: string, after: string) => diffSeq(before.split(/(\s+)
|
|
|
112
112
|
|
|
113
113
|
const TONE = { ' ': 'var(--dim)', '-': 'var(--red, #e5484d)', '+': 'var(--green, #46a758)' } as const
|
|
114
114
|
|
|
115
|
-
/** the kind's data view of
|
|
116
|
-
export const KindView = observer(({ app,
|
|
115
|
+
/** the kind's data view of one version, under its words; `stamp` its last message, so an answer reads it again */
|
|
116
|
+
export const KindView = observer(({ app, item, stamp }: { app: Urls; item: Item; stamp: string }) => {
|
|
117
117
|
const k = kindViewOf(app)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const v = k.of(x)
|
|
118
|
+
useEffect(() => k.read(item.id, stamp), [k, item.id, stamp])
|
|
119
|
+
const v = k.of(item.id, stamp)
|
|
121
120
|
if (v === undefined) return null
|
|
122
121
|
if ('error' in v) return <div className="rv-err rv-pre">the repo's view of this item: {v.error}</div>
|
|
123
122
|
const t = v.text
|
|
@@ -143,7 +142,7 @@ export const KindView = observer(({ app, x }: { app: Urls; x: ReviewItem }) => {
|
|
|
143
142
|
))}
|
|
144
143
|
</pre>
|
|
145
144
|
) : null}
|
|
146
|
-
{v.parts.map((p, i) => <PartCard key={i} app={app}
|
|
145
|
+
{v.parts.map((p, i) => <PartCard key={i} app={app} id={item.id} n={i} p={p} />)}
|
|
147
146
|
{v.live !== null ? (
|
|
148
147
|
<div>
|
|
149
148
|
<button className="ghost" onClick={() => k.toggleLive()}>{k.live ? 'hide live' : 'live'}</button>
|
|
@@ -187,9 +186,9 @@ const Side = ({ before, after, side }: { before: string; after: string; side: '-
|
|
|
187
186
|
)
|
|
188
187
|
|
|
189
188
|
/** a part of the subject as a card: its logo and name, its change, its media beside its text or the text's change */
|
|
190
|
-
const PartCard = ({ app,
|
|
189
|
+
const PartCard = ({ app, id, n, p }: { app: Urls; id: string; n: number; p: PartData }) => {
|
|
191
190
|
const t = p.text
|
|
192
|
-
const src = app.fileUrl(
|
|
191
|
+
const src = app.fileUrl(id, `part-${n}`)
|
|
193
192
|
return (
|
|
194
193
|
<div className="rv-part">
|
|
195
194
|
<div className="rv-parthead">
|
|
@@ -216,8 +215,8 @@ const PartCard = ({ app, x, n, p }: { app: Urls; x: ReviewItem; n: number; p: Pa
|
|
|
216
215
|
}
|
|
217
216
|
|
|
218
217
|
/** a pair of images as a looping animation to download: the mode, the format, the corner labels */
|
|
219
|
-
export const AnimPanel = observer(({ app,
|
|
220
|
-
const pairs =
|
|
218
|
+
export const AnimPanel = observer(({ app, item }: { app: Urls; item: Item }) => {
|
|
219
|
+
const pairs = item.views.flatMap((v, i) => (!isGallery(v) && isPair(v.files) && !v.clip && !v.audio ? [{ i, name: viewName(v, i) }] : []))
|
|
221
220
|
if (pairs.length === 0) return null
|
|
222
221
|
const k = kindViewOf(app)
|
|
223
222
|
const a = k.anim
|
|
@@ -234,7 +233,7 @@ export const AnimPanel = observer(({ app, x }: { app: Urls; x: ReviewItem }) =>
|
|
|
234
233
|
{pick('mode', [['cut', 'cut'], ['fade', 'fade'], ['wipe', 'wipe']], a.mode)}
|
|
235
234
|
{pick('format', [['mp4', 'MP4'], ['gif', 'GIF']], a.format)}
|
|
236
235
|
{pick('labels', [['en', 'EN'], ['fr', 'FR'], ['none', 'no labels']], a.labels)}
|
|
237
|
-
<a href={k.animUrl(
|
|
236
|
+
<a href={k.animUrl(item.id, view)} download>download</a>
|
|
238
237
|
</div>
|
|
239
238
|
)
|
|
240
239
|
})
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// spinner, who listens, the thumbnail. Colours come from review.css, which reads hub.css tokens
|
|
3
3
|
import { observer } from 'mobx-react-lite'
|
|
4
4
|
import { useEffect, useState } from 'react'
|
|
5
|
-
import
|
|
5
|
+
import type { ThreadRow } from '../../../review/cells.ts'
|
|
6
|
+
import type { ReviewStatus, ShownStatus, Side } from '../../../review/model.ts'
|
|
6
7
|
import type { ReviewSt } from './review-st.ts'
|
|
7
8
|
|
|
8
9
|
/** a status's tone, as a class review.css colours: its tint, its line, its badge */
|
|
@@ -64,8 +65,7 @@ export const AutoTag = ({ rule }: { rule: string }) => (
|
|
|
64
65
|
)
|
|
65
66
|
|
|
66
67
|
/** a lane reworking the card: a slow spinner and « in work · L147 » in the lane's colour; nothing when nobody does */
|
|
67
|
-
export const Rework =
|
|
68
|
-
const r = rv.reworkOf(x)
|
|
68
|
+
export const Rework = ({ r }: { r: ThreadRow['rework'] }) => {
|
|
69
69
|
const [, redraw] = useState(0)
|
|
70
70
|
const until = r?.until
|
|
71
71
|
useEffect(() => {
|
|
@@ -73,7 +73,7 @@ export const Rework = observer(({ rv, x }: { rv: ReviewSt; x: ReviewItem }) => {
|
|
|
73
73
|
const t = setTimeout(() => redraw((n) => n + 1), Math.max(0, until - Date.now()) + 1000)
|
|
74
74
|
return () => clearTimeout(t)
|
|
75
75
|
}, [until])
|
|
76
|
-
if (!r) return null
|
|
76
|
+
if (!r || Date.now() > r.until) return null
|
|
77
77
|
return (
|
|
78
78
|
<div className="rv-reworkrow">
|
|
79
79
|
<span className="rv-rework" style={{ ['--lane' as string]: laneColor(r.lane) }} title={`${r.lane} reworks this card since ${when(r.since)}`}>
|
|
@@ -82,11 +82,11 @@ export const Rework = observer(({ rv, x }: { rv: ReviewSt; x: ReviewItem }) => {
|
|
|
82
82
|
</span>
|
|
83
83
|
</div>
|
|
84
84
|
)
|
|
85
|
-
}
|
|
85
|
+
}
|
|
86
86
|
|
|
87
87
|
/** who listens: the pid of each live `sk review watch` that reads his answer on these cards, or « nobody listens » */
|
|
88
|
-
export const Listeners = observer(({ rv,
|
|
89
|
-
const ws = rv.listenersOf(
|
|
88
|
+
export const Listeners = observer(({ rv, heads }: { rv: ReviewSt; heads: readonly { lane?: string | undefined; session?: string | undefined }[] }) => {
|
|
89
|
+
const ws = rv.listenersOf(heads)
|
|
90
90
|
const on = ws.length > 0
|
|
91
91
|
return (
|
|
92
92
|
<span
|
|
@@ -102,11 +102,10 @@ export const Listeners = observer(({ rv, cards }: { rv: ReviewSt; cards: readonl
|
|
|
102
102
|
)
|
|
103
103
|
})
|
|
104
104
|
|
|
105
|
-
/**
|
|
106
|
-
export const ThumbOf = ({ rv,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return <img className="rv-thumbimg" src={rv.thumbUrl(x, thumbFileOf(first))} alt="" loading="lazy" />
|
|
105
|
+
/** a thread's thumbnail in the list: its head's first view at the list's size, else a speech mark (a note with no image) */
|
|
106
|
+
export const ThumbOf = ({ rv, row }: { rv: ReviewSt; row: ThreadRow }) => {
|
|
107
|
+
if (!row.thumb) return <div className="rv-thumbnone">✎</div>
|
|
108
|
+
return <img className="rv-thumbimg" src={rv.thumbUrl(row.head, row.thumb)} alt="" loading="lazy" />
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
/** the page's empty pane: one line of dim words */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// the dispatcher's board (wiki build/shipkit/review.md, Raised items): what the owner, a player or a rule raised, by state,
|
|
2
|
-
// each with its topic and its worker, a stale claim marked; who holds the dispatcher role. A row
|
|
2
|
+
// each with its topic and its worker, a stale claim marked (`GET /api/review/board`); who holds the dispatcher role. A row
|
|
3
|
+
// opens its item
|
|
3
4
|
import { observer } from 'mobx-react-lite'
|
|
4
|
-
import {
|
|
5
|
+
import { topicLabel, type State } from '../../../review/model.ts'
|
|
5
6
|
import type { ReviewSt } from './review-st.ts'
|
|
6
7
|
|
|
7
8
|
const STATES: { state: State; label: string }[] = [
|
|
@@ -14,33 +15,34 @@ const STATES: { state: State; label: string }[] = [
|
|
|
14
15
|
|
|
15
16
|
export const ReviewBoard = observer(({ rv }: { rv: ReviewSt }) => {
|
|
16
17
|
const spec = rv.spec
|
|
17
|
-
const
|
|
18
|
-
const rows = rv.items.filter((x) => x.item.origin.by !== 'agent' && !isMarkItem(x)).map((x) => ({ x, st: stateOf(x, rv.followed.has(x.item.id)) }))
|
|
18
|
+
const rows = rv.boardRows
|
|
19
19
|
const role = spec?.role
|
|
20
|
+
const open = rv.card?.data?.members ?? []
|
|
20
21
|
return (
|
|
21
22
|
<div className="rv-listscroll rv-board">
|
|
22
23
|
<div className="rv-count">{role ? `dispatcher: ${role.name}, since ${role.since.slice(0, 16).replace('T', ' ')}` : 'dispatcher: nobody (sk review dispatcher --as <name>)'}</div>
|
|
24
|
+
{rows === null ? <div className="rv-empty"><span className="spin" /> reading the board…</div> : null}
|
|
23
25
|
{STATES.map(({ state, label }) => {
|
|
24
|
-
const of = rows.filter((r) => r.
|
|
26
|
+
const of = (rows ?? []).filter((r) => r.state === state)
|
|
25
27
|
if (of.length === 0) return null
|
|
26
28
|
return (
|
|
27
29
|
<div key={state}>
|
|
28
30
|
<div className="rv-divider">{label} · {of.length}</div>
|
|
29
|
-
{of.map((
|
|
30
|
-
<div key={
|
|
31
|
-
<div className="rv-linkedtitle">{
|
|
31
|
+
{of.map((r) => (
|
|
32
|
+
<div key={r.id} className={`rv-boardrow${open.includes(r.id) ? ' on' : ''}`} onClick={() => rv.pick(r.id)}>
|
|
33
|
+
<div className="rv-linkedtitle">{r.title}</div>
|
|
32
34
|
<div className="rv-dim">
|
|
33
|
-
{
|
|
34
|
-
{
|
|
35
|
-
{
|
|
36
|
-
{
|
|
35
|
+
{r.topic ? topicLabel(r.topic, spec ?? undefined) : 'no topic'}
|
|
36
|
+
{r.worker ? ` · ${r.worker}` : ''}
|
|
37
|
+
{r.stale ? ' · stale claim' : ''}
|
|
38
|
+
{r.from ? ` · ${r.from}` : ''}
|
|
37
39
|
</div>
|
|
38
40
|
</div>
|
|
39
41
|
))}
|
|
40
42
|
</div>
|
|
41
43
|
)
|
|
42
44
|
})}
|
|
43
|
-
{rows.every((r) => r.
|
|
45
|
+
{rows !== null && rows.every((r) => r.state === 'closed') ? <div className="rv-empty">Nothing raised is open.</div> : null}
|
|
44
46
|
</div>
|
|
45
47
|
)
|
|
46
48
|
})
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// the cells of a thread, one framed card each (wiki build/shipkit/review.md, The review page): a header bar (who, when,
|
|
2
|
+
// the kind, `v2`, fold, copy the id), then the body, or one line of summary when folded. A folded cell draws no media.
|
|
3
|
+
// A version holds its words and its views, a verdict points back at the version it judged and lists his notes (a
|
|
4
|
+
// click shows the view they sit on), a reply and a note are words; a run of state changes is one thin line
|
|
5
|
+
import { observer } from 'mobx-react-lite'
|
|
6
|
+
import type { EventCell, NoteCell, ReplyCell, VerdictCell, VersionCell } from '../../../review/cells.ts'
|
|
7
|
+
import { isGallery, STATUS_LABEL, viewName, viewTag, type Rect } from '../../../review/model.ts'
|
|
8
|
+
import { Icon, ICON } from '../icons.tsx'
|
|
9
|
+
import { renderMd } from '../md.ts'
|
|
10
|
+
import { ageWords, stampWords } from '../time-ago.tsx'
|
|
11
|
+
import { KindView, AnimPanel } from './kind-view.tsx'
|
|
12
|
+
import { keepFocus, laneColor, REACTIONS, secs, SIDE_LABEL, toneOf } from './kit.tsx'
|
|
13
|
+
import type { ReviewSt } from './review-st.ts'
|
|
14
|
+
import { VersionViews } from './review-views.tsx'
|
|
15
|
+
import { cellDom, type Framed, type ThreadSt } from './thread-st.ts'
|
|
16
|
+
|
|
17
|
+
/** who a cell is from, as its header says it: you, a player, or the agent's lane */
|
|
18
|
+
const whoWords = (who: string): string => (who === 'owner' ? 'you' : who)
|
|
19
|
+
|
|
20
|
+
/** an agent that named no lane: « agent », or « agent 66573d » after its session */
|
|
21
|
+
const anonymous = (who: string): boolean => who === 'agent' || who.startsWith('agent ')
|
|
22
|
+
|
|
23
|
+
/** a round mark of who speaks: his own, a player's, the lane's colour and name, or a neutral mark for an agent that
|
|
24
|
+
* named no lane */
|
|
25
|
+
const avatarText = (who: string): string => (who === 'owner' ? 'you' : who === 'player' ? 'P' : anonymous(who) ? '⚙' : who.slice(0, 4))
|
|
26
|
+
|
|
27
|
+
const Avatar = ({ who }: { who: string }) => {
|
|
28
|
+
const mine = who === 'owner'
|
|
29
|
+
const player = who === 'player'
|
|
30
|
+
const anon = anonymous(who)
|
|
31
|
+
const tip = anon ? `${who}: an agent that named no lane${who === 'agent' ? '' : ' (its session)'}` : whoWords(who)
|
|
32
|
+
return (
|
|
33
|
+
<span className={`rv-avatar${mine ? ' mine' : player ? ' player' : anon ? ' anon' : ''}`} style={mine || player || anon ? undefined : { ['--lane' as string]: laneColor(who) }} title={tip}>
|
|
34
|
+
{avatarText(who)}
|
|
35
|
+
</span>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** a time as « 3h ago », the exact stamp in its tooltip; it moves with the repo's clock */
|
|
40
|
+
export const When = observer(({ rv, at }: { rv: ReviewSt; at: string }) => {
|
|
41
|
+
const t = Date.parse(at)
|
|
42
|
+
return <time className="rv-when" dateTime={at} title={stampWords(t)}>{ageWords(t, rv.now)}</time>
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const KIND_LABEL: Record<Framed['kind'], string> = { version: 'version', verdict: 'verdict', reply: 'reply', note: 'note' }
|
|
46
|
+
|
|
47
|
+
/** one framed cell: its header bar, then its body, or its summary when folded */
|
|
48
|
+
export const CellFrame = observer(({ rv, card, c }: { rv: ReviewSt; card: ThreadSt; c: Framed }) => {
|
|
49
|
+
const open = card.isOpen(c)
|
|
50
|
+
const head = card.head?.id === c.id
|
|
51
|
+
const unread = (c.kind === 'reply' || c.kind === 'note') && c.party === 'agent' && !c.read
|
|
52
|
+
const tone = c.kind === 'version' ? toneOf(c.status) : c.kind === 'verdict' ? toneOf(c.verdict) : ''
|
|
53
|
+
return (
|
|
54
|
+
<article id={cellDom(c.id)} data-unread={unread ? c.id : undefined} className={`rv-c k-${c.kind} p-${c.party}${open ? '' : ' folded'}${head ? ' head' : ''} ${tone}`}>
|
|
55
|
+
<header className="rv-chead" onClick={() => card.toggleCell(c)}>
|
|
56
|
+
<button className="rv-foldbtn" aria-label={open ? 'fold' : 'unfold'} aria-expanded={open} onMouseDown={keepFocus} onClick={(e) => { e.stopPropagation(); card.toggleCell(c) }}>{open ? '▾' : '▸'}</button>
|
|
57
|
+
<Avatar who={c.who} />
|
|
58
|
+
{avatarText(c.who) === whoWords(c.who) ? null : <b className="rv-cwho">{whoWords(c.who)}</b>}
|
|
59
|
+
<span className="rv-ckind">{c.kind === 'version' ? `v${c.n}` : c.kind === 'reply' && c.op ? (c.op === 'ask' ? 'question' : 'answer') : KIND_LABEL[c.kind]}</span>
|
|
60
|
+
{c.kind === 'version' ? <span className="rv-badge">{STATUS_LABEL[c.status]}</span> : null}
|
|
61
|
+
{c.kind === 'verdict' ? <span className="rv-badge">{STATUS_LABEL[c.verdict]}</span> : null}
|
|
62
|
+
{c.kind === 'verdict' ? (
|
|
63
|
+
<button className="rv-on ghost" title={c.n > 0 ? `the version this answers: v${c.n}` : 'the note this answers'} onMouseDown={keepFocus} onClick={(e) => { e.stopPropagation(); card.reveal(c.on) }}>↑ on {c.n > 0 ? `v${c.n}` : 'the note'}</button>
|
|
64
|
+
) : c.kind !== 'version' && c.on !== c.id && c.on !== card.data?.head ? (
|
|
65
|
+
<button className="rv-on ghost" title="the item this was said on" onMouseDown={keepFocus} onClick={(e) => { e.stopPropagation(); card.reveal(c.on) }}>↑ on {onWords(card, c.on)}</button>
|
|
66
|
+
) : null}
|
|
67
|
+
{head ? <span className="rv-headtag" title="your verdict and your reply go to this one">answer here</span> : null}
|
|
68
|
+
{unread ? <span className="rv-unread" title="not read yet" /> : null}
|
|
69
|
+
<span className="sp" />
|
|
70
|
+
<When rv={rv} at={c.at} />
|
|
71
|
+
<button className="rv-copyid ghost" title={`copy the id: ${c.id}`} aria-label="copy the id" onMouseDown={keepFocus} onClick={(e) => { e.stopPropagation(); void rv.copyId(c.id) }}>
|
|
72
|
+
<Icon d={ICON.copy} />
|
|
73
|
+
</button>
|
|
74
|
+
</header>
|
|
75
|
+
{open ? (
|
|
76
|
+
<div className="rv-cbody">
|
|
77
|
+
{c.kind === 'version' ? <VersionBody rv={rv} card={card} c={c} /> : c.kind === 'verdict' ? <VerdictBody card={card} c={c} /> : c.kind === 'reply' ? <ReplyBody rv={rv} c={c} /> : <NoteBody rv={rv} c={c} />}
|
|
78
|
+
</div>
|
|
79
|
+
) : (
|
|
80
|
+
<div className="rv-csum" onClick={() => card.toggleCell(c)}>{c.summary || '·'}</div>
|
|
81
|
+
)}
|
|
82
|
+
</article>
|
|
83
|
+
)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
/** what an item a word sits on is called: its version, or the note it answers */
|
|
87
|
+
const onWords = (card: ThreadSt, on: string): string => {
|
|
88
|
+
const v = card.versionOf(on)
|
|
89
|
+
return v ? `v${v.n}` : 'the note'
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** a long text folded to its first lines, a « more » that unfolds it in place */
|
|
93
|
+
const LONG_WHAT = 480
|
|
94
|
+
|
|
95
|
+
const Clamp = observer(({ card, id, md }: { card: ThreadSt; id: string; md: string }) => {
|
|
96
|
+
const long = md.length > LONG_WHAT || md.split('\n').length > 8
|
|
97
|
+
const key = `${id}#what`
|
|
98
|
+
const open = !long || card.folds[key] === true
|
|
99
|
+
return (
|
|
100
|
+
<div className={`rv-clamp${open ? '' : ' shut'}`}>
|
|
101
|
+
<div className="md rv-what" dangerouslySetInnerHTML={{ __html: renderMd(md) }} />
|
|
102
|
+
{long ? (
|
|
103
|
+
<button className="rv-more ghost" aria-expanded={open} onMouseDown={keepFocus} onClick={() => card.toggle(key, open)}>{open ? 'less ▴' : 'more ▾'}</button>
|
|
104
|
+
) : null}
|
|
105
|
+
</div>
|
|
106
|
+
)
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
/** a version: its gutter (its big `v3`, sticky while it scrolls), what the agent says, the repo's facts on it, its views */
|
|
110
|
+
const VersionBody = observer(({ rv, card, c }: { rv: ReviewSt; card: ThreadSt; c: VersionCell }) => (
|
|
111
|
+
<div className="rv-vgrid">
|
|
112
|
+
<div className="rv-gut" aria-hidden="true"><span className="rv-gutlabel">v{c.n}</span></div>
|
|
113
|
+
<div className="rv-vmain"><VersionMain rv={rv} card={card} c={c} /></div>
|
|
114
|
+
</div>
|
|
115
|
+
))
|
|
116
|
+
|
|
117
|
+
const VersionMain = observer(({ rv, card, c }: { rv: ReviewSt; card: ThreadSt; c: VersionCell }) => {
|
|
118
|
+
const r = c.item
|
|
119
|
+
const live = c.id === card.head?.id && card.takesVerdict
|
|
120
|
+
const stamp = card.cells.findLast((x) => x.on === c.id)?.id ?? c.id
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
{r.what ? <Clamp card={card} id={c.id} md={r.what} /> : null}
|
|
124
|
+
{r.keeps ? <div className="rv-keeps"><b>keeps:</b> {r.keeps}</div> : null}
|
|
125
|
+
{r.why ? <div className="rv-pre rv-why">another subject: {r.why}</div> : null}
|
|
126
|
+
<div className="rv-cfacts">
|
|
127
|
+
{r.commit ? <span className="rv-mono" title={`commit ${r.commit}`}>@{r.commit.slice(0, 9)}</span> : null}
|
|
128
|
+
<span className="rv-mono rv-dim">{r.id}</span>
|
|
129
|
+
</div>
|
|
130
|
+
<KindView app={rv} item={r} stamp={stamp} />
|
|
131
|
+
<AnimPanel app={rv} item={r} />
|
|
132
|
+
{r.views.length > 0 ? <VersionViews ver={{ rv, card, cell: c, live }} /> : null}
|
|
133
|
+
</>
|
|
134
|
+
)
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
/** where a rectangle sits, in words: its view's number and name, its side, its moment */
|
|
138
|
+
const rectPlace = (card: ThreadSt, on: string, r: Rect): string => {
|
|
139
|
+
const v = card.versionOf(on)
|
|
140
|
+
const i = r.view ?? 0
|
|
141
|
+
return `${v ? `${viewTag(v.n, i)}${v.item.views[i]?.label ? ` ${v.item.views[i]!.label}` : ''}` : viewName(undefined, i)}${r.side ? ` ${SIDE_LABEL[r.side]}` : ''}${r.t !== undefined ? ` · ${secs(r.t)}` : ''}`
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** the owner's verdict: the verdict, the words, the pick, then each note with the view it sits on (a click shows it) */
|
|
145
|
+
const VerdictBody = observer(({ card, c }: { card: ThreadSt; c: VerdictCell }) => {
|
|
146
|
+
const v = card.versionOf(c.on)
|
|
147
|
+
const views = v?.item.views ?? []
|
|
148
|
+
return (
|
|
149
|
+
<>
|
|
150
|
+
<div className="rv-verdictline">
|
|
151
|
+
<span className={`rv-bigpill ${toneOf(c.verdict)}`}>{STATUS_LABEL[c.verdict]}</span>
|
|
152
|
+
{c.current ? null : <span className="rv-dim">an earlier answer, before a reopen or a newer one</span>}
|
|
153
|
+
<span className="rv-dim">{c.read ? 'read by the agent' : 'not read yet'}</span>
|
|
154
|
+
</div>
|
|
155
|
+
{c.text ? <div className="rv-pre rv-words">{c.text}</div> : null}
|
|
156
|
+
{c.pick !== undefined ? (
|
|
157
|
+
<button className="rv-noteline re-approved" onClick={() => card.reveal(c.on, c.pick)}>✓ picked {v ? `${viewTag(v.n, c.pick)} ` : ''}{viewName(views[c.pick], c.pick)}</button>
|
|
158
|
+
) : null}
|
|
159
|
+
{c.rects.map((r, k) => (
|
|
160
|
+
<button key={`r${k}`} className="rv-noteline rect" onClick={() => card.reveal(c.on, r.view ?? 0)}>
|
|
161
|
+
<span className="rv-notemark">⬚ {k + 1}</span>
|
|
162
|
+
<span className="rv-noteplace">{rectPlace(card, c.on, r)}</span>
|
|
163
|
+
<span className="rv-notetext">{r.comment || <i className="rv-dim">no word</i>}</span>
|
|
164
|
+
</button>
|
|
165
|
+
))}
|
|
166
|
+
{c.reactions.map((q, k) => {
|
|
167
|
+
const o = REACTIONS.find((x) => x.status === q.status)
|
|
168
|
+
const view = views[q.view]
|
|
169
|
+
const tile = q.tile !== undefined && view && isGallery(view) ? ` · ${view.gallery[q.tile]?.label ?? `tile ${q.tile + 1}`}` : ''
|
|
170
|
+
return (
|
|
171
|
+
<button key={`q${k}`} className={`rv-noteline${q.status ? ` re-${q.status}` : ''}`} onClick={() => card.reveal(c.on, q.view)}>
|
|
172
|
+
<span className="rv-notemark">{o?.glyph ?? ''}{q.stars ? ` ★${q.stars}` : ''}</span>
|
|
173
|
+
<span className="rv-noteplace">{v ? `${viewTag(v.n, q.view)} ` : ''}{view?.label || (v ? '' : viewName(view, q.view))}{tile}</span>
|
|
174
|
+
<span className="rv-notetext">{q.comment || (o ? o.label : '')}</span>
|
|
175
|
+
</button>
|
|
176
|
+
)
|
|
177
|
+
})}
|
|
178
|
+
</>
|
|
179
|
+
)
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
/** words of either party, and an image he pasted */
|
|
183
|
+
const ReplyBody = ({ rv, c }: { rv: ReviewSt; c: ReplyCell }) => (
|
|
184
|
+
<>
|
|
185
|
+
<div className="rv-pre rv-words">{c.text}</div>
|
|
186
|
+
{c.image ? (
|
|
187
|
+
<a href={rv.threadImageUrl(c.on, c.image)} target="_blank" rel="noreferrer"><img className="rv-msgimg" src={rv.threadImageUrl(c.on, c.image)} alt="" loading="lazy" /></a>
|
|
188
|
+
) : null}
|
|
189
|
+
</>
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
/** what he or a player raised, or his mark: the words, the still with his rectangles on it */
|
|
193
|
+
const NoteBody = ({ rv, c }: { rv: ReviewSt; c: NoteCell }) => {
|
|
194
|
+
const first = c.item?.views[0]
|
|
195
|
+
const still = first && !isGallery(first) && 'image' in first.files ? { name: first.files.image, size: first.size } : null
|
|
196
|
+
const r = c.rate
|
|
197
|
+
return (
|
|
198
|
+
<>
|
|
199
|
+
{c.item && c.item.title !== c.text ? <div className="rv-notetitle">{c.item.title}</div> : null}
|
|
200
|
+
{r ? <div className="rv-dim">marked {[r.stars !== undefined ? `★${r.stars}` : '', r.mark ?? '', r.part ? `on ${r.part}` : ''].filter(Boolean).join(' ')}</div> : null}
|
|
201
|
+
{c.text ? <div className="rv-pre rv-words">{c.text}</div> : null}
|
|
202
|
+
{still && c.item ? (
|
|
203
|
+
<div className="rv-raisedframe" style={{ aspectRatio: `${still.size.w} / ${still.size.h}` }}>
|
|
204
|
+
<img src={rv.fitUrl(c.item.id, still.name)} alt="" loading="lazy" decoding="async" />
|
|
205
|
+
{c.rects.map((q, k) => (
|
|
206
|
+
<div key={k} className="rv-rect sent" style={{ left: `${q.x * 100}%`, top: `${q.y * 100}%`, width: `${q.w * 100}%`, height: `${q.h * 100}%` }} title={q.comment}>
|
|
207
|
+
<span className="rv-rectn">{k + 1}</span>
|
|
208
|
+
</div>
|
|
209
|
+
))}
|
|
210
|
+
</div>
|
|
211
|
+
) : null}
|
|
212
|
+
{c.rects.some((q) => q.comment) ? c.rects.map((q, k) => (q.comment ? <div key={k} className="rv-noteline rect still"><span className="rv-notemark">⬚ {k + 1}</span><span className="rv-notetext">{q.comment}</span></div> : null)) : null}
|
|
213
|
+
{c.image && c.item ? <img className="rv-msgimg" src={rv.threadImageUrl(c.item.id, c.image)} alt="" loading="lazy" /> : null}
|
|
214
|
+
</>
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** a run of state changes in a row: one thin line, the same change said once with its count and its first and last
|
|
219
|
+
* time. A run never crosses a framed cell: the thread draws a verdict or a word between two changes as its own cell */
|
|
220
|
+
export const EventsLine = observer(({ rv, cells }: { rv: ReviewSt; cells: EventCell[] }) => {
|
|
221
|
+
const runs: { c: EventCell; n: number; last: EventCell }[] = []
|
|
222
|
+
for (const c of cells) {
|
|
223
|
+
const run = runs.at(-1)
|
|
224
|
+
if (run && run.c.summary === c.summary) {
|
|
225
|
+
run.n++
|
|
226
|
+
run.last = c
|
|
227
|
+
} else runs.push({ c, n: 1, last: c })
|
|
228
|
+
}
|
|
229
|
+
return (
|
|
230
|
+
<div className="rv-events">
|
|
231
|
+
{runs.map(({ c, n, last }) => (
|
|
232
|
+
<div key={c.id} id={cellDom(c.id)} className="rv-event" title={n > 1 ? `${n} times: ${c.summary}` : c.summary}>
|
|
233
|
+
{n > 1 ? <b className="rv-eventn">{n}×</b> : null}
|
|
234
|
+
<span className="rv-eventtext">{c.summary}</span>
|
|
235
|
+
<When rv={rv} at={c.at} />
|
|
236
|
+
{n > 1 ? <>{' → '}<When rv={rv} at={last.at} /></> : null}
|
|
237
|
+
</div>
|
|
238
|
+
))}
|
|
239
|
+
</div>
|
|
240
|
+
)
|
|
241
|
+
})
|