rvlib-shipkit 2.18.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 (186) hide show
  1. package/CHANGELOG.md +31 -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/asks/asks-queue.ts +63 -10
  6. package/src/checks/SK040-release-words.check.ts +43 -0
  7. package/src/checks/SK041-annex-links.check.ts +28 -0
  8. package/src/checks/SK042-post-kinds.check.ts +73 -0
  9. package/src/cli/cmd_Annex.ts +179 -0
  10. package/src/cli/cmd_Asks.ts +3 -1
  11. package/src/cli/cmd_Commands.ts +4 -1
  12. package/src/cli/cmd_GlobalProcesses.ts +34 -11
  13. package/src/cli/cmd_Home.ts +41 -4
  14. package/src/cli/cmd_Messages.ts +155 -0
  15. package/src/cli/cmd_Releases.ts +48 -0
  16. package/src/cli/cmd_Review.ts +161 -6
  17. package/src/cli/cmd_Secret.ts +4 -30
  18. package/src/cli/cmd_Shot.ts +4 -4
  19. package/src/cli/cmd_Social.ts +179 -3
  20. package/src/cli/cmd_Trailer.ts +15 -3
  21. package/src/cli/family-pages.ts +2 -0
  22. package/src/cli/kit/index.ts +1 -1
  23. package/src/cli/kit/verb.ts +11 -3
  24. package/src/cli/registry.ts +8 -2
  25. package/src/collections/actions.ts +29 -1
  26. package/src/collections/collection-types.ts +10 -1
  27. package/src/collections/providers.ts +5 -2
  28. package/src/commands/model.ts +36 -0
  29. package/src/commands/registry.ts +49 -0
  30. package/src/commands/routes.ts +59 -0
  31. package/src/commands/runner.ts +35 -0
  32. package/src/commands/runs.ts +112 -0
  33. package/src/core/app-icon.ts +4 -3
  34. package/src/core/icon-type.ts +8 -0
  35. package/src/core/jobs.ts +4 -3
  36. package/src/core/layout.ts +5 -2
  37. package/src/core/squircle.ts +95 -0
  38. package/src/home/daemon-jobs.ts +26 -2
  39. package/src/home/global-units.ts +3 -0
  40. package/src/home/gui-app/ShipkitGui.swift +302 -5
  41. package/src/home/gui-app.ts +63 -33
  42. package/src/home/hmr-keep.ts +134 -0
  43. package/src/home/home-paths.ts +5 -1
  44. package/src/home/home-start.ts +14 -14
  45. package/src/home/lib-watch.ts +21 -11
  46. package/src/home/pm.ts +1 -1
  47. package/src/home/process-apps.ts +181 -0
  48. package/src/home/resources.ts +3 -3
  49. package/src/home/run-daemon.ts +11 -2
  50. package/src/home/run-pm.ts +9 -1
  51. package/src/home/run-web.ts +7 -4
  52. package/src/home/serve-web.ts +64 -14
  53. package/src/home/supervise.ts +3 -1
  54. package/src/identities/collection.ts +49 -0
  55. package/src/identities/identities.ts +130 -11
  56. package/src/identities/machine.ts +4 -3
  57. package/src/identities/rating.ts +33 -0
  58. package/src/identities/shown.ts +170 -0
  59. package/src/identities/steps.ts +5 -0
  60. package/src/media-store/purge.ts +15 -1
  61. package/src/media-store/remote.ts +22 -6
  62. package/src/messages/brief.ts +117 -0
  63. package/src/messages/collection.ts +40 -0
  64. package/src/messages/model.ts +171 -0
  65. package/src/messages/routes.ts +15 -0
  66. package/src/messages/score.ts +180 -0
  67. package/src/messages/tabs.ts +13 -0
  68. package/src/release/notes.ts +130 -0
  69. package/src/release/run-bump.ts +41 -18
  70. package/src/release/run-release.ts +22 -4
  71. package/src/release/run-releases.ts +17 -15
  72. package/src/release/unit-resolve.ts +9 -0
  73. package/src/releases/add.ts +66 -0
  74. package/src/releases/collection.ts +36 -0
  75. package/src/releases/from-card.ts +66 -0
  76. package/src/releases/model.ts +267 -0
  77. package/src/releases/pictures.ts +89 -0
  78. package/src/releases/routes.ts +36 -0
  79. package/src/releases/store.ts +71 -0
  80. package/src/repo-config.ts +5 -0
  81. package/src/review/cells.ts +0 -11
  82. package/src/review/format.ts +10 -6
  83. package/src/review/http.ts +7 -2
  84. package/src/review/model.ts +92 -3
  85. package/src/review/notes.ts +2 -48
  86. package/src/review/routes.ts +28 -10
  87. package/src/review/stage-card.ts +197 -0
  88. package/src/review/stage-routes.ts +123 -0
  89. package/src/review/store.ts +117 -19
  90. package/src/review/trailer-card.ts +99 -0
  91. package/src/review/trailer-desk.ts +57 -4
  92. package/src/review/trailer-model.ts +41 -7
  93. package/src/review/trailer-notes.ts +45 -0
  94. package/src/review/trailer-routes.ts +22 -13
  95. package/src/secrets/manager.ts +59 -0
  96. package/src/secrets/name.ts +2 -0
  97. package/src/serve/hub-app/app-bridge.ts +71 -0
  98. package/src/serve/hub-app/col-card.tsx +10 -0
  99. package/src/serve/hub-app/cols-svc.ts +37 -6
  100. package/src/serve/hub-app/commands/commands-page.tsx +122 -0
  101. package/src/serve/hub-app/commands/commands-st.ts +177 -0
  102. package/src/serve/hub-app/commands.css +24 -0
  103. package/src/serve/hub-app/hash-route.ts +40 -1
  104. package/src/serve/hub-app/home-st.ts +11 -2
  105. package/src/serve/hub-app/home.html +3 -0
  106. package/src/serve/hub-app/hub-app.tsx +6 -0
  107. package/src/serve/hub-app/hub.css +1 -0
  108. package/src/serve/hub-app/icons.tsx +5 -0
  109. package/src/serve/hub-app/identities-view.tsx +4 -1
  110. package/src/serve/hub-app/identities.css +1 -0
  111. package/src/serve/hub-app/index.html +3 -0
  112. package/src/serve/hub-app/keys.ts +2 -2
  113. package/src/serve/hub-app/machine-st.ts +41 -10
  114. package/src/serve/hub-app/messages/messages-page.tsx +354 -0
  115. package/src/serve/hub-app/messages/messages-st.ts +74 -0
  116. package/src/serve/hub-app/messages.css +35 -0
  117. package/src/serve/hub-app/releases/releases-page.tsx +94 -0
  118. package/src/serve/hub-app/releases/releases-st.ts +69 -0
  119. package/src/serve/hub-app/releases.css +25 -0
  120. package/src/serve/hub-app/repo-sections.ts +15 -1
  121. package/src/serve/hub-app/repo-st.ts +56 -5
  122. package/src/serve/hub-app/review/clip-st.ts +31 -3
  123. package/src/serve/hub-app/review/note-place.ts +31 -0
  124. package/src/serve/hub-app/review/review-cells.tsx +27 -3
  125. package/src/serve/hub-app/review/review-st.ts +77 -2
  126. package/src/serve/hub-app/review/review-thread.tsx +9 -31
  127. package/src/serve/hub-app/review/review-views.tsx +164 -58
  128. package/src/serve/hub-app/review/thread-st.ts +108 -41
  129. package/src/serve/hub-app/review/trailer-card.tsx +187 -0
  130. package/src/serve/hub-app/review/trailer-page.tsx +62 -31
  131. package/src/serve/hub-app/review/trailer-st.ts +138 -26
  132. package/src/serve/hub-app/review/trailer-timeline.tsx +39 -26
  133. package/src/serve/hub-app/review.css +49 -6
  134. package/src/serve/hub-app/social/comms-page.tsx +55 -23
  135. package/src/serve/hub-app/social/identity-pictures.ts +112 -0
  136. package/src/serve/hub-app/social/kit.tsx +9 -6
  137. package/src/serve/hub-app/social/post-card.tsx +10 -2
  138. package/src/serve/hub-app/social/social-model.ts +37 -3
  139. package/src/serve/hub-app/social/social-page.tsx +236 -82
  140. package/src/serve/hub-app/social/social-st.ts +79 -26
  141. package/src/serve/hub-app/social/stage-popup.tsx +268 -0
  142. package/src/serve/hub-app/social/stage-st.ts +310 -0
  143. package/src/serve/hub-app/social/step-layout.ts +42 -0
  144. package/src/serve/hub-app/social.css +68 -4
  145. package/src/serve/hub-app/tree-build.ts +38 -1
  146. package/src/serve/hub-app/tree-svc.ts +10 -3
  147. package/src/serve/project-gutter-route.ts +4 -2
  148. package/src/serve/same-origin.ts +24 -1
  149. package/src/serve/serve-hub.ts +27 -3
  150. package/src/shipkit-files.ts +9 -7
  151. package/src/shot/shooter.ts +3 -3
  152. package/src/shot/shot-ask.ts +14 -3
  153. package/src/shot/shot.shipkit.ts +1 -1
  154. package/src/social/discord-layout.ts +282 -0
  155. package/src/social/fit.ts +84 -0
  156. package/src/social/identity-words.ts +74 -0
  157. package/src/social/kind-pages.ts +41 -0
  158. package/src/social/kinds.ts +92 -0
  159. package/src/social/load.ts +105 -9
  160. package/src/social/md.ts +14 -6
  161. package/src/social/media-limit.ts +63 -2
  162. package/src/social/presence.ts +1 -1
  163. package/src/social/publish/bluesky.ts +58 -19
  164. package/src/social/publish/discord.ts +3 -2
  165. package/src/social/publish/index.ts +31 -5
  166. package/src/social/reach.ts +49 -0
  167. package/src/social/release-stage.ts +173 -0
  168. package/src/social/routes.ts +44 -9
  169. package/src/social/stage.ts +227 -0
  170. package/src/social/strip.ts +85 -0
  171. package/src/social/text.ts +6 -2
  172. package/src/social/unit.ts +57 -1
  173. package/src/social/writes.ts +11 -0
  174. package/src/stores/routes.ts +2 -2
  175. package/src/suite/judge-suites.ts +1 -1
  176. package/src/suite/suite-cli.ts +5 -5
  177. package/src/trailer/build.ts +90 -52
  178. package/src/trailer/draft.ts +28 -0
  179. package/src/trailer/footage.ts +4 -2
  180. package/src/trailer/grammar.ts +25 -13
  181. package/src/trailer/graph.ts +32 -9
  182. package/src/trailer/profile.ts +35 -0
  183. package/src/trailer/prune.ts +15 -10
  184. package/src/trailer/public-words.ts +41 -0
  185. package/src/trailer/stitch.ts +22 -10
  186. package/src/trailer/titles.ts +47 -2
@@ -1,10 +1,11 @@
1
1
  // the desks' words and pure rules (wiki tools/shipkit/social.md, The desks in the hub): the desk as the hub's route
2
2
  // sends it, a draft's angle as cards, the families of the list, a card a heading, the address's query. Pure, no
3
3
  // browser, so the rules are pinned headless
4
+ import type { DeskKind } from '../../../social/kind-pages.ts'
4
5
  import type { Draft, Desk, DeskAccount, DeskIdentity, Media, SocialPost } from '../../../social/load.ts'
5
6
  import type { Family, Timeline } from '../../../social/presence.ts'
6
7
 
7
- export type { Draft, DeskAccount, DeskIdentity, Media, SocialPost, Timeline }
8
+ export type { DeskKind, Draft, DeskAccount, DeskIdentity, Media, SocialPost, Timeline }
8
9
  export type Place = DeskAccount['places'][number]
9
10
  export type Row = DeskIdentity['rows'][number]
10
11
  export type Picture = DeskIdentity['pictures'][number]
@@ -126,12 +127,43 @@ export function partsOf(d: Pick<Draft, 'posts'>): string[] {
126
127
  }
127
128
 
128
129
  /** a kind's hue, a token of the hub: the kinds named, else one by its letters */
129
- const KIND_TONE: Readonly<Record<string, string>> = { look: 'k3', devlog: 'k2', people: 'warn', puzzle: 'blue', trailer: 'red', announcement: 'k4', hello: 'k1', welcome: 'review', roundup: 'ok', page: 'dim' }
130
+ const KIND_TONE: Readonly<Record<string, string>> = {
131
+ announcement: 'k4',
132
+ feature: 'accent',
133
+ iteration: 'k2',
134
+ showcase: 'warn',
135
+ release: 'ok',
136
+ trailer: 'red',
137
+ throwback: 'k5',
138
+ custom: 'dim',
139
+ look: 'k3',
140
+ devlog: 'k2',
141
+ people: 'warn',
142
+ puzzle: 'blue',
143
+ hello: 'k1',
144
+ welcome: 'review',
145
+ roundup: 'ok',
146
+ page: 'dim',
147
+ }
130
148
  const SPARE = ['k6', 'k5', 'accent', 'k4']
131
149
  export const kindTone = (kind: string): string => `var(--${KIND_TONE[kind] ?? SPARE[[...kind].reduce((n, c) => n + c.charCodeAt(0), 0) % SPARE.length]})`
132
150
 
151
+ /** a file of this machine opened in VS Code */
152
+ export const editorLink = (abs: string): string => `vscode://file${encodeURI(abs)}`
153
+
154
+ /** a choice of the list's kind filter: a kind the repo takes with its drafts, or a word off the set its drafts still name */
155
+ export type KindChoice = { id: string; n: number; off: boolean }
156
+
157
+ /** the kinds the repo takes, each with its drafts among `drafts`, then each word off the set the drafts name */
158
+ export function kindChoices(drafts: readonly Pick<Draft, 'kind'>[], kinds: readonly Pick<DeskKind, 'id'>[]): KindChoice[] {
159
+ const n = (k: string): number => drafts.filter((d) => d.kind === k).length
160
+ const set = new Set(kinds.map((k) => k.id))
161
+ const off = [...new Set(drafts.map((d) => d.kind).filter((k) => !set.has(k)))].sort()
162
+ return [...kinds.map((k) => ({ id: k.id, n: n(k.id), off: false })), ...off.map((k) => ({ id: k, n: n(k), off: true }))]
163
+ }
164
+
133
165
  /** the list's view as the address carries it, each key only when it is not the default */
134
- export type CommsView = { fam: Fam | null; channel: string | null; newestFirst: boolean; who: string | null }
166
+ export type CommsView = { fam: Fam | null; channel: string | null; newestFirst: boolean; who: string | null; kind: string | null }
135
167
 
136
168
  export function commsQuery(v: CommsView): string {
137
169
  const q = new URLSearchParams()
@@ -139,6 +171,7 @@ export function commsQuery(v: CommsView): string {
139
171
  if (v.channel) q.set('ch', v.channel)
140
172
  if (!v.newestFirst) q.set('order', 'old')
141
173
  if (v.who) q.set('who', v.who)
174
+ if (v.kind != null) q.set('kind', v.kind)
142
175
  return q.toString()
143
176
  }
144
177
 
@@ -150,5 +183,6 @@ export function readCommsQuery(q: string): Partial<CommsView> {
150
183
  if (p.has('ch')) out.channel = p.get('ch') || null
151
184
  if (p.has('order')) out.newestFirst = p.get('order') !== 'old'
152
185
  if (p.has('who')) out.who = p.get('who') || null
186
+ if (p.has('kind')) out.kind = p.get('kind')
153
187
  return out
154
188
  }
@@ -4,7 +4,7 @@
4
4
  // payouts, its profile or the place's rules. Its parts are the home's identity view too (identities-view.tsx). Green
5
5
  // is only ever a link he pasted
6
6
  import { observer } from 'mobx-react-lite'
7
- import { useEffect, type CSSProperties } from 'react'
7
+ import { useEffect, type CSSProperties, type ReactNode } from 'react'
8
8
  import { Panel, Separator } from 'react-resizable-panels'
9
9
  import { KeptCols } from '../kept-cols.tsx'
10
10
  import { plainClick } from '../home-st.ts'
@@ -13,8 +13,11 @@ import { PANEL, PhoneTop } from '../review/review-page.tsx'
13
13
  import { brandVar, CopyIcon, CopyRow, ErrorLine, Go, KeptFold, Lightbox, Logo, Md, MdInline, Toast } from './kit.tsx'
14
14
  import { PostCard } from './post-card.tsx'
15
15
  import { Problems } from './problems.tsx'
16
+ import { stepRefs } from '../../../identities/steps.ts'
17
+ import { bannerGroups, factsOf, hasNote, otherRating, otherRows, pasteOf, pasteState, pictureOf, ratingOf, rowPictures, shownFile, staleBadge, staleWhy, uploadOf, usedBy, type Upload } from './identity-pictures.ts'
16
18
  import { AUTOMATION, fileName, LEGAL, linksText, ME, type DeskAccount, type DeskIdentity, type Picture, type Place, type Row } from './social-model.ts'
17
19
  import type { SocialSt } from './social-st.ts'
20
+ import { stepLayout, textKind, type RefKind } from './step-layout.ts'
18
21
 
19
22
  export const SocialPage = observer(({ app }: { app: RepoSt }) => {
20
23
  const so = app.social
@@ -119,7 +122,7 @@ const Totals = observer(({ so, i }: { so: SocialSt; i: DeskIdentity }) => {
119
122
 
120
123
  const avatarOf = (i: DeskIdentity): Picture | null => {
121
124
  const file = i.rows.find((r) => r.field === 'avatar')?.files[0]
122
- return file ? (i.pictures.find((f) => f.file === file) ?? { file, w: null, h: null }) : null
125
+ return file ? pictureOf(i, file) : null
123
126
  }
124
127
  const firstColour = (i: DeskIdentity): string | null => i.brand.find((r) => /^#[0-9a-f]{6}$/i.test(r.value))?.value ?? null
125
128
 
@@ -287,6 +290,7 @@ export const IdentityPage = observer(({ so, i }: { so: SocialSt; i: DeskIdentity
287
290
  <Logo id={a.id} name={a.name} size={22} muted={a.live === ''} />
288
291
  <b className="so-rowname">{a.name}</b>
289
292
  <span className="so-rowvalue so-ellip">{a.handle}</span>
293
+ {staleBadge(a) == null ? null : <span className="so-badge solid t-warn">{staleBadge(a)}</span>}
290
294
  <span className={`so-badge ${a.live ? 't-ok solid' : 't-dim'}`}>{a.live ? 'online' : 'to create'}</span>
291
295
  {a.live ? <CopyIcon so={so} text={a.live} k={`${i.id}/link/${a.id}`} title="copy the link" /> : null}
292
296
  {a.live || a.profile ? (
@@ -301,39 +305,47 @@ export const IdentityPage = observer(({ so, i }: { so: SocialSt; i: DeskIdentity
301
305
  )
302
306
  })
303
307
 
304
- /** the right of an identity: the avatars in one row, the banners at full width, then its other pictures; each with its
305
- * size, « copy » (the image on the clipboard) and « ⬇ » */
308
+ /** the right of an identity: every picture of its folders, the avatars, then the banners by venue, then its other
309
+ * pictures; each tile labelled by its name (rating, variant), with its size, the accounts whose row names it,
310
+ * « copy » (the image on the clipboard), « ⬇ », the Finder and its other formats */
306
311
  export const IdentityMedia = observer(({ so, i }: { so: SocialSt; i: DeskIdentity }) => {
307
- const name = (f: Picture): string => fileName(f.file).replace(/\.\w+$/, '')
308
- const avatars = i.pictures.filter((f) => name(f).startsWith('avatar-')).sort((a, b) => name(a).localeCompare(name(b)))
309
- const banners = i.pictures.filter((f) => name(f).startsWith('banner-')).sort((a, b) => name(a).localeCompare(name(b)))
310
- const rest = i.pictures.filter((f) => !avatars.includes(f) && !banners.includes(f))
311
- if (i.pictures.length === 0) return <div className="rv-empty">no picture: `files` and `pictures` in {i.id}'s identity.md</div>
312
+ const kind = (f: Picture): string => factsOf(f.file, i.id).kind
313
+ const nsfw = (f: Picture): number => (factsOf(f.file, i.id).rating === 'nsfw' ? 1 : 0)
314
+ const avatars = i.pictures.filter((f) => kind(f) === 'avatar').sort((a, b) => nsfw(a) - nsfw(b) || a.file.localeCompare(b.file))
315
+ const banners = bannerGroups(i)
316
+ const rest = i.pictures.filter((f) => kind(f) === 'other')
317
+ const nBanners = banners.reduce((n, g) => n + g.pictures.length, 0)
318
+ if (i.pictures.length === 0) return <div className="rv-empty">no picture: a pictures/ folder in {i.id}'s folder</div>
312
319
  return (
313
320
  <div className="so-colin">
314
321
  {avatars.length > 0 ? (
315
322
  <KeptFold so={so} card="identity/avatars" title="Avatars" right={<span className="rv-dim rv-small">{avatars.length}</span>}>
316
323
  <div className="so-tiles">
317
324
  {avatars.map((f) => (
318
- <PictureTile key={f.file} so={so} i={i} f={f} width={112} />
325
+ <PictureTile key={f.file} so={so} i={i} f={f} width={180} label={factsOf(f.file, i.id).label} used={usedBy(i, f)} />
319
326
  ))}
320
327
  </div>
321
328
  </KeptFold>
322
329
  ) : null}
323
- {banners.length > 0 ? (
324
- <KeptFold so={so} card="identity/banners" title="Banners" right={<span className="rv-dim rv-small">{banners.length}</span>}>
325
- <div className="so-tilestack">
326
- {banners.map((f) => (
327
- <PictureTile key={f.file} so={so} i={i} f={f} />
328
- ))}
329
- </div>
330
+ {nBanners > 0 ? (
331
+ <KeptFold so={so} card="identity/banners" title="Banners" right={<span className="rv-dim rv-small">{nBanners}</span>}>
332
+ {banners.map((g) => (
333
+ <div key={g.venue} className="so-picgroup">
334
+ <b className="rv-small so-picgrouptitle">{g.title}</b>
335
+ <div className="so-picgrid">
336
+ {g.pictures.map((f) => (
337
+ <PictureTile key={f.file} so={so} i={i} f={f} label={factsOf(f.file, i.id).label} used={usedBy(i, f)} />
338
+ ))}
339
+ </div>
340
+ </div>
341
+ ))}
330
342
  </KeptFold>
331
343
  ) : null}
332
344
  {rest.length > 0 ? (
333
345
  <KeptFold so={so} card="identity/files" title="The brand's pictures" right={<span className="rv-dim rv-small">{rest.length}</span>}>
334
346
  <div className="so-tiles">
335
347
  {rest.map((f) => (
336
- <PictureTile key={f.file} so={so} i={i} f={f} width={200} />
348
+ <PictureTile key={f.file} so={so} i={i} f={f} width={200} used={usedBy(i, f)} />
337
349
  ))}
338
350
  </div>
339
351
  </KeptFold>
@@ -348,16 +360,40 @@ const YOUTUBE_AREAS = [
348
360
  { w: 1546, label: 'phone', cls: ' phone' },
349
361
  ]
350
362
 
351
- /** one picture: the image (a clip plays muted), its name and size, « copy », « ⬇ » and 📂 the Finder (the desktop has
352
- * one, a phone none); `width` a tile, else full width */
353
- const PictureTile = observer(({ so, i, f, width, tile }: { so: SocialSt; i: DeskIdentity; f: Picture; width?: number; tile?: boolean }) => {
363
+ /** what one does with a picture, wherever it shows: « copy » (not a clip), « ⬇ », 📂 the Finder (none on a phone) */
364
+ const PictureActions = observer(({ so, i, f }: { so: SocialSt; i: DeskIdentity; f: Picture }) => {
354
365
  const { url, clip } = so.picture(i, f)
355
- const size = f.w !== null ? ` · ${f.w}×${f.h}` : ''
356
366
  const key = `${i.id}/pic/${f.file}`
367
+ return (
368
+ <>
369
+ {!clip ? (
370
+ <button className="so-icon" onClick={() => void so.copyImage(url, key)} title="copy the image, to paste in the account's page">
371
+ {so.copiedKey === key ? '✓' : '⧉'}
372
+ </button>
373
+ ) : null}
374
+ <a className="so-icon" href={url} download={fileName(f.file)} title="download">
375
+ ⬇
376
+ </a>
377
+ {!so.phone ? (
378
+ <button className="so-icon" onClick={() => void so.revealPicture(i.id, f.file)} title={`show ${fileName(f.file)} in the Finder`}>
379
+ 📂
380
+ </button>
381
+ ) : null}
382
+ </>
383
+ )
384
+ })
385
+
386
+ /** one picture: the image (a clip plays muted), its name or `label` and size, « copy », « ⬇ », 📂 the Finder (the
387
+ * desktop has one, a phone none) and a download per other format; under it the accounts whose row names it (`used`);
388
+ * `width` a tile, else the width it is given */
389
+ const PictureTile = observer(({ so, i, f, width, label, used, foot }: { so: SocialSt; i: DeskIdentity; f: Picture; width?: number; label?: string; used?: readonly string[]; foot?: ReactNode }) => {
390
+ const { url, clip } = so.picture(i, f)
391
+ const size = f.w !== null ? ` · ${f.w}×${f.h}` : ''
392
+ const ext = (file: string): string => file.replace(/^.*\./, '')
357
393
  return (
358
394
  <div className="so-card so-pic" style={width ? { width } : undefined}>
359
395
  <div className="so-picframe">
360
- {clip ? <video src={url} muted loop autoPlay playsInline /> : <img src={url} alt="" />}
396
+ {clip ? <video src={url} muted loop autoPlay playsInline /> : <img src={url} alt="" loading="lazy" decoding="async" />}
361
397
  {f.file.endsWith('-youtube.jpg')
362
398
  ? YOUTUBE_AREAS.map((a) => (
363
399
  <div key={a.label} className={`so-ytarea${a.cls}`} style={{ left: `${((2560 - a.w) / 2 / 2560) * 100}%`, width: `${(a.w / 2560) * 100}%`, top: `${((1440 - 423) / 2 / 1440) * 100}%`, height: `${(423 / 1440) * 100}%` }}>
@@ -367,28 +403,100 @@ const PictureTile = observer(({ so, i, f, width, tile }: { so: SocialSt; i: Desk
367
403
  : null}
368
404
  </div>
369
405
  <div className="so-picrow">
370
- <b className="rv-small so-ellip so-grow" title={`${fileName(f.file)}${size}`}>
371
- {fileName(f.file).replace(/^(avatar|banner)-(caid-)?/, '').replace(/\.\w+$/, '').replace(/-round$/, ' round')}
372
- {!width && !tile ? <span className="rv-dim">{size}</span> : null}
406
+ <b className="rv-small so-ellip so-grow" title={`${[f.file, ...f.also].map(fileName).join(', ')}${size}`}>
407
+ {label ?? fileName(f.file).replace(/^(avatar|banner)-(caid-)?/, '').replace(/\.\w+$/, '').replace(/-round$/, ' round')}
408
+ {label == null && !width ? <span className="rv-dim so-light">{size}</span> : null}
373
409
  </b>
374
- {!clip ? (
375
- <button className="so-icon" onClick={() => void so.copyImage(url, key)} title="copy the image, to paste in the account's page">
376
- {so.copiedKey === key ? '✓' : '⧉'}
377
- </button>
378
- ) : null}
379
- <a className="so-icon" href={url} download={fileName(f.file)} title="download">
380
- ⬇
381
- </a>
382
- {!so.phone ? (
383
- <button className="so-icon" onClick={() => void so.revealPicture(i.id, f.file)} title={`show ${fileName(f.file)} in the Finder`}>
384
- 📂
385
- </button>
386
- ) : null}
410
+ <PictureActions so={so} i={i} f={f} />
387
411
  </div>
412
+ {f.also.length > 0 || (label != null && size !== '') ? (
413
+ <div className="so-picrow so-picmore">
414
+ {label != null && f.w !== null ? <span className="rv-dim rv-small">{f.w}×{f.h}</span> : null}
415
+ {f.also.map((x) => (
416
+ <a key={x} className="so-fmt" href={so.pictureUrl(i.id, x)} download={fileName(x)} title={`download ${fileName(x)}`}>
417
+ ⬇ {ext(x)}
418
+ </a>
419
+ ))}
420
+ </div>
421
+ ) : null}
422
+ {used?.length ? <span className="rv-dim rv-small" title="the accounts whose row names it">→ {used.join(', ')}</span> : null}
423
+ {foot}
388
424
  </div>
389
425
  )
390
426
  })
391
427
 
428
+ /** the row file a tile shows, by its shown file or one of its other formats */
429
+ const rowFileOf = (u: Upload, f: Picture): string | null => u.files.find((x) => x === f.file || f.also.includes(x)) ?? null
430
+
431
+ /** under a picture of a row: « Done, uploaded » while the account does not show the row as it is now, « on X » under
432
+ * the one it shows */
433
+ const ShownFoot = observer(({ so, a, u, f }: { so: SocialSt; a: DeskAccount; u: Upload; f: Picture }) => {
434
+ const file = rowFileOf(u, f)
435
+ if (file == null) return null
436
+ if (!u.stale) return shownFile(u) === file ? <span className="so-badge t-ok so-shownok" title={`recorded ${u.shown!.on}, sha ${u.shown!.sha}`}>✓ on {a.name}</span> : null
437
+ return (
438
+ <button className="so-btn primary so-uploaded" disabled={so.busy} onClick={() => void so.markShown(a, u.field, file)} title={`records that ${a.name} now shows ${fileName(file)}`}>
439
+ ✓ Done, uploaded
440
+ </button>
441
+ )
442
+ })
443
+
444
+ /** after a text row he pastes: « ✓ pasted » when the account shows it as it is now, else « Done, pasted », with
445
+ * « changed, paste again » once its value moved since he pasted it */
446
+ const PasteFoot = observer(({ so, a, field }: { so: SocialSt; a: DeskAccount; field: string }) => {
447
+ const u = pasteOf(a, field)
448
+ if (u == null) return null
449
+ const state = pasteState(u)
450
+ if (state === 'pasted')
451
+ return (
452
+ <span className="so-paste">
453
+ <span className="so-badge t-ok" title={`pasted on ${a.name} ${u.shown!.on}, sha ${u.shown!.sha}`}>✓ pasted</span>
454
+ </span>
455
+ )
456
+ return (
457
+ <span className="so-paste">
458
+ {state === 'changed' ? (
459
+ <span className="so-badge solid t-warn" title={staleWhy(a, u)}>
460
+ changed, paste again
461
+ </span>
462
+ ) : null}
463
+ <button className={`so-btn so-pastebtn${state === 'changed' ? ' primary' : ''}`} disabled={so.busy} onClick={() => void so.markPasted(a, field, u.shas[0]!)} title={`records that ${a.name} now shows this text as it is here`}>
464
+ ✓ Done, pasted
465
+ </button>
466
+ </span>
467
+ )
468
+ })
469
+
470
+ /** a text row's tone on the page: warn once its value moved since he pasted it */
471
+ const pasteTone = (a: DeskAccount, field: string): string | undefined => (pasteOf(a, field)?.stale === true ? 'warn' : undefined)
472
+
473
+ /** one picture row of « Upload here »: its stale headline, its tiles with « Done, uploaded » or « on X », its note */
474
+ const UploadRow = observer(({ so, i, a, r }: { so: SocialSt; i: DeskIdentity; a: DeskAccount; r: Row }) => {
475
+ const u = uploadOf(a, r.field)
476
+ return (
477
+ <div className="so-row">
478
+ <span className="so-rowfield">{r.field}</span>
479
+ <div className="so-uppics">
480
+ {u?.stale ? <StaleLine a={a} u={u} /> : null}
481
+ <div className="so-tiles">
482
+ {rowPictures(i, r.files).map((f) => (
483
+ <PictureTile key={f.file} so={so} i={i} f={f} width={tileWidth(f)} label={factsOf(f.file, i.id).label} foot={u == null ? null : <ShownFoot so={so} a={a} u={u} f={f} />} />
484
+ ))}
485
+ </div>
486
+ {hasNote(r) ? <span className="rv-dim rv-small">{r.value}</span> : null}
487
+ </div>
488
+ </div>
489
+ )
490
+ })
491
+
492
+ /** a stale row's headline, impossible to miss: « new: not on X yet », and why */
493
+ const StaleLine = ({ a, u }: { a: DeskAccount; u: Upload }) => (
494
+ <div className="so-stale t-warn">
495
+ <b>new: not on {a.name} yet</b>
496
+ <span>{staleWhy(a, u)}</span>
497
+ </div>
498
+ )
499
+
392
500
  /** the middle of the company: every row a form asks, the private ones under a lock, then the open questions */
393
501
  export const LegalPage = observer(({ so, i }: { so: SocialSt; i: DeskIdentity }) => {
394
502
  const l = i.legal
@@ -520,6 +628,7 @@ export const PlatformHeader = observer(({ so, a }: { so: SocialSt; a: DeskAccoun
520
628
  <Go href={a.write.replace('{text}', '')} label="Write" icon="✎" solid />
521
629
  <Go href={a.inbox} label="Replies" icon="🔔" solid />
522
630
  <Go href={a.stats} label="Stats" icon="▥" solid />
631
+ <Go href={a.settings} label="Settings" icon="⚙" solid />
523
632
  </div>
524
633
  </div>
525
634
  <KeptFold so={so} card="automation" title="What can be automated" open={false} summary={a.automationText} right={<span className={`so-badge t-${auto.tone}`}>{auto.label}</span>}>
@@ -563,23 +672,35 @@ const Checklist = observer(({ so, a }: { so: SocialSt; a: DeskAccount }) => {
563
672
  )
564
673
  })
565
674
 
566
- const REF = /\[\[([^\]]+)\]\]/g
567
-
568
- /** a step's words, its refs drawn inline: a row's value with « copy », an image with « ⬇ », a draft to copy */
675
+ /** a step's words, then its form (step-layout.ts): a short row a chip whole in the sentence, a long row or a picture
676
+ * one line under it with its name, its whole value and « copy », or its pictures with « ⬇ » and « Done, uploaded » */
569
677
  const StepText = observer(({ so, a, index, text }: { so: SocialSt; a: DeskAccount; index: number; text: string }) => {
570
- const parts = text.split(REF)
571
678
  const i = so.identityOf(a.identity)
679
+ const rowOf = (ref: string): Row | undefined => a.rows.find((r) => r.field === ref)
680
+ const kindOf = (ref: string): RefKind => {
681
+ if (so.refDraft(a, ref)) return 'draft'
682
+ const row = rowOf(ref)
683
+ if (row == null) return 'bad'
684
+ return row.files.length > 0 && i ? 'picture' : textKind(row.value)
685
+ }
686
+ const { sentence, fields } = stepLayout(text, kindOf)
687
+ const keyOf = (ref: string): string => `${a.identity}/${a.id}/step/${index}/${ref}`
572
688
  return (
573
689
  <>
574
- {parts.map((part, j) => {
575
- if (j % 2 === 0) return <MdInline key={j} text={part} />
576
- const key = `${a.identity}/${a.id}/step/${index}/${part}`
577
- const draft = so.refDraft(a, part)
690
+ {sentence.map((p, j) => {
691
+ if ('text' in p) return <MdInline key={j} text={p.text} />
692
+ if (p.as === 'tag')
693
+ return (
694
+ <span key={j} className="so-steptag" title="its value is in the form under this step">
695
+ {p.ref}
696
+ </span>
697
+ )
698
+ const draft = so.refDraft(a, p.ref)
578
699
  if (draft)
579
700
  return (
580
701
  <span key={j} className="so-chip">
581
- <button className="primary" onClick={() => void so.copy(draft.text, key)} title="copy that draft's text">
582
- {so.copiedKey === key ? '✓ copied' : `⧉ « ${draft.title || draft.slug.replace(/^\d{8}-\d{6}-/, '')} »`}
702
+ <button className="primary" onClick={() => void so.copy(draft.text, keyOf(p.ref))} title="copy that draft's text">
703
+ {so.copiedKey === keyOf(p.ref) ? '✓ copied' : `⧉ « ${draft.title || draft.slug.replace(/^\d{8}-\d{6}-/, '')} »`}
583
704
  </button>
584
705
  {draft.media ? (
585
706
  <a className="so-btn" href={so.mediaUrl(draft.slug, draft.media)} download={fileName(draft.media.name)}>
@@ -588,58 +709,91 @@ const StepText = observer(({ so, a, index, text }: { so: SocialSt; a: DeskAccoun
588
709
  ) : null}
589
710
  </span>
590
711
  )
591
- const row: Row | undefined = a.rows.find((r) => r.field === part)
592
- if (row?.files.length && i)
593
- return (
594
- <span key={j} className="so-chip">
595
- {row.files.map((file) => (
596
- <span key={file} className="so-chip">
597
- <img className="so-stepimg" src={so.pictureUrl(i.id, file)} alt="" />
598
- <a className="so-btn" href={so.pictureUrl(i.id, file)} download={fileName(file)}>
599
- ⬇
600
- </a>
601
- </span>
602
- ))}
603
- </span>
604
- )
712
+ const row = rowOf(p.ref)
605
713
  if (row)
606
714
  return (
607
715
  <span key={j} className="so-chip">
608
- <button className="primary so-chipvalue" onClick={() => void so.copy(row.value, key)} title={row.value}>
609
- <span className="so-ellip">{row.value}</span> {so.copiedKey === key ? '✓' : '⧉'}
716
+ <button className="primary so-chipvalue" onClick={() => void so.copy(row.value, keyOf(p.ref))} title={`copy ${row.field}`}>
717
+ {row.value} {so.copiedKey === keyOf(p.ref) ? '✓' : '⧉'}
610
718
  </button>
719
+ <PasteFoot so={so} a={a} field={row.field} />
611
720
  </span>
612
721
  )
613
722
  return (
614
723
  <span key={j} className="so-badref">
615
- [[{part}]]
724
+ [[{p.ref}]]
616
725
  </span>
617
726
  )
618
727
  })}
728
+ {fields.length > 0 ? (
729
+ <div className="so-stepform">
730
+ {fields.map((ref) => {
731
+ const row = rowOf(ref)!
732
+ if (row.files.length === 0 || i == null) return <CopyRow key={ref} so={so} k={keyOf(ref)} field={ref} value={row.value} tone={pasteTone(a, ref)} foot={<PasteFoot so={so} a={a} field={ref} />} />
733
+ // one chip a picture, its other formats (the svg master of a png) under it, never an image of their own
734
+ const u = uploadOf(a, ref)
735
+ return (
736
+ <CopyRow key={ref} so={so} k={keyOf(ref)} field={ref} value={row.value}>
737
+ <span className="so-steppics">
738
+ {u?.stale ? <span className="so-badge solid t-warn" title={staleWhy(a, u)}>new: not on {a.name} yet</span> : null}
739
+ {rowPictures(i, row.files).map((f) => (
740
+ <span key={f.file} className="so-chip">
741
+ <img className="so-stepimg" src={so.pictureUrl(i.id, f.file)} alt="" title={fileName(f.file)} />
742
+ <PictureActions so={so} i={i} f={f} />
743
+ {u == null ? null : <ShownFoot so={so} a={a} u={u} f={f} />}
744
+ </span>
745
+ ))}
746
+ </span>
747
+ </CopyRow>
748
+ )
749
+ })}
750
+ </div>
751
+ ) : null}
619
752
  </>
620
753
  )
621
754
  })
622
755
 
623
- /** the account: its profile row by row (the identity's rows with its own over them), then its notes */
756
+ /** a tile's width on an account's page: a banner wide, an avatar small */
757
+ const tileWidth = (f: Picture): number => (f.w != null && f.h != null && f.w > f.h * 1.6 ? 300 : 180)
758
+
759
+ /** the account: « Upload here », the pictures its rows name for its rating (the identity's rows with its own over
760
+ * them), then its text rows, then its notes */
624
761
  export const AccountProfile = observer(({ so, a }: { so: SocialSt; a: DeskAccount }) => {
625
762
  const i = so.identityOf(a.identity)
763
+ const rating = ratingOf(a)
764
+ const pics = i == null ? [] : a.rows.filter((r) => r.files.length > 0)
765
+ const mine = pics.filter((r) => !otherRating(r.field, rating))
766
+ const others = pics.filter((r) => otherRating(r.field, rating))
767
+ // a row of the other rating the account names itself is a variant it shows too, tracked like the others
768
+ const variants = others.filter((r) => uploadOf(a, r.field) != null)
769
+ const apart = others.filter((r) => uploadOf(a, r.field) == null)
770
+ const stale = a.uploads.filter((u) => u.stale && u.kind === 'picture').length
771
+ const guided = stepRefs(a.steps).size > 0
772
+ const rest = otherRows(i, a)
773
+ const right = (
774
+ <>
775
+ {stale > 0 ? <span className="so-badge solid t-warn" title="rows this account does not show as the folder holds them now">{stale} to update</span> : null}
776
+ {rating === '' ? null : <span className={`so-badge solid ${rating === 'sfw' ? 't-ok' : 't-warn'}`} title="its rating row: the pictures it shows">{rating}</span>}
777
+ </>
778
+ )
626
779
  return (
627
780
  <div className="so-colin">
628
- <KeptFold so={so} card="profile" title="The profile" flush>
629
- {a.rows.map((r) =>
630
- r.files.length && i ? (
631
- <CopyRow key={r.field} so={so} k={`${a.identity}/${a.id}/row/${r.field}`} field={r.field} value={r.value}>
632
- <div className={`so-rowpics n${Math.min(r.files.length, 2)}`}>
633
- {r.files.map((f) => (
634
- <PictureTile key={f} so={so} i={i} f={i.pictures.find((x) => x.file === f) ?? { file: f, w: null, h: null }} tile />
635
- ))}
636
- </div>
637
- </CopyRow>
638
- ) : (
639
- <CopyRow key={r.field} so={so} k={`${a.identity}/${a.id}/row/${r.field}`} field={r.field} value={r.value} />
640
- ),
641
- )}
642
- </KeptFold>
781
+ {i != null && mine.length > 0 ? (
782
+ <KeptFold so={so} card="upload" title="Upload here" flush tone={stale > 0 ? 'warn' : undefined} right={right}>
783
+ {mine.map((r) => <UploadRow key={r.field} so={so} i={i} a={a} r={r} />)}
784
+ {variants.length > 0 ? <div className="so-row so-upband rv-small">its {variants[0]!.field.split(/\s+/).pop()} variant, named by this account</div> : null}
785
+ {variants.map((r) => <UploadRow key={r.field} so={so} i={i} a={a} r={r} />)}
786
+ {apart.length > 0 ? <div className="so-row rv-dim rv-small">not for this venue, its rating is {rating}: {apart.map((r) => r.field).join(', ')}</div> : null}
787
+ </KeptFold>
788
+ ) : null}
789
+ {rest.length > 0 ? (
790
+ // with a setup, its steps are the form he fills; the rows no step names stay apart, folded
791
+ <KeptFold so={so} card={guided ? 'rows' : 'profile'} title={guided ? 'Other rows' : 'The profile'} open={!guided} flush right={guided ? <span className="rv-dim rv-small">{rest.length}</span> : undefined}>
792
+ {rest.map((r) => (
793
+ <CopyRow key={r.field} so={so} k={`${a.identity}/${a.id}/row/${r.field}`} field={r.field} value={r.value} tone={pasteTone(a, r.field)} foot={<PasteFoot so={so} a={a} field={r.field} />} />
794
+ ))}
795
+ </KeptFold>
796
+ ) : null}
643
797
  {a.notes ? (
644
798
  <KeptFold so={so} card="notes" title="Notes" open={false} summary={a.notes}>
645
799
  <Md text={a.notes} />