rvlib-shipkit 2.19.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/package.json +1 -1
- package/src/annex/annex.ts +227 -0
- package/src/annex/offload.ts +279 -0
- package/src/checks/SK004-gitignore-policy.check.ts +6 -3
- package/src/checks/SK040-release-words.check.ts +43 -0
- package/src/checks/SK041-annex-links.check.ts +28 -0
- package/src/checks/SK042-post-kinds.check.ts +73 -0
- package/src/cli/cmd_Annex.ts +179 -0
- package/src/cli/cmd_Commands.ts +4 -1
- package/src/cli/cmd_GlobalProcesses.ts +2 -107
- package/src/cli/cmd_Home.ts +4 -3
- package/src/cli/cmd_Messages.ts +155 -0
- package/src/cli/cmd_Overview.ts +2 -1
- package/src/cli/cmd_Releases.ts +84 -0
- package/src/cli/cmd_Review.ts +176 -12
- package/src/cli/cmd_Shot.ts +4 -4
- package/src/cli/cmd_Social.ts +151 -8
- package/src/cli/cmd_Sound.ts +17 -4
- package/src/cli/cmd_Trailer.ts +67 -1
- package/src/cli/family-pages.ts +2 -0
- package/src/cli/kit/index.ts +1 -1
- package/src/cli/kit/verb.ts +11 -3
- package/src/cli/registry.ts +7 -1
- package/src/collections/collection-types.ts +8 -1
- package/src/collections/providers.ts +4 -1
- package/src/collections/review.ts +23 -4
- package/src/commands/model.ts +36 -0
- package/src/commands/registry.ts +49 -0
- package/src/commands/routes.ts +59 -0
- package/src/commands/runner.ts +35 -0
- package/src/commands/runs.ts +112 -0
- package/src/core/app-icon.ts +4 -3
- package/src/core/icon-type.ts +8 -0
- package/src/core/jobs.ts +4 -3
- package/src/core/layout.ts +11 -2
- package/src/core/squircle.ts +95 -0
- package/src/home/daemon-jobs.ts +26 -2
- package/src/home/global-units.ts +3 -0
- package/src/home/gui-app/ShipkitGui.swift +337 -5
- package/src/home/gui-app.ts +64 -33
- package/src/home/hmr-keep.ts +134 -0
- package/src/home/home-start.ts +2 -2
- package/src/home/lib-watch.ts +21 -11
- package/src/home/pm-switch.ts +112 -0
- package/src/home/pm.ts +1 -1
- package/src/home/process-apps.ts +181 -0
- package/src/home/resources.ts +3 -3
- package/src/home/run-web.ts +7 -4
- package/src/home/serve-web.ts +64 -14
- package/src/identities/collection.ts +49 -0
- package/src/identities/identities.ts +121 -14
- package/src/identities/machine.ts +4 -3
- package/src/identities/rating.ts +33 -0
- package/src/identities/shown.ts +170 -0
- package/src/identities/steps.ts +5 -0
- package/src/media-store/purge.ts +15 -1
- package/src/media-store/remote.ts +22 -6
- package/src/messages/brief.ts +117 -0
- package/src/messages/collection.ts +40 -0
- package/src/messages/model.ts +171 -0
- package/src/messages/routes.ts +15 -0
- package/src/messages/score.ts +182 -0
- package/src/messages/tabs.ts +13 -0
- package/src/release/notes.ts +130 -0
- package/src/release/run-bump.ts +41 -18
- package/src/release/run-release.ts +22 -4
- package/src/release/run-releases.ts +17 -15
- package/src/release/unit-resolve.ts +9 -0
- package/src/releases/add.ts +94 -0
- package/src/releases/before.ts +31 -0
- package/src/releases/collection.ts +36 -0
- package/src/releases/from-card.ts +151 -0
- package/src/releases/model.ts +327 -0
- package/src/releases/pictures.ts +110 -0
- package/src/releases/routes.ts +36 -0
- package/src/releases/store.ts +71 -0
- package/src/repo-config.ts +5 -0
- package/src/review/cells.ts +0 -11
- package/src/review/format.ts +10 -6
- package/src/review/http.ts +1 -1
- package/src/review/model.ts +102 -3
- package/src/review/notes.ts +2 -48
- package/src/review/routes.ts +28 -10
- package/src/review/stage-card.ts +197 -0
- package/src/review/stage-routes.ts +123 -0
- package/src/review/store.ts +47 -1
- package/src/review/trailer-card.ts +99 -0
- package/src/review/trailer-desk.ts +76 -4
- package/src/review/trailer-model.ts +106 -7
- package/src/review/trailer-notes.ts +45 -0
- package/src/review/trailer-routes.ts +119 -13
- package/src/review/trailer-voices.ts +144 -0
- package/src/review/watchers.ts +58 -1
- package/src/serve/hub-app/app-bridge.ts +71 -0
- package/src/serve/hub-app/benign-errors.ts +22 -0
- package/src/serve/hub-app/commands/commands-page.tsx +122 -0
- package/src/serve/hub-app/commands/commands-st.ts +177 -0
- package/src/serve/hub-app/commands.css +24 -0
- package/src/serve/hub-app/hash-route.ts +59 -8
- package/src/serve/hub-app/home-st.ts +19 -2
- package/src/serve/hub-app/home.html +3 -0
- package/src/serve/hub-app/hub-app.tsx +8 -0
- package/src/serve/hub-app/icons.tsx +5 -0
- package/src/serve/hub-app/identities-view.tsx +4 -1
- package/src/serve/hub-app/identities.css +1 -0
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/keys.ts +2 -2
- package/src/serve/hub-app/machine-st.ts +41 -10
- package/src/serve/hub-app/messages/messages-page.tsx +354 -0
- package/src/serve/hub-app/messages/messages-st.ts +74 -0
- package/src/serve/hub-app/messages.css +35 -0
- package/src/serve/hub-app/project-list.css +7 -2
- package/src/serve/hub-app/project-list.tsx +9 -0
- package/src/serve/hub-app/projects-svc.ts +16 -6
- package/src/serve/hub-app/releases/releases-page.tsx +187 -0
- package/src/serve/hub-app/releases/releases-st.ts +111 -0
- package/src/serve/hub-app/releases.css +52 -0
- package/src/serve/hub-app/repo-sections.ts +16 -2
- package/src/serve/hub-app/repo-st.ts +66 -10
- package/src/serve/hub-app/review/clip-st.ts +34 -4
- package/src/serve/hub-app/review/kit.tsx +3 -3
- package/src/serve/hub-app/review/note-place.ts +31 -0
- package/src/serve/hub-app/review/review-cells.tsx +27 -3
- package/src/serve/hub-app/review/review-st.ts +77 -2
- package/src/serve/hub-app/review/review-thread.tsx +9 -31
- package/src/serve/hub-app/review/review-views.tsx +164 -58
- package/src/serve/hub-app/review/thread-st.ts +108 -41
- package/src/serve/hub-app/review/trailer-card.tsx +187 -0
- package/src/serve/hub-app/review/trailer-page.tsx +92 -36
- package/src/serve/hub-app/review/trailer-st.ts +306 -34
- package/src/serve/hub-app/review/trailer-timeline.tsx +68 -23
- package/src/serve/hub-app/review/trailer-voices-st.ts +370 -0
- package/src/serve/hub-app/review/trailer-voices.tsx +574 -0
- package/src/serve/hub-app/review.css +137 -6
- package/src/serve/hub-app/social/comms-page.tsx +65 -28
- package/src/serve/hub-app/social/identity-pictures.ts +46 -8
- package/src/serve/hub-app/social/kit.tsx +9 -6
- package/src/serve/hub-app/social/next-release.tsx +118 -0
- package/src/serve/hub-app/social/post-card.tsx +10 -2
- package/src/serve/hub-app/social/social-model.ts +39 -3
- package/src/serve/hub-app/social/social-page.tsx +179 -65
- package/src/serve/hub-app/social/social-st.ts +117 -27
- package/src/serve/hub-app/social/stage-popup.tsx +268 -0
- package/src/serve/hub-app/social/stage-st.ts +310 -0
- package/src/serve/hub-app/social/step-layout.ts +42 -0
- package/src/serve/hub-app/social.css +68 -1
- package/src/serve/hub-app/tree-build.ts +40 -1
- package/src/serve/hub-app/tree-svc.ts +10 -3
- package/src/serve/project-gutter-route.ts +12 -2
- package/src/serve/project-gutter.ts +4 -2
- package/src/serve/same-origin.ts +24 -1
- package/src/serve/serve-hub.ts +15 -1
- package/src/shipkit-files.ts +9 -7
- package/src/shot/box.ts +33 -12
- package/src/shot/client.ts +1 -1
- package/src/shot/shooter.ts +22 -12
- package/src/shot/shot-ask.ts +14 -3
- package/src/shot/shot.shipkit.ts +1 -1
- package/src/social/desk-index.ts +49 -8
- package/src/social/discord-layout.ts +54 -7
- package/src/social/drafts.ts +1 -1
- package/src/social/fit.ts +84 -0
- package/src/social/identity-words.ts +74 -0
- package/src/social/kind-pages.ts +41 -0
- package/src/social/kinds.ts +93 -0
- package/src/social/load.ts +125 -10
- package/src/social/media-limit.ts +63 -2
- package/src/social/presence.ts +1 -1
- package/src/social/publish/bluesky.ts +58 -19
- package/src/social/publish/index.ts +47 -6
- package/src/social/reach.ts +49 -0
- package/src/social/release-stage.ts +277 -0
- package/src/social/routes.ts +44 -8
- package/src/social/stage.ts +246 -0
- package/src/social/strip.ts +85 -0
- package/src/social/text.ts +6 -2
- package/src/social/unit.ts +57 -1
- package/src/social/writes.ts +11 -0
- package/src/trailer/bed.ts +111 -0
- package/src/trailer/build.ts +72 -40
- package/src/trailer/ffmpeg.ts +6 -0
- package/src/trailer/grammar.ts +37 -6
- package/src/trailer/graph.ts +12 -1
- package/src/trailer/public-words.ts +41 -0
- package/src/trailer/shot-plan.ts +75 -0
- package/src/trailer/shot-state.ts +191 -0
- package/src/trailer/sound/audio.ts +28 -0
- package/src/trailer/sound/brand.ts +53 -3
- package/src/trailer/sound/gen.ts +61 -2
- package/src/trailer/sound/index.ts +25 -11
- package/src/trailer/sound/presets.ts +86 -5
- package/src/trailer/sound/run.ts +1 -1
- package/src/trailer/sound/takes.ts +94 -0
- package/src/trailer/titles.ts +36 -0
- package/src/trailer/url.ts +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// the Communications and Social pages as state (wiki tools/shipkit/social.md, The desks in the hub): one desk read from
|
|
2
2
|
// the hub for both, what each page picked, the list's view, the folds he set, the editor, his notes, the writes. A
|
|
3
3
|
// pick goes through RepoSt (showComms, showSocial), the one writer of the address
|
|
4
|
-
import { makeAutoObservable, runInAction } from 'mobx'
|
|
4
|
+
import { makeAutoObservable, observableRef, runInAction } from 'mobx'
|
|
5
|
+
import { releaseSource, StageSt } from './stage-st.ts'
|
|
5
6
|
import { compose, messageLength } from '../../../social/compose.ts'
|
|
6
7
|
import { deskOfWire, type Wire } from '../../../social/desk-wire.ts'
|
|
7
|
-
import type {
|
|
8
|
+
import type { NextReleaseView } from '../../../social/desk-index.ts'
|
|
8
9
|
import { identityAddress } from '../identity-address.ts'
|
|
9
10
|
import { SEARCH_KEY } from '../keys.ts'
|
|
10
11
|
import { reach } from '../reach.ts'
|
|
@@ -15,10 +16,13 @@ import {
|
|
|
15
16
|
commsQuery,
|
|
16
17
|
countsOf,
|
|
17
18
|
draftWaiting,
|
|
19
|
+
editorLink,
|
|
18
20
|
FAMS,
|
|
21
|
+
kindChoices,
|
|
19
22
|
LEGAL,
|
|
20
23
|
legalLive,
|
|
21
24
|
ME,
|
|
25
|
+
NEXT_PICK,
|
|
22
26
|
partsOf,
|
|
23
27
|
readCommsQuery,
|
|
24
28
|
waiting,
|
|
@@ -26,7 +30,9 @@ import {
|
|
|
26
30
|
type DeskAccount,
|
|
27
31
|
type DeskIdentity,
|
|
28
32
|
type DeskJson,
|
|
33
|
+
type DeskKind,
|
|
29
34
|
type Draft,
|
|
35
|
+
type KindChoice,
|
|
30
36
|
type Fam,
|
|
31
37
|
type Media,
|
|
32
38
|
type Picture,
|
|
@@ -94,6 +100,8 @@ export class SocialSt {
|
|
|
94
100
|
newestFirst = true
|
|
95
101
|
/** the identity the list keeps; null, every one */
|
|
96
102
|
who: string | null = null
|
|
103
|
+
/** the kind the list keeps, a word of the set or one off it; null, every one */
|
|
104
|
+
kind: string | null = null
|
|
97
105
|
draftQuery = ''
|
|
98
106
|
calendarOpen = true
|
|
99
107
|
/** the drafts whose sub entries he folded in the list */
|
|
@@ -126,11 +134,15 @@ export class SocialSt {
|
|
|
126
134
|
/** the headings open in the editor, `<heading key>/<slug>` */
|
|
127
135
|
edits: Record<string, DraftEdit> = {}
|
|
128
136
|
notes: Record<string, DraftNote[]> = {}
|
|
129
|
-
/** the
|
|
130
|
-
|
|
137
|
+
/** the stage popup on a release draft: its media picked among the approved cards the release ships */
|
|
138
|
+
stage: StageSt | null = null
|
|
131
139
|
toast: string | null = null
|
|
132
140
|
/** the phone shows one pane at a time: the list, or what it opened */
|
|
133
141
|
phonePane: 'list' | 'detail' = 'list'
|
|
142
|
+
/** the release being filled, as the release that cuts it would stage it; never a draft, never posted */
|
|
143
|
+
next: NextReleaseView | null = null
|
|
144
|
+
/** its ETag: « not modified » keeps it */
|
|
145
|
+
nextTag: string | null = null
|
|
134
146
|
/** the post tracker by identity: the URLs waiting for a line, its stamp, its last steps by platform */
|
|
135
147
|
tracker: Record<string, TrackerView> = {}
|
|
136
148
|
/** the line whose « search » runs, and what each found, by `<key>/<slug>` */
|
|
@@ -152,10 +164,11 @@ export class SocialSt {
|
|
|
152
164
|
this.channel = v.channel ?? null
|
|
153
165
|
this.newestFirst = v.newestFirst ?? true
|
|
154
166
|
this.who = v.who ?? null
|
|
167
|
+
this.kind = typeof v.kind === 'string' ? v.kind : null
|
|
155
168
|
for (const slug of kept<unknown[]>(SERIES, [])) if (typeof slug === 'string') this.foldedSeries[slug] = true
|
|
156
169
|
this.calendarOpen = kept<boolean>(CALENDAR, true)
|
|
157
170
|
for (const [k, x] of Object.entries(kept<Record<string, unknown>>(FOLDS, {}))) if (typeof x === 'boolean') this.folds[k] = x
|
|
158
|
-
makeAutoObservable<this, 'st' | 'nav' | 'started' | 'toastTimer' | 'copyTimer' | 'trackerTimer' | 'onBack'>(this, { st: false, nav: false, started: false, toastTimer: false, copyTimer: false, trackerTimer: false, onBack: false, searchEl: false })
|
|
171
|
+
makeAutoObservable<this, 'st' | 'nav' | 'started' | 'toastTimer' | 'copyTimer' | 'trackerTimer' | 'onBack'>(this, { st: false, nav: false, started: false, toastTimer: false, copyTimer: false, trackerTimer: false, onBack: false, searchEl: false, stage: observableRef })
|
|
159
172
|
}
|
|
160
173
|
|
|
161
174
|
/** the home's view of an identity, every account its own page; null off the home (a hub of its own, a frame) */
|
|
@@ -184,12 +197,41 @@ export class SocialSt {
|
|
|
184
197
|
start(): void {
|
|
185
198
|
if (this.started++ === 0) {
|
|
186
199
|
window.addEventListener('focus', this.onBack)
|
|
187
|
-
this.trackerTimer = setInterval(() =>
|
|
200
|
+
this.trackerTimer = setInterval(() => {
|
|
201
|
+
void this.loadTracker()
|
|
202
|
+
void this.loadNext()
|
|
203
|
+
}, TRACKER_MS)
|
|
188
204
|
}
|
|
189
205
|
void this.load()
|
|
190
|
-
void this.loadAsked()
|
|
191
206
|
void this.loadStats()
|
|
192
207
|
void this.loadTracker()
|
|
208
|
+
void this.loadNext()
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** next.md previewed (wiki tools/shipkit/social-desks.md, The next release): read on every tick, a 304 while it stands */
|
|
212
|
+
async loadNext(): Promise<void> {
|
|
213
|
+
try {
|
|
214
|
+
const r = await reach(this.st.url('/api/social/next-release.json'), { cache: 'no-store', headers: this.nextTag ? { 'If-None-Match': this.nextTag } : {} })
|
|
215
|
+
if (r.status === 304) return
|
|
216
|
+
const body = (await r.json()) as NextReleaseView & { error?: string }
|
|
217
|
+
const tag = r.headers.get('ETag')
|
|
218
|
+
runInAction(() => {
|
|
219
|
+
this.next = r.ok ? body : { preview: null, error: body.error ?? `HTTP ${r.status}` }
|
|
220
|
+
this.nextTag = r.ok ? tag : null
|
|
221
|
+
})
|
|
222
|
+
} catch (e) {
|
|
223
|
+
runInAction(() => (this.next = { preview: null, error: (e as Error).message }))
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** the next release is what the middle shows */
|
|
228
|
+
get nextPicked(): boolean {
|
|
229
|
+
return this.draftSlug === NEXT_PICK && this.next?.preview != null
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** its section in the list, open unless he folded it */
|
|
233
|
+
get nextOpen(): boolean {
|
|
234
|
+
return this.isOpen(NEXT_PICK, true)
|
|
193
235
|
}
|
|
194
236
|
|
|
195
237
|
stop(): void {
|
|
@@ -266,7 +308,6 @@ export class SocialSt {
|
|
|
266
308
|
|
|
267
309
|
private readonly onBack = (): void => {
|
|
268
310
|
void this.load()
|
|
269
|
-
void this.loadAsked()
|
|
270
311
|
}
|
|
271
312
|
|
|
272
313
|
/** what the page says while the desk is not read yet: never a bare « loading… » */
|
|
@@ -347,8 +388,9 @@ export class SocialSt {
|
|
|
347
388
|
return this.accountOf(p.identity, p.platform)
|
|
348
389
|
}
|
|
349
390
|
|
|
391
|
+
/** the load's lines: its errors, then what only warns (an old kind word), each a line of the problems row */
|
|
350
392
|
get errors(): string[] {
|
|
351
|
-
return this.desk?.errors ?? []
|
|
393
|
+
return [...(this.desk?.errors ?? []), ...(this.desk?.warnings ?? [])]
|
|
352
394
|
}
|
|
353
395
|
|
|
354
396
|
statOf(a: DeskAccount): string | undefined {
|
|
@@ -375,8 +417,32 @@ export class SocialSt {
|
|
|
375
417
|
return d.posts.filter((p) => this.inFamilyPost(p))
|
|
376
418
|
}
|
|
377
419
|
|
|
378
|
-
|
|
379
|
-
|
|
420
|
+
/** `byKind` false: every filter but the kind's, the drafts its choices count */
|
|
421
|
+
private kept(d: Draft, byKind = true): boolean {
|
|
422
|
+
return (this.family === null || this.familyPosts(d).length > 0) && (this.channel === null || d.posts.some((p) => p.platform === this.channel)) && (this.who === null || d.identity === this.who) && (!byKind || this.kindShown === null || d.kind === this.kindShown)
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/** the kind the list keeps, or null when the word it remembers is neither a kind of the repo nor one a draft names:
|
|
426
|
+
* a word every draft moved off would hide them all */
|
|
427
|
+
get kindShown(): string | null {
|
|
428
|
+
const k = this.kind
|
|
429
|
+
if (k === null || this.desk == null) return k
|
|
430
|
+
return this.desk.kinds.some((x) => x.id === k) || this.drafts.some((d) => d.kind === k) ? k : null
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** the kind filter's choices: each kind the repo takes with its drafts under the other filters, then the words off the set */
|
|
434
|
+
get kindChoices(): KindChoice[] {
|
|
435
|
+
return kindChoices(this.drafts.filter((d) => this.kept(d, false)), this.desk?.kinds ?? [])
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/** a kind the repo takes, with its rules page; null for a word off the set */
|
|
439
|
+
kindOf(id: string): DeskKind | null {
|
|
440
|
+
return this.desk?.kinds.find((k) => k.id === id) ?? null
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/** what the load says of a word off the set, from a draft that names it */
|
|
444
|
+
kindProblemOf(id: string): string | undefined {
|
|
445
|
+
return this.drafts.find((d) => d.kind === id && d.kindProblem != null)?.kindProblem ?? undefined
|
|
380
446
|
}
|
|
381
447
|
|
|
382
448
|
/** every platform some draft writes for, the family's only, in the accounts' order */
|
|
@@ -404,6 +470,7 @@ export class SocialSt {
|
|
|
404
470
|
|
|
405
471
|
/** the draft shown is always one the view keeps */
|
|
406
472
|
get currentDraft(): Draft | null {
|
|
473
|
+
if (this.nextPicked) return null
|
|
407
474
|
const kept = this.drafts.filter((d) => this.kept(d))
|
|
408
475
|
return kept.find((d) => d.slug === this.draftSlug) ?? kept[0] ?? null
|
|
409
476
|
}
|
|
@@ -470,7 +537,7 @@ export class SocialSt {
|
|
|
470
537
|
|
|
471
538
|
/** the list's view as the address carries it */
|
|
472
539
|
get commsAddress(): string {
|
|
473
|
-
return commsQuery({ fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who })
|
|
540
|
+
return commsQuery({ fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who, kind: this.kind })
|
|
474
541
|
}
|
|
475
542
|
|
|
476
543
|
/** an address's query: a key it leaves out keeps what the page remembers */
|
|
@@ -483,9 +550,10 @@ export class SocialSt {
|
|
|
483
550
|
if (v.newestFirst !== undefined) this.newestFirst = v.newestFirst
|
|
484
551
|
if (v.who !== undefined) this.who = v.who
|
|
485
552
|
if (v.channel !== undefined) this.channel = v.channel
|
|
553
|
+
if (v.kind !== undefined) this.kind = v.kind
|
|
486
554
|
// a channel outside the family would hide every draft
|
|
487
555
|
if (this.channel !== null && this.desk != null && !this.channels.includes(this.channel)) this.channel = null
|
|
488
|
-
keep(VIEW, { fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who })
|
|
556
|
+
keep(VIEW, { fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who, kind: this.kind })
|
|
489
557
|
}
|
|
490
558
|
|
|
491
559
|
/** a filter, the order: the view changes, the address follows it */
|
|
@@ -504,6 +572,7 @@ export class SocialSt {
|
|
|
504
572
|
if (this.family !== null && this.familyPosts(d).length === 0) clear.fam = null
|
|
505
573
|
if (this.channel !== null && !d.posts.some((p) => p.platform === this.channel)) clear.channel = null
|
|
506
574
|
if (this.who !== null && d.identity !== this.who) clear.who = null
|
|
575
|
+
if (this.kind !== null && d.kind !== this.kind) clear.kind = null
|
|
507
576
|
if (Object.keys(clear).length > 0) this.applyView(clear)
|
|
508
577
|
}
|
|
509
578
|
}
|
|
@@ -710,8 +779,10 @@ export class SocialSt {
|
|
|
710
779
|
return this.st.url(`/api/social/media/${slug}/${encodeURIComponent(m.name)}`)
|
|
711
780
|
}
|
|
712
781
|
|
|
782
|
+
/** a picture's url carries its version, so a page that stays open never shows the old bytes of a redrawn file */
|
|
713
783
|
pictureUrl(identity: string, file: string): string {
|
|
714
|
-
|
|
784
|
+
const v = this.identityOf(identity)?.pictures.find((p) => p.v[file] != null)?.v[file] ?? ''
|
|
785
|
+
return this.st.url(`/api/social/picture/${identity}/${file.split('/').map(encodeURIComponent).join('/')}${v === '' ? '' : `?v=${v}`}`)
|
|
715
786
|
}
|
|
716
787
|
|
|
717
788
|
previewUrl(slug: string): string {
|
|
@@ -720,7 +791,7 @@ export class SocialSt {
|
|
|
720
791
|
|
|
721
792
|
/** a file in VS Code: a file joins the open window, a folder would replace it */
|
|
722
793
|
editorUrl(abs: string): string {
|
|
723
|
-
return
|
|
794
|
+
return editorLink(abs)
|
|
724
795
|
}
|
|
725
796
|
|
|
726
797
|
/** a path from the repo's root, as he reads it */
|
|
@@ -760,6 +831,26 @@ export class SocialSt {
|
|
|
760
831
|
this.copyTimer = setTimeout(() => runInAction(() => (this.copiedKey = null)), 1500)
|
|
761
832
|
}
|
|
762
833
|
|
|
834
|
+
/** a path of the repo's hub as the page reaches it */
|
|
835
|
+
url(p: string): string {
|
|
836
|
+
return this.st.url(p)
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/** « 📤 add a media » on a release draft */
|
|
840
|
+
openStage(slug: string): void {
|
|
841
|
+
this.stage?.dispose()
|
|
842
|
+
this.stage = new StageSt(releaseSource((p) => this.st.url(p), slug), '', () => {
|
|
843
|
+
this.closeStage()
|
|
844
|
+
this.say('media added: the draft waits for your Publish')
|
|
845
|
+
void this.load()
|
|
846
|
+
})
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
closeStage(): void {
|
|
850
|
+
this.stage?.dispose()
|
|
851
|
+
this.stage = null
|
|
852
|
+
}
|
|
853
|
+
|
|
763
854
|
say(words: string): void {
|
|
764
855
|
this.toast = words
|
|
765
856
|
if (this.toastTimer) clearTimeout(this.toastTimer)
|
|
@@ -864,6 +955,17 @@ export class SocialSt {
|
|
|
864
955
|
await this.write('step', { identity: a.identity, account: a.id, index, done: !step.done })
|
|
865
956
|
}
|
|
866
957
|
|
|
958
|
+
/** « Done, uploaded »: the account now shows this file of the row, its sha recorded by the server */
|
|
959
|
+
async markShown(a: DeskAccount, row: string, file: string): Promise<void> {
|
|
960
|
+
await this.write('shown', { identity: a.identity, account: a.id, row, file })
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/** « Done, pasted »: the account now shows this text row as the page showed it, `sha` its value's; the server
|
|
964
|
+
* refuses it when the value moved since */
|
|
965
|
+
async markPasted(a: DeskAccount, row: string, sha: string): Promise<void> {
|
|
966
|
+
await this.write('shown', { identity: a.identity, account: a.id, row, sha })
|
|
967
|
+
}
|
|
968
|
+
|
|
867
969
|
/** a public act: asked first, then the message posts as its identity and its link lands in the draft */
|
|
868
970
|
async publish(a: DeskAccount, p: SocialPost): Promise<void> {
|
|
869
971
|
const k = this.postKey(p)
|
|
@@ -954,18 +1056,6 @@ export class SocialSt {
|
|
|
954
1056
|
|
|
955
1057
|
// ── his notes on a draft ─────────────────────────────────────────────
|
|
956
1058
|
|
|
957
|
-
/** the post requests still open: the review store's, the same items the card's bar shows */
|
|
958
|
-
async loadAsked(): Promise<void> {
|
|
959
|
-
try {
|
|
960
|
-
const r = await reach(this.st.url('/api/social/asked'))
|
|
961
|
-
const body = (await r.json()) as { asked?: AskedPost[]; error?: string }
|
|
962
|
-
if (!r.ok) throw new Error(body.error ?? `HTTP ${r.status}`)
|
|
963
|
-
runInAction(() => (this.asked = body.asked ?? []))
|
|
964
|
-
} catch (e) {
|
|
965
|
-
runInAction(() => (this.error = (e as Error).message))
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
|
|
969
1059
|
async loadNotes(slug: string): Promise<void> {
|
|
970
1060
|
try {
|
|
971
1061
|
const r = await reach(this.st.url(`/api/social/notes?slug=${encodeURIComponent(slug)}`))
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
// the stage popup over a card (wiki tools/shipkit/review-raised-items.md, A post staged from a card): the media large,
|
|
2
|
+
// the card's media strip, the alt, the rating, the kind and its rules page, the card's words as chips, his text, the tags, where it goes with each
|
|
3
|
+
// count and skip, the slot, « ✍️ polish », the problems; Enter stages, Escape closes
|
|
4
|
+
import { observer } from 'mobx-react-lite'
|
|
5
|
+
import { useEffect, useRef, type CSSProperties } from 'react'
|
|
6
|
+
import { takes, type PostRating } from '../../../identities/rating.ts'
|
|
7
|
+
import type { Chip } from '../../../review/stage-card.ts'
|
|
8
|
+
import { editorLink, kindTone } from './social-model.ts'
|
|
9
|
+
import type { StageSt } from './stage-st.ts'
|
|
10
|
+
|
|
11
|
+
const FROM: Record<Chip['from'] | 'tested', string> = { tested: 'tested', post: 'its post line', card: 'the card', view: 'its views', his: 'your words', agent: 'the lane' }
|
|
12
|
+
const RATING_TIP: Record<PostRating, string> = { safe: 'no nudity', mild: 'nudity, never explicit', explicit: 'the rest: adult venues only' }
|
|
13
|
+
|
|
14
|
+
/** what the post is for: each kind the repo takes with its line, its rules page beside it, and a custom kind's reason */
|
|
15
|
+
const Kind = observer(({ st }: { st: StageSt }) => {
|
|
16
|
+
if (!st.picksKind) return null
|
|
17
|
+
const k = st.kindInfo
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<div className="sg-field">
|
|
21
|
+
<span>kind</span>
|
|
22
|
+
<select value={st.kind} onChange={(e) => st.setKind(e.target.value)} title="what the post is for: read its rules page before the first word">
|
|
23
|
+
{(st.data?.kinds ?? []).map((x) => (
|
|
24
|
+
<option key={x.id} value={x.id}>
|
|
25
|
+
{x.id}: {x.for}
|
|
26
|
+
</option>
|
|
27
|
+
))}
|
|
28
|
+
</select>
|
|
29
|
+
{k?.page ? (
|
|
30
|
+
<a className="so-kind" style={{ '--kt': kindTone(k.id) } as CSSProperties} href={editorLink(k.page)} title={`the rules of a ${k.id} post: ${k.page}`}>
|
|
31
|
+
{k.title ?? k.id} ↗
|
|
32
|
+
</a>
|
|
33
|
+
) : null}
|
|
34
|
+
</div>
|
|
35
|
+
{st.kind === 'custom' ? (
|
|
36
|
+
<label className="sg-field">
|
|
37
|
+
<span>why</span>
|
|
38
|
+
<input value={st.kindWhy} onChange={(e) => st.setKindWhy(e.target.value)} placeholder="why no kind fits, one line: it goes in the draft as kindWhy" />
|
|
39
|
+
</label>
|
|
40
|
+
) : null}
|
|
41
|
+
</>
|
|
42
|
+
)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
/** the media as it will go out: the image, the clip, or the pair's wipe drawn from its two images */
|
|
46
|
+
const Media = observer(({ st, url }: { st: StageSt; url: (p: string) => string }) => {
|
|
47
|
+
const clip = useRef<HTMLVideoElement | null>(null)
|
|
48
|
+
const m = st.media
|
|
49
|
+
if (m == null) return <div className="sg-media sg-none">no media: a text post</div>
|
|
50
|
+
const src = m.side === 'wipe' ? url(`/api/review/${m.item}/anim?view=${m.view}&mode=wipe&format=mp4&labels=none`) : url(`/api/review/${m.item}/${m.file}`)
|
|
51
|
+
const p = st.passage
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
<div className="sg-media">
|
|
55
|
+
{m.kind === 'clip' ? <video ref={clip} key={src} src={src} controls loop autoPlay muted playsInline /> : <img src={url(`/api/review/${m.item}/preview/fit/${m.file}`)} alt={st.alt} />}
|
|
56
|
+
</div>
|
|
57
|
+
{m.kind === 'clip' ? (
|
|
58
|
+
<div className="sg-strip">
|
|
59
|
+
<span className="sg-from">passage</span>
|
|
60
|
+
<button className="rv-chip" title="the passage starts at the player's time" onClick={() => st.setIn(clip.current?.currentTime ?? 0)}>
|
|
61
|
+
⇤ in here
|
|
62
|
+
</button>
|
|
63
|
+
<button className="rv-chip" title="the passage ends at the player's time" onClick={() => st.setOut(clip.current?.currentTime ?? 0)}>
|
|
64
|
+
out here ⇥
|
|
65
|
+
</button>
|
|
66
|
+
<span className="rv-dim">{p.from !== null && p.to !== null ? `${p.from} s → ${p.to} s` : p.from !== null ? `from ${p.from} s, set the out` : 'the whole clip'}</span>
|
|
67
|
+
{p.from !== null || p.to !== null ? (
|
|
68
|
+
<button className="ghost" onClick={() => st.clearPassage()}>
|
|
69
|
+
✕
|
|
70
|
+
</button>
|
|
71
|
+
) : null}
|
|
72
|
+
</div>
|
|
73
|
+
) : null}
|
|
74
|
+
</>
|
|
75
|
+
)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
/** each account of the voice: where the post lands, its count against its max, or why it skips */
|
|
79
|
+
const GoesTo = observer(({ st }: { st: StageSt }) => {
|
|
80
|
+
const d = st.data
|
|
81
|
+
if (d == null || st.rating === null) return null
|
|
82
|
+
const rating = st.rating
|
|
83
|
+
return (
|
|
84
|
+
<div className="sg-goes">
|
|
85
|
+
{d.accounts.map((a) => {
|
|
86
|
+
const post = st.dry?.posts.find((p) => p.platform === a.id)
|
|
87
|
+
const skip = st.dry?.skipped.find((k) => k.account === a.id)
|
|
88
|
+
const over = post && a.max !== null && post.length > a.max
|
|
89
|
+
const channels = a.places.filter((p) => takes(p.ceiling as PostRating, rating))
|
|
90
|
+
return (
|
|
91
|
+
<span key={a.id} className={`sg-acc${skip || (st.dry && !post) ? ' skip' : ''}${over || post?.refused ? ' bad' : ''}`} title={skip?.why ?? post?.refused ?? ''}>
|
|
92
|
+
<b>{a.name}</b>
|
|
93
|
+
{post ? (
|
|
94
|
+
<>
|
|
95
|
+
{' '}
|
|
96
|
+
{a.max !== null ? `${post.length}/${a.max}` : post.length} {over || post.refused ? '✗' : '✓'}
|
|
97
|
+
{a.places.length > 0 ? (
|
|
98
|
+
<select value={st.place?.account === a.id ? st.place.place : post.place} onChange={(e) => st.setPlace(a.id, e.target.value, post.place)}>
|
|
99
|
+
{channels.map((c) => (
|
|
100
|
+
<option key={c.id} value={c.id}>
|
|
101
|
+
#{c.id}
|
|
102
|
+
</option>
|
|
103
|
+
))}
|
|
104
|
+
</select>
|
|
105
|
+
) : post.place ? (
|
|
106
|
+
<span className="rv-dim"> {post.place}</span>
|
|
107
|
+
) : null}
|
|
108
|
+
</>
|
|
109
|
+
) : skip ? (
|
|
110
|
+
<span className="rv-dim"> ✗ {skip.why.split(':')[0]}</span>
|
|
111
|
+
) : st.dry ? (
|
|
112
|
+
<span className="rv-dim"> not in this post</span>
|
|
113
|
+
) : (
|
|
114
|
+
<span className="rv-dim"> …</span>
|
|
115
|
+
)}
|
|
116
|
+
</span>
|
|
117
|
+
)
|
|
118
|
+
})}
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
export const StagePopup = observer(({ st, url, close }: { st: StageSt; url: (p: string) => string; close: () => void }) => {
|
|
124
|
+
const box = useRef<HTMLTextAreaElement | null>(null)
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
const t = setTimeout(() => box.current?.focus(), 0)
|
|
127
|
+
return () => clearTimeout(t)
|
|
128
|
+
}, [st])
|
|
129
|
+
const d = st.data
|
|
130
|
+
const chips: { from: Chip['from'] | 'tested'; text: string }[] = [...(d?.lines ?? []).map((l) => ({ from: 'tested' as const, text: l.text })), ...(d?.words ?? [])]
|
|
131
|
+
const groups = [...new Set(chips.map((c) => c.from))]
|
|
132
|
+
return (
|
|
133
|
+
<div
|
|
134
|
+
className="sg-veil"
|
|
135
|
+
onClick={close}
|
|
136
|
+
onKeyDown={(e) => {
|
|
137
|
+
if (e.key === 'Escape') {
|
|
138
|
+
e.stopPropagation()
|
|
139
|
+
close()
|
|
140
|
+
}
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
<div className="sg-pop" role="dialog" aria-label="stage a post" onClick={(e) => e.stopPropagation()}>
|
|
144
|
+
<div className="sg-head">
|
|
145
|
+
<b>Stage a post</b>
|
|
146
|
+
<span className="rv-dim">{d?.identity ? `speaks as ${d.identity.name}${d.identity.adult ? ' (18+)' : ''}` : 'reading the card…'}</span>
|
|
147
|
+
<span className="sp" />
|
|
148
|
+
<button className="ghost" onClick={close} title="close (Escape)">
|
|
149
|
+
esc
|
|
150
|
+
</button>
|
|
151
|
+
</div>
|
|
152
|
+
{st.error ? <div className="sg-error t-red">{st.error}</div> : null}
|
|
153
|
+
<div className="sg-body">
|
|
154
|
+
<div className="sg-left">
|
|
155
|
+
<Media st={st} url={url} />
|
|
156
|
+
<div className="sg-strip">
|
|
157
|
+
{d?.media.map((m) => (
|
|
158
|
+
<button key={m.key} className={`rv-chip${m.key === st.pick ? ' on' : ''}`} onClick={() => st.setPick(m.key)} title={m.key}>
|
|
159
|
+
{m.kind === 'clip' ? '▶ ' : ''}
|
|
160
|
+
{m.label}
|
|
161
|
+
</button>
|
|
162
|
+
))}
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
<div className="sg-right">
|
|
166
|
+
<label className="sg-field">
|
|
167
|
+
<span>alt</span>
|
|
168
|
+
<input value={st.alt} onChange={(e) => st.setAlt(e.target.value)} placeholder="what the media shows" />
|
|
169
|
+
</label>
|
|
170
|
+
<div className="sg-field">
|
|
171
|
+
<span>rating</span>
|
|
172
|
+
<span className="seg">
|
|
173
|
+
{(d?.ratings ?? []).map((r) => (
|
|
174
|
+
<button key={r} className={st.rating === r ? 'on' : ''} title={RATING_TIP[r]} onClick={() => st.setRating(r)}>
|
|
175
|
+
{r}
|
|
176
|
+
</button>
|
|
177
|
+
))}
|
|
178
|
+
</span>
|
|
179
|
+
{st.rating === null && d ? <span className="t-warn"> pick one</span> : null}
|
|
180
|
+
</div>
|
|
181
|
+
<Kind st={st} />
|
|
182
|
+
<div className="sg-words">
|
|
183
|
+
{groups.map((g) => (
|
|
184
|
+
<div key={g} className="sg-chips">
|
|
185
|
+
<span className="sg-from">{FROM[g]}</span>
|
|
186
|
+
{chips
|
|
187
|
+
.filter((c) => c.from === g)
|
|
188
|
+
.map((c, k) => (
|
|
189
|
+
<button key={k} className="rv-chip" title="insert at the cursor" onMouseDown={(e) => e.preventDefault()} onClick={() => st.insert(c.text)}>
|
|
190
|
+
{c.text.length > 90 ? `${c.text.slice(0, 88)}…` : c.text}
|
|
191
|
+
</button>
|
|
192
|
+
))}
|
|
193
|
+
</div>
|
|
194
|
+
))}
|
|
195
|
+
</div>
|
|
196
|
+
<textarea
|
|
197
|
+
ref={box}
|
|
198
|
+
className="sg-text"
|
|
199
|
+
rows={3}
|
|
200
|
+
value={st.text}
|
|
201
|
+
placeholder="the post: click a chip, or write it. Enter stages, ⇧Enter a new line"
|
|
202
|
+
onChange={(e) => st.setText(e.target.value, e.target.selectionStart)}
|
|
203
|
+
onSelect={(e) => st.setCaret(e.currentTarget.selectionStart)}
|
|
204
|
+
onKeyDown={(e) => {
|
|
205
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
206
|
+
e.preventDefault()
|
|
207
|
+
void st.stage()
|
|
208
|
+
}
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
211
|
+
{d && d.tags.length > 0 ? (
|
|
212
|
+
<div className="sg-chips">
|
|
213
|
+
<span className="sg-from">tags</span>
|
|
214
|
+
{d.tags.map((t) => (
|
|
215
|
+
<button key={t} className={`rv-chip${st.tags.includes(t) ? ' on' : ''}`} onClick={() => st.toggleTag(t)}>
|
|
216
|
+
{t}
|
|
217
|
+
</button>
|
|
218
|
+
))}
|
|
219
|
+
</div>
|
|
220
|
+
) : null}
|
|
221
|
+
<div className="sg-field">
|
|
222
|
+
<span>goes to</span>
|
|
223
|
+
<GoesTo st={st} />
|
|
224
|
+
</div>
|
|
225
|
+
{d && d.slots.length > 0 ? (
|
|
226
|
+
<label className="sg-field">
|
|
227
|
+
<span>when</span>
|
|
228
|
+
<select value={st.slot} onChange={(e) => st.setSlot(e.target.value)}>
|
|
229
|
+
<option value="">the queue, no slot</option>
|
|
230
|
+
{d.slots.map((s) => (
|
|
231
|
+
<option key={s.value} value={s.value}>
|
|
232
|
+
{s.value} {s.what}
|
|
233
|
+
{s.taken ? ' (taken)' : ''}
|
|
234
|
+
</option>
|
|
235
|
+
))}
|
|
236
|
+
</select>
|
|
237
|
+
</label>
|
|
238
|
+
) : null}
|
|
239
|
+
<label className="sg-field sg-polish">
|
|
240
|
+
<input type="checkbox" checked={st.polish} onChange={(e) => st.setPolish(e.target.checked)} />
|
|
241
|
+
<span>✍️ polish: an agent rewrites it in the voice, each venue its own words</span>
|
|
242
|
+
</label>
|
|
243
|
+
{st.anyOverLimit || st.fit ? (
|
|
244
|
+
<label className="sg-field sg-polish">
|
|
245
|
+
<input type="checkbox" checked={st.fit} onChange={(e) => st.setFit(e.target.checked)} />
|
|
246
|
+
<span>fit: one copy within the tightest limits of the venues it goes to</span>
|
|
247
|
+
</label>
|
|
248
|
+
) : null}
|
|
249
|
+
{st.problems.map((p, k) => (
|
|
250
|
+
<div key={k} className="sg-problem t-red">
|
|
251
|
+
⚠ {p}
|
|
252
|
+
</div>
|
|
253
|
+
))}
|
|
254
|
+
<div className="sg-foot">
|
|
255
|
+
{d && d.drafts.length > 0 ? <span className="rv-dim">already staged from this card: {d.drafts.map((x) => `📝 ${x.title}`).join(' · ')}</span> : null}
|
|
256
|
+
<span className="sp" />
|
|
257
|
+
<span className="rv-dim">{st.waits}</span>
|
|
258
|
+
<button className="primary" disabled={!st.ready} onClick={() => void st.stage()}>
|
|
259
|
+
{st.busy ? 'Staging…' : 'Stage ⏎'}
|
|
260
|
+
</button>
|
|
261
|
+
</div>
|
|
262
|
+
<div className="rv-dim sg-note">Staging writes a draft in Communications. Nothing is posted: Publish stays yours.</div>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
)
|
|
268
|
+
})
|