rvlib-shipkit 2.16.0 → 2.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/package.json +1 -1
- package/src/assets/kit-config.ts +19 -1
- package/src/assets/run-assets.ts +18 -0
- package/src/cli/cmd_Review.ts +26 -7
- package/src/cli/cmd_Secret.ts +127 -0
- package/src/cli/cmd_Wiki.ts +4 -4
- package/src/cli/family-pages.ts +1 -0
- package/src/cli/registry.ts +4 -0
- package/src/core/discover-checks.ts +18 -5
- package/src/core/scope.ts +42 -0
- package/src/home/beat.ts +30 -0
- package/src/home/home-paths.ts +1 -0
- package/src/home/pm.ts +3 -1
- package/src/home/run-daemon.ts +5 -2
- package/src/home/run-web.ts +4 -2
- package/src/home/supervise.ts +18 -1
- package/src/repo-config.ts +3 -0
- package/src/review/auto.ts +7 -2
- package/src/review/cells.ts +1 -1
- package/src/review/format.ts +2 -2
- package/src/review/model.ts +57 -13
- package/src/review/previews.ts +1 -1
- package/src/review/routes.ts +11 -0
- package/src/review/store.ts +18 -10
- package/src/secrets/list.ts +40 -0
- package/src/serve/hub-app/hub-app.tsx +28 -2
- package/src/serve/hub-app/icons.tsx +1 -0
- package/src/serve/hub-app/identities-view.tsx +1 -1
- package/src/serve/hub-app/kept-cols.tsx +47 -8
- package/src/serve/hub-app/layout-st.ts +37 -3
- package/src/serve/hub-app/review/review-kit.ts +12 -0
- package/src/serve/hub-app/review/review-page.tsx +1 -1
- package/src/serve/hub-app/review/review-st.ts +63 -4
- package/src/serve/hub-app/review/review-thread.tsx +1 -0
- package/src/serve/hub-app/review/review-views.tsx +215 -63
- package/src/serve/hub-app/review/thread-st.ts +82 -16
- package/src/serve/hub-app/review/trailer-page.tsx +1 -1
- package/src/serve/hub-app/review.css +41 -2
- package/src/serve/hub-app/social/comms-page.tsx +1 -1
- package/src/serve/hub-app/social/social-page.tsx +1 -1
- package/src/serve/hub-app/stores/stores-page.tsx +1 -1
- package/src/serve/hub-app/veille/veille-page.tsx +1 -1
- package/src/shipkit.ts +1 -1
- package/src/shot/box.ts +9 -1
- package/src/shot/shooter.ts +24 -2
- package/src/social/load.ts +3 -1
- package/src/trailer/grammar.ts +2 -0
- package/src/trailer/sound/presets.ts +3 -3
- package/src/trailer/sound/run.ts +22 -14
- package/src/trailer/titles.ts +1 -1
- package/src/wiki/lint-md.ts +4 -2
- package/src/wiki/run-wiki.ts +22 -6
- package/src/wiki/scan-md.ts +3 -1
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
import { observer } from 'mobx-react-lite'
|
|
8
8
|
import { useEffect, useRef, useState, type ReactNode } from 'react'
|
|
9
9
|
import type { VersionCell } from '../../../review/cells.ts'
|
|
10
|
-
import { isChoice, isGallery, isPair, onFrame, STARS, STATUS_LABEL, thumbFileOf, viewFilesOf, viewName, viewTag, type GalleryView, type Item, type MediaView, type Rect, type ReviewClip, type ReviewMark, type ReviewView, type Side } from '../../../review/model.ts'
|
|
10
|
+
import { isChoice, isGallery, isPair, onFrame, STARS, STATUS_LABEL, thumbFileOf, tileName, viewFilesOf, viewName, viewTag, type GalleryTile, type GalleryView, type Item, type MediaView, type Rect, type ReviewClip, type ReviewMark, type ReviewView, type Side } from '../../../review/model.ts'
|
|
11
11
|
import { AutoText } from '../auto-text.tsx'
|
|
12
12
|
import type { ClipSt } from './clip-st.ts'
|
|
13
13
|
import { blurOnEscape, FIT_ROOM, keepFocus, PAIR_NAMES, REACTIONS, secs, SIDE_LABEL } from './kit.tsx'
|
|
14
|
-
import { ZOOMS, type Zoom } from './review-kit.ts'
|
|
14
|
+
import { GALLERY_FITS, GALLERY_MODES, TILE_H, ZOOMS, type GalleryFit, type GalleryMode, type Zoom } from './review-kit.ts'
|
|
15
15
|
import { COMPARE_MODES, drawnSide, type CompareMode, type CompareSt, type PairSide, type ReviewSt } from './review-st.ts'
|
|
16
|
-
import { viewDom, viewKind, viewKey, type ThreadSt } from './thread-st.ts'
|
|
16
|
+
import { TILE_FILTERS, viewDom, viewKind, viewKey, type ThreadSt, type TileFilter } from './thread-st.ts'
|
|
17
17
|
import { Caret } from '../icons.tsx'
|
|
18
18
|
|
|
19
19
|
const ZOOM_LABEL: Record<Zoom, string> = { fit: 'Fit', '1': '100 %', '1.5': '150 %', '2': '200 %' }
|
|
@@ -44,7 +44,7 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
|
|
|
44
44
|
const item = itemOf(ver)
|
|
45
45
|
const views = item.views
|
|
46
46
|
const rows = card.rows(item)
|
|
47
|
-
const drawable = takes(ver) && views.some((v) =>
|
|
47
|
+
const drawable = takes(ver) && views.some((v) => isGallery(v) || (!v.clip && !v.audio))
|
|
48
48
|
// a draft card's history is no view of its own: its frames cycle in place over the live one
|
|
49
49
|
const history = item.wip ? views.find(isGallery) : undefined
|
|
50
50
|
const options = rows || (card.full[item.id] === true)
|
|
@@ -59,9 +59,17 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
|
|
|
59
59
|
) : null}
|
|
60
60
|
{rv.phone.on && drawable ? <button className={rv.phone.draw ? 'primary' : ''} onClick={() => rv.phone.toggleDraw()}>Circle</button> : null}
|
|
61
61
|
<span className="sp" />
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
{views.some(isGallery) ? (
|
|
63
|
+
<label className="rv-tilesize" title="the size of every tile of every grid, kept for this repo">
|
|
64
|
+
tiles
|
|
65
|
+
<input type="range" min={TILE_H.min} max={TILE_H.max} step={10} value={rv.tileH} onChange={(e) => rv.setTileH(Number(e.target.value))} />
|
|
66
|
+
</label>
|
|
67
|
+
) : null}
|
|
68
|
+
{views.some((v) => !isGallery(v)) ? (
|
|
69
|
+
<span className="seg" title="the zoom of every view of every card">
|
|
70
|
+
{ZOOMS.map((z) => <button key={z} className={rv.zoom === z ? 'on' : ''} onMouseDown={keepFocus} onClick={() => rv.setZoom(z)}>{ZOOM_LABEL[z]}</button>)}
|
|
71
|
+
</span>
|
|
72
|
+
) : null}
|
|
65
73
|
</div>
|
|
66
74
|
{rows ? (
|
|
67
75
|
<div className="rv-opts">{views.map((v, i) => <OptionRow key={i} ver={ver} v={v} i={i} />)}</div>
|
|
@@ -93,7 +101,7 @@ const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewVie
|
|
|
93
101
|
{takes(ver) ? <ReactionToggles ver={ver} view={i} /> : shown?.status ? <SentReaction status={shown.status} /> : null}
|
|
94
102
|
<span className="sp" />
|
|
95
103
|
{open && media?.marks && media.marks.length > 0 ? <button className={rv.marksOn ? 'primary' : ''} onMouseDown={keepFocus} onClick={() => rv.toggleMarks()}>marks · M</button> : null}
|
|
96
|
-
{open && media && isPair(media.files) && !media.audio && !rv.phone.on ? <CompareModes c={rv.compare} /> : null}
|
|
104
|
+
{open && media && isPair(media.files) && !media.audio && !rv.phone.on ? <CompareModes c={rv.compare} clip={media.clip !== undefined} /> : null}
|
|
97
105
|
</header>
|
|
98
106
|
<ViewNotes ver={ver} i={i} gallery={isGallery(v)} />
|
|
99
107
|
{open ? (
|
|
@@ -119,12 +127,12 @@ const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: num
|
|
|
119
127
|
return (
|
|
120
128
|
<div className="rv-viewnotes">
|
|
121
129
|
{said.map((s, k) => {
|
|
122
|
-
const tile = s.reaction?.tile
|
|
123
|
-
const where =
|
|
130
|
+
const tile = s.reaction?.tile ?? s.rect?.r.tile
|
|
131
|
+
const where = tileWhere(views[i], tile)
|
|
124
132
|
return (
|
|
125
133
|
<div key={k} className={`rv-said${s.reaction?.status ? ` re-${s.reaction.status}` : s.rect ? ' rect' : ''}`}>
|
|
126
134
|
<span className="rv-saidmark">
|
|
127
|
-
{s.rect ? `⬚ ${s.rect.n}${s.rect.r.side ? ` ${SIDE_LABEL[s.rect.r.side]}` : ''}${s.rect.r.t !== undefined ? ` · ${secs(s.rect.r.t)}` : ''}` : `${REACTIONS.find((o) => o.status === s.reaction?.status)?.glyph ?? ''}${s.reaction?.stars ? ` ★${s.reaction.stars}` : ''}${where ? ` ${where}` : ''}`}
|
|
135
|
+
{s.rect ? `⬚ ${s.rect.n}${s.rect.r.side ? ` ${SIDE_LABEL[s.rect.r.side]}` : ''}${s.rect.r.t !== undefined ? ` · ${secs(s.rect.r.t)}` : ''}${where ? ` ${where}` : ''}` : `${REACTIONS.find((o) => o.status === s.reaction?.status)?.glyph ?? ''}${s.reaction?.stars ? ` ★${s.reaction.stars}` : ''}${where ? ` ${where}` : ''}`}
|
|
128
136
|
</span>
|
|
129
137
|
<span className="rv-saidtext">{(s.rect ? s.rect.r.comment : s.reaction?.comment) || <i className="rv-dim">{s.reaction?.status ? REACTIONS.find((o) => o.status === s.reaction?.status)?.tip : 'no word'}</i>}</span>
|
|
130
138
|
<span className="rv-saidwho rv-dim">you · {STATUS_LABEL[s.verdict.verdict]} · v{cell.n}</span>
|
|
@@ -140,7 +148,7 @@ const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: num
|
|
|
140
148
|
{draft.map(([r, k]) => (
|
|
141
149
|
<div key={`d${k}`} className={`rv-outrow${card.rect === k ? ' on' : ''}`}>
|
|
142
150
|
<button className={`rv-outbadge rect${card.rect === k ? ' on' : ''}`} title={r.t !== undefined ? 'go to this moment and open the note' : 'open the note on the image'} onMouseDown={keepFocus} onClick={() => card.pickRect(k, true)}>
|
|
143
|
-
{k + 1}{r.side ? ` ${SIDE_LABEL[r.side]}` : ''}{r.t !== undefined ? ` · ${secs(r.t)}` : ''}
|
|
151
|
+
{k + 1}{r.side ? ` ${SIDE_LABEL[r.side]}` : ''}{r.t !== undefined ? ` · ${secs(r.t)}` : ''}{r.tile !== undefined ? ` ${tileWhere(views[i], r.tile) ?? ''}` : ''}
|
|
144
152
|
</button>
|
|
145
153
|
<button className="rv-outtext ghost" title="open the note on the image" onMouseDown={keepFocus} onClick={() => card.pickRect(k, true)}>
|
|
146
154
|
{r.comment.trim() ? r.comment : <i className="rv-dim">no word yet</i>}
|
|
@@ -158,6 +166,10 @@ const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: num
|
|
|
158
166
|
|
|
159
167
|
const isGalleryView = (v: ReviewView | undefined): v is GalleryView => v !== undefined && isGallery(v)
|
|
160
168
|
|
|
169
|
+
/** the name of a gallery tile a note is on, or null off a gallery */
|
|
170
|
+
const tileWhere = (v: ReviewView | undefined, tile: number | undefined): string | null =>
|
|
171
|
+
tile !== undefined && isGalleryView(v) ? (v.gallery[tile] ? tileName(v.gallery[tile]) : `tile ${tile + 1}`) : null
|
|
172
|
+
|
|
161
173
|
/** a reaction an older answer gave, as a still pill */
|
|
162
174
|
const SentReaction = ({ status }: { status: string }) => {
|
|
163
175
|
const o = REACTIONS.find((r) => r.status === status)
|
|
@@ -258,14 +270,14 @@ const Gone = ({ files }: { files: readonly string[] }) => (
|
|
|
258
270
|
const clock = (t: number): string => `${Math.floor(t / 60)}:${String(Math.floor(t % 60)).padStart(2, '0')}`
|
|
259
271
|
|
|
260
272
|
/** an option's score: STARS stars, a click on the one given clears it; an older version's stars as he gave them */
|
|
261
|
-
const Stars = observer(({ ver, view, given }: { ver: Ver; view: number; given: number | undefined }) => {
|
|
273
|
+
const Stars = observer(({ ver, view, tile, given }: { ver: Ver; view: number; tile?: number; given: number | undefined }) => {
|
|
262
274
|
const { card } = ver
|
|
263
275
|
const live = takes(ver)
|
|
264
276
|
const n = given ?? 0
|
|
265
277
|
return (
|
|
266
|
-
<span className="rv-stars" title={live ? `your score (⇧1 to ⇧${STARS} on the row playing)` : 'your score'}>
|
|
278
|
+
<span className="rv-stars" title={live ? (tile === undefined ? `your score (⇧1 to ⇧${STARS} on the row playing)` : `your score (1 to ${STARS} with the pointer on the tile)`) : 'your score'}>
|
|
267
279
|
{Array.from({ length: STARS }, (_, k) => (
|
|
268
|
-
<button key={k} className={k < n ? 'on' : ''} disabled={!live} aria-label={`${k + 1} of ${STARS}`} onMouseDown={keepFocus} onClick={() => mark(ver, () => card.setStars(view, k + 1))}>{k < n ? '★' : '☆'}</button>
|
|
280
|
+
<button key={k} className={k < n ? 'on' : ''} disabled={!live} aria-label={`${k + 1} of ${STARS}`} onMouseDown={keepFocus} onClick={() => mark(ver, () => card.setStars(view, k + 1, tile))}>{k < n ? '★' : '☆'}</button>
|
|
269
281
|
))}
|
|
270
282
|
</span>
|
|
271
283
|
)
|
|
@@ -346,37 +358,166 @@ const ReactionToggles = observer(({ ver, view, tile, small }: { ver: Ver; view:
|
|
|
346
358
|
)
|
|
347
359
|
})
|
|
348
360
|
|
|
349
|
-
/** a gallery
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
* reaction; a click shows it large at the column's size */
|
|
361
|
+
/** a gallery view, drawn the way he picks (kept per repo): tabs, a side list of its images with the picked one large;
|
|
362
|
+
* list, one image a row at full width; grid, its tiles at the slider's height, one row per asset when its tiles are
|
|
363
|
+
* variants (a group each). A head picks the mode and the fit, filters the tiles, flips every tile to its before, adds
|
|
364
|
+
* the small sizes. A phone has no room for a side list, so its tabs read as the list */
|
|
354
365
|
const Gallery = observer(({ ver, v, view }: { ver: Ver; v: GalleryView; view: number }) => {
|
|
366
|
+
const { rv, card } = ver
|
|
367
|
+
const befores = v.gallery.some((t) => t.before)
|
|
368
|
+
const tiles = v.gallery.map((t, k) => ({ t, k }))
|
|
369
|
+
const sections = v.gallery.some((t) => t.group) ? [...new Set(v.gallery.map((t) => t.group ?? ''))].map((g) => ({ g, tiles: tiles.filter((x) => (x.t.group ?? '') === g) })) : null
|
|
370
|
+
const mode: GalleryMode = rv.galleryMode === 'tabs' && rv.phone.on ? 'list' : rv.galleryMode
|
|
371
|
+
const draw = (xs: typeof tiles): ReactNode =>
|
|
372
|
+
mode === 'list'
|
|
373
|
+
? <div className="rv-gallerylist">{xs.map(({ t, k }) => <Tile key={k} ver={ver} v={v} view={view} t={t} k={k} fill />)}</div>
|
|
374
|
+
: <div className="rv-gallery">{xs.map(({ t, k }) => <Tile key={k} ver={ver} v={v} view={view} t={t} k={k} />)}</div>
|
|
375
|
+
return (
|
|
376
|
+
<div className="rv-gallerywrap">
|
|
377
|
+
<div className="rv-galleryhead rv-small">
|
|
378
|
+
<span className="seg" role="group" aria-label="how the images show">
|
|
379
|
+
{GALLERY_MODES.map((m) => (
|
|
380
|
+
<button key={m} data-mode={m} className={rv.galleryMode === m ? 'on' : ''} title={GALLERY_MODE_TITLE[m]} onMouseDown={keepFocus} onClick={() => rv.setGalleryMode(m)}>{m}</button>
|
|
381
|
+
))}
|
|
382
|
+
</span>
|
|
383
|
+
{mode !== 'grid' ? (
|
|
384
|
+
<span className="seg" role="group" aria-label="how a large image fits">
|
|
385
|
+
{GALLERY_FITS.map((f) => (
|
|
386
|
+
<button key={f} data-fit={f} className={rv.galleryFit === f ? 'on' : ''} title={GALLERY_FIT_TITLE[f]} onMouseDown={keepFocus} onClick={() => rv.setGalleryFit(f)}>{`fit ${f}`}</button>
|
|
387
|
+
))}
|
|
388
|
+
</span>
|
|
389
|
+
) : null}
|
|
390
|
+
<span className="seg" role="group" aria-label="which tiles show">
|
|
391
|
+
{TILE_FILTERS.map((f) => (
|
|
392
|
+
<button key={f} className={card.tileFilter === f ? 'on' : ''} onMouseDown={keepFocus} onClick={() => card.setTileFilter(f)}>{TILE_FILTER_LABEL[f]}</button>
|
|
393
|
+
))}
|
|
394
|
+
</span>
|
|
395
|
+
{befores ? <button className={`rv-chip${card.beforeAll ? ' on' : ''}`} title="every tile shows its before" onMouseDown={keepFocus} onClick={() => card.toggleBeforeAll()}>before</button> : null}
|
|
396
|
+
<button className={`rv-chip${rv.tileSmall ? ' on' : ''}`} title="each tile also at 16, 32 and 64 px" onMouseDown={keepFocus} onClick={() => rv.toggleTileSmall()}>real size</button>
|
|
397
|
+
</div>
|
|
398
|
+
{mode === 'tabs'
|
|
399
|
+
? <GalleryTabs ver={ver} v={v} view={view} />
|
|
400
|
+
: sections
|
|
401
|
+
? sections.map(({ g, tiles: xs }) => (
|
|
402
|
+
<div key={g} className="rv-galleryrow">
|
|
403
|
+
<div className="rv-rowlabel">{g || 'others'}</div>
|
|
404
|
+
{draw(xs)}
|
|
405
|
+
</div>
|
|
406
|
+
))
|
|
407
|
+
: draw(tiles)}
|
|
408
|
+
</div>
|
|
409
|
+
)
|
|
410
|
+
})
|
|
411
|
+
|
|
412
|
+
const GALLERY_MODE_TITLE: Record<GalleryMode, string> = {
|
|
413
|
+
tabs: 'a list of the images on the left, the picked one large (↑ ↓ in the list walk it)',
|
|
414
|
+
list: 'every image one under the other, at full width',
|
|
415
|
+
grid: 'the images side by side, at the tiles slider\'s height',
|
|
416
|
+
}
|
|
417
|
+
const GALLERY_FIT_TITLE: Record<GalleryFit, string> = { width: 'a large image takes the whole width, and scrolls', screen: 'a large image fits the screen whole' }
|
|
418
|
+
|
|
419
|
+
/** the tabs of a gallery: one row a shown tile (its thumbnail, its name, its stars, its mark's colour), a row per
|
|
420
|
+
* asset name over its variants, and the picked tile drawn large beside them. ↑ ↓ walk the list while it has the
|
|
421
|
+
* focus, and never reach the page, where they walk the cards */
|
|
422
|
+
const GalleryTabs = observer(({ ver, v, view }: { ver: Ver; v: GalleryView; view: number }) => {
|
|
355
423
|
const { rv, card, cell } = ver
|
|
356
424
|
const id = itemOf(ver).id
|
|
425
|
+
const shown = v.gallery.map((t, k) => ({ t, k, r: card.reactionShown(cell, view, k) })).filter((x) => card.tileShown(x.r))
|
|
426
|
+
const at = shown.find((x) => x.k === card.galleryTab[view]) ?? shown[0]
|
|
427
|
+
if (at === undefined) return <div className="rv-dim rv-small">no image passes this filter</div>
|
|
428
|
+
const step = (by: number): void => {
|
|
429
|
+
const i = shown.indexOf(at)
|
|
430
|
+
card.setGalleryTab(view, shown[(i + by + shown.length) % shown.length]!.k)
|
|
431
|
+
}
|
|
432
|
+
const walk = (e: React.KeyboardEvent): void => {
|
|
433
|
+
if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return
|
|
434
|
+
e.preventDefault()
|
|
435
|
+
e.stopPropagation()
|
|
436
|
+
step(e.key === 'ArrowDown' ? 1 : -1)
|
|
437
|
+
}
|
|
357
438
|
return (
|
|
358
|
-
<div className="rv-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
<img src={big ? rv.fitUrl(id, t.file) : rv.thumbUrl(id, t.file)} alt={t.label} draggable={false} loading="lazy" />
|
|
369
|
-
</div>
|
|
370
|
-
<div className="rv-tilelabel" title={t.label}>{t.label}</div>
|
|
371
|
-
{takes(ver) ? (
|
|
372
|
-
<>
|
|
373
|
-
<ReactionToggles ver={ver} view={view} tile={k} small />
|
|
374
|
-
<AutoText className="rv-word" placeholder="a word" value={r?.comment ?? ''} onKeyDown={blurOnEscape} onText={(t) => mark(ver, () => card.setReactionComment(view, k, t))} />
|
|
375
|
-
</>
|
|
376
|
-
) : r?.status ? <SentReaction status={r.status} /> : null}
|
|
439
|
+
<div className="rv-gtabs">
|
|
440
|
+
<nav className="rv-gtablist" aria-label="the images" onKeyDown={walk}>
|
|
441
|
+
{shown.map(({ t, k, r }, i) => (
|
|
442
|
+
<div key={k} className="rv-gtabslot">
|
|
443
|
+
{t.group && t.group !== shown[i - 1]?.t.group ? <div className="rv-gtabgroup">{t.group}</div> : null}
|
|
444
|
+
<button className={`rv-gtab${k === at.k ? ' on' : ''}${toneClass(r?.status)}`} aria-current={k === at.k} title={t.label} onClick={() => card.setGalleryTab(view, k)}>
|
|
445
|
+
<img src={rv.thumbUrl(id, t.file)} alt="" loading="lazy" draggable={false} />
|
|
446
|
+
<span className="rv-gtablabel">{t.label}</span>
|
|
447
|
+
<span className="rv-gtabmark">{r?.stars ? '★'.repeat(r.stars) : ''}{r?.picked ? ' ✓ kept' : ''}</span>
|
|
448
|
+
</button>
|
|
377
449
|
</div>
|
|
378
|
-
)
|
|
379
|
-
|
|
450
|
+
))}
|
|
451
|
+
</nav>
|
|
452
|
+
<div className="rv-gtabbody">
|
|
453
|
+
<Tile key={at.k} ver={ver} v={v} view={view} t={at.t} k={at.k} fill />
|
|
454
|
+
</div>
|
|
455
|
+
</div>
|
|
456
|
+
)
|
|
457
|
+
})
|
|
458
|
+
|
|
459
|
+
const TILE_FILTER_LABEL: Record<TileFilter, string> = { all: 'all', unrated: 'unrated', low: 'under 3★', fix: 'fix or no' }
|
|
460
|
+
|
|
461
|
+
/** a tile's frame around its image (padding and border, both sides), its narrowest width for its controls, and the
|
|
462
|
+
* widest image it shows, as a share of its height */
|
|
463
|
+
const TILE_CHROME = 12
|
|
464
|
+
const TILE_MIN_W = 150
|
|
465
|
+
const TILE_WIDE = 1.6
|
|
466
|
+
|
|
467
|
+
/** the small sizes an icon lives at */
|
|
468
|
+
const SMALL_SIZES = [16, 32, 64] as const
|
|
469
|
+
|
|
470
|
+
/** one gallery tile: its image (its before while flipped or peeked), the small sizes, its label, stars, the variant
|
|
471
|
+
* pick on a row, OK fix or no and a word; a click shows it large at the column's size. `fill`: drawn large in the
|
|
472
|
+
* tabs or the list, at the fit he picks (the column's width, or the screen), with no click to shrink it */
|
|
473
|
+
const Tile = observer(({ ver, v, view, t, k, fill = false }: { ver: Ver; v: GalleryView; view: number; t: GalleryTile; k: number; fill?: boolean }) => {
|
|
474
|
+
const { rv, card, cell } = ver
|
|
475
|
+
const id = itemOf(ver).id
|
|
476
|
+
const big = card.bigTile === `${viewKey(id, view)}/${k}`
|
|
477
|
+
const r = card.reactionShown(cell, view, k)
|
|
478
|
+
if (!big && !card.tileShown(r)) return null
|
|
479
|
+
const live = takes(ver)
|
|
480
|
+
const h = rv.tileH
|
|
481
|
+
const ratio = t.size.w / t.size.h
|
|
482
|
+
// the image box takes the image's own ratio, so a rectangle's coordinates are the image's; a very wide one is narrowed
|
|
483
|
+
const iw = Math.round(Math.min(h * ratio, h * TILE_WIDE))
|
|
484
|
+
const ih = Math.round(iw / ratio)
|
|
485
|
+
const file = t.before && card.showsBefore(view, k) ? t.before : t.file
|
|
486
|
+
const thumb = rv.thumbUrl(id, file)
|
|
487
|
+
const src = big || fill || h > TILE_H.thumb ? rv.fitUrl(id, file) : thumb
|
|
488
|
+
const toggle = (): void => { if (!fill) card.toggleTile(id, view, k) }
|
|
489
|
+
const aspect = `${t.size.w} / ${t.size.h}`
|
|
490
|
+
const screen = { width: `min(100%, calc((100vh - ${FIT_ROOM}px) * ${ratio}))`, aspectRatio: aspect }
|
|
491
|
+
const imgStyle = fill ? (rv.galleryFit === 'width' ? { width: '100%', aspectRatio: aspect } : screen) : big ? screen : { width: iw, height: ih }
|
|
492
|
+
const title = live ? (fill ? 'drag to circle a spot' : 'drag to circle a spot, click to enlarge') : fill ? undefined : big ? 'click to shrink' : 'click to enlarge'
|
|
493
|
+
return (
|
|
494
|
+
<div className={`rv-tile${big ? ' big' : ''}${fill ? ' fill' : ''}${r?.picked ? ' picked' : ''}${toneClass(r?.status)}`} style={big || fill ? undefined : { width: Math.max(iw, TILE_MIN_W) + TILE_CHROME }}
|
|
495
|
+
onMouseEnter={live ? () => card.setHoverTile({ view, tile: k }) : undefined} onMouseLeave={live ? () => card.setHoverTile(null) : undefined}>
|
|
496
|
+
<div className="rv-tileimg" onClick={live ? undefined : toggle} title={title} style={imgStyle}>
|
|
497
|
+
<Marks ver={ver} src={src} side={undefined} view={view} tile={k} onTap={toggle} />
|
|
498
|
+
{ver.live ? <div className="rv-over"><RectNote ver={ver} view={view} sides={[undefined]} tile={k} /></div> : null}
|
|
499
|
+
{t.before ? (
|
|
500
|
+
<span className={`rv-beforechip${file === t.before ? ' on' : ''}`} title="the pointer here shows the before" onClick={(e) => e.stopPropagation()}
|
|
501
|
+
onMouseEnter={() => card.setPeekTile(view, k)} onMouseLeave={() => card.setPeekTile(view, null)}>before</span>
|
|
502
|
+
) : null}
|
|
503
|
+
</div>
|
|
504
|
+
{rv.tileSmall ? (
|
|
505
|
+
<div className="rv-tilesmall">
|
|
506
|
+
{SMALL_SIZES.map((px) => <img key={px} src={thumb} alt="" width={px} height={px} title={`${px} px`} draggable={false} loading="lazy" />)}
|
|
507
|
+
</div>
|
|
508
|
+
) : null}
|
|
509
|
+
<div className="rv-tilelabel" title={t.label}>{t.label}</div>
|
|
510
|
+
{live || r?.stars ? <Stars ver={ver} view={view} tile={k} given={r?.stars} /> : null}
|
|
511
|
+
{t.group && (live || r?.picked) ? (
|
|
512
|
+
<button className={`rv-chip rv-keep${r?.picked ? ' on' : ''}`} disabled={!live} title={`keep this one for ${t.group}: one a row`} onMouseDown={keepFocus}
|
|
513
|
+
onClick={() => mark(ver, () => card.pickTile(view, k, t.group ?? '', v.gallery))}>{r?.picked ? '✓ kept' : 'keep'}</button>
|
|
514
|
+
) : null}
|
|
515
|
+
{live ? (
|
|
516
|
+
<>
|
|
517
|
+
<ReactionToggles ver={ver} view={view} tile={k} small />
|
|
518
|
+
<AutoText className="rv-word" placeholder="a word" value={r?.comment ?? ''} onKeyDown={blurOnEscape} onText={(t) => mark(ver, () => card.setReactionComment(view, k, t))} />
|
|
519
|
+
</>
|
|
520
|
+
) : r?.status ? <SentReaction status={r.status} /> : null}
|
|
380
521
|
</div>
|
|
381
522
|
)
|
|
382
523
|
})
|
|
@@ -420,20 +561,21 @@ const MediaBody = observer(({ ver, v, i, zoom }: { ver: Ver; v: MediaView; i: nu
|
|
|
420
561
|
</>
|
|
421
562
|
)
|
|
422
563
|
const c = rv.compare
|
|
423
|
-
const
|
|
564
|
+
const mode = c.modeFor(v.clip !== undefined)
|
|
565
|
+
const cols = mode === 'side' ? 2 : 1
|
|
424
566
|
const fitW = `min(100%, calc((100vh - ${room}px) * ${ratio * cols}))`
|
|
425
567
|
return (
|
|
426
568
|
<>
|
|
427
569
|
<div style={scroll}>
|
|
428
570
|
<div className="rv-pairgrid" style={{ width: scale ? `${v.size.w * scale * cols + 8 * (cols - 1)}px` : fitW, gridTemplateColumns: `repeat(${cols}, 1fr)` }}>
|
|
429
|
-
<Compare c={c} base={before} mod={after} names={PAIR_NAMES} aspect={aspect}
|
|
430
|
-
draw={(s, face) => <Marks ver={ver} src={s} side={drawnSide(
|
|
431
|
-
over={(srcs) => (ver.live ? <RectNote ver={ver} view={i} sides={srcs.map((s) => drawnSide(
|
|
571
|
+
<Compare c={c} mode={mode} base={before} mod={after} names={PAIR_NAMES} aspect={aspect}
|
|
572
|
+
draw={(s, face) => <Marks ver={ver} src={s} side={drawnSide(mode, s === before ? 'before' : 'after')} view={i} face={face} />}
|
|
573
|
+
over={(srcs) => (ver.live ? <RectNote ver={ver} view={i} sides={srcs.map((s) => drawnSide(mode, s === before ? 'before' : 'after'))} /> : null)} />
|
|
432
574
|
</div>
|
|
433
575
|
</div>
|
|
434
576
|
{bar ? <div style={{ width: fitW, margin: '0 auto' }}>{bar}</div> : null}
|
|
435
577
|
<div style={{ width: fitW, margin: '0 auto' }}>{saves}</div>
|
|
436
|
-
{
|
|
578
|
+
{mode === 'swipe' ? <div className="rv-dim rv-center">curtain: a drag moves the line; rectangles are drawn in the other modes</div> : null}
|
|
437
579
|
</>
|
|
438
580
|
)
|
|
439
581
|
})
|
|
@@ -469,6 +611,15 @@ const Downloads = observer(({ rv, item, files }: { rv: ReviewSt; item: Item; fil
|
|
|
469
611
|
{files.map(({ file, label }) => (
|
|
470
612
|
<a key={file} className="rv-dl" href={rv.fileUrl(item.id, file, item.wip)} download={`${item.id}-${file}`} title={`download ${file} at full size`}>⤓ save {label ?? (file.split('.').pop() ?? 'file')}</a>
|
|
471
613
|
))}
|
|
614
|
+
{files.map(({ file, label }) => {
|
|
615
|
+
const s = rv.shared.get(`${item.id}/${file}`)
|
|
616
|
+
return (
|
|
617
|
+
<button key={`share-${file}`} className="rv-dl ghost" disabled={s === 'sending'} onClick={() => void rv.share(item.id, file)}
|
|
618
|
+
title={s && s !== 'sending' ? `copy again: ${s}` : `publish ${file} in the Space and copy its link: a permanent public url, anyone who has it downloads the file`}>
|
|
619
|
+
{s === 'sending' ? 'uploading…' : `🔗 ${label ? `link ${label}` : 'copy link'}`}
|
|
620
|
+
</button>
|
|
621
|
+
)
|
|
622
|
+
})}
|
|
472
623
|
{/* the Finder is on the desktop only: a phone has none */}
|
|
473
624
|
{rv.phone.on || files[0] === undefined ? null : (
|
|
474
625
|
<button className="rv-dl ghost" title={`open the card's folder in the Finder, ${files[0].file} selected`} onClick={() => void rv.reveal(item.id, files[0]!.file)}>show in Finder</button>
|
|
@@ -532,12 +683,12 @@ const MODES: { mode: CompareMode; glyph: string; tip: string }[] = [
|
|
|
532
683
|
]
|
|
533
684
|
|
|
534
685
|
/** the compare modes as tiny buttons, the onion's opacity floating under them */
|
|
535
|
-
const CompareModes = observer(({ c }: { c: CompareSt }) => (
|
|
686
|
+
const CompareModes = observer(({ c, clip }: { c: CompareSt; clip: boolean }) => (
|
|
536
687
|
<span className="rv-modes">
|
|
537
688
|
<span className="seg">
|
|
538
|
-
{COMPARE_MODES.map((m) => {
|
|
689
|
+
{COMPARE_MODES.filter((m) => !(clip && m === 'diff')).map((m) => {
|
|
539
690
|
const o = MODES.find((x) => x.mode === m)!
|
|
540
|
-
return <button key={m} title={`${o.tip} (D cycles, ⇧D back)`} className={c.
|
|
691
|
+
return <button key={m} title={`${o.tip} (D cycles, ⇧D back)`} className={c.modeFor(clip) === m ? 'on' : ''} onMouseDown={keepFocus} onClick={() => c.setMode(m)}>{o.glyph}</button>
|
|
541
692
|
})}
|
|
542
693
|
</span>
|
|
543
694
|
{c.mode === 'onion' ? (
|
|
@@ -618,25 +769,25 @@ function track(move: (e: PointerEvent) => void): void {
|
|
|
618
769
|
/** THE pair: side by side, the curtain clipping both images, the after over the before as an onion skin, or the
|
|
619
770
|
* after alone (the before while the pointer is over it). One image alone when `mod` is undefined. `over` draws what
|
|
620
771
|
* sits over a frame unclipped (the picked rectangle's note box), given the images that frame shows */
|
|
621
|
-
const Compare = observer(({ c, base, mod, names, aspect, draw, over }: { c: CompareSt; base: string; mod: string | undefined; names?: { base: string; mod: string }; aspect: string; draw: (src: string, face?: ReactNode) => ReactNode; over?: (srcs: string[]) => ReactNode }) => {
|
|
772
|
+
const Compare = observer(({ c, mode = c.mode, base, mod, names, aspect, draw, over }: { c: CompareSt; mode?: CompareMode; base: string; mod: string | undefined; names?: { base: string; mod: string }; aspect: string; draw: (src: string, face?: ReactNode) => ReactNode; over?: (srcs: string[]) => ReactNode }) => {
|
|
622
773
|
const [peek, setPeek] = useState(false)
|
|
623
774
|
const [share, setShare] = useState<number | null | undefined>(undefined)
|
|
624
775
|
if (mod === undefined) return <Frame aspect={aspect} caption={null} over={over?.([base])}><div className="rv-fill">{draw(base)}</div></Frame>
|
|
625
776
|
const n = names ?? PAIR_NAMES
|
|
626
|
-
if (
|
|
777
|
+
if (mode === 'side')
|
|
627
778
|
return (
|
|
628
779
|
<>
|
|
629
780
|
<Frame aspect={aspect} caption={n.base} over={over?.([base])}><div className="rv-fill">{draw(base)}</div></Frame>
|
|
630
781
|
<Frame aspect={aspect} caption={n.mod} modCap over={over?.([mod])}><div className="rv-fill">{draw(mod)}</div></Frame>
|
|
631
782
|
</>
|
|
632
783
|
)
|
|
633
|
-
if (
|
|
784
|
+
if (mode === 'diff')
|
|
634
785
|
return (
|
|
635
786
|
<Frame aspect={aspect} caption={<>changes <span className="rv-modcap">{changesWords(share)}</span></>} over={over?.([mod])}>
|
|
636
787
|
<div className="rv-fill">{draw(mod, <DiffCanvas base={base} mod={mod} say={setShare} />)}</div>
|
|
637
788
|
</Frame>
|
|
638
789
|
)
|
|
639
|
-
if (
|
|
790
|
+
if (mode === 'mod')
|
|
640
791
|
return (
|
|
641
792
|
<Frame aspect={aspect} caption={peek ? n.base : n.mod} modCap={!peek} onPeek={setPeek} over={over?.([peek ? base : mod])}>
|
|
642
793
|
<div className="rv-fill">{draw(peek ? base : mod)}</div>
|
|
@@ -644,10 +795,10 @@ const Compare = observer(({ c, base, mod, names, aspect, draw, over }: { c: Comp
|
|
|
644
795
|
)
|
|
645
796
|
const pct = Math.round(c.split * 100)
|
|
646
797
|
return (
|
|
647
|
-
<Frame aspect={aspect} caption={<>{n.base} {
|
|
648
|
-
<div className="rv-fill" style={
|
|
649
|
-
<div className="rv-fill" style={
|
|
650
|
-
{
|
|
798
|
+
<Frame aspect={aspect} caption={<>{n.base} {mode === 'swipe' ? '◀ ▶' : '+'} <span className="rv-modcap">{n.mod}</span></>} swipe={mode === 'swipe' ? c : undefined} over={over?.([base, mod])}>
|
|
799
|
+
<div className="rv-fill" style={mode === 'swipe' ? { clipPath: `inset(0 ${100 - pct}% 0 0)` } : undefined}>{draw(base)}</div>
|
|
800
|
+
<div className="rv-fill" style={mode === 'swipe' ? { clipPath: `inset(0 0 0 ${pct}%)` } : { opacity: c.opacity }}>{draw(mod)}</div>
|
|
801
|
+
{mode === 'swipe' ? <div className="rv-curtain" style={{ left: `${pct}%` }} /> : null}
|
|
651
802
|
</Frame>
|
|
652
803
|
)
|
|
653
804
|
})
|
|
@@ -693,7 +844,7 @@ const MIN_DRAG = 0.01
|
|
|
693
844
|
* that version that is not the active one loops on its own: a click makes it active. On a claiming version (the newest,
|
|
694
845
|
* his answer on an older one) a drag draws at once and brings his answer here. `face` takes the image's place (the
|
|
695
846
|
* changes of a pair) */
|
|
696
|
-
const Marks = observer(({ ver, src, side, view, face }: { ver: Ver; src: string; side: Side | undefined; view: number; face?: ReactNode }) => {
|
|
847
|
+
const Marks = observer(({ ver, src, side, view, face, tile, onTap }: { ver: Ver; src: string; side: Side | undefined; view: number; face?: ReactNode; tile?: number; onTap?: () => void }) => {
|
|
697
848
|
const { rv, card, cell } = ver
|
|
698
849
|
const el = useRef<HTMLDivElement>(null)
|
|
699
850
|
const [drag, setDrag] = useState<{ x0: number; y0: number; x1: number; y1: number } | null>(null)
|
|
@@ -736,15 +887,16 @@ const Marks = observer(({ ver, src, side, view, face }: { ver: Ver; src: string;
|
|
|
736
887
|
window.removeEventListener('pointercancel', up)
|
|
737
888
|
setDrag(null)
|
|
738
889
|
const r = box(cur)
|
|
739
|
-
if (r.w > MIN_DRAG && r.h > MIN_DRAG) card.addRect(r, side, view)
|
|
890
|
+
if (r.w > MIN_DRAG && r.h > MIN_DRAG) card.addRect(r, side, view, tile)
|
|
891
|
+
else if (onTap) onTap()
|
|
740
892
|
else card.pickRect(null)
|
|
741
893
|
}
|
|
742
894
|
window.addEventListener('pointermove', move)
|
|
743
895
|
window.addEventListener('pointerup', up)
|
|
744
896
|
window.addEventListener('pointercancel', up)
|
|
745
897
|
}
|
|
746
|
-
const rects = ver.live ? card.draft.rects.map((r, i) => [r, i] as const).filter(([r]) => r.side === side && (r.view ?? 0) === view) : []
|
|
747
|
-
const sent = card.sentRects(cell.id, view, side)
|
|
898
|
+
const rects = ver.live ? card.draft.rects.map((r, i) => [r, i] as const).filter(([r]) => r.side === side && (r.view ?? 0) === view && r.tile === tile) : []
|
|
899
|
+
const sent = card.sentRects(cell.id, view, side, tile)
|
|
748
900
|
const onIts = (r: Rect): boolean => !clip || !c || r.t === undefined || (c.paused && onFrame(r.t, c.time, clip.fps))
|
|
749
901
|
const rings = rv.marksOn ? (shown?.marks ?? []).filter((m) => m.side === side) : []
|
|
750
902
|
const live = drawing || (clip !== undefined && ver.live && !active)
|
|
@@ -791,12 +943,12 @@ const firstWords = (s: string): string => {
|
|
|
791
943
|
* or clicked. Enter or Escape closes it (the rectangle stays), Shift Enter is a new line; `sides` are the sides the
|
|
792
944
|
* frame shows. Its tag names the side it marks (before or after), and a second row repeats the view's OK, Fix and No
|
|
793
945
|
* under the hand that drew it (ReactionToggles, the head's own) */
|
|
794
|
-
const RectNote = observer(({ ver, view, sides }: { ver: Ver; view: number; sides: readonly (Side | undefined)[] }) => {
|
|
946
|
+
const RectNote = observer(({ ver, view, sides, tile }: { ver: Ver; view: number; sides: readonly (Side | undefined)[]; tile?: number }) => {
|
|
795
947
|
const { card } = ver
|
|
796
948
|
const box = useRef<HTMLTextAreaElement | null>(null)
|
|
797
949
|
const i = card.rect
|
|
798
950
|
const r = i === null ? undefined : card.draft.rects[i]
|
|
799
|
-
const here = i !== null && r !== undefined && (r.view ?? 0) === view && sides.includes(r.side)
|
|
951
|
+
const here = i !== null && r !== undefined && (r.view ?? 0) === view && sides.includes(r.side) && r.tile === tile
|
|
800
952
|
const focus = here && card.noteFocus === i
|
|
801
953
|
useEffect(() => {
|
|
802
954
|
if (!focus || box.current === null) return
|
|
@@ -39,6 +39,10 @@ const isDirty = (d: Draft | undefined): boolean => d !== undefined && (d.rects.l
|
|
|
39
39
|
/** a framed cell: every kind but the thin event line */
|
|
40
40
|
export type Framed = VersionCell | VerdictCell | ReplyCell | NoteCell
|
|
41
41
|
|
|
42
|
+
/** the gallery filter: every tile, the ones not scored nor marked, under 3 stars, marked fix or no */
|
|
43
|
+
export const TILE_FILTERS = ['all', 'unrated', 'low', 'fix'] as const
|
|
44
|
+
export type TileFilter = (typeof TILE_FILTERS)[number]
|
|
45
|
+
|
|
42
46
|
/** one line of the thread as drawn: a day's divider, a run of state changes, or a framed cell */
|
|
43
47
|
export type Line = { kind: 'day'; day: string } | { kind: 'events'; cells: EventCell[] } | { kind: 'cell'; cell: Framed }
|
|
44
48
|
|
|
@@ -116,6 +120,16 @@ export class ThreadSt {
|
|
|
116
120
|
noteFocus: number | null = null
|
|
117
121
|
/** the gallery tile shown large, `<item>#<view>/<tile>` */
|
|
118
122
|
bigTile: string | null = null
|
|
123
|
+
/** the tile each gallery view opens in tabs mode, by view; absent = its first shown tile */
|
|
124
|
+
galleryTab: Record<number, number> = {}
|
|
125
|
+
/** the gallery tile under the pointer of the newest version: 1 to 5 score it */
|
|
126
|
+
hoverTile: { view: number; tile: number } | null = null
|
|
127
|
+
/** which gallery tiles show: all, the ones he has not scored nor marked, under 3 stars, the ones marked fix or no */
|
|
128
|
+
tileFilter: TileFilter = 'all'
|
|
129
|
+
/** every tile of the card shows its before; a tile's « before » chip peeks at one alone */
|
|
130
|
+
beforeAll = false
|
|
131
|
+
/** the tile whose before shows while the pointer is on its chip, `<view>/<tile>` */
|
|
132
|
+
peekTile: string | null = null
|
|
119
133
|
/** a draft card's past frame shown in place of its live one; null is now */
|
|
120
134
|
frame: number | null = null
|
|
121
135
|
/** a card of options shown full, by item id */
|
|
@@ -394,12 +408,14 @@ export class ThreadSt {
|
|
|
394
408
|
if (h?.kind !== 'version' || h.item.wip) return []
|
|
395
409
|
const sent = this.verdictsOn(h.id).findLast((v) => v.current)
|
|
396
410
|
const choice = isChoice(h.item)
|
|
397
|
-
return h.item.views.map((
|
|
411
|
+
return h.item.views.map((v, i) => {
|
|
398
412
|
const own = this.reactionOf(i)
|
|
399
413
|
const given = sent?.reactions.find((r) => r.view === i && r.tile === undefined)
|
|
400
414
|
const r = own ?? given
|
|
401
415
|
const picked = this.pickShown(h) === i
|
|
402
|
-
|
|
416
|
+
// a gallery is answered tile by tile: one tile scored or marked answers the view
|
|
417
|
+
const tiles = isGallery(v) && [...(this.draft.reactions ?? []), ...(sent?.reactions ?? [])].some((q) => q.view === i && q.tile !== undefined && (q.status || q.stars || q.picked))
|
|
418
|
+
const answer: ViewMark['answer'] = picked ? 'picked' : r?.status ? r.status : (choice && r?.stars) || tiles ? 'scored' : sent ? 'sent' : 'none'
|
|
403
419
|
const noted = this.draft.rects.some((q) => (q.view ?? 0) === i) || (own?.comment ?? '').trim() !== ''
|
|
404
420
|
return { view: i, tag: viewTag(h.n, i), answer, noted }
|
|
405
421
|
})
|
|
@@ -428,8 +444,8 @@ export class ThreadSt {
|
|
|
428
444
|
}
|
|
429
445
|
|
|
430
446
|
/** the sent rectangles drawn over a view of a version, with their number in their verdict */
|
|
431
|
-
sentRects(id: string, view: number, side: Side | undefined): { r: Rect; n: number }[] {
|
|
432
|
-
return this.verdictsOn(id).flatMap((v) => v.rects.flatMap((r, k) => ((r.view ?? 0) === view && r.side === side ? [{ r, n: k + 1 }] : [])))
|
|
447
|
+
sentRects(id: string, view: number, side: Side | undefined, tile?: number): { r: Rect; n: number }[] {
|
|
448
|
+
return this.verdictsOn(id).flatMap((v) => v.rects.flatMap((r, k) => ((r.view ?? 0) === view && r.side === side && r.tile === tile ? [{ r, n: k + 1 }] : [])))
|
|
433
449
|
}
|
|
434
450
|
|
|
435
451
|
/** the reaction a view shows: his draft's on the newest version, else the latest verdict's */
|
|
@@ -513,12 +529,12 @@ export class ThreadSt {
|
|
|
513
529
|
}
|
|
514
530
|
|
|
515
531
|
/** a rectangle on a view of the newest version, which becomes the active one; on a clip it keeps the frame's time */
|
|
516
|
-
addRect(r: { x: number; y: number; w: number; h: number }, side: Side | undefined, on: number): void {
|
|
532
|
+
addRect(r: { x: number; y: number; w: number; h: number }, side: Side | undefined, on: number, tile?: number): void {
|
|
517
533
|
if (on !== this.view) this.setView(on)
|
|
518
534
|
const view = on > 0 ? { view: on } : {}
|
|
519
|
-
const clip = this.clipKey ? this.clipOf(this.target ?? '', on) : null
|
|
535
|
+
const clip = tile === undefined && this.clipKey ? this.clipOf(this.target ?? '', on) : null
|
|
520
536
|
const t = clip ? { t: Math.round(clip.time * 1000) / 1000 } : {}
|
|
521
|
-
this.edit((d) => ({ ...d, rects: [...d.rects, { ...r, comment: '', ...view, ...(side ? { side } : {}), ...t }] }))
|
|
537
|
+
this.edit((d) => ({ ...d, rects: [...d.rects, { ...r, comment: '', ...view, ...(side ? { side } : {}), ...t, ...(tile !== undefined ? { tile } : {}) }] }))
|
|
522
538
|
this.rect = this.draft.rects.length - 1
|
|
523
539
|
this.noteFocus = this.rect
|
|
524
540
|
}
|
|
@@ -563,19 +579,19 @@ export class ThreadSt {
|
|
|
563
579
|
this.putReaction(view, tile, { ...this.reactionOf(view, tile), comment })
|
|
564
580
|
}
|
|
565
581
|
|
|
566
|
-
/** an option's stars; the same number again clears them */
|
|
567
|
-
setStars(view: number, n: number): void {
|
|
568
|
-
const cur = this.reactionOf(view)
|
|
569
|
-
this.putReaction(view,
|
|
582
|
+
/** an option's or a gallery tile's stars; the same number again clears them */
|
|
583
|
+
setStars(view: number, n: number, tile?: number): void {
|
|
584
|
+
const cur = this.reactionOf(view, tile)
|
|
585
|
+
this.putReaction(view, tile, { ...cur, comment: cur?.comment ?? '', stars: cur?.stars === n ? undefined : n })
|
|
570
586
|
}
|
|
571
587
|
|
|
572
588
|
removeReaction(view: number, tile: number | undefined): void {
|
|
573
589
|
this.putReaction(view, tile, { comment: '' })
|
|
574
590
|
}
|
|
575
591
|
|
|
576
|
-
private putReaction(view: number, tile: number | undefined, r: { status?: ReviewStatus | undefined; comment: string; stars?: number | undefined }): void {
|
|
577
|
-
const next: ReviewReaction = { view, ...(tile !== undefined ? { tile } : {}), ...(r.status ? { status: r.status } : {}), comment: r.comment, ...(r.stars ? { stars: r.stars } : {}) }
|
|
578
|
-
const empty = !r.status && r.comment === '' && !r.stars
|
|
592
|
+
private putReaction(view: number, tile: number | undefined, r: { status?: ReviewStatus | undefined; comment: string; stars?: number | undefined; picked?: true | undefined }): void {
|
|
593
|
+
const next: ReviewReaction = { view, ...(tile !== undefined ? { tile } : {}), ...(r.status ? { status: r.status } : {}), comment: r.comment, ...(r.stars ? { stars: r.stars } : {}), ...(r.picked ? { picked: true as const } : {}) }
|
|
594
|
+
const empty = !r.status && r.comment === '' && !r.stars && !r.picked
|
|
579
595
|
this.edit((d) => {
|
|
580
596
|
const rest = (d.reactions ?? []).filter((q) => !sameSpot(q, view, tile))
|
|
581
597
|
return { ...d, reactions: empty ? rest : [...rest, next] }
|
|
@@ -606,6 +622,54 @@ export class ThreadSt {
|
|
|
606
622
|
this.frame = f
|
|
607
623
|
}
|
|
608
624
|
|
|
625
|
+
setHoverTile(t: { view: number; tile: number } | null): void {
|
|
626
|
+
this.hoverTile = t
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
setTileFilter(f: TileFilter): void {
|
|
630
|
+
this.tileFilter = f
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
toggleBeforeAll(): void {
|
|
634
|
+
this.beforeAll = !this.beforeAll
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
setPeekTile(view: number, tile: number | null): void {
|
|
638
|
+
this.peekTile = tile === null ? null : `${view}/${tile}`
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/** a tile shows its before: all of them flipped, or this one peeked */
|
|
642
|
+
showsBefore(view: number, tile: number): boolean {
|
|
643
|
+
return this.beforeAll || this.peekTile === `${view}/${tile}`
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
/** whether a tile passes the filter, by the reaction it shows */
|
|
647
|
+
tileShown(r: ReviewReaction | null): boolean {
|
|
648
|
+
const f = this.tileFilter
|
|
649
|
+
if (f === 'all') return true
|
|
650
|
+
if (f === 'unrated') return !r?.stars && !r?.status && !r?.picked
|
|
651
|
+
if (f === 'low') return r?.stars !== undefined && r.stars < 3
|
|
652
|
+
return r?.status === 'approved-with-fix' || r?.status === 'rejected'
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/** a variant kept for its row: the row's other pick clears; the same tile again clears it */
|
|
656
|
+
pickTile(view: number, tile: number, group: string, tiles: readonly { group?: string }[]): void {
|
|
657
|
+
const was = this.reactionOf(view, tile)?.picked === true
|
|
658
|
+
tiles.forEach((t, k) => {
|
|
659
|
+
if (t.group !== group) return
|
|
660
|
+
const cur = this.reactionOf(view, k)
|
|
661
|
+
if (cur?.picked) this.putReaction(view, k, { ...cur, picked: undefined })
|
|
662
|
+
})
|
|
663
|
+
if (!was) {
|
|
664
|
+
const cur = this.reactionOf(view, tile)
|
|
665
|
+
this.putReaction(view, tile, { ...cur, comment: cur?.comment ?? '', picked: true })
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
setGalleryTab(view: number, tile: number): void {
|
|
670
|
+
this.galleryTab = { ...this.galleryTab, [view]: tile }
|
|
671
|
+
}
|
|
672
|
+
|
|
609
673
|
toggleTile(id: string, view: number, tile: number): void {
|
|
610
674
|
const k = `${viewKey(id, view)}/${tile}`
|
|
611
675
|
this.bigTile = this.bigTile === k ? null : k
|
|
@@ -787,7 +851,7 @@ export class ThreadSt {
|
|
|
787
851
|
}
|
|
788
852
|
|
|
789
853
|
/** the keys a card takes (ReviewSt.key routes them): 1 to 9 play an option row of the newest version, ⇧1 to ⇧5
|
|
790
|
-
* score the row playing, P picks it; on a clip Space plays, ← → a frame (a sound: two seconds) */
|
|
854
|
+
* score the row playing, P picks it; 1 to 5 score the gallery tile under the pointer; on a clip Space plays, ← → a frame (a sound: two seconds) */
|
|
791
855
|
key(e: Pick<KeyboardEvent, 'key' | 'shiftKey'> & { code?: string }): boolean {
|
|
792
856
|
const h = this.head
|
|
793
857
|
if (h?.kind !== 'version') return false
|
|
@@ -796,7 +860,9 @@ export class ThreadSt {
|
|
|
796
860
|
const digit = Number(/^Digit([1-9])$/.exec(e.code ?? '')?.[1] ?? (/^[1-9]$/.test(e.key) ? e.key : 0))
|
|
797
861
|
const clip = this.clip
|
|
798
862
|
const sound = this.openView?.audio !== undefined
|
|
799
|
-
|
|
863
|
+
const tile = this.hoverTile
|
|
864
|
+
if (tile && !rows && digit > 0 && digit <= STARS && !e.shiftKey) this.setStars(tile.view, digit, tile.tile)
|
|
865
|
+
else if (rows && digit > 0 && !e.shiftKey) {
|
|
800
866
|
if (digit <= h.item.views.length) this.listen(h.id, digit - 1)
|
|
801
867
|
} else if (choice && rows && digit > 0 && e.shiftKey) {
|
|
802
868
|
if (digit <= STARS) this.setStars(this.view, digit)
|