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
package/src/trailer/prune.ts
CHANGED
|
@@ -163,7 +163,7 @@ function filesUnder(dir: string): string[] {
|
|
|
163
163
|
const cacheOf = async (root: string): Promise<string> => join((await import('./footage.ts')).trailerCache(root, 'footage'), '..')
|
|
164
164
|
|
|
165
165
|
/** each folder's files that go, as of `now`; `now` Infinity names the files only their age keeps too */
|
|
166
|
-
function planOf(cache: string, live: Live,
|
|
166
|
+
function planOf(cache: string, live: Live, now: number): [string, Doomed[]][] {
|
|
167
167
|
const whole = live.broken.length === 0
|
|
168
168
|
// titles/ holds the vertical's drawings too: only a title's and a card's files are the prune's
|
|
169
169
|
const ownTitle = (n: string): boolean => /^(title|card)-[0-9a-f]{16}\./.test(n)
|
|
@@ -176,7 +176,6 @@ function planOf(cache: string, live: Live, views: readonly string[], now: number
|
|
|
176
176
|
]
|
|
177
177
|
const dead = existsSync(cache) ? readdirSync(cache, { withFileTypes: true }).filter((e) => e.isDirectory() && !FOLDERS.includes(e.name)) : []
|
|
178
178
|
for (const d of dead) plan.push([`${d.name}/ (dead)`, filesUnder(join(cache, d.name)).map(doomed)])
|
|
179
|
-
plan.push(['trailer-view/', views.filter((f) => existsSync(f) && now - statSync(f).mtimeMs > RENDER_GRACE_MS).map(doomed)])
|
|
180
179
|
return plan
|
|
181
180
|
}
|
|
182
181
|
|
|
@@ -188,15 +187,14 @@ interface Stamp {
|
|
|
188
187
|
|
|
189
188
|
const stampFile = (cache: string): string => join(cache, 'prune.json')
|
|
190
189
|
|
|
191
|
-
/** what the prune reads that a build can change: every cut's text, every file name in the cache's folders
|
|
192
|
-
*
|
|
190
|
+
/** what the prune reads that a build can change: every cut's text, every file name in the cache's folders. The same
|
|
191
|
+
* key and no spared file of age: the prune would find what it found */
|
|
193
192
|
async function pruneKey(root: string, cache: string): Promise<string> {
|
|
194
|
-
const
|
|
193
|
+
const { cutFiles } = await import('./build.ts')
|
|
195
194
|
const h = new Bun.CryptoHasher('sha1')
|
|
196
195
|
for (const f of cutFiles(root)) h.update(`${f}\0`).update(readFileSync(f)).update('\0')
|
|
197
196
|
const folders = existsSync(cache) ? readdirSync(cache, { withFileTypes: true }).filter((e) => e.isDirectory()) : []
|
|
198
197
|
for (const d of folders.map((e) => e.name).sort()) h.update(`${d}/\0${filesUnder(join(cache, d)).sort().join('\0')}\0`)
|
|
199
|
-
h.update(viewsToDrop(root).sort().join('\0'))
|
|
200
198
|
return h.digest('hex')
|
|
201
199
|
}
|
|
202
200
|
|
|
@@ -214,17 +212,15 @@ export async function pruneIfMoved(root: string, now = Date.now()): Promise<Prun
|
|
|
214
212
|
/** plans every folder's prune, then deletes unless `dry`; a whole prune writes its stamp */
|
|
215
213
|
export async function prune(root: string, o: { dry: boolean; now?: number }): Promise<Pruned> {
|
|
216
214
|
const now = o.now ?? Date.now()
|
|
217
|
-
const { viewsToDrop } = await import('../review/trailer-desk.ts')
|
|
218
215
|
const cache = await cacheOf(root)
|
|
219
216
|
const live = await liveSet(root)
|
|
220
|
-
const
|
|
221
|
-
const plan = planOf(cache, live, views, now)
|
|
217
|
+
const plan = planOf(cache, live, now)
|
|
222
218
|
if (!o.dry && existsSync(cache)) {
|
|
223
219
|
for (const [, ds] of plan) for (const d of ds) rmSync(d.file, { force: true })
|
|
224
220
|
for (const d of readdirSync(cache, { withFileTypes: true }).filter((e) => e.isDirectory() && !FOLDERS.includes(e.name))) rmSync(join(cache, d.name), { recursive: true, force: true })
|
|
225
221
|
rmSync(stampFile(cache), { force: true })
|
|
226
222
|
if (live.broken.length === 0) {
|
|
227
|
-
const spared = planOf(cache, live,
|
|
223
|
+
const spared = planOf(cache, live, Number.POSITIVE_INFINITY).flatMap(([, ds]) => ds.filter((d) => existsSync(d.file)))
|
|
228
224
|
const until = Math.min(Number.MAX_SAFE_INTEGER, ...spared.map((d) => statSync(d.file).mtimeMs + RENDER_GRACE_MS))
|
|
229
225
|
writeFileSync(stampFile(cache), JSON.stringify({ key: await pruneKey(root, cache), until } satisfies Stamp))
|
|
230
226
|
}
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
// the review page's right column: the card's header (title, state pill, what), a kind's facts, the linked cards, what
|
|
2
|
-
// goes to the agent, the verdicts (the phone's in a bar under the thumb), then the thread's conversation and his reply
|
|
3
|
-
// box. When the page reads in one column the header sits over the views instead (review-views.tsx)
|
|
4
|
-
import { observer } from 'mobx-react-lite'
|
|
5
|
-
import { AutoText } from '../auto-text.tsx'
|
|
6
|
-
import { Icon, ICON } from '../icons.tsx'
|
|
7
|
-
import { laneOf, placeText, STATUS_LABEL, stateOf, verdictOf, viewName, withdrawnOf, type ReviewItem, type ReviewStatus } from '../../../review/model.ts'
|
|
8
|
-
import { renderMd } from '../md.ts'
|
|
9
|
-
import { AutoTag, blurOnEscape, Empty, LaneTag, Listeners, REACTIONS, Rework, secs, short, SIDE_LABEL, ThumbOf, toneOf, VERDICTS } from './kit.tsx'
|
|
10
|
-
import { AnimPanel, KindView } from './kind-view.tsx'
|
|
11
|
-
import type { ReviewSt } from './review-st.ts'
|
|
12
|
-
|
|
13
|
-
export const ReviewForm = observer(({ rv }: { rv: ReviewSt }) => {
|
|
14
|
-
const x = rv.open
|
|
15
|
-
if (!x) return <Empty text="The open card, its comment and its answer." />
|
|
16
|
-
const r = x.item
|
|
17
|
-
const draft = rv.draft
|
|
18
|
-
const sent = verdictOf(x)
|
|
19
|
-
return (
|
|
20
|
-
<div className="rv-form">
|
|
21
|
-
{rv.headInViews ? null : <CardHead rv={rv} x={x} />}
|
|
22
|
-
<KindView app={rv} x={x} />
|
|
23
|
-
<AnimPanel app={rv} x={x} />
|
|
24
|
-
{rv.newer.map((y) => <Linked key={y.item.id} rv={rv} label="replaced by" id={y.item.id} item={y} />)}
|
|
25
|
-
{r.supersedes && rv.history.length === 0 ? <Linked rv={rv} label="replaces" id={r.supersedes} item={null} /> : null}
|
|
26
|
-
{rv.answered.map((y) => <Linked key={y.item.id} rv={rv} label="answers" id={y.item.id} item={y} />)}
|
|
27
|
-
{rv.answeredBy ? <Linked rv={rv} label="answered by" id={rv.answeredBy.item.id} item={rv.answeredBy} /> : null}
|
|
28
|
-
{rv.history.length > 0 ? <div className="rv-divider">earlier versions</div> : null}
|
|
29
|
-
{rv.history.map((y, i) => <Linked key={y.item.id} rv={rv} label={`v${rv.history.length - i}`} id={y.item.id} item={y} />)}
|
|
30
|
-
<Outgoing rv={rv} />
|
|
31
|
-
<Messages rv={rv} />
|
|
32
|
-
<div className="rv-formfoot">
|
|
33
|
-
<button className="ghost" onClick={() => rv.nextPending()}>next waiting (N)</button>
|
|
34
|
-
{rv.dirty && sent ? <button className="ghost" onClick={() => rv.dropDraft()}>back to the answer sent</button> : null}
|
|
35
|
-
</div>
|
|
36
|
-
{sent && rv.dirty ? <div className="rv-dim">The changes are not sent yet: a verdict sends them.</div> : null}
|
|
37
|
-
{!sent && rv.dirty ? <div className="rv-dim">Draft kept in this browser until it is sent.</div> : null}
|
|
38
|
-
{rv.error ? <div className="rv-err rv-pre">{rv.error}</div> : null}
|
|
39
|
-
</div>
|
|
40
|
-
)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
const RAISED_NOW: Record<string, string> = {
|
|
44
|
-
new: 'waiting for a dispatcher',
|
|
45
|
-
question: 'a question for you',
|
|
46
|
-
blocked: 'blocked: it waits on your decision',
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** where the item stands, in a few words beside its pill: when it was sent or answered, who holds a raised item */
|
|
50
|
-
function stateWords(x: ReviewItem): string {
|
|
51
|
-
const o = x.item.origin
|
|
52
|
-
if (o.by !== 'agent') {
|
|
53
|
-
const st = stateOf(x, false)
|
|
54
|
-
const by = o.by === 'player' ? `by ${o.player}` : o.by === 'auto' ? `by the rule ${o.rule}` : 'by you'
|
|
55
|
-
const now =
|
|
56
|
-
st.state === 'open' ? `sent to ${st.topic ?? 'a topic'}`
|
|
57
|
-
: st.state === 'claimed' ? `taken by ${st.worker ?? 'an agent'}`
|
|
58
|
-
: st.state === 'closed' ? (st.why === 'wontfix' ? 'closed, not done' : st.why === 'superseded' ? 'replaced by a card' : st.why === 'rated' ? 'rated' : 'done')
|
|
59
|
-
: RAISED_NOW[st.state] ?? st.state
|
|
60
|
-
return `raised ${by} ${short(x.item.created)} · ${now}`
|
|
61
|
-
}
|
|
62
|
-
const fb = verdictOf(x)
|
|
63
|
-
if (fb) return `answered ${short(fb.at)} · ${fb.seen ? 'read by the agent' : 'not read yet'}`
|
|
64
|
-
const withdrawn = withdrawnOf(x)
|
|
65
|
-
if (withdrawn !== undefined) return `withdrawn: ${withdrawn}`
|
|
66
|
-
return x.item.wip ? 'the agent works on it' : `sent ${short(x.item.created)}`
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** the card's header, for every card: the title, one tight line (the state as the list's pill, the lane, when, the
|
|
70
|
-
* commit, the button that copies the card for an agent), then what the agent says. No subject row: the list's row names it, a kind's facts say the
|
|
71
|
-
* rest; no id row: the url carries it. Under it the four verdicts (on the phone they ride the bar under the thumb)
|
|
72
|
-
* and his overall comment, on every card and in every layout */
|
|
73
|
-
export const CardHead = observer(({ rv, x }: { rv: ReviewSt; x: ReviewItem }) => {
|
|
74
|
-
const r = x.item
|
|
75
|
-
const draft = rv.draft
|
|
76
|
-
const status = rv.statusOf(x)
|
|
77
|
-
const sent = verdictOf(x)
|
|
78
|
-
const lane = laneOf(x)
|
|
79
|
-
return (
|
|
80
|
-
<div className="rv-head">
|
|
81
|
-
<h3 className="rv-title">{r.title}</h3>
|
|
82
|
-
<div className="rv-meta">
|
|
83
|
-
<span className={`rv-badge ${toneOf(status)}`}>{STATUS_LABEL[status]}</span>
|
|
84
|
-
{lane ? <LaneTag lane={lane} /> : null}
|
|
85
|
-
{r.origin.by === 'auto' ? <AutoTag rule={r.origin.rule} /> : null}
|
|
86
|
-
<span>{stateWords(x)}</span>
|
|
87
|
-
{r.commit ? <span className="rv-mono" title={`commit ${r.commit}`}>@{r.commit.slice(0, 9)}</span> : null}
|
|
88
|
-
<button className="rv-copyid ghost" title={`copy this card for an agent (C): its title, its repo, sk review show ${r.id}, its link`} aria-label="copy this card for an agent" onClick={() => void rv.copyCard()}>
|
|
89
|
-
<Icon d={ICON.copy} />
|
|
90
|
-
</button>
|
|
91
|
-
</div>
|
|
92
|
-
<Rework rv={rv} x={x} />
|
|
93
|
-
{r.views.length > 0 && r.what ? <div className="md rv-what" dangerouslySetInnerHTML={{ __html: renderMd(r.what) }} /> : null}
|
|
94
|
-
{r.keeps ? <div className="rv-keeps"><b>keeps:</b> {r.keeps}</div> : null}
|
|
95
|
-
{r.why ? <div className="rv-pre rv-why">another subject: {r.why}</div> : null}
|
|
96
|
-
{!rv.phone.on && !r.wip && r.origin.by === 'agent' ? (
|
|
97
|
-
<div className="rv-headverdicts">
|
|
98
|
-
{VERDICTS.map((v) => <VerdictButton key={v.status} v={v} sent={sent?.status} busy={rv.busy} send={() => void rv.submit(v.status)} />)}
|
|
99
|
-
<Listeners rv={rv} cards={[x]} />
|
|
100
|
-
</div>
|
|
101
|
-
) : null}
|
|
102
|
-
<AutoText className="rv-comment" rows={2} placeholder="your overall word (a verdict sends it)" value={draft.comment} onKeyDown={blurOnEscape} onText={(t) => rv.setComment(t)} />
|
|
103
|
-
</div>
|
|
104
|
-
)
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
/** one verdict: plain until one is sent, then the chosen one filled and the others dimmed */
|
|
108
|
-
const VerdictButton = ({ v, sent, busy, send }: { v: (typeof VERDICTS)[number]; sent: ReviewStatus | undefined; busy: boolean; send: () => void }) => (
|
|
109
|
-
<button className={`rv-verdict ${toneOf(v.status)}${sent === v.status ? ' chosen' : ''}${sent && sent !== v.status ? ' off' : ''}`} disabled={busy} onClick={send} title={`${v.label} (${v.key})`}>
|
|
110
|
-
<span className="rv-vglyph">{sent === v.status ? '✓' : v.glyph}</span> {v.short} ({v.key})
|
|
111
|
-
</button>
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
/** the phone's verdicts: one row stuck to the bottom of the open card, under the thumb */
|
|
115
|
-
export const VerdictBar = observer(({ rv }: { rv: ReviewSt }) => {
|
|
116
|
-
const x = rv.open
|
|
117
|
-
if (!x || x.item.wip || x.item.origin.by !== 'agent') return null
|
|
118
|
-
const sent = verdictOf(x)?.status
|
|
119
|
-
return (
|
|
120
|
-
<div className="rv-verdictbar">
|
|
121
|
-
{VERDICTS.map((v) => (
|
|
122
|
-
<button key={v.status} className={`rv-verdict ${toneOf(v.status)}${sent === v.status ? ' chosen' : ''}${sent && sent !== v.status ? ' off' : ''}`} disabled={rv.busy}
|
|
123
|
-
onClick={() => void rv.submit(v.status)}>
|
|
124
|
-
{sent === v.status ? '✓' : v.glyph} {v.short}
|
|
125
|
-
</button>
|
|
126
|
-
))}
|
|
127
|
-
</div>
|
|
128
|
-
)
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
/** the card this one replaces, or the one replacing it: a click opens it, its answer shown here */
|
|
132
|
-
const Linked = observer(({ rv, label, id, item }: { rv: ReviewSt; label: string; id: string; item: ReviewItem | null }) => {
|
|
133
|
-
if (!item) return <div className="rv-err">{label} {id}: not found</div>
|
|
134
|
-
const status = rv.statusOf(item)
|
|
135
|
-
const fb = verdictOf(item)
|
|
136
|
-
return (
|
|
137
|
-
<div className={`rv-linked ${toneOf(status)}`}>
|
|
138
|
-
<div className="rv-linkedrow">
|
|
139
|
-
<div className="rv-thumb xs" onClick={() => rv.pick(item.item.id)}><ThumbOf rv={rv} x={item} /></div>
|
|
140
|
-
<span className="rv-dim">{label}</span>
|
|
141
|
-
<a className="rv-linkedtitle" onClick={() => rv.pick(item.item.id)}>{item.item.title}</a>
|
|
142
|
-
<span className="rv-badge">{STATUS_LABEL[status]}</span>
|
|
143
|
-
</div>
|
|
144
|
-
{fb?.comment ? <div className="rv-pre rv-small">{fb.comment}</div> : null}
|
|
145
|
-
{fb?.rects.map((q, i) => (q.comment ? (
|
|
146
|
-
<div key={i} className="rv-dim rv-small">{i + 1}{q.side ? ` ${SIDE_LABEL[q.side]}` : ''}{q.t !== undefined ? ` · ${secs(q.t)}` : ''}: {q.comment}</div>
|
|
147
|
-
) : null))}
|
|
148
|
-
</div>
|
|
149
|
-
)
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
/** scrolls the middle column to a view, or to one tile of a gallery */
|
|
153
|
-
function jumpTo(view: number, tile?: number): void {
|
|
154
|
-
document.getElementById(tile === undefined ? `review-view-${view}` : `review-tile-${view}-${tile}`)?.scrollIntoView({ behavior: 'smooth', block: tile === undefined ? 'start' : 'center' })
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** « what goes to the agent »: every reaction to a view or a tile, then every rectangle, each by its view's label; a
|
|
158
|
-
* click on its badge scrolls to it, its comment edits in place, the cross removes it */
|
|
159
|
-
const Outgoing = observer(({ rv }: { rv: ReviewSt }) => {
|
|
160
|
-
const x = rv.open
|
|
161
|
-
if (!x) return null
|
|
162
|
-
const views = x.item.views
|
|
163
|
-
const draft = rv.draft
|
|
164
|
-
const reactions = rv.outgoingReactions
|
|
165
|
-
const empty = reactions.length === 0 && draft.rects.length === 0 && draft.pick === undefined
|
|
166
|
-
return (
|
|
167
|
-
<div className="rv-outgoing">
|
|
168
|
-
<div className="rv-divider">what goes to the agent</div>
|
|
169
|
-
{empty ? (
|
|
170
|
-
<div className="rv-dim rv-small">
|
|
171
|
-
{rv.choice && rv.rows
|
|
172
|
-
? 'Score the options (stars, or ⇧1 to ⇧5 on the one playing), a word on one with ✎, then pick one (P): the pick is your answer.'
|
|
173
|
-
: rv.rows
|
|
174
|
-
? 'Play each one (1 to 9), then OK, fix or no on a row, or a word with ✎.'
|
|
175
|
-
: rv.clipKey
|
|
176
|
-
? 'React to a view (OK, fix, no, a word), or drag on the clip to circle a detail: it pauses, the rectangle keeps its moment.'
|
|
177
|
-
: rv.phone.on
|
|
178
|
-
? 'React to a view (OK, fix, no, a word), or turn « Circle » on above the image, then drag to circle a detail.'
|
|
179
|
-
: 'React to a view (OK, fix, no, a word), or drag on the image to circle a detail, then write beside it.'}
|
|
180
|
-
</div>
|
|
181
|
-
) : null}
|
|
182
|
-
{draft.pick !== undefined ? (
|
|
183
|
-
<div className="rv-outrow">
|
|
184
|
-
<button className="rv-outbadge re-approved on" title="see the option you picked" onClick={() => { rv.setView(draft.pick ?? 0); jumpTo(draft.pick ?? 0) }}>
|
|
185
|
-
✓ picked {viewName(views[draft.pick], draft.pick)}
|
|
186
|
-
</button>
|
|
187
|
-
</div>
|
|
188
|
-
) : null}
|
|
189
|
-
{reactions.map((q) => {
|
|
190
|
-
const o = REACTIONS.find((r) => r.status === q.status)
|
|
191
|
-
return (
|
|
192
|
-
<div key={`${q.view}/${q.tile ?? ''}`} className="rv-outrow">
|
|
193
|
-
<button className={`rv-outbadge${q.status ? ` re-${q.status} on` : ''}`} title="see this image" onClick={() => { rv.setView(q.view); jumpTo(q.view, q.tile) }}>
|
|
194
|
-
{o?.glyph ?? (q.stars ? '' : '·')}{q.stars ? `★${q.stars}` : ''} {placeText(q, views).slice(1, -1)}
|
|
195
|
-
</button>
|
|
196
|
-
<AutoText placeholder={o ? `${o.label}, with no word` : 'a word'} value={q.comment} onKeyDown={blurOnEscape}
|
|
197
|
-
onText={(t) => rv.setReactionComment(q.view, q.tile, t)} />
|
|
198
|
-
<button className="ghost rv-x" aria-label="remove this reaction" onClick={() => rv.removeReaction(q.view, q.tile)}>✕</button>
|
|
199
|
-
</div>
|
|
200
|
-
)
|
|
201
|
-
})}
|
|
202
|
-
{draft.rects.map((q, i) => (
|
|
203
|
-
<div key={`rect${i}`} className="rv-outrow">
|
|
204
|
-
<button className={`rv-outbadge rect${rv.rect === i ? ' on' : ''}`} title="see this rectangle" onClick={() => { rv.pickRect(i); jumpTo(q.view ?? 0) }}>
|
|
205
|
-
⬚ {i + 1}{views.length > 1 ? ` · ${viewName(views[q.view ?? 0], q.view ?? 0)}` : ''}{q.side ? ` ${SIDE_LABEL[q.side]}` : ''}{q.t !== undefined ? ` · ${secs(q.t)}` : ''}
|
|
206
|
-
</button>
|
|
207
|
-
<AutoText placeholder="what is wrong here" value={q.comment} onFocus={() => rv.pickRect(i)} onKeyDown={blurOnEscape}
|
|
208
|
-
onText={(t) => rv.setRectComment(i, t)} />
|
|
209
|
-
<button className="ghost rv-x" aria-label="delete this rectangle" onClick={() => rv.removeRect(i)}>✕</button>
|
|
210
|
-
</div>
|
|
211
|
-
))}
|
|
212
|
-
</div>
|
|
213
|
-
)
|
|
214
|
-
})
|
|
215
|
-
|
|
216
|
-
/** the thread's conversation, every version's and every answered item's messages in time order, then his reply box
|
|
217
|
-
* (⌘Enter sends) */
|
|
218
|
-
const Messages = observer(({ rv }: { rv: ReviewSt }) => {
|
|
219
|
-
const conv = rv.conversation
|
|
220
|
-
const versions = rv.openThread?.versions ?? []
|
|
221
|
-
const vOf = (id: string): number => versions.length - versions.findIndex((x) => x.item.id === id)
|
|
222
|
-
const multi = new Set(conv.map((m) => m.on)).size > 1
|
|
223
|
-
return (
|
|
224
|
-
<div className="rv-messages">
|
|
225
|
-
<div className="rv-divider">talk</div>
|
|
226
|
-
{conv.length === 0 ? <div className="rv-dim rv-small">No message. An agent answers with sk review reply.</div> : null}
|
|
227
|
-
{conv.map((m) => {
|
|
228
|
-
const mine = m.who === 'owner'
|
|
229
|
-
return (
|
|
230
|
-
<div key={`${m.on}/${m.id}`} className={`rv-msg${mine ? ' mine' : ''}`}>
|
|
231
|
-
<div className="rv-dim rv-small">{mine ? 'you' : m.who} · {short(m.at)}{multi ? ` · v${vOf(m.on)}` : ''}</div>
|
|
232
|
-
<div className="rv-pre">{m.text}</div>
|
|
233
|
-
{m.image ? (
|
|
234
|
-
<a href={rv.threadImageUrl(m.on, m.image)} target="_blank" rel="noreferrer"><img className="rv-msgimg" src={rv.threadImageUrl(m.on, m.image)} alt="" /></a>
|
|
235
|
-
) : null}
|
|
236
|
-
</div>
|
|
237
|
-
)
|
|
238
|
-
})}
|
|
239
|
-
<AutoText className="rv-reply" rows={2} placeholder="Answer the agent (⌘Enter sends)" value={rv.reply} onText={(t) => rv.setReply(t)}
|
|
240
|
-
onKeyDown={(e) => {
|
|
241
|
-
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
|
242
|
-
e.preventDefault()
|
|
243
|
-
void rv.sendReply()
|
|
244
|
-
} else blurOnEscape(e)
|
|
245
|
-
}} />
|
|
246
|
-
<div className="rv-replyrow"><button className="primary" disabled={!rv.reply.trim() || rv.busy} onClick={() => void rv.sendReply()}>Reply</button></div>
|
|
247
|
-
</div>
|
|
248
|
-
)
|
|
249
|
-
})
|