rvlib-shipkit 2.17.1 → 2.19.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 (64) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/package.json +1 -1
  3. package/src/asks/asks-queue.ts +63 -10
  4. package/src/checks/SK039-vscode-watch-generated.check.ts +119 -0
  5. package/src/cli/cmd_Asks.ts +3 -1
  6. package/src/cli/cmd_GlobalProcesses.ts +34 -11
  7. package/src/cli/cmd_Home.ts +38 -2
  8. package/src/cli/cmd_Secret.ts +4 -30
  9. package/src/cli/cmd_Social.ts +40 -1
  10. package/src/cli/cmd_Trailer.ts +15 -3
  11. package/src/cli/registry.ts +2 -1
  12. package/src/collections/actions.ts +29 -1
  13. package/src/collections/collection-types.ts +2 -0
  14. package/src/collections/providers.ts +1 -1
  15. package/src/home/home-paths.ts +5 -1
  16. package/src/home/home-start.ts +12 -12
  17. package/src/home/run-daemon.ts +11 -2
  18. package/src/home/run-pm.ts +9 -1
  19. package/src/home/supervise.ts +3 -1
  20. package/src/identities/identities.ts +22 -5
  21. package/src/review/http.ts +7 -2
  22. package/src/review/store.ts +81 -19
  23. package/src/scaffold/files/vscode-settings.json +9 -1
  24. package/src/secrets/manager.ts +59 -0
  25. package/src/secrets/name.ts +2 -0
  26. package/src/serve/hub-app/auto-text.tsx +6 -1
  27. package/src/serve/hub-app/col-card.tsx +10 -0
  28. package/src/serve/hub-app/cols-svc.ts +37 -6
  29. package/src/serve/hub-app/hub.css +1 -0
  30. package/src/serve/hub-app/review/review-st.ts +12 -2
  31. package/src/serve/hub-app/review/review-thread.tsx +1 -1
  32. package/src/serve/hub-app/review/thread-st.ts +17 -1
  33. package/src/serve/hub-app/social/identity-pictures.ts +74 -0
  34. package/src/serve/hub-app/social/kit.tsx +3 -3
  35. package/src/serve/hub-app/social/post-card.tsx +2 -1
  36. package/src/serve/hub-app/social/social-page.tsx +77 -37
  37. package/src/serve/hub-app/social.css +9 -4
  38. package/src/serve/hub-app/stores/stores-page.tsx +4 -3
  39. package/src/serve/hub-app/veille/veille-page.tsx +2 -1
  40. package/src/serve/serve-hub.ts +16 -6
  41. package/src/serve/warm-cell.ts +63 -1
  42. package/src/shot/box.ts +23 -8
  43. package/src/shot/browser-slot.ts +8 -1
  44. package/src/shot/client.ts +9 -4
  45. package/src/shot/clip-encoder.ts +5 -2
  46. package/src/shot/job-store.ts +167 -0
  47. package/src/shot/shooter.ts +8 -3
  48. package/src/social/discord-layout.ts +239 -0
  49. package/src/social/md.ts +14 -6
  50. package/src/social/publish/discord.ts +3 -2
  51. package/src/social/routes.ts +3 -3
  52. package/src/stores/routes.ts +2 -2
  53. package/src/suite/judge-suites.ts +1 -1
  54. package/src/suite/select.ts +32 -6
  55. package/src/suite/suite-cli.ts +5 -5
  56. package/src/trailer/build.ts +75 -50
  57. package/src/trailer/draft.ts +28 -0
  58. package/src/trailer/footage.ts +4 -2
  59. package/src/trailer/grammar.ts +11 -9
  60. package/src/trailer/graph.ts +41 -12
  61. package/src/trailer/profile.ts +35 -0
  62. package/src/trailer/prune.ts +15 -10
  63. package/src/trailer/stitch.ts +22 -10
  64. package/src/trailer/titles.ts +47 -2
@@ -7,6 +7,7 @@ import { makeAutoObservable, runInAction } from 'mobx'
7
7
  import type { RepoSt } from './repo-st.ts'
8
8
  import type { Col, ColMeta, HubProblem, Resource } from './hub-types.ts'
9
9
  import type { PlanRow } from '../../plan/planner.ts'
10
+ import type { SecretAnswer } from '../../collections/actions.ts'
10
11
  import { readScreen, SCREEN_WRITE_MS, writeScreen } from './screen-cache.ts'
11
12
  import { ownTrouble, reach } from './reach.ts'
12
13
 
@@ -58,6 +59,10 @@ export class ColsSvc {
58
59
  actErr = ''
59
60
  remarkDraft = ''
60
61
  proofDraft = ''
62
+ /** a value pasted under a credential ask, by secret name: in memory only, never kept, gone once sent */
63
+ secretDrafts = new Map<string, string>()
64
+ /** what the last store answered: stored, then the check's verdict */
65
+ secretNote = ''
61
66
  /** user fold choices win; default = open when the section holds needs */
62
67
  foldOverride = new Map<string, boolean>()
63
68
  /** the viewer's fold choices on the table groups (`checks:pass`,
@@ -245,30 +250,56 @@ export class ColsSvc {
245
250
  this.actErr = ''
246
251
  this.remarkDraft = ''
247
252
  this.proofDraft = ''
253
+ this.secretDrafts.clear()
254
+ this.secretNote = ''
248
255
  }
249
256
 
250
- private async act(path: string, body: Record<string, unknown>): Promise<boolean> {
257
+ /** the act's json answer, null when it failed (actErr says why) */
258
+ private async act<T = unknown>(path: string, body: Record<string, unknown>): Promise<T | null> {
251
259
  this.actErr = ''
252
260
  try {
253
261
  const r = await reach(this.st.url(`/api/act/${path}`), { method: 'POST', body: JSON.stringify(body) })
254
262
  if (!r.ok) throw new Error(await r.text())
263
+ const answer = (await r.json()) as T
255
264
  await this.poll(true)
256
- return true
265
+ return answer
257
266
  } catch (e) {
258
267
  runInAction(() => { this.actErr = ownTrouble(e, this.st.home.machine) })
259
- return false
268
+ return null
260
269
  }
261
270
  }
262
271
 
263
- askDone(file: string): Promise<boolean> {
272
+ async askDone(file: string): Promise<boolean> {
264
273
  const url = this.proofDraft.trim()
265
- return url !== '' ? this.act('ask-proof', { file, url }) : this.act('ask-done', { file })
274
+ return (await (url !== '' ? this.act('ask-proof', { file, url }) : this.act('ask-done', { file }))) != null
266
275
  }
267
276
  async remark(body: Record<string, unknown>): Promise<void> {
268
277
  const text = this.remarkDraft.trim()
269
278
  if (text === '') return
270
279
  // draft survives a failed send, so nothing typed is ever erased
271
280
  const ok = await this.act('remark', { ...body, text })
272
- if (ok) runInAction(() => { this.remarkDraft = '' })
281
+ if (ok != null) runInAction(() => { this.remarkDraft = '' })
282
+ }
283
+
284
+ setSecretDraft(name: string, value: string): void {
285
+ this.secretDrafts.set(name, value)
286
+ }
287
+
288
+ /** the pasted value goes to the hub once and leaves the page: the field
289
+ * clears whatever the answer, a failure included */
290
+ async storeSecret(file: string, name: string): Promise<void> {
291
+ const value = this.secretDrafts.get(name) ?? ''
292
+ if (value.trim() === '') return
293
+ this.secretDrafts.delete(name)
294
+ this.secretNote = ''
295
+ const a = await this.act<SecretAnswer>('ask-secret', { file, name, value })
296
+ if (a == null) return
297
+ runInAction(() => {
298
+ // a passing check archived the ask: its page is now the done one
299
+ if (a.check === 'passed') this.select('asks', `ask:done/${file}`)
300
+ this.secretNote = a.check === 'passed' ? `stored ${a.stored}: the check passes, the ask is archived`
301
+ : a.check === 'none' ? `stored ${a.stored}: this ask has no check, click done once every value is in`
302
+ : `stored ${a.stored}, but the check still fails: ${a.why}`
303
+ })
273
304
  }
274
305
  }
@@ -437,6 +437,7 @@ kbd{background:var(--panel2);border:1px solid var(--line);border-radius:4px;padd
437
437
  .colcard .cand{background:var(--bg);border:1px solid var(--line);border-radius:3px;padding:var(--s2) var(--s3);margin-top:var(--s2)}
438
438
  .colcard .candhint{color:var(--dim);font-size:12.5px;white-space:pre-wrap}
439
439
  .colcard .err,.assetrem .err{color:var(--red);margin-top:var(--s2);font-size:12.5px}
440
+ .colcard .said{color:var(--ok);margin-top:var(--s2);font-size:12.5px}
440
441
  .colcard a{color:var(--accent)}
441
442
 
442
443
  /* ONE GATE CHECK's page: small widgets on a responsive grid, each answering
@@ -4,7 +4,7 @@
4
4
  // 304 when the store did not move. His drafts are kept in the browser until they are sent
5
5
  import { makeAutoObservable, observableRef, reaction, runInAction } from 'mobx'
6
6
  import { PAGE, type BoardRow, type ThreadPage, type ThreadRow } from '../../../review/cells.ts'
7
- import { MOVE_LABEL, pasteBlock, STATUS_LABEL, type Move, type ShownStatus, type Spec } from '../../../review/model.ts'
7
+ import { MOVE_LABEL, pasteBlock, STATUS_LABEL, type Move, type ReviewStatus, type ShownStatus, type Spec } from '../../../review/model.ts'
8
8
  import type { PasteHosts } from '../../../review/paste.ts'
9
9
  import type { Role } from '../../../review/role.ts'
10
10
  import type { RepoSt } from '../repo-st.ts'
@@ -319,8 +319,18 @@ export class ReviewSt {
319
319
  return `${f ? `${f}&` : ''}limit=${this.shown}`
320
320
  }
321
321
 
322
+ /** the verdict he just gave, by thread head: its row shows it at once, while the store takes it */
323
+ answering: Record<string, ReviewStatus> = {}
324
+
325
+ setAnswering(head: string, status: ReviewStatus | null): void {
326
+ if (status === null) delete this.answering[head]
327
+ else this.answering[head] = status
328
+ }
329
+
322
330
  get rows(): ThreadRow[] {
323
- return this.page?.rows ?? []
331
+ const rows = this.page?.rows ?? []
332
+ const a = this.answering
333
+ return Object.keys(a).length === 0 ? rows : rows.map((r) => (a[r.head] ? { ...r, status: a[r.head]! } : r))
324
334
  }
325
335
 
326
336
  /** more rows sit on the server past the ones shown */
@@ -300,7 +300,7 @@ const Composer = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => {
300
300
  const views = card.headItem?.views ?? []
301
301
  const reactions = card.outgoingReactions
302
302
  const verdicts = card.takesVerdict
303
- const sent = h?.kind === 'version' ? card.verdictsOn(h.id).findLast((x) => x.current)?.verdict : undefined
303
+ const sent = h?.kind === 'version' ? card.chosenOn(h.id) : undefined
304
304
  const newest = card.newest
305
305
  const parked = card.parked === null ? null : card.versionOf(card.parked)
306
306
  return (
@@ -137,6 +137,8 @@ export class ThreadSt {
137
137
  /** an option row folded or unfolded by hand, by `<item>#<view>` */
138
138
  openRows: Record<string, boolean> = {}
139
139
  busy = false
140
+ /** the verdict he just gave: shown as chosen the moment he clicks, while the store takes it */
141
+ sending: { on: string; status: ReviewStatus } | null = null
140
142
  /** « 📣 post »'s box: his word while it is open, null when shut */
141
143
  postBox: string | null = null
142
144
  private readonly clips = new Map<string, ClipSt>()
@@ -431,6 +433,12 @@ export class ThreadSt {
431
433
  // ── what was said on each view ──
432
434
 
433
435
  /** the verdicts on one version, oldest first */
436
+ /** the verdict a version shows as chosen: the one being sent, else its current one */
437
+ chosenOn(id: string): ReviewStatus | undefined {
438
+ if (this.sending?.on === id) return this.sending.status
439
+ return this.verdictsOn(id).findLast((x) => x.current)?.verdict
440
+ }
441
+
434
442
  verdictsOn(id: string): VerdictCell[] {
435
443
  return this.cells.filter((c): c is VerdictCell => c.kind === 'verdict' && c.on === id)
436
444
  }
@@ -757,8 +765,11 @@ export class ThreadSt {
757
765
  return
758
766
  }
759
767
  const d = this.draft
768
+ const head = this.data?.head ?? h.id
760
769
  this.busy = true
761
770
  this.error = null
771
+ this.sending = { on: h.id, status }
772
+ this.rv.setAnswering(head, status)
762
773
  try {
763
774
  const pick = isChoice(h.item) && isApproved(status) && d.pick !== undefined ? { pick: d.pick } : {}
764
775
  await postJson(this.rv.url(`/api/review/${h.id}/feedback`), { status, comment: d.comment, rects: d.rects, reactions: d.reactions ?? [], ...pick })
@@ -767,7 +778,12 @@ export class ThreadSt {
767
778
  } catch (e) {
768
779
  runInAction(() => (this.error = (e as Error).message))
769
780
  } finally {
770
- runInAction(() => (this.busy = false))
781
+ // the store's answer is in by now, or the send failed: either way what shows is the truth again
782
+ runInAction(() => {
783
+ this.busy = false
784
+ this.sending = null
785
+ this.rv.setAnswering(head, null)
786
+ })
771
787
  }
772
788
  }
773
789
 
@@ -0,0 +1,74 @@
1
+ // an identity's pictures as the hub shows them (wiki tools/shipkit/social-identities.md, Identities): what a picture's
2
+ // name says (`avatar-<name>[-round]`, `banner-<venue>-<rating>-<variant>`), the banners by venue, which account's row
3
+ // names each one, the rows of an account's rating. Pure, no browser
4
+ import { fileName, type DeskAccount, type DeskIdentity, type Picture, type Row } from './social-model.ts'
5
+
6
+ export const RATINGS: readonly string[] = ['sfw', 'nsfw']
7
+
8
+ /** the picture a path names, by its shown file or one of its other formats */
9
+ export const pictureOf = (i: DeskIdentity, file: string): Picture => i.pictures.find((p) => p.file === file || p.also.includes(file)) ?? { file, w: null, h: null, also: [] }
10
+
11
+ /** a row's pictures, one each however many of its formats the row names */
12
+ export function rowPictures(i: DeskIdentity, files: readonly string[]): Picture[] {
13
+ const out: Picture[] = []
14
+ for (const f of files) {
15
+ const p = pictureOf(i, f)
16
+ if (!out.some((x) => x.file === p.file)) out.push(p)
17
+ }
18
+ return out
19
+ }
20
+
21
+ export type Facts = { kind: 'avatar' | 'banner' | 'other'; venue: string; rating: string; label: string }
22
+
23
+ /** what a picture's name says; its label the words after its kind, venue and identity: « sfw · a », « nsfw · round » */
24
+ export function factsOf(file: string, identity: string): Facts {
25
+ const name = fileName(file).replace(/\.\w+$/, '')
26
+ const [head = '', ...tokens] = name.split('-')
27
+ if (head !== 'avatar' && head !== 'banner') return { kind: 'other', venue: '', rating: '', label: name }
28
+ const r = tokens.findIndex((t) => RATINGS.includes(t))
29
+ const venue = head === 'banner' && r > 0 ? tokens.slice(0, r).join('-') : ''
30
+ const words = (venue === '' ? tokens : tokens.slice(r)).filter((t) => t !== identity)
31
+ return { kind: head, venue, rating: r === -1 ? '' : tokens[r]!, label: words.join(' · ') || head }
32
+ }
33
+
34
+ /** the banners by venue, in the order of the identity's accounts, then the venues no account names, then the
35
+ * banners whose name says no venue; each group named by its account: « Discord · splash » */
36
+ export function bannerGroups(i: DeskIdentity): { venue: string; title: string; pictures: Picture[] }[] {
37
+ const groups = new Map<string, Picture[]>()
38
+ for (const p of i.pictures) {
39
+ const f = factsOf(p.file, i.id)
40
+ if (f.kind === 'banner') groups.set(f.venue, [...(groups.get(f.venue) ?? []), p])
41
+ }
42
+ const rank = (venue: string): number => {
43
+ if (venue === '') return Number.MAX_SAFE_INTEGER
44
+ const n = i.accounts.findIndex((a) => a.id === venue.split('-')[0])
45
+ return n === -1 ? i.accounts.length : n
46
+ }
47
+ const title = (venue: string): string => {
48
+ if (venue === '') return 'banners'
49
+ const [first = '', ...rest] = venue.split('-')
50
+ return [i.accounts.find((a) => a.id === first)?.name ?? first, ...rest].join(' · ')
51
+ }
52
+ return [...groups]
53
+ .sort(([a], [b]) => rank(a) - rank(b) || a.localeCompare(b))
54
+ .map(([venue, pictures]) => ({ venue, title: title(venue), pictures: pictures.sort((x, y) => x.file.localeCompare(y.file)) }))
55
+ }
56
+
57
+ /** an account's own rows: the ones the identity's profile does not give it as they are */
58
+ const ownRows = (i: DeskIdentity, a: DeskAccount): Row[] => a.rows.filter((r) => !i.rows.some((s) => s.field === r.field && s.value === r.value))
59
+
60
+ /** every account whose own row names the picture: « X banner », « Discord icon » */
61
+ export const usedBy = (i: DeskIdentity, p: Picture): string[] =>
62
+ i.accounts.flatMap((a) => ownRows(i, a).filter((r) => r.files.some((f) => f === p.file || p.also.includes(f))).map((r) => `${a.name} ${r.field}`))
63
+
64
+ /** the account's `rating` row, its first word: `sfw`, `nsfw`, or '' when it names none */
65
+ export const ratingOf = (a: DeskAccount): string => (a.rows.find((r) => r.field === 'rating')?.value.trim().split(/\s/)[0] ?? '').toLowerCase()
66
+
67
+ /** a row for the other rating, `avatar nsfw` on an sfw account: not this venue's */
68
+ export function otherRating(field: string, rating: string): boolean {
69
+ const last = field.trim().split(/\s+/).pop() ?? ''
70
+ return rating !== '' && RATINGS.includes(last) && last !== rating
71
+ }
72
+
73
+ /** a row's value is more than its paths: a note to show under its pictures */
74
+ export const hasNote = (r: Row): boolean => r.value.replace(/,/g, ' ').split(/\s+/).filter(Boolean).join(' ') !== r.files.join(' ')
@@ -4,6 +4,7 @@
4
4
  import { observer } from 'mobx-react-lite'
5
5
  import { useState, type CSSProperties, type ReactNode } from 'react'
6
6
  import { BRANDS, brandHex } from '../../../social/brands.ts'
7
+ import { AutoText } from '../auto-text.tsx'
7
8
  import { renderMd, renderMdInline } from '../md.ts'
8
9
  import { plain } from './social-model.ts'
9
10
  import type { DraftNote, SocialSt } from './social-st.ts'
@@ -145,11 +146,10 @@ export const NotesBox = observer((p: { so: SocialSt; notes: readonly DraftNote[]
145
146
  return (
146
147
  <div className="so-notes">
147
148
  <div className="so-noteline">
148
- <textarea
149
- rows={1}
149
+ <AutoText
150
150
  placeholder={p.placeholder}
151
151
  value={text}
152
- onChange={(e) => setText(e.currentTarget.value)}
152
+ onText={setText}
153
153
  onKeyDown={(e) => {
154
154
  if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) void send()
155
155
  }}
@@ -8,6 +8,7 @@ import { CopyFrame, Count, ExpandButton, Field, Fold, FoldCard, Logo, Md, popup
8
8
  import { angleCards, isClip, isVertical, logoStacks, sharing, STATUS, TEXT_FIELD, TITLE_MAX, type DeskAccount, type Media, type Place, type SocialPost } from './social-model.ts'
9
9
  import type { SocialSt } from './social-st.ts'
10
10
  import { Caret } from '../icons.tsx'
11
+ import { AutoText } from '../auto-text.tsx'
11
12
 
12
13
  /** the platforms of some messages, each lit once posted there; a group's accounts one stack of overlapping logos */
13
14
  export const Logos = observer((p: { so: SocialSt; posts: readonly SocialPost[]; size: number }) => {
@@ -406,7 +407,7 @@ const EditBox = observer((p: { so: SocialSt; post: SocialPost; label: string })
406
407
  </Field>
407
408
  ) : null}
408
409
  <Field label={p.label}>
409
- <textarea className="so-editor" autoFocus rows={Math.min(20, Math.max(3, e.text.split('\n').length + 1))} value={e.text} onChange={(ev) => so.typeEdit(p.post, { text: ev.currentTarget.value })} onKeyDown={keys} />
410
+ <AutoText className="so-editor" autoFocus rows={3} value={e.text} onText={(text) => so.typeEdit(p.post, { text })} onKeyDown={keys} />
410
411
  </Field>
411
412
  <Field label="Tags">
412
413
  <input className="so-input" placeholder="#gamedev #indiedev" value={e.tags} onChange={(ev) => so.typeEdit(p.post, { tags: ev.currentTarget.value })} onKeyDown={keys} />
@@ -13,6 +13,7 @@ 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 { bannerGroups, factsOf, hasNote, otherRating, pictureOf, ratingOf, rowPictures, usedBy } from './identity-pictures.ts'
16
17
  import { AUTOMATION, fileName, LEGAL, linksText, ME, type DeskAccount, type DeskIdentity, type Picture, type Place, type Row } from './social-model.ts'
17
18
  import type { SocialSt } from './social-st.ts'
18
19
 
@@ -119,7 +120,7 @@ const Totals = observer(({ so, i }: { so: SocialSt; i: DeskIdentity }) => {
119
120
 
120
121
  const avatarOf = (i: DeskIdentity): Picture | null => {
121
122
  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
123
+ return file ? pictureOf(i, file) : null
123
124
  }
124
125
  const firstColour = (i: DeskIdentity): string | null => i.brand.find((r) => /^#[0-9a-f]{6}$/i.test(r.value))?.value ?? null
125
126
 
@@ -301,39 +302,47 @@ export const IdentityPage = observer(({ so, i }: { so: SocialSt; i: DeskIdentity
301
302
  )
302
303
  })
303
304
 
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 « ⬇ » */
305
+ /** the right of an identity: every picture of its folders, the avatars, then the banners by venue, then its other
306
+ * pictures; each tile labelled by its name (rating, variant), with its size, the accounts whose row names it,
307
+ * « copy » (the image on the clipboard), « ⬇ », the Finder and its other formats */
306
308
  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>
309
+ const kind = (f: Picture): string => factsOf(f.file, i.id).kind
310
+ const nsfw = (f: Picture): number => (factsOf(f.file, i.id).rating === 'nsfw' ? 1 : 0)
311
+ const avatars = i.pictures.filter((f) => kind(f) === 'avatar').sort((a, b) => nsfw(a) - nsfw(b) || a.file.localeCompare(b.file))
312
+ const banners = bannerGroups(i)
313
+ const rest = i.pictures.filter((f) => kind(f) === 'other')
314
+ const nBanners = banners.reduce((n, g) => n + g.pictures.length, 0)
315
+ if (i.pictures.length === 0) return <div className="rv-empty">no picture: a pictures/ folder in {i.id}'s folder</div>
312
316
  return (
313
317
  <div className="so-colin">
314
318
  {avatars.length > 0 ? (
315
319
  <KeptFold so={so} card="identity/avatars" title="Avatars" right={<span className="rv-dim rv-small">{avatars.length}</span>}>
316
320
  <div className="so-tiles">
317
321
  {avatars.map((f) => (
318
- <PictureTile key={f.file} so={so} i={i} f={f} width={112} />
322
+ <PictureTile key={f.file} so={so} i={i} f={f} width={180} label={factsOf(f.file, i.id).label} used={usedBy(i, f)} />
319
323
  ))}
320
324
  </div>
321
325
  </KeptFold>
322
326
  ) : 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>
327
+ {nBanners > 0 ? (
328
+ <KeptFold so={so} card="identity/banners" title="Banners" right={<span className="rv-dim rv-small">{nBanners}</span>}>
329
+ {banners.map((g) => (
330
+ <div key={g.venue} className="so-picgroup">
331
+ <b className="rv-small so-picgrouptitle">{g.title}</b>
332
+ <div className="so-picgrid">
333
+ {g.pictures.map((f) => (
334
+ <PictureTile key={f.file} so={so} i={i} f={f} label={factsOf(f.file, i.id).label} used={usedBy(i, f)} />
335
+ ))}
336
+ </div>
337
+ </div>
338
+ ))}
330
339
  </KeptFold>
331
340
  ) : null}
332
341
  {rest.length > 0 ? (
333
342
  <KeptFold so={so} card="identity/files" title="The brand's pictures" right={<span className="rv-dim rv-small">{rest.length}</span>}>
334
343
  <div className="so-tiles">
335
344
  {rest.map((f) => (
336
- <PictureTile key={f.file} so={so} i={i} f={f} width={200} />
345
+ <PictureTile key={f.file} so={so} i={i} f={f} width={200} used={usedBy(i, f)} />
337
346
  ))}
338
347
  </div>
339
348
  </KeptFold>
@@ -348,16 +357,18 @@ const YOUTUBE_AREAS = [
348
357
  { w: 1546, label: 'phone', cls: ' phone' },
349
358
  ]
350
359
 
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 }) => {
360
+ /** one picture: the image (a clip plays muted), its name or `label` and size, « copy », « ⬇ », 📂 the Finder (the
361
+ * desktop has one, a phone none) and a download per other format; under it the accounts whose row names it (`used`);
362
+ * `width` a tile, else the width it is given */
363
+ const PictureTile = observer(({ so, i, f, width, label, used }: { so: SocialSt; i: DeskIdentity; f: Picture; width?: number; label?: string; used?: readonly string[] }) => {
354
364
  const { url, clip } = so.picture(i, f)
355
365
  const size = f.w !== null ? ` · ${f.w}×${f.h}` : ''
356
366
  const key = `${i.id}/pic/${f.file}`
367
+ const ext = (file: string): string => file.replace(/^.*\./, '')
357
368
  return (
358
369
  <div className="so-card so-pic" style={width ? { width } : undefined}>
359
370
  <div className="so-picframe">
360
- {clip ? <video src={url} muted loop autoPlay playsInline /> : <img src={url} alt="" />}
371
+ {clip ? <video src={url} muted loop autoPlay playsInline /> : <img src={url} alt="" loading="lazy" decoding="async" />}
361
372
  {f.file.endsWith('-youtube.jpg')
362
373
  ? YOUTUBE_AREAS.map((a) => (
363
374
  <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,9 +378,9 @@ const PictureTile = observer(({ so, i, f, width, tile }: { so: SocialSt; i: Desk
367
378
  : null}
368
379
  </div>
369
380
  <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}
381
+ <b className="rv-small so-ellip so-grow" title={`${[f.file, ...f.also].map(fileName).join(', ')}${size}`}>
382
+ {label ?? fileName(f.file).replace(/^(avatar|banner)-(caid-)?/, '').replace(/\.\w+$/, '').replace(/-round$/, ' round')}
383
+ {label == null && !width ? <span className="rv-dim so-light">{size}</span> : null}
373
384
  </b>
374
385
  {!clip ? (
375
386
  <button className="so-icon" onClick={() => void so.copyImage(url, key)} title="copy the image, to paste in the account's page">
@@ -385,6 +396,17 @@ const PictureTile = observer(({ so, i, f, width, tile }: { so: SocialSt; i: Desk
385
396
  </button>
386
397
  ) : null}
387
398
  </div>
399
+ {f.also.length > 0 || (label != null && size !== '') ? (
400
+ <div className="so-picrow so-picmore">
401
+ {label != null && f.w !== null ? <span className="rv-dim rv-small">{f.w}×{f.h}</span> : null}
402
+ {f.also.map((x) => (
403
+ <a key={x} className="so-fmt" href={so.pictureUrl(i.id, x)} download={fileName(x)} title={`download ${fileName(x)}`}>
404
+ ⬇ {ext(x)}
405
+ </a>
406
+ ))}
407
+ </div>
408
+ ) : null}
409
+ {used?.length ? <span className="rv-dim rv-small" title="the accounts whose row names it">→ {used.join(', ')}</span> : null}
388
410
  </div>
389
411
  )
390
412
  })
@@ -620,25 +642,43 @@ const StepText = observer(({ so, a, index, text }: { so: SocialSt; a: DeskAccoun
620
642
  )
621
643
  })
622
644
 
623
- /** the account: its profile row by row (the identity's rows with its own over them), then its notes */
645
+ /** a tile's width on an account's page: a banner wide, an avatar small */
646
+ const tileWidth = (f: Picture): number => (f.w != null && f.h != null && f.w > f.h * 1.6 ? 300 : 180)
647
+
648
+ /** the account: « Upload here », the pictures its rows name for its rating (the identity's rows with its own over
649
+ * them), then its text rows, then its notes */
624
650
  export const AccountProfile = observer(({ so, a }: { so: SocialSt; a: DeskAccount }) => {
625
651
  const i = so.identityOf(a.identity)
652
+ const rating = ratingOf(a)
653
+ const pics = i == null ? [] : a.rows.filter((r) => r.files.length > 0)
654
+ const mine = pics.filter((r) => !otherRating(r.field, rating))
655
+ const others = pics.filter((r) => otherRating(r.field, rating))
626
656
  return (
627
657
  <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
- ))}
658
+ {i != null && mine.length > 0 ? (
659
+ <KeptFold so={so} card="upload" title="Upload here" flush right={rating === '' ? null : <span className={`so-badge solid ${rating === 'sfw' ? 't-ok' : 't-warn'}`} title="its rating row: the pictures it shows">{rating}</span>}>
660
+ {mine.map((r) => (
661
+ <div key={r.field} className="so-row">
662
+ <span className="so-rowfield">{r.field}</span>
663
+ <div className="so-uppics">
664
+ <div className="so-tiles">
665
+ {rowPictures(i, r.files).map((f) => (
666
+ <PictureTile key={f.file} so={so} i={i} f={f} width={tileWidth(f)} label={factsOf(f.file, i.id).label} />
667
+ ))}
668
+ </div>
669
+ {hasNote(r) ? <span className="rv-dim rv-small">{r.value}</span> : null}
636
670
  </div>
637
- </CopyRow>
638
- ) : (
671
+ </div>
672
+ ))}
673
+ {others.length > 0 ? <div className="so-row rv-dim rv-small">not for this venue, its rating is {rating}: {others.map((r) => r.field).join(', ')}</div> : null}
674
+ </KeptFold>
675
+ ) : null}
676
+ <KeptFold so={so} card="profile" title="The profile" flush>
677
+ {a.rows
678
+ .filter((r) => i == null || r.files.length === 0)
679
+ .map((r) => (
639
680
  <CopyRow key={r.field} so={so} k={`${a.identity}/${a.id}/row/${r.field}`} field={r.field} value={r.value} />
640
- ),
641
- )}
681
+ ))}
642
682
  </KeptFold>
643
683
  {a.notes ? (
644
684
  <KeptFold so={so} card="notes" title="Notes" open={false} summary={a.notes}>
@@ -70,9 +70,7 @@ a.so-icon:visited{color:var(--dim)}
70
70
  .so-rowfield{flex:none;width:88px;font-size:11.5px;font-weight:700;color:var(--dim);padding-top:var(--s0)}
71
71
  .so-rowname{flex:none;width:96px;align-self:center}
72
72
  .so-rowvalue{flex:1;min-width:0;overflow-wrap:anywhere}
73
- .so-rowpics{flex:1;display:grid;gap:var(--s2)}
74
- .so-rowpics.n1{grid-template-columns:minmax(0,200px)}
75
- .so-rowpics.n2{grid-template-columns:repeat(2,minmax(0,150px))}
73
+ .so-uppics{flex:1;min-width:0;display:flex;flex-direction:column;gap:var(--s1)}
76
74
 
77
75
  /* the list on the left */
78
76
  .so-listcol{height:100%;display:flex;flex-direction:column;min-height:0;background:var(--panel)}
@@ -107,7 +105,7 @@ a.so-icon:visited{color:var(--dim)}
107
105
  .so-partchip{font-size:13px;font-weight:700;padding:0 var(--s2);line-height:24px;border-radius:4px;background:var(--sel);color:var(--accent)}
108
106
  .so-notes{display:flex;flex-direction:column;gap:var(--s1);padding:var(--s2);border-radius:6px;border:1px solid color-mix(in srgb,var(--warn) 45%,var(--line));background:color-mix(in srgb,var(--warn) 7%,var(--panel))}
109
107
  .so-noteline{display:flex;gap:var(--s2);align-items:flex-end}
110
- .so-noteline textarea{flex:1;min-height:0;font:12.5px/1.45 system-ui,sans-serif;padding:var(--s1) var(--s2);resize:vertical}
108
+ .so-noteline textarea{flex:1;min-width:0;font:12.5px/1.45 system-ui,sans-serif;padding:var(--s1) var(--s2)}
111
109
  .so-said{text-align:left;font-size:12px;padding:var(--s1) var(--s2);border:0;border-left:3px solid var(--tone);background:none;white-space:pre-wrap;cursor:pointer}
112
110
  .so-saidstate{font-size:10px;font-weight:700;text-transform:uppercase;color:var(--tone)}
113
111
  .so-text{font-size:13px}
@@ -273,6 +271,13 @@ a.so-go:visited{color:var(--accent)}
273
271
  .so-picframe{position:relative}
274
272
  .so-picframe img,.so-picframe video{display:block;width:100%;border-radius:4px;background:var(--panel2)}
275
273
  .so-picrow{display:flex;align-items:center;gap:var(--s1);min-width:0}
274
+ .so-picmore{flex-wrap:wrap}
275
+ .so-fmt{font-size:11px;font-weight:700;padding:0 var(--s1);border:1px solid var(--line);border-radius:3px;line-height:16px;text-decoration:none;color:var(--dim)}
276
+ .so-fmt:hover{color:var(--ink);border-color:var(--dim)}
277
+ .so-picgroup{display:flex;flex-direction:column;gap:var(--s1)}
278
+ .so-picgroup + .so-picgroup{margin-top:var(--s3)}
279
+ .so-picgrouptitle{color:var(--dim)}
280
+ .so-picgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:var(--s2)}
276
281
  .so-ytarea{position:absolute;border:2px dashed var(--tag);border-radius:4px;pointer-events:none}
277
282
  .so-ytarea.phone{border-color:var(--review)}
278
283
  .so-ytarea span{position:absolute;top:-15px;left:var(--s0);font-size:10px;font-weight:700;color:var(--tag)}
@@ -11,6 +11,7 @@ import { renderMd } from '../md.ts'
11
11
  import type { RepoSt } from '../repo-st.ts'
12
12
  import { PANEL, PhoneTop } from '../review/review-page.tsx'
13
13
  import type { FieldView, Picture, StoresSt, StoreView } from './stores-st.ts'
14
+ import { AutoText } from '../auto-text.tsx'
14
15
 
15
16
  export const StoresPage = observer(({ app }: { app: RepoSt }) => {
16
17
  const so = app.stores
@@ -158,7 +159,7 @@ const FieldCard = observer(({ so, f }: { so: StoresSt; f: FieldView }) => {
158
159
  </div>
159
160
  {editing ? (
160
161
  <>
161
- <textarea className="sto-edit" autoFocus rows={Math.min(24, Math.max(4, (so.editing?.text ?? '').split('\n').length + 1))} value={so.editing?.text ?? ''} onChange={(e) => so.type(e.currentTarget.value)} onKeyDown={keys} />
162
+ <AutoText className="sto-edit" autoFocus rows={4} value={so.editing?.text ?? ''} onText={(t) => so.type(t)} onKeyDown={keys} />
162
163
  <div className="sto-acts">
163
164
  <button disabled={so.busy || (so.editing?.text.trim() ?? '') === ''} onClick={() => void so.saveEdit(f)}>Save</button>
164
165
  <button className="ghost" onClick={() => so.cancelEdit()}>Cancel</button>
@@ -198,12 +199,12 @@ const NoteBox = observer(({ so, asset, said }: { so: StoresSt; asset: string; sa
198
199
  {n.answer ? <div className="rv-dim">↳ {n.answer}</div> : null}
199
200
  </button>
200
201
  ))}
201
- <textarea
202
+ <AutoText
202
203
  autoFocus
203
204
  rows={2}
204
205
  placeholder="a note on this: it goes to the review page, an agent takes it"
205
206
  value={text}
206
- onChange={(e) => so.typeNote(asset, e.currentTarget.value)}
207
+ onText={(t) => so.typeNote(asset, t)}
207
208
  onKeyDown={(e) => {
208
209
  if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) void so.sendNote(asset)
209
210
  }}
@@ -11,6 +11,7 @@ import type { RepoSt } from '../repo-st.ts'
11
11
  import { PANEL, PhoneTop } from '../review/review-page.tsx'
12
12
  import { type FeedRow, type Platform, shelfOf, SHELVES, type VeilleSt, WINDOWS } from './veille-st.ts'
13
13
  import { Caret } from '../icons.tsx'
14
+ import { AutoText } from '../auto-text.tsx'
14
15
 
15
16
  const short = (n: number | null): string => (n == null ? '–' : n >= 1e6 ? `${(n / 1e6).toFixed(1)}M` : n >= 1e4 ? `${Math.round(n / 1e3)}k` : n >= 1e3 ? `${(n / 1e3).toFixed(1)}k` : String(n))
16
17
  const age = (ms: number): string => (ms < 3600_000 ? `${Math.max(1, Math.round(ms / 60_000))} min` : ms < 48 * 3600_000 ? `${Math.round(ms / 3600_000)} h` : `${Math.round(ms / 86_400_000)} j`)
@@ -389,7 +390,7 @@ const ReplyPanel = observer(({ v }: { v: VeilleSt }) => {
389
390
  </div>
390
391
  <label className="vl-label">
391
392
  Notre réponse
392
- <textarea rows={5} placeholder="« Proposer » la demande à un agent, ou écris la ici (la voix de l'identité)" value={text} onChange={(e) => v.setText(r.key, e.currentTarget.value)} />
393
+ <AutoText rows={5} placeholder="« Proposer » la demande à un agent, ou écris la ici (la voix de l'identité)" value={text} onText={(t) => v.setText(r.key, t)} />
393
394
  </label>
394
395
  <div className={`vl-small ${text.length > v.max ? 't-red vl-over' : 'rv-dim'}`}>
395
396
  {text.length} / {v.max}