rvlib-shipkit 2.19.0 → 2.20.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/src/annex/annex.ts +227 -0
  4. package/src/annex/offload.ts +279 -0
  5. package/src/checks/SK040-release-words.check.ts +43 -0
  6. package/src/checks/SK041-annex-links.check.ts +28 -0
  7. package/src/checks/SK042-post-kinds.check.ts +73 -0
  8. package/src/cli/cmd_Annex.ts +179 -0
  9. package/src/cli/cmd_Commands.ts +4 -1
  10. package/src/cli/cmd_Home.ts +3 -2
  11. package/src/cli/cmd_Messages.ts +155 -0
  12. package/src/cli/cmd_Releases.ts +48 -0
  13. package/src/cli/cmd_Review.ts +161 -6
  14. package/src/cli/cmd_Shot.ts +4 -4
  15. package/src/cli/cmd_Social.ts +143 -6
  16. package/src/cli/family-pages.ts +2 -0
  17. package/src/cli/kit/index.ts +1 -1
  18. package/src/cli/kit/verb.ts +11 -3
  19. package/src/cli/registry.ts +6 -1
  20. package/src/collections/collection-types.ts +8 -1
  21. package/src/collections/providers.ts +4 -1
  22. package/src/commands/model.ts +36 -0
  23. package/src/commands/registry.ts +49 -0
  24. package/src/commands/routes.ts +59 -0
  25. package/src/commands/runner.ts +35 -0
  26. package/src/commands/runs.ts +112 -0
  27. package/src/core/app-icon.ts +4 -3
  28. package/src/core/icon-type.ts +8 -0
  29. package/src/core/jobs.ts +4 -3
  30. package/src/core/layout.ts +5 -2
  31. package/src/core/squircle.ts +95 -0
  32. package/src/home/daemon-jobs.ts +26 -2
  33. package/src/home/global-units.ts +3 -0
  34. package/src/home/gui-app/ShipkitGui.swift +302 -5
  35. package/src/home/gui-app.ts +63 -33
  36. package/src/home/hmr-keep.ts +134 -0
  37. package/src/home/home-start.ts +2 -2
  38. package/src/home/lib-watch.ts +21 -11
  39. package/src/home/pm.ts +1 -1
  40. package/src/home/process-apps.ts +181 -0
  41. package/src/home/resources.ts +3 -3
  42. package/src/home/run-web.ts +7 -4
  43. package/src/home/serve-web.ts +64 -14
  44. package/src/identities/collection.ts +49 -0
  45. package/src/identities/identities.ts +110 -8
  46. package/src/identities/machine.ts +4 -3
  47. package/src/identities/rating.ts +33 -0
  48. package/src/identities/shown.ts +170 -0
  49. package/src/identities/steps.ts +5 -0
  50. package/src/media-store/purge.ts +15 -1
  51. package/src/media-store/remote.ts +22 -6
  52. package/src/messages/brief.ts +117 -0
  53. package/src/messages/collection.ts +40 -0
  54. package/src/messages/model.ts +171 -0
  55. package/src/messages/routes.ts +15 -0
  56. package/src/messages/score.ts +180 -0
  57. package/src/messages/tabs.ts +13 -0
  58. package/src/release/notes.ts +130 -0
  59. package/src/release/run-bump.ts +41 -18
  60. package/src/release/run-release.ts +22 -4
  61. package/src/release/run-releases.ts +17 -15
  62. package/src/release/unit-resolve.ts +9 -0
  63. package/src/releases/add.ts +66 -0
  64. package/src/releases/collection.ts +36 -0
  65. package/src/releases/from-card.ts +66 -0
  66. package/src/releases/model.ts +267 -0
  67. package/src/releases/pictures.ts +89 -0
  68. package/src/releases/routes.ts +36 -0
  69. package/src/releases/store.ts +71 -0
  70. package/src/repo-config.ts +5 -0
  71. package/src/review/cells.ts +0 -11
  72. package/src/review/format.ts +10 -6
  73. package/src/review/model.ts +92 -3
  74. package/src/review/notes.ts +2 -48
  75. package/src/review/routes.ts +28 -10
  76. package/src/review/stage-card.ts +197 -0
  77. package/src/review/stage-routes.ts +123 -0
  78. package/src/review/store.ts +36 -0
  79. package/src/review/trailer-card.ts +99 -0
  80. package/src/review/trailer-desk.ts +57 -4
  81. package/src/review/trailer-model.ts +41 -7
  82. package/src/review/trailer-notes.ts +45 -0
  83. package/src/review/trailer-routes.ts +22 -13
  84. package/src/serve/hub-app/app-bridge.ts +71 -0
  85. package/src/serve/hub-app/commands/commands-page.tsx +122 -0
  86. package/src/serve/hub-app/commands/commands-st.ts +177 -0
  87. package/src/serve/hub-app/commands.css +24 -0
  88. package/src/serve/hub-app/hash-route.ts +40 -1
  89. package/src/serve/hub-app/home-st.ts +11 -2
  90. package/src/serve/hub-app/home.html +3 -0
  91. package/src/serve/hub-app/hub-app.tsx +6 -0
  92. package/src/serve/hub-app/icons.tsx +5 -0
  93. package/src/serve/hub-app/identities-view.tsx +4 -1
  94. package/src/serve/hub-app/identities.css +1 -0
  95. package/src/serve/hub-app/index.html +3 -0
  96. package/src/serve/hub-app/keys.ts +2 -2
  97. package/src/serve/hub-app/machine-st.ts +41 -10
  98. package/src/serve/hub-app/messages/messages-page.tsx +354 -0
  99. package/src/serve/hub-app/messages/messages-st.ts +74 -0
  100. package/src/serve/hub-app/messages.css +35 -0
  101. package/src/serve/hub-app/releases/releases-page.tsx +94 -0
  102. package/src/serve/hub-app/releases/releases-st.ts +69 -0
  103. package/src/serve/hub-app/releases.css +25 -0
  104. package/src/serve/hub-app/repo-sections.ts +15 -1
  105. package/src/serve/hub-app/repo-st.ts +56 -5
  106. package/src/serve/hub-app/review/clip-st.ts +31 -3
  107. package/src/serve/hub-app/review/note-place.ts +31 -0
  108. package/src/serve/hub-app/review/review-cells.tsx +27 -3
  109. package/src/serve/hub-app/review/review-st.ts +77 -2
  110. package/src/serve/hub-app/review/review-thread.tsx +9 -31
  111. package/src/serve/hub-app/review/review-views.tsx +164 -58
  112. package/src/serve/hub-app/review/thread-st.ts +108 -41
  113. package/src/serve/hub-app/review/trailer-card.tsx +187 -0
  114. package/src/serve/hub-app/review/trailer-page.tsx +62 -31
  115. package/src/serve/hub-app/review/trailer-st.ts +138 -26
  116. package/src/serve/hub-app/review/trailer-timeline.tsx +39 -26
  117. package/src/serve/hub-app/review.css +49 -6
  118. package/src/serve/hub-app/social/comms-page.tsx +55 -23
  119. package/src/serve/hub-app/social/identity-pictures.ts +46 -8
  120. package/src/serve/hub-app/social/kit.tsx +9 -6
  121. package/src/serve/hub-app/social/post-card.tsx +10 -2
  122. package/src/serve/hub-app/social/social-model.ts +37 -3
  123. package/src/serve/hub-app/social/social-page.tsx +179 -65
  124. package/src/serve/hub-app/social/social-st.ts +79 -26
  125. package/src/serve/hub-app/social/stage-popup.tsx +268 -0
  126. package/src/serve/hub-app/social/stage-st.ts +310 -0
  127. package/src/serve/hub-app/social/step-layout.ts +42 -0
  128. package/src/serve/hub-app/social.css +60 -1
  129. package/src/serve/hub-app/tree-build.ts +38 -1
  130. package/src/serve/hub-app/tree-svc.ts +10 -3
  131. package/src/serve/project-gutter-route.ts +4 -2
  132. package/src/serve/same-origin.ts +24 -1
  133. package/src/serve/serve-hub.ts +15 -1
  134. package/src/shipkit-files.ts +9 -7
  135. package/src/shot/shooter.ts +3 -3
  136. package/src/shot/shot-ask.ts +14 -3
  137. package/src/shot/shot.shipkit.ts +1 -1
  138. package/src/social/discord-layout.ts +48 -5
  139. package/src/social/fit.ts +84 -0
  140. package/src/social/identity-words.ts +74 -0
  141. package/src/social/kind-pages.ts +41 -0
  142. package/src/social/kinds.ts +92 -0
  143. package/src/social/load.ts +105 -9
  144. package/src/social/media-limit.ts +63 -2
  145. package/src/social/presence.ts +1 -1
  146. package/src/social/publish/bluesky.ts +58 -19
  147. package/src/social/publish/index.ts +31 -5
  148. package/src/social/reach.ts +49 -0
  149. package/src/social/release-stage.ts +173 -0
  150. package/src/social/routes.ts +42 -7
  151. package/src/social/stage.ts +227 -0
  152. package/src/social/strip.ts +85 -0
  153. package/src/social/text.ts +6 -2
  154. package/src/social/unit.ts +57 -1
  155. package/src/social/writes.ts +11 -0
  156. package/src/trailer/build.ts +15 -2
  157. package/src/trailer/grammar.ts +14 -4
  158. package/src/trailer/public-words.ts +41 -0
@@ -10,6 +10,8 @@ import type { Role } from '../../../review/role.ts'
10
10
  import type { RepoSt } from '../repo-st.ts'
11
11
  import { copyText, etagLoader, GALLERY_FITS, GALLERY_MODES, kept, postJson, TILE_H, ZOOMS, type EtagLoader, type GalleryFit, type GalleryMode, type Zoom } from './review-kit.ts'
12
12
  import { ThreadSt, type Draft } from './thread-st.ts'
13
+ import { cardSource, StageSt, type StageFill } from '../social/stage-st.ts'
14
+ import { isPostRating } from '../../../identities/rating.ts'
13
15
 
14
16
  /** a live `sk review watch`: its process, the session or lane it keeps, when it started */
15
17
  export interface Watcher {
@@ -50,22 +52,31 @@ const draftOf = (s: string | null): Draft | null => {
50
52
  }
51
53
  }
52
54
 
53
- /** the pair's compare mode, the curtain's line and the onion's opacity, shared by every pair of the page */
55
+ /** the pair's compare mode, the curtain's line and the onion's opacity, shared by every pair of the page. Only a
56
+ * normal mode is kept: the changes stay on the card he turned them on (a slip of D read as every pair broken) */
54
57
  export class CompareSt {
55
58
  mode: CompareMode = 'side'
59
+ /** the normal mode he picked last: kept in the browser, and the one another card opens in */
60
+ saved: Exclude<CompareMode, 'diff'> = 'side'
56
61
  split = 0.5
57
62
  opacity = 0.5
58
63
  constructor(private readonly key: string) {
59
64
  const m = kept.get(key)
60
- if (m && (COMPARE_MODES as readonly string[]).includes(m)) this.mode = m as CompareMode
65
+ if (m && m !== 'diff' && (COMPARE_MODES as readonly string[]).includes(m)) this.mode = this.saved = m as Exclude<CompareMode, 'diff'>
61
66
  makeAutoObservable<this, 'key'>(this, { key: false })
62
67
  }
68
+ /** another card opens: the changes drop back to the kept mode, every other mode carries over */
69
+ leaveCard(): void {
70
+ if (this.mode === 'diff') this.mode = this.saved
71
+ }
63
72
  /** the mode a pair draws in: the changes read pixels from two images, so a pair of clips shows side by side */
64
73
  modeFor(clip: boolean): CompareMode {
65
74
  return clip && this.mode === 'diff' ? 'side' : this.mode
66
75
  }
67
76
  setMode(m: CompareMode): void {
68
77
  this.mode = m
78
+ if (m === 'diff') return
79
+ this.saved = m
69
80
  kept.put(this.key, m)
70
81
  }
71
82
  /** the next mode (D), or the one before (⇧D), round the list */
@@ -124,6 +135,8 @@ export class ReviewSt {
124
135
  pinned: string | null = null
125
136
  /** the open card as a thread: made when a card opens */
126
137
  card: ThreadSt | null = null
138
+ /** the stage popup over the card: one of its media staged as a post */
139
+ stage: StageSt | null = null
127
140
  /** what the search box holds; `q` is what the server was asked, once he stopped typing */
128
141
  query = ''
129
142
  q = ''
@@ -206,6 +219,7 @@ export class ReviewSt {
206
219
  compare: false,
207
220
  phone: false,
208
221
  card: observableRef,
222
+ stage: observableRef,
209
223
  page: observableRef,
210
224
  boardRows: observableRef,
211
225
  })
@@ -230,6 +244,11 @@ export class ReviewSt {
230
244
  }
231
245
 
232
246
  /** an absolute hub path as this repo's hub answers it */
247
+ /** the repo this page is of: a trailer card's player reads its trailers through it */
248
+ get repo(): RepoSt {
249
+ return this.st
250
+ }
251
+
233
252
  url(p: string): string {
234
253
  return this.st.url(p)
235
254
  }
@@ -424,6 +443,7 @@ export class ReviewSt {
424
443
  if (this.status !== null) q.set('status', this.status)
425
444
  if (!this.hideHandled) q.set('handled', '1')
426
445
  if (this.byLane) q.set('lanes', '1')
446
+ if (this.stage !== null) q.set('stage', this.stage.pick || '1')
427
447
  return q.toString()
428
448
  }
429
449
 
@@ -443,13 +463,42 @@ export class ReviewSt {
443
463
  if (status !== null && isShownStatus(status)) this.status = status
444
464
  if (q.get('handled') === '1') this.hideHandled = false
445
465
  if (q.get('lanes') === '1') this.byLane = true
466
+ // `stage=<pick>` (or `stage=1`, its first media): the stage popup open, a link or a shot of it
467
+ // with it, `rating=`, `text=`, `kind=` and `kindWhy=` prefill the popup: a link an agent hands him with its
468
+ // suggested line and kind
469
+ const stage = q.get('stage')
470
+ if (stage !== null && this.stage?.pick !== stage) {
471
+ const rating = q.get('rating')
472
+ const kind = q.get('kind')
473
+ const kindWhy = q.get('kindWhy')
474
+ this.pendingStage = {
475
+ want: stage === '1' ? '' : stage,
476
+ text: q.get('text') ?? '',
477
+ rating: rating !== null && isPostRating(rating) ? rating : null,
478
+ ...(kind ? { kind } : {}),
479
+ ...(kindWhy ? { kindWhy } : {}),
480
+ }
481
+ if (this.card !== null || this.selectedId !== null) this.openPendingStage()
482
+ }
483
+ }
484
+
485
+ /** the popup an address asked for, opened once a card is there */
486
+ private pendingStage: (StageFill & { want: string }) | null = null
487
+
488
+ private openPendingStage(): void {
489
+ const p = this.pendingStage
490
+ if (p === null) return
491
+ this.pendingStage = null
492
+ this.openStage(p.want, p)
446
493
  }
447
494
 
448
495
  /** the card the address names */
449
496
  select(id: string | null): void {
450
497
  // a link to a card on the phone opens the card, never the list
451
498
  if (id !== null && id !== this.selectedId && this.phone.on) this.phone.show('card')
499
+ if (id !== this.selectedId) this.compare.leaveCard()
452
500
  this.selectedId = id
501
+ if (id !== null) this.openPendingStage()
453
502
  }
454
503
 
455
504
  /** opens a card from the page: its address follows */
@@ -606,6 +655,29 @@ export class ReviewSt {
606
655
  await this.copied(text, `copied for an agent: title, repo, sk review show, ${w?.phone ? 'links' : 'link'}`)
607
656
  }
608
657
 
658
+ /** « 📤 »: the stage popup over the open card, on the media `want` names (a pick, or `<item>#<view>`; empty, the
659
+ * newest version's first) */
660
+ openStage(want = '', fill?: StageFill): void {
661
+ const card = this.card?.data?.head ?? this.card?.id ?? this.selectedId
662
+ if (card == null) return
663
+ this.stage?.dispose()
664
+ this.stage = new StageSt(
665
+ cardSource((p) => this.url(p), card),
666
+ want,
667
+ (slug) => {
668
+ this.closeStage()
669
+ this.say(`staged: ${slug}, waiting in Communications`)
670
+ void this.answered()
671
+ },
672
+ fill,
673
+ )
674
+ }
675
+
676
+ closeStage(): void {
677
+ this.stage?.dispose()
678
+ this.stage = null
679
+ }
680
+
609
681
  /** a draft this card was turned into, opened in Communications: the hub's own, or the host's in a frame */
610
682
  openDraft(slug: string): void {
611
683
  if (this.st.home.embedded && window.parent !== window) window.parent.postMessage({ shipkit: 'show', page: 'comms', hash: `#page:comms:${slug}` }, location.origin)
@@ -633,6 +705,8 @@ export class ReviewSt {
633
705
  * compare mode of every pair (⇧D the one before), ↑ ↓ the list (W the card wide is the hub's, kept-cols.tsx); the card takes
634
706
  * the rest (ThreadSt.key). A digit is read from its physical key (`code`), so ⇧ and an AZERTY keyboard read the same */
635
707
  key(e: Pick<KeyboardEvent, 'key' | 'shiftKey'> & { code?: string }): boolean {
708
+ // the stage popup takes its own keys
709
+ if (this.stage !== null) return false
636
710
  const card = this.card
637
711
  if (card?.key(e)) return true
638
712
  const k = e.key.toLowerCase()
@@ -646,6 +720,7 @@ export class ReviewSt {
646
720
  else if (k === 'm') this.toggleMarks()
647
721
  else if (k === 't') this.toggleRail()
648
722
  else if (k === 'd') this.compare.cycle(e.shiftKey ? -1 : 1)
723
+ else if (k === 's' && card?.data) this.openStage(`${card.data.head}#${card.view}`)
649
724
  else return false
650
725
  return true
651
726
  }
@@ -4,8 +4,9 @@
4
4
  // them: one word, sent with a verdict or as a reply. The column opens scrolled to the newest cell
5
5
  import { observer } from 'mobx-react-lite'
6
6
  import { useEffect, useRef } from 'react'
7
- import { isPostSubject, MOVE_LABEL, STATUS_LABEL, subjectLabel, viewName, viewTag, type ItemState } from '../../../review/model.ts'
7
+ import { MOVE_LABEL, STATUS_LABEL, subjectLabel, viewName, viewTag } from '../../../review/model.ts'
8
8
  import { AutoText } from '../auto-text.tsx'
9
+ import { StagePopup } from '../social/stage-popup.tsx'
9
10
  import { Icon, ICON } from '../icons.tsx'
10
11
  import { AutoTag, Empty, keepFocus, LaneTag, Listeners, Rework, toneOf, VERDICTS } from './kit.tsx'
11
12
  import { CellFrame, EventsLine } from './review-cells.tsx'
@@ -49,49 +50,27 @@ export const ThreadColumn = observer(({ rv, back }: { rv: ReviewSt; back?: (() =
49
50
  ) : null}
50
51
  </div>
51
52
  <Composer rv={rv} card={card} />
53
+ {rv.stage ? <StagePopup st={rv.stage} url={(p) => rv.url(p)} close={() => rv.closeStage()} /> : null}
52
54
  </>
53
55
  )}
54
56
  </div>
55
57
  )
56
58
  })
57
59
 
58
- const POST_STATE = (s: ItemState): string => (s.state === 'closed' ? (s.why === 'fixed' ? 'written' : s.why ?? 'closed') : s.state === 'claimed' ? 'in work' : 'asked')
59
-
60
- /** « 📣 post »: this card deserves its own public post; each post already asked, where it stands, a click away */
61
- const PostAsk = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => {
60
+ /** « 📤 stage »: a media of the card staged as a post in one popup; each draft already staged from it, a click away */
61
+ const StageBar = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => {
62
62
  const v = card.data
63
- if (!v || isPostSubject(v.subject)) return null
63
+ if (!v || v.origin.by !== 'agent') return null
64
64
  return (
65
65
  <>
66
66
  {v.drafts.map((d) => (
67
- <button key={d.slug} className="ghost rv-chip" title={`the draft written from this card: ${d.slug}, in comms`} onMouseDown={keepFocus} onClick={() => rv.openDraft(d.slug)}>📝 {d.title}</button>
68
- ))}
69
- {v.posts.map((p) => (
70
- <button key={p.id} className="ghost rv-chip" title={`the post asked from this card: ${p.id}`} onMouseDown={keepFocus} onClick={() => rv.pick(p.id)}>📣 {POST_STATE(p.state)}</button>
67
+ <button key={d.slug} className="ghost rv-chip" title={`the draft staged from this card: ${d.slug}, in comms`} onMouseDown={keepFocus} onClick={() => rv.openDraft(d.slug)}>📝 {d.title}</button>
71
68
  ))}
72
- <button className={card.postBox !== null ? 'on' : ''} title="this card deserves its own post: an agent writes the draft in comms" onMouseDown={keepFocus} onClick={() => (card.postBox === null ? card.openPost() : card.closePost())}>📣 post</button>
69
+ <button className={rv.stage !== null ? 'on' : ''} title="stage a media of this card as a post (S): a draft in comms, never posted" onMouseDown={keepFocus} onClick={() => rv.openStage()}>📤 stage</button>
73
70
  </>
74
71
  )
75
72
  })
76
73
 
77
- /** his word on the post he asks: the angle, the account; Enter asks, an empty word too */
78
- const PostBox = observer(({ card }: { card: ThreadSt }) => {
79
- if (card.postBox === null) return null
80
- return (
81
- <div className="rv-postbox">
82
- <AutoText autoFocus placeholder="its own post: the angle, the account (optional). Enter asks, Escape closes" value={card.postBox}
83
- onText={(t) => card.setPost(t)}
84
- onKeyDown={(e) => {
85
- if (e.key === 'Enter' && !e.shiftKey) {
86
- e.preventDefault()
87
- void card.askPost()
88
- } else if (e.key === 'Escape') card.closePost()
89
- }} />
90
- <button disabled={card.busy} onClick={() => void card.askPost()}>ask</button>
91
- </div>
92
- )
93
- })
94
-
95
74
  /** the card's bar: its title, where it stands, its lane, who listens, the copy for an agent, fold or unfold all; on the
96
75
  * phone the contents and a way back to the cards */
97
76
  const TopBar = observer(({ rv, card, back }: { rv: ReviewSt; card: ThreadSt; back?: (() => void) | null }) => {
@@ -107,7 +86,6 @@ const TopBar = observer(({ rv, card, back }: { rv: ReviewSt; card: ThreadSt; bac
107
86
  <Icon d={ICON.copy} />
108
87
  </button>
109
88
  </div>
110
- <PostBox card={card} />
111
89
  {rv.phone.on && v ? <Minimap rv={rv} card={card} dir="row" /> : null}
112
90
  {v ? (
113
91
  <div className="rv-meta">
@@ -125,7 +103,7 @@ const TopBar = observer(({ rv, card, back }: { rv: ReviewSt; card: ThreadSt; bac
125
103
  ) : null}
126
104
  <Rework r={v.rework} />
127
105
  <span className="sp" />
128
- <PostAsk rv={rv} card={card} />
106
+ <StageBar rv={rv} card={card} />
129
107
  <button className={`rv-iconbtn${rv.wide ? ' on' : ''}`} aria-pressed={rv.wide} title={rv.wide ? 'back to the sidebar and the cards (W)' : 'wide: fold the sidebar and the cards, the card takes the page (W)'} aria-label="wide" onMouseDown={keepFocus} onClick={() => rv.toggleWide()}><Icon d={ICON.wide} /></button>
130
108
  <span className="seg">
131
109
  <button className="rv-iconbtn" title="fold every cell" aria-label="fold every cell" onMouseDown={keepFocus} onClick={() => card.foldAll(false)}><Icon d={ICON.foldAll} /></button>
@@ -5,13 +5,14 @@
5
5
  // and keeps the frame's time. A choice, or views that each play alone, read as option rows, each image and clip full
6
6
  // under its row
7
7
  import { observer } from 'mobx-react-lite'
8
- import { useEffect, useRef, useState, type ReactNode } from 'react'
8
+ import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react'
9
9
  import type { VersionCell } from '../../../review/cells.ts'
10
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
14
  import { GALLERY_FITS, GALLERY_MODES, TILE_H, ZOOMS, type GalleryFit, type GalleryMode, type Zoom } from './review-kit.ts'
15
+ import { notePlace } from './note-place.ts'
15
16
  import { COMPARE_MODES, drawnSide, type CompareMode, type CompareSt, type PairSide, type ReviewSt } from './review-st.ts'
16
17
  import { TILE_FILTERS, viewDom, viewKind, viewKey, type ThreadSt, type TileFilter } from './thread-st.ts'
17
18
  import { Caret } from '../icons.tsx'
@@ -102,6 +103,7 @@ const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewVie
102
103
  <span className="sp" />
103
104
  {open && media?.marks && media.marks.length > 0 ? <button className={rv.marksOn ? 'primary' : ''} onMouseDown={keepFocus} onClick={() => rv.toggleMarks()}>marks · M</button> : null}
104
105
  {open && media && isPair(media.files) && !media.audio && !rv.phone.on ? <CompareModes c={rv.compare} clip={media.clip !== undefined} /> : null}
106
+ <StageButtons ver={ver} v={v} i={i} />
105
107
  </header>
106
108
  <ViewNotes ver={ver} i={i} gallery={isGallery(v)} />
107
109
  {open ? (
@@ -115,6 +117,30 @@ const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewVie
115
117
  )
116
118
  })
117
119
 
120
+ /** « 📤 » on a view: the stage popup on that media; a pair offers its after, its before, and the wipe of two images; a
121
+ * gallery opens on its first tile, the popup's strip holding every other; a sound alone stages nothing */
122
+ const StageButtons = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number }) => {
123
+ const { rv } = ver
124
+ const item = itemOf(ver)
125
+ if (item.origin.by !== 'agent') return null
126
+ const at = `${item.id}#${i}`
127
+ const btn = (key: string, label: string, tip: string) => (
128
+ <button key={key} className="ghost rv-stagebtn" title={tip} onMouseDown={keepFocus} onClick={() => rv.openStage(key)}>
129
+ {label}
130
+ </button>
131
+ )
132
+ if (isGallery(v)) return btn(`${at}/0`, '📤', 'stage a tile of this grid as a post')
133
+ if (v.audio) return null
134
+ if (!isPair(v.files)) return btn(at, '📤', 'stage this media as a post: a draft in comms, never posted')
135
+ return (
136
+ <>
137
+ {btn(`${at}.after`, '📤 after', 'stage the after as a post')}
138
+ {btn(`${at}.before`, '📤 before', 'stage the before as a post')}
139
+ {v.clip ? null : btn(`${at}.wipe`, '📤 wipe', 'stage the pair as one wipe from before to after')}
140
+ </>
141
+ )
142
+ })
143
+
118
144
  /** what was said on one view, above it: each answer's rectangles and reactions (a click shows the rectangle), then on
119
145
  * the newest version his draft: each rectangle's word, his word on the view */
120
146
  const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: number; gallery: boolean; word?: boolean }) => {
@@ -208,6 +234,7 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
208
234
  </button>
209
235
  ) : null}
210
236
  <b className="rv-optlabel" title={viewName(v, i)}>{viewName(v, i)}</b>
237
+ {choice && item.agentPick === i ? <span className="rv-mypick" title="the option the agent suggests; your pick is your own">my pick</span> : null}
211
238
  {c && playable?.clip && !unfolded ? (
212
239
  <span className="rv-optthumb" style={{ aspectRatio: `${playable.size.w} / ${playable.size.h}` }} onClick={() => card.toggleRow(item, i)} title="the full view">
213
240
  <ClipVideo clip={c} src={rv.fileUrl(id, file, item.wip)} poster={rv.thumbUrl(id, playable.clip.poster)} loop={false} />
@@ -783,7 +810,7 @@ const Compare = observer(({ c, mode = c.mode, base, mod, names, aspect, draw, ov
783
810
  )
784
811
  if (mode === 'diff')
785
812
  return (
786
- <Frame aspect={aspect} caption={<>changes <span className="rv-modcap">{changesWords(share)}</span></>} over={over?.([mod])}>
813
+ <Frame aspect={aspect} caption={<>changes view: only the changed pixels are coloured, <span className="rv-modcap">{changesWords(share)}</span> · ◫ or D for the normal view</>} over={over?.([mod])}>
787
814
  <div className="rv-fill">{draw(mod, <DiffCanvas base={base} mod={mod} say={setShare} />)}</div>
788
815
  </Frame>
789
816
  )
@@ -833,36 +860,78 @@ const Frame = ({ aspect, caption, modCap, swipe, onPeek, over, children }: { asp
833
860
 
834
861
  // ── drawing ──
835
862
 
836
- const box = (a: { x0: number; y0: number; x1: number; y1: number }) => ({ x: Math.min(a.x0, a.x1), y: Math.min(a.y0, a.y1), w: Math.abs(a.x1 - a.x0), h: Math.abs(a.y1 - a.y0) })
837
- const pct = (r: { x: number; y: number; w: number; h: number }) => ({ left: `${r.x * 100}%`, top: `${r.y * 100}%`, width: `${r.w * 100}%`, height: `${r.h * 100}%` })
863
+ type Corners = { x0: number; y0: number; x1: number; y1: number }
864
+ const box = (a: Corners) => ({ x: Math.min(a.x0, a.x1), y: Math.min(a.y0, a.y1), w: Math.abs(a.x1 - a.x0), h: Math.abs(a.y1 - a.y0) })
865
+ export const pct = (r: { x: number; y: number; w: number; h: number }) => ({ left: `${r.x * 100}%`, top: `${r.y * 100}%`, width: `${r.w * 100}%`, height: `${r.h * 100}%` })
838
866
  const clamp01 = (v: number): number => Math.max(0, Math.min(1, v))
839
867
  /** a drag shorter than this, on either axis, is a click: it picks nothing */
840
868
  const MIN_DRAG = 0.01
841
869
 
870
+ /** the drag that draws a rectangle on a picture, 0 to 1 over `el`: `show` the box while it moves (null once let go),
871
+ * `end` the rectangle, or null for a click. A card's views draw with it, and a trailer page's frame */
872
+ export function dragBox(e: { clientX: number; clientY: number }, el: Element, show: (c: Corners | null) => void, end: (r: { x: number; y: number; w: number; h: number } | null) => void): void {
873
+ const at = (p: { clientX: number; clientY: number }): { x: number; y: number } => {
874
+ const b = el.getBoundingClientRect()
875
+ return { x: clamp01((p.clientX - b.left) / b.width), y: clamp01((p.clientY - b.top) / b.height) }
876
+ }
877
+ const a = at(e)
878
+ let cur: Corners = { x0: a.x, y0: a.y, x1: a.x, y1: a.y }
879
+ show(cur)
880
+ const move = (m: PointerEvent): void => {
881
+ const b = at(m)
882
+ cur = { ...cur, x1: b.x, y1: b.y }
883
+ show(cur)
884
+ }
885
+ const up = (): void => {
886
+ window.removeEventListener('pointermove', move)
887
+ window.removeEventListener('pointerup', up)
888
+ window.removeEventListener('pointercancel', up)
889
+ show(null)
890
+ const r = box(cur)
891
+ end(r.w > MIN_DRAG && r.h > MIN_DRAG ? r : null)
892
+ }
893
+ window.addEventListener('pointermove', move)
894
+ window.addEventListener('pointerup', up)
895
+ window.addEventListener('pointercancel', up)
896
+ }
897
+
898
+ /** the rectangle being drawn */
899
+ export const DragBox = ({ c }: { c: Corners | null }) => (c ? <div className="rv-drag" style={pct(box(c))} /> : null)
900
+
901
+ /** what a host that shows notes by time says of each rectangle: hidden now (null), else its number and whether it is lit */
902
+ export type ShownNote = (r: Rect) => { n: number; lit: boolean } | null
903
+
904
+ /** a picture another kind of view hosts (a trailer card's player): the regular frame and its rectangles over the host's
905
+ * own `face`, drawn and kept as on an image, the picked one's note box beside it. `notes` says which rectangles show
906
+ * now and their numbers */
907
+ export const HostedFrame = observer(({ ver, view, side, aspect, face, notes }: { ver: Ver; view: number; side: Side | undefined; aspect: string; face: ReactNode; notes: ShownNote }) => (
908
+ <Frame aspect={aspect} caption={null} over={ver.live ? <RectNote ver={ver} view={view} sides={[side]} notes={notes} /> : null}>
909
+ <div className="rv-fill"><Marks ver={ver} src="" side={side} view={view} face={face} alone notes={notes} /></div>
910
+ </Frame>
911
+ ))
912
+
842
913
  /** one image or clip of view `view` and its rectangles: the ones his answers sent (still), and on the version his
843
914
  * answer goes to his draft's, a drag drawing one (never in the curtain, whose drag moves the line). A clip view of
844
915
  * that version that is not the active one loops on its own: a click makes it active. On a claiming version (the newest,
845
916
  * his answer on an older one) a drag draws at once and brings his answer here. `face` takes the image's place (the
846
- * changes of a pair) */
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 }) => {
917
+ * changes of a pair, a trailer card's player); `alone`: one picture with no curtain over it, whatever its side. The
918
+ * clock its frames stand on is the card's (`clockOf`): a clip's own, a trailer card's player's. `notes`: a host that
919
+ * shows its notes by time picks which rectangles show and numbers them, each with its first words */
920
+ const Marks = observer(({ ver, src, side, view, face, tile, onTap, alone, notes }: { ver: Ver; src: string; side: Side | undefined; view: number; face?: ReactNode; tile?: number; onTap?: () => void; alone?: boolean; notes?: ShownNote }) => {
848
921
  const { rv, card, cell } = ver
849
922
  const el = useRef<HTMLDivElement>(null)
850
- const [drag, setDrag] = useState<{ x0: number; y0: number; x1: number; y1: number } | null>(null)
923
+ const [drag, setDrag] = useState<Corners | null>(null)
851
924
  const phone = rv.phone
852
925
  const any = itemOf(ver).views[view]
853
926
  const shown = any && !isGallery(any) ? any : undefined
854
- const clip = shown?.clip
927
+ const clock = tile === undefined ? card.clockOf(cell.id, view) : null
855
928
  const active = card.view === view
856
- const drawing = takes(ver) && (phone.on ? phone.draw && (side === undefined || phone.pair !== 'swipe' || rv.compare.mode !== 'swipe') : side === undefined || rv.compare.mode !== 'swipe')
857
- const c = clip ? card.clipOf(cell.id, view) : null
858
- const at = (e: { clientX: number; clientY: number }): { x: number; y: number } => {
859
- const b = el.current?.getBoundingClientRect()
860
- if (!b) return { x: 0, y: 0 }
861
- return { x: clamp01((e.clientX - b.left) / b.width), y: clamp01((e.clientY - b.top) / b.height) }
862
- }
929
+ const free = alone === true || side === undefined
930
+ const drawing = takes(ver) && (phone.on ? phone.draw && (free || phone.pair !== 'swipe' || rv.compare.mode !== 'swipe') : free || rv.compare.mode !== 'swipe')
931
+ const c = clock?.c ?? null
863
932
  const down = (e: React.PointerEvent): void => {
864
933
  if (e.button !== 0) return
865
- if (clip && ver.live && !active) {
934
+ if (clock && ver.live && !active) {
866
935
  e.preventDefault()
867
936
  card.setView(view)
868
937
  return
@@ -873,46 +942,49 @@ const Marks = observer(({ ver, src, side, view, face, tile, onTap }: { ver: Ver;
873
942
  if (ver.claim) card.answerNewest()
874
943
  // he draws on the paused frame: the rectangle keeps its time
875
944
  if (c && !c.paused) c.pause()
876
- const a = at(e)
877
- let cur = { x0: a.x, y0: a.y, x1: a.x, y1: a.y }
878
- setDrag(cur)
879
- const move = (m: PointerEvent): void => {
880
- const b = at(m)
881
- cur = { ...cur, x1: b.x, y1: b.y }
882
- setDrag(cur)
883
- }
884
- const up = (): void => {
885
- window.removeEventListener('pointermove', move)
886
- window.removeEventListener('pointerup', up)
887
- window.removeEventListener('pointercancel', up)
888
- setDrag(null)
889
- const r = box(cur)
890
- if (r.w > MIN_DRAG && r.h > MIN_DRAG) card.addRect(r, side, view, tile)
945
+ if (!el.current) return
946
+ dragBox(e, el.current, setDrag, (r) => {
947
+ if (r) card.addRect(r, side, view, tile)
891
948
  else if (onTap) onTap()
892
949
  else card.pickRect(null)
893
- }
894
- window.addEventListener('pointermove', move)
895
- window.addEventListener('pointerup', up)
896
- window.addEventListener('pointercancel', up)
950
+ })
897
951
  }
898
952
  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
953
  const sent = card.sentRects(cell.id, view, side, tile)
900
- const onIts = (r: Rect): boolean => !clip || !c || r.t === undefined || (c.paused && onFrame(r.t, c.time, clip.fps))
954
+ const onIts = (r: Rect): boolean => !clock || r.t === undefined || (clock.c.paused && onFrame(r.t, clock.c.time, clock.fps))
901
955
  const rings = rv.marksOn ? (shown?.marks ?? []).filter((m) => m.side === side) : []
902
- const live = drawing || (clip !== undefined && ver.live && !active)
956
+ const live = drawing || (clock !== null && ver.live && !active)
903
957
  return (
904
- <div ref={el} className={`rv-marks${clip && ver.live && !active ? ' pick' : drawing ? ' draw' : ''}`} onPointerDown={down} style={{ pointerEvents: live ? 'auto' : 'none', touchAction: drawing ? 'none' : undefined }}>
958
+ <div ref={el} className={`rv-marks${clock && ver.live && !active ? ' pick' : drawing ? ' draw' : ''}`} onPointerDown={down} style={{ pointerEvents: live ? 'auto' : 'none', touchAction: drawing ? 'none' : undefined }}>
905
959
  {face ?? (c ? <ClipVideo key={src} clip={c} src={src} poster={shown?.clip ? rv.fitUrl(cell.id, shown.clip.poster) : undefined} preload={ver.live ? 'auto' : 'none'} /> : <img src={src} alt="" draggable={false} className="rv-markimg" loading="lazy" decoding="async" />)}
906
960
  {shown && rings.length > 0 ? <Rings marks={rings} w={shown.size.w} h={shown.size.h} /> : null}
907
- {sent.map(({ r, n }, k) => <div key={`s${k}`} className={`rv-rect sent${onIts(r) ? '' : ' faint'}`} style={pct(r)} title={r.comment || `rectangle ${n}`}><span className="rv-rectn">{n}</span></div>)}
908
- {rects.map(([r, i]) => (
909
- <RectMark key={i} r={r} n={i + 1} on={card.rect === i} faint={!onIts(r)} at={clip && r.t !== undefined ? secs(r.t) : undefined} pick={() => card.pickRect(i, true)} />
910
- ))}
911
- {drag ? <div className="rv-drag" style={pct(box(drag))} /> : null}
961
+ {notes
962
+ ? sent.flatMap(({ r }, k) => {
963
+ const s = notes(r)
964
+ return s ? [<NoteRect key={`s${k}`} r={r} n={s.n} on={s.lit} sent />] : []
965
+ })
966
+ : sent.map(({ r, n }, k) => <div key={`s${k}`} className={`rv-rect sent${onIts(r) ? '' : ' faint'}`} style={pct(r)} title={r.comment || `rectangle ${n}`}><span className="rv-rectn">{n}</span></div>)}
967
+ {notes
968
+ ? rects.flatMap(([r, i]) => {
969
+ const s = notes(r)
970
+ return s ? [<NoteRect key={i} r={r} n={s.n} on={s.lit || card.rect === i} pick={() => card.pickRect(i, true)} />] : []
971
+ })
972
+ : rects.map(([r, i]) => (
973
+ <RectMark key={i} r={r} n={i + 1} on={card.rect === i} faint={!onIts(r)} at={clock && r.t !== undefined ? secs(r.t) : undefined} pick={() => card.pickRect(i, true)} />
974
+ ))}
975
+ <DragBox c={drag} />
912
976
  </div>
913
977
  )
914
978
  })
915
979
 
980
+ /** a note's rectangle as a host that shows notes by time draws it: solid, its number and its first words on its label */
981
+ export const NoteRect = ({ r, n, on, sent, pick }: { r: { x: number; y: number; w: number; h: number; comment: string }; n: number; on: boolean; sent?: boolean; pick?: () => void }) => (
982
+ <div className={`rv-rect tr-noterect${on ? ' on' : ''}${sent ? ' was' : ''}`} style={{ ...pct(r), pointerEvents: pick ? 'auto' : 'none' }} title={r.comment || `note ${n}`}
983
+ onPointerDown={pick ? (e) => { e.stopPropagation(); pick() } : undefined} onMouseDown={keepFocus}>
984
+ <span className="tr-notelabel"><b>{n}</b>{r.comment.trim() ? ` ${firstWords(r.comment)}` : ''}</span>
985
+ </div>
986
+ )
987
+
916
988
  /** a repo's own rings over its shot; they never take a click */
917
989
  const Rings = ({ marks, w, h }: { marks: readonly ReviewMark[]; w: number; h: number }) => (
918
990
  <svg className="rv-rings" viewBox={`0 0 ${w} ${h}`} preserveAspectRatio="none">
@@ -939,28 +1011,64 @@ const firstWords = (s: string): string => {
939
1011
  return w.length > 5 ? `${w.slice(0, 5).join(' ')}…` : w.join(' ')
940
1012
  }
941
1013
 
942
- /** the picked rectangle's note box, beside it on the image: under it, or over it when it sits low, focused once drawn
943
- * or clicked. Enter or Escape closes it (the rectangle stays), Shift Enter is a new line; `sides` are the sides the
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
945
- * under the hand that drew it (ReactionToggles, the head's own) */
946
- const RectNote = observer(({ ver, view, sides, tile }: { ver: Ver; view: number; sides: readonly (Side | undefined)[]; tile?: number }) => {
1014
+ /** the picked rectangle's note box, beside it on the frame and never over it (notePlace), focused once drawn or
1015
+ * clicked. Enter, Escape or a press anywhere outside closes it (the rectangle and its words stay: each key writes the
1016
+ * draft), Shift Enter is a new line; `sides` are the sides the frame shows. Its tag names the side it marks (before or
1017
+ * after), and a second row repeats the view's OK, Fix and No under the hand that drew it (ReactionToggles, the head's
1018
+ * own). `notes`: a host that shows its notes by time (a trailer card) numbers it, shows it only paused on its frame,
1019
+ * and leaves OK, Fix and No to the verdict */
1020
+ const RectNote = observer(({ ver, view, sides, tile, notes }: { ver: Ver; view: number; sides: readonly (Side | undefined)[]; tile?: number; notes?: ShownNote }) => {
947
1021
  const { card } = ver
948
1022
  const box = useRef<HTMLTextAreaElement | null>(null)
1023
+ const el = useRef<HTMLDivElement>(null)
1024
+ const [size, setSize] = useState<{ fw: number; fh: number; nw: number; nh: number } | null>(null)
949
1025
  const i = card.rect
950
1026
  const r = i === null ? undefined : card.draft.rects[i]
951
- const here = i !== null && r !== undefined && (r.view ?? 0) === view && sides.includes(r.side) && r.tile === tile
1027
+ const shown = r && notes ? notes(r) : null
1028
+ const paused = card.clockOf(card.target ?? '', view)?.c.paused ?? true
1029
+ const here = i !== null && r !== undefined && (r.view ?? 0) === view && sides.includes(r.side) && r.tile === tile && (!notes || (shown !== null && paused))
952
1030
  const focus = here && card.noteFocus === i
953
1031
  useEffect(() => {
954
- if (!focus || box.current === null) return
955
- box.current.focus()
1032
+ const t = box.current
1033
+ if (!focus || t === null) return
1034
+ // the cursor after the words, so a reopened note goes on where it stopped
1035
+ t.focus()
1036
+ t.setSelectionRange(t.value.length, t.value.length)
956
1037
  card.noteFocused()
957
1038
  }, [focus, card])
1039
+ // the frame's size and its own, read before paint and again as either changes (a word wraps, the window moves)
1040
+ useLayoutEffect(() => {
1041
+ const n = el.current
1042
+ const f = n?.parentElement
1043
+ if (!n || !f) return
1044
+ const read = (): void => {
1045
+ const v = { fw: f.clientWidth, fh: f.clientHeight, nw: n.offsetWidth, nh: n.offsetHeight }
1046
+ setSize((s) => (s && s.fw === v.fw && s.fh === v.fh && s.nw === v.nw && s.nh === v.nh ? s : v))
1047
+ }
1048
+ read()
1049
+ const ro = new ResizeObserver(read)
1050
+ ro.observe(n)
1051
+ ro.observe(f)
1052
+ return () => ro.disconnect()
1053
+ }, [here])
1054
+ // a press outside closes it, captured so a handler that stops it (a rectangle, the frame's drag) closes it too
1055
+ useEffect(() => {
1056
+ if (!here) return
1057
+ const out = (e: PointerEvent): void => {
1058
+ if (!el.current?.contains(e.target as Node)) card.pickRect(null)
1059
+ }
1060
+ document.addEventListener('pointerdown', out, true)
1061
+ return () => document.removeEventListener('pointerdown', out, true)
1062
+ }, [here, card])
958
1063
  if (!here) return null
959
- const below = r.y + r.h <= NOTE_LOW || r.y < 1 - NOTE_LOW
960
- const place = below ? { top: `${(r.y + r.h) * 100}%` } : { bottom: `${(1 - r.y) * 100}%` }
1064
+ const at = size ? notePlace({ x: r.x * size.fw, y: r.y * size.fh, w: r.w * size.fw, h: r.h * size.fh }, { w: size.fw, h: size.fh }, { w: size.nw, h: size.nh }) : null
1065
+ // until measured it waits unseen, still focusable, where it most often lands
1066
+ const place = at ? { left: at.left, top: at.top } : { left: `${r.x * 100}%`, top: `${(r.y + r.h) * 100}%`, opacity: 0 }
1067
+ const n = shown?.n ?? i + 1
1068
+ const side = notes ? undefined : r.side
961
1069
  return (
962
- <div className={`rv-note${below ? ' below' : ' above'}`} style={{ ...place, ['--nx' as string]: `${r.x * 100}%` }} onPointerDown={(e) => e.stopPropagation()}>
963
- <span className={`rv-noten${r.side ? ` ${r.side}` : ''}`}>{i + 1}{r.side ? ` · ${r.side}` : ''}{r.t !== undefined ? ` · ${secs(r.t)}` : ''}</span>
1070
+ <div ref={el} className={`rv-note ${at?.side ?? 'below'}`} style={place} onPointerDown={(e) => e.stopPropagation()}>
1071
+ <span className={`rv-noten${side ? ` ${side}` : ''}`}>{n}{side ? ` · ${side}` : ''}{r.t !== undefined ? ` · ${secs(r.t)}` : ''}</span>
964
1072
  <AutoText el={(t) => (box.current = t)} placeholder="what is wrong here · Enter closes" value={r.comment}
965
1073
  onText={(t) => card.setRectComment(i, t)}
966
1074
  onKeyDown={(e) => {
@@ -970,12 +1078,10 @@ const RectNote = observer(({ ver, view, sides, tile }: { ver: Ver; view: number;
970
1078
  }
971
1079
  }} />
972
1080
  <button className="ghost rv-x" title="delete this rectangle" aria-label="delete this rectangle" onMouseDown={keepFocus} onClick={() => card.removeRect(i)}>✕</button>
973
- <span className="rv-notereacts"><ReactionToggles ver={ver} view={view} small /></span>
1081
+ {notes ? null : <span className="rv-notereacts"><ReactionToggles ver={ver} view={view} small /></span>}
974
1082
  </div>
975
1083
  )
976
1084
  })
977
- /** a rectangle whose bottom is lower than this share of the image opens its note over it, when there is room above */
978
- const NOTE_LOW = 0.78
979
1085
 
980
1086
  // ── a clip ──
981
1087