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.
- package/CHANGELOG.md +31 -0
- package/package.json +1 -1
- package/src/annex/annex.ts +227 -0
- package/src/annex/offload.ts +279 -0
- package/src/asks/asks-queue.ts +63 -10
- 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_Asks.ts +3 -1
- package/src/cli/cmd_Commands.ts +4 -1
- package/src/cli/cmd_GlobalProcesses.ts +34 -11
- package/src/cli/cmd_Home.ts +41 -4
- package/src/cli/cmd_Messages.ts +155 -0
- package/src/cli/cmd_Releases.ts +48 -0
- package/src/cli/cmd_Review.ts +161 -6
- package/src/cli/cmd_Secret.ts +4 -30
- package/src/cli/cmd_Shot.ts +4 -4
- package/src/cli/cmd_Social.ts +179 -3
- package/src/cli/cmd_Trailer.ts +15 -3
- 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 +8 -2
- package/src/collections/actions.ts +29 -1
- package/src/collections/collection-types.ts +10 -1
- package/src/collections/providers.ts +5 -2
- 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 +5 -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 +302 -5
- package/src/home/gui-app.ts +63 -33
- package/src/home/hmr-keep.ts +134 -0
- package/src/home/home-paths.ts +5 -1
- package/src/home/home-start.ts +14 -14
- package/src/home/lib-watch.ts +21 -11
- 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-daemon.ts +11 -2
- package/src/home/run-pm.ts +9 -1
- package/src/home/run-web.ts +7 -4
- package/src/home/serve-web.ts +64 -14
- package/src/home/supervise.ts +3 -1
- package/src/identities/collection.ts +49 -0
- package/src/identities/identities.ts +130 -11
- 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 +180 -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 +66 -0
- package/src/releases/collection.ts +36 -0
- package/src/releases/from-card.ts +66 -0
- package/src/releases/model.ts +267 -0
- package/src/releases/pictures.ts +89 -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 +7 -2
- package/src/review/model.ts +92 -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 +117 -19
- package/src/review/trailer-card.ts +99 -0
- package/src/review/trailer-desk.ts +57 -4
- package/src/review/trailer-model.ts +41 -7
- package/src/review/trailer-notes.ts +45 -0
- package/src/review/trailer-routes.ts +22 -13
- package/src/secrets/manager.ts +59 -0
- package/src/secrets/name.ts +2 -0
- package/src/serve/hub-app/app-bridge.ts +71 -0
- package/src/serve/hub-app/col-card.tsx +10 -0
- package/src/serve/hub-app/cols-svc.ts +37 -6
- 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 +40 -1
- package/src/serve/hub-app/home-st.ts +11 -2
- package/src/serve/hub-app/home.html +3 -0
- package/src/serve/hub-app/hub-app.tsx +6 -0
- package/src/serve/hub-app/hub.css +1 -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/releases/releases-page.tsx +94 -0
- package/src/serve/hub-app/releases/releases-st.ts +69 -0
- package/src/serve/hub-app/releases.css +25 -0
- package/src/serve/hub-app/repo-sections.ts +15 -1
- package/src/serve/hub-app/repo-st.ts +56 -5
- package/src/serve/hub-app/review/clip-st.ts +31 -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 +62 -31
- package/src/serve/hub-app/review/trailer-st.ts +138 -26
- package/src/serve/hub-app/review/trailer-timeline.tsx +39 -26
- package/src/serve/hub-app/review.css +49 -6
- package/src/serve/hub-app/social/comms-page.tsx +55 -23
- package/src/serve/hub-app/social/identity-pictures.ts +112 -0
- package/src/serve/hub-app/social/kit.tsx +9 -6
- package/src/serve/hub-app/social/post-card.tsx +10 -2
- package/src/serve/hub-app/social/social-model.ts +37 -3
- package/src/serve/hub-app/social/social-page.tsx +236 -82
- package/src/serve/hub-app/social/social-st.ts +79 -26
- 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 -4
- package/src/serve/hub-app/tree-build.ts +38 -1
- package/src/serve/hub-app/tree-svc.ts +10 -3
- package/src/serve/project-gutter-route.ts +4 -2
- package/src/serve/same-origin.ts +24 -1
- package/src/serve/serve-hub.ts +27 -3
- package/src/shipkit-files.ts +9 -7
- package/src/shot/shooter.ts +3 -3
- package/src/shot/shot-ask.ts +14 -3
- package/src/shot/shot.shipkit.ts +1 -1
- package/src/social/discord-layout.ts +282 -0
- 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 +92 -0
- package/src/social/load.ts +105 -9
- package/src/social/md.ts +14 -6
- 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/discord.ts +3 -2
- package/src/social/publish/index.ts +31 -5
- package/src/social/reach.ts +49 -0
- package/src/social/release-stage.ts +173 -0
- package/src/social/routes.ts +44 -9
- package/src/social/stage.ts +227 -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/stores/routes.ts +2 -2
- package/src/suite/judge-suites.ts +1 -1
- package/src/suite/suite-cli.ts +5 -5
- package/src/trailer/build.ts +90 -52
- package/src/trailer/draft.ts +28 -0
- package/src/trailer/footage.ts +4 -2
- package/src/trailer/grammar.ts +25 -13
- package/src/trailer/graph.ts +32 -9
- package/src/trailer/profile.ts +35 -0
- package/src/trailer/prune.ts +15 -10
- package/src/trailer/public-words.ts +41 -0
- package/src/trailer/stitch.ts +22 -10
- package/src/trailer/titles.ts +47 -2
|
@@ -1,10 +1,10 @@
|
|
|
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 { AskedPost } from '../../../review/notes.ts'
|
|
8
8
|
import { identityAddress } from '../identity-address.ts'
|
|
9
9
|
import { SEARCH_KEY } from '../keys.ts'
|
|
10
10
|
import { reach } from '../reach.ts'
|
|
@@ -15,7 +15,9 @@ import {
|
|
|
15
15
|
commsQuery,
|
|
16
16
|
countsOf,
|
|
17
17
|
draftWaiting,
|
|
18
|
+
editorLink,
|
|
18
19
|
FAMS,
|
|
20
|
+
kindChoices,
|
|
19
21
|
LEGAL,
|
|
20
22
|
legalLive,
|
|
21
23
|
ME,
|
|
@@ -26,7 +28,9 @@ import {
|
|
|
26
28
|
type DeskAccount,
|
|
27
29
|
type DeskIdentity,
|
|
28
30
|
type DeskJson,
|
|
31
|
+
type DeskKind,
|
|
29
32
|
type Draft,
|
|
33
|
+
type KindChoice,
|
|
30
34
|
type Fam,
|
|
31
35
|
type Media,
|
|
32
36
|
type Picture,
|
|
@@ -94,6 +98,8 @@ export class SocialSt {
|
|
|
94
98
|
newestFirst = true
|
|
95
99
|
/** the identity the list keeps; null, every one */
|
|
96
100
|
who: string | null = null
|
|
101
|
+
/** the kind the list keeps, a word of the set or one off it; null, every one */
|
|
102
|
+
kind: string | null = null
|
|
97
103
|
draftQuery = ''
|
|
98
104
|
calendarOpen = true
|
|
99
105
|
/** the drafts whose sub entries he folded in the list */
|
|
@@ -126,8 +132,8 @@ export class SocialSt {
|
|
|
126
132
|
/** the headings open in the editor, `<heading key>/<slug>` */
|
|
127
133
|
edits: Record<string, DraftEdit> = {}
|
|
128
134
|
notes: Record<string, DraftNote[]> = {}
|
|
129
|
-
/** the
|
|
130
|
-
|
|
135
|
+
/** the stage popup on a release draft: its media picked among the approved cards the release ships */
|
|
136
|
+
stage: StageSt | null = null
|
|
131
137
|
toast: string | null = null
|
|
132
138
|
/** the phone shows one pane at a time: the list, or what it opened */
|
|
133
139
|
phonePane: 'list' | 'detail' = 'list'
|
|
@@ -152,10 +158,11 @@ export class SocialSt {
|
|
|
152
158
|
this.channel = v.channel ?? null
|
|
153
159
|
this.newestFirst = v.newestFirst ?? true
|
|
154
160
|
this.who = v.who ?? null
|
|
161
|
+
this.kind = typeof v.kind === 'string' ? v.kind : null
|
|
155
162
|
for (const slug of kept<unknown[]>(SERIES, [])) if (typeof slug === 'string') this.foldedSeries[slug] = true
|
|
156
163
|
this.calendarOpen = kept<boolean>(CALENDAR, true)
|
|
157
164
|
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 })
|
|
165
|
+
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
166
|
}
|
|
160
167
|
|
|
161
168
|
/** the home's view of an identity, every account its own page; null off the home (a hub of its own, a frame) */
|
|
@@ -187,7 +194,6 @@ export class SocialSt {
|
|
|
187
194
|
this.trackerTimer = setInterval(() => void this.loadTracker(), TRACKER_MS)
|
|
188
195
|
}
|
|
189
196
|
void this.load()
|
|
190
|
-
void this.loadAsked()
|
|
191
197
|
void this.loadStats()
|
|
192
198
|
void this.loadTracker()
|
|
193
199
|
}
|
|
@@ -266,7 +272,6 @@ export class SocialSt {
|
|
|
266
272
|
|
|
267
273
|
private readonly onBack = (): void => {
|
|
268
274
|
void this.load()
|
|
269
|
-
void this.loadAsked()
|
|
270
275
|
}
|
|
271
276
|
|
|
272
277
|
/** what the page says while the desk is not read yet: never a bare « loading… » */
|
|
@@ -347,8 +352,9 @@ export class SocialSt {
|
|
|
347
352
|
return this.accountOf(p.identity, p.platform)
|
|
348
353
|
}
|
|
349
354
|
|
|
355
|
+
/** the load's lines: its errors, then what only warns (an old kind word), each a line of the problems row */
|
|
350
356
|
get errors(): string[] {
|
|
351
|
-
return this.desk?.errors ?? []
|
|
357
|
+
return [...(this.desk?.errors ?? []), ...(this.desk?.warnings ?? [])]
|
|
352
358
|
}
|
|
353
359
|
|
|
354
360
|
statOf(a: DeskAccount): string | undefined {
|
|
@@ -375,8 +381,32 @@ export class SocialSt {
|
|
|
375
381
|
return d.posts.filter((p) => this.inFamilyPost(p))
|
|
376
382
|
}
|
|
377
383
|
|
|
378
|
-
|
|
379
|
-
|
|
384
|
+
/** `byKind` false: every filter but the kind's, the drafts its choices count */
|
|
385
|
+
private kept(d: Draft, byKind = true): boolean {
|
|
386
|
+
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)
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** the kind the list keeps, or null when the word it remembers is neither a kind of the repo nor one a draft names:
|
|
390
|
+
* a word every draft moved off would hide them all */
|
|
391
|
+
get kindShown(): string | null {
|
|
392
|
+
const k = this.kind
|
|
393
|
+
if (k === null || this.desk == null) return k
|
|
394
|
+
return this.desk.kinds.some((x) => x.id === k) || this.drafts.some((d) => d.kind === k) ? k : null
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** the kind filter's choices: each kind the repo takes with its drafts under the other filters, then the words off the set */
|
|
398
|
+
get kindChoices(): KindChoice[] {
|
|
399
|
+
return kindChoices(this.drafts.filter((d) => this.kept(d, false)), this.desk?.kinds ?? [])
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** a kind the repo takes, with its rules page; null for a word off the set */
|
|
403
|
+
kindOf(id: string): DeskKind | null {
|
|
404
|
+
return this.desk?.kinds.find((k) => k.id === id) ?? null
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/** what the load says of a word off the set, from a draft that names it */
|
|
408
|
+
kindProblemOf(id: string): string | undefined {
|
|
409
|
+
return this.drafts.find((d) => d.kind === id && d.kindProblem != null)?.kindProblem ?? undefined
|
|
380
410
|
}
|
|
381
411
|
|
|
382
412
|
/** every platform some draft writes for, the family's only, in the accounts' order */
|
|
@@ -470,7 +500,7 @@ export class SocialSt {
|
|
|
470
500
|
|
|
471
501
|
/** the list's view as the address carries it */
|
|
472
502
|
get commsAddress(): string {
|
|
473
|
-
return commsQuery({ fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who })
|
|
503
|
+
return commsQuery({ fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who, kind: this.kind })
|
|
474
504
|
}
|
|
475
505
|
|
|
476
506
|
/** an address's query: a key it leaves out keeps what the page remembers */
|
|
@@ -483,9 +513,10 @@ export class SocialSt {
|
|
|
483
513
|
if (v.newestFirst !== undefined) this.newestFirst = v.newestFirst
|
|
484
514
|
if (v.who !== undefined) this.who = v.who
|
|
485
515
|
if (v.channel !== undefined) this.channel = v.channel
|
|
516
|
+
if (v.kind !== undefined) this.kind = v.kind
|
|
486
517
|
// a channel outside the family would hide every draft
|
|
487
518
|
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 })
|
|
519
|
+
keep(VIEW, { fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who, kind: this.kind })
|
|
489
520
|
}
|
|
490
521
|
|
|
491
522
|
/** a filter, the order: the view changes, the address follows it */
|
|
@@ -504,6 +535,7 @@ export class SocialSt {
|
|
|
504
535
|
if (this.family !== null && this.familyPosts(d).length === 0) clear.fam = null
|
|
505
536
|
if (this.channel !== null && !d.posts.some((p) => p.platform === this.channel)) clear.channel = null
|
|
506
537
|
if (this.who !== null && d.identity !== this.who) clear.who = null
|
|
538
|
+
if (this.kind !== null && d.kind !== this.kind) clear.kind = null
|
|
507
539
|
if (Object.keys(clear).length > 0) this.applyView(clear)
|
|
508
540
|
}
|
|
509
541
|
}
|
|
@@ -710,8 +742,10 @@ export class SocialSt {
|
|
|
710
742
|
return this.st.url(`/api/social/media/${slug}/${encodeURIComponent(m.name)}`)
|
|
711
743
|
}
|
|
712
744
|
|
|
745
|
+
/** a picture's url carries its version, so a page that stays open never shows the old bytes of a redrawn file */
|
|
713
746
|
pictureUrl(identity: string, file: string): string {
|
|
714
|
-
|
|
747
|
+
const v = this.identityOf(identity)?.pictures.find((p) => p.v[file] != null)?.v[file] ?? ''
|
|
748
|
+
return this.st.url(`/api/social/picture/${identity}/${file.split('/').map(encodeURIComponent).join('/')}${v === '' ? '' : `?v=${v}`}`)
|
|
715
749
|
}
|
|
716
750
|
|
|
717
751
|
previewUrl(slug: string): string {
|
|
@@ -720,7 +754,7 @@ export class SocialSt {
|
|
|
720
754
|
|
|
721
755
|
/** a file in VS Code: a file joins the open window, a folder would replace it */
|
|
722
756
|
editorUrl(abs: string): string {
|
|
723
|
-
return
|
|
757
|
+
return editorLink(abs)
|
|
724
758
|
}
|
|
725
759
|
|
|
726
760
|
/** a path from the repo's root, as he reads it */
|
|
@@ -760,6 +794,26 @@ export class SocialSt {
|
|
|
760
794
|
this.copyTimer = setTimeout(() => runInAction(() => (this.copiedKey = null)), 1500)
|
|
761
795
|
}
|
|
762
796
|
|
|
797
|
+
/** a path of the repo's hub as the page reaches it */
|
|
798
|
+
url(p: string): string {
|
|
799
|
+
return this.st.url(p)
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/** « 📤 add a media » on a release draft */
|
|
803
|
+
openStage(slug: string): void {
|
|
804
|
+
this.stage?.dispose()
|
|
805
|
+
this.stage = new StageSt(releaseSource((p) => this.st.url(p), slug), '', () => {
|
|
806
|
+
this.closeStage()
|
|
807
|
+
this.say('media added: the draft waits for your Publish')
|
|
808
|
+
void this.load()
|
|
809
|
+
})
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
closeStage(): void {
|
|
813
|
+
this.stage?.dispose()
|
|
814
|
+
this.stage = null
|
|
815
|
+
}
|
|
816
|
+
|
|
763
817
|
say(words: string): void {
|
|
764
818
|
this.toast = words
|
|
765
819
|
if (this.toastTimer) clearTimeout(this.toastTimer)
|
|
@@ -864,6 +918,17 @@ export class SocialSt {
|
|
|
864
918
|
await this.write('step', { identity: a.identity, account: a.id, index, done: !step.done })
|
|
865
919
|
}
|
|
866
920
|
|
|
921
|
+
/** « Done, uploaded »: the account now shows this file of the row, its sha recorded by the server */
|
|
922
|
+
async markShown(a: DeskAccount, row: string, file: string): Promise<void> {
|
|
923
|
+
await this.write('shown', { identity: a.identity, account: a.id, row, file })
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/** « Done, pasted »: the account now shows this text row as the page showed it, `sha` its value's; the server
|
|
927
|
+
* refuses it when the value moved since */
|
|
928
|
+
async markPasted(a: DeskAccount, row: string, sha: string): Promise<void> {
|
|
929
|
+
await this.write('shown', { identity: a.identity, account: a.id, row, sha })
|
|
930
|
+
}
|
|
931
|
+
|
|
867
932
|
/** a public act: asked first, then the message posts as its identity and its link lands in the draft */
|
|
868
933
|
async publish(a: DeskAccount, p: SocialPost): Promise<void> {
|
|
869
934
|
const k = this.postKey(p)
|
|
@@ -954,18 +1019,6 @@ export class SocialSt {
|
|
|
954
1019
|
|
|
955
1020
|
// ── his notes on a draft ─────────────────────────────────────────────
|
|
956
1021
|
|
|
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
1022
|
async loadNotes(slug: string): Promise<void> {
|
|
970
1023
|
try {
|
|
971
1024
|
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
|
+
})
|