rvlib-shipkit 2.11.0 → 2.13.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 +56 -12
- package/README.md +1 -1
- package/package.json +4 -2
- package/src/agent-time/store.ts +2 -2
- package/src/check.ts +1 -1
- package/src/checks/SK001-package-json-shape.check.ts +4 -0
- package/src/checks/SK003-claude-md-shape.check.ts +1 -1
- package/src/checks/SK004-gitignore-policy.check.ts +27 -2
- package/src/checks/SK005-rvlib-versions.check.ts +1 -1
- package/src/checks/SK008-reviewer-agent.check.ts +2 -2
- package/src/checks/SK012-config-barrel-import.check.ts +1 -1
- package/src/checks/SK015-nested-repo.check.ts +1 -1
- package/src/checks/SK035-public-clean.check.ts +46 -0
- package/src/checks/SK036-draft-media-size.check.ts +28 -0
- package/src/cli/cmd_Backup.ts +152 -0
- package/src/cli/cmd_Ci.ts +8 -11
- package/src/cli/cmd_Drill.ts +145 -0
- package/src/cli/cmd_Home.ts +50 -3
- package/src/cli/cmd_Media.ts +96 -5
- package/src/cli/cmd_Review.ts +8 -2
- package/src/cli/cmd_Shot.ts +5 -2
- package/src/cli/cmd_Smoke.ts +4 -1
- package/src/cli/cmd_Social.ts +226 -0
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Trailer.ts +9 -2
- package/src/cli/cmd_Veille.ts +173 -0
- package/src/cli/family-pages.ts +3 -0
- package/src/cli/registry.ts +13 -2
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +1 -49
- package/src/collections/checks.ts +2 -1
- package/src/collections/collection-types.ts +11 -2
- package/src/collections/providers.ts +4 -4
- package/src/collections/review.ts +2 -1
- package/src/collections/tests.ts +19 -8
- package/src/contracts/apply-contracts.ts +1 -3
- package/src/contracts/contract-manifests.ts +2 -3
- package/src/contracts/contract-types.ts +0 -1
- package/src/contracts/contracts-engine.ts +0 -3
- package/src/core/app-icon.ts +9 -3
- package/src/core/bun-builtins.ts +2 -2
- package/src/core/discover-checks.ts +37 -5
- package/src/core/fix-scope.ts +4 -2
- package/src/core/floor-resolve.ts +68 -48
- package/src/core/floor.ts +9 -0
- package/src/core/git-root.ts +24 -0
- package/src/core/last-good.ts +3 -1
- package/src/core/layout.ts +8 -0
- package/src/core/log-stamp.ts +36 -0
- package/src/core/loop-watch.ts +93 -0
- package/src/core/machine-link.ts +134 -0
- package/src/core/memory-watch.ts +41 -0
- package/src/core/one-way-in-policy.ts +27 -19
- package/src/core/run-ci.ts +6 -8
- package/src/core/run-fixers.ts +9 -9
- package/src/core/slots.ts +21 -0
- package/src/core/tree-rev.ts +60 -0
- package/src/core/unit-files.ts +42 -0
- package/src/drill/render.ts +140 -0
- package/src/drill/run.ts +269 -0
- package/src/fleet/scan-fleet.ts +6 -5
- package/src/home/daemon-jobs.ts +201 -0
- package/src/home/global-context.ts +34 -1
- package/src/home/home-routes.ts +22 -15
- package/src/home/hubs.ts +10 -3
- package/src/home/inbox-shape.ts +61 -6
- package/src/home/inbox.ts +75 -4
- package/src/home/lib-watch.ts +10 -3
- package/src/home/machine-stores.ts +15 -29
- package/src/home/run-daemon.ts +15 -18
- package/src/home/run-pm.ts +2 -0
- package/src/home/serve-daemon.ts +4 -3
- package/src/home/serve-web.ts +110 -1
- package/src/hooks/commit-message.ts +28 -19
- package/src/hooks/leak-guard.ts +10 -3
- package/src/hooks/run-hooks.ts +2 -6
- package/src/identities/identities.ts +334 -0
- package/src/identities/machine-route.ts +126 -0
- package/src/identities/machine.ts +62 -0
- package/src/init-repo.ts +1 -1
- package/src/ledger/check-stats.ts +10 -9
- package/src/ledger/gate-checks.ts +32 -1
- package/src/ledger/record-kept.ts +112 -0
- package/src/ledger/repo-view.ts +10 -0
- package/src/ledger/run-log.ts +17 -12
- package/src/ledger/run-timeline.ts +8 -4
- package/src/ledger/store.ts +7 -0
- package/src/ledger/suite-log.ts +17 -13
- package/src/media-kinds.ts +9 -1
- package/src/media-store/backup/daemon.ts +73 -0
- package/src/media-store/backup/keys.ts +25 -0
- package/src/media-store/backup/manifest.ts +193 -0
- package/src/media-store/backup/restore.ts +192 -0
- package/src/media-store/backup/run.ts +278 -0
- package/src/media-store/backup/secret.ts +86 -0
- package/src/media-store/backup/snapshot.ts +64 -0
- package/src/media-store/backup/sources.ts +199 -0
- package/src/media-store/content.ts +11 -1
- package/src/media-store/daemon.ts +56 -70
- package/src/media-store/hand.ts +58 -0
- package/src/media-store/put.ts +122 -0
- package/src/media-store/space.ts +73 -11
- package/src/pages/forward.ts +35 -0
- package/src/pages/frame-client.ts +118 -0
- package/src/pages/routes.ts +29 -0
- package/src/pages/unit.ts +92 -0
- package/src/plan/planner.ts +12 -0
- package/src/plan/repo-source.ts +19 -5
- package/src/reflect/transcript.ts +35 -10
- package/src/release/public-clean.ts +301 -0
- package/src/release/published-here.ts +22 -0
- package/src/release/run-bump.ts +2 -1
- package/src/release/run-release.ts +4 -1
- package/src/repo-config.ts +53 -2
- package/src/review/http.ts +16 -2
- package/src/review/media-kind.ts +3 -3
- package/src/review/media-read.ts +3 -3
- package/src/review/model.ts +24 -5
- package/src/review/notes.ts +77 -0
- package/src/review/project.ts +6 -38
- package/src/review/routes.ts +8 -13
- package/src/review/store.ts +46 -4
- package/src/review/trailer-media.ts +24 -3
- package/src/review/trailer-shots.ts +106 -0
- package/src/review/unit.ts +1 -1
- package/src/scaffold/files/agent-handoff.md +3 -0
- package/src/scaffold/files/agent-index.md +4 -12
- package/src/scaffold/project-scaffold.ts +5 -4
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/col-card.tsx +3 -17
- package/src/serve/hub-app/col-tables-view.tsx +2 -1
- package/src/serve/hub-app/cols-svc.ts +12 -14
- package/src/serve/hub-app/dock-st.ts +4 -2
- package/src/serve/hub-app/dock-view.tsx +2 -0
- package/src/serve/hub-app/frames-st.ts +35 -0
- package/src/serve/hub-app/hash-route.ts +64 -1
- package/src/serve/hub-app/home-st.ts +31 -7
- package/src/serve/hub-app/home-strip.css +9 -1
- package/src/serve/hub-app/home-strip.tsx +7 -6
- package/src/serve/hub-app/home.html +5 -0
- package/src/serve/hub-app/hub-app.tsx +49 -5
- package/src/serve/hub-app/hub.css +29 -11
- package/src/serve/hub-app/icons.tsx +16 -1
- package/src/serve/hub-app/identities-st.ts +210 -0
- package/src/serve/hub-app/identities-view.tsx +352 -0
- package/src/serve/hub-app/identities.css +48 -0
- package/src/serve/hub-app/identity-address.ts +52 -0
- package/src/serve/hub-app/inbox-st.ts +59 -6
- package/src/serve/hub-app/inbox-view.tsx +48 -6
- package/src/serve/hub-app/inbox.css +12 -1
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/keys.ts +10 -2
- package/src/serve/hub-app/list-walk.ts +89 -0
- package/src/serve/hub-app/machine-st.ts +12 -0
- package/src/serve/hub-app/media-view.tsx +2 -1
- package/src/serve/hub-app/pages-frames.tsx +134 -0
- package/src/serve/hub-app/pages-svc.ts +111 -0
- package/src/serve/hub-app/palette-st.ts +18 -3
- package/src/serve/hub-app/palette-view.tsx +9 -2
- package/src/serve/hub-app/planned-view.tsx +2 -1
- package/src/serve/hub-app/project-list.css +18 -14
- package/src/serve/hub-app/project-list.tsx +88 -49
- package/src/serve/hub-app/projects-svc.ts +33 -3
- package/src/serve/hub-app/repo-sections.ts +19 -2
- package/src/serve/hub-app/repo-st.ts +75 -19
- package/src/serve/hub-app/review/review-cells.tsx +3 -3
- package/src/serve/hub-app/review/review-kit.ts +30 -7
- package/src/serve/hub-app/review/review-page.tsx +1 -1
- package/src/serve/hub-app/review/review-st.ts +33 -11
- package/src/serve/hub-app/review/review-thread.tsx +11 -9
- package/src/serve/hub-app/review/review-views.tsx +84 -19
- package/src/serve/hub-app/review/thread-st.ts +1 -10
- package/src/serve/hub-app/review/trailer-page.tsx +2 -1
- package/src/serve/hub-app/review.css +17 -8
- package/src/serve/hub-app/site/site-part.tsx +173 -0
- package/src/serve/hub-app/site/site-st.ts +157 -0
- package/src/serve/hub-app/site.css +35 -0
- package/src/serve/hub-app/social/calendar.tsx +182 -0
- package/src/serve/hub-app/social/comms-page.tsx +306 -0
- package/src/serve/hub-app/social/kit.tsx +244 -0
- package/src/serve/hub-app/social/post-card.tsx +456 -0
- package/src/serve/hub-app/social/problems.tsx +60 -0
- package/src/serve/hub-app/social/social-model.ts +154 -0
- package/src/serve/hub-app/social/social-page.tsx +674 -0
- package/src/serve/hub-app/social/social-st.ts +986 -0
- package/src/serve/hub-app/social.css +289 -0
- package/src/serve/hub-app/stores/stores-page.tsx +311 -0
- package/src/serve/hub-app/stores/stores-st.ts +286 -0
- package/src/serve/hub-app/stores.css +54 -0
- package/src/serve/hub-app/test-view.tsx +9 -2
- package/src/serve/hub-app/tests-svc.ts +16 -1
- package/src/serve/hub-app/timeline-geometry.ts +1 -1
- package/src/serve/hub-app/timeline-view.tsx +3 -2
- package/src/serve/hub-app/tree-build.ts +6 -0
- package/src/serve/hub-app/tree-row.tsx +27 -4
- package/src/serve/hub-app/tree-svc.ts +18 -49
- package/src/serve/hub-app/veille/veille-page.tsx +514 -0
- package/src/serve/hub-app/veille/veille-st.ts +443 -0
- package/src/serve/hub-app/veille.css +84 -0
- package/src/serve/hub-runtime.ts +14 -9
- package/src/serve/project-gutter-route.ts +44 -12
- package/src/serve/resources-wire.ts +48 -0
- package/src/serve/run-lanes.ts +7 -4
- package/src/serve/same-origin.ts +1 -1
- package/src/serve/serve-hub.ts +27 -18
- package/src/serve/tracked-watch.ts +24 -3
- package/src/serve/warm-cell.ts +5 -1
- package/src/shipkit-files.ts +15 -4
- package/src/shipkit.ts +0 -1
- package/src/shot/box.ts +162 -0
- package/src/shot/browser-slot.ts +62 -0
- package/src/shot/client.ts +43 -7
- package/src/shot/clip-encoder.ts +93 -12
- package/src/shot/film-box.ts +188 -0
- package/src/shot/shooter.ts +50 -15
- package/src/shot/shot-ask.ts +10 -2
- package/src/shot/stepped-clip.ts +5 -4
- package/src/site/desk.ts +242 -0
- package/src/site/routes.ts +66 -0
- package/src/site/unit.ts +62 -0
- package/src/social/brands.ts +22 -0
- package/src/social/compose.ts +97 -0
- package/src/social/desk-index.ts +123 -0
- package/src/social/desk-wire.ts +64 -0
- package/src/social/drafts.ts +183 -0
- package/src/social/house.ts +24 -0
- package/src/social/load.ts +319 -0
- package/src/social/md.ts +70 -0
- package/src/social/media-facts.ts +53 -0
- package/src/social/media-kind.ts +189 -0
- package/src/social/media-limit.ts +42 -0
- package/src/social/media-of.ts +30 -0
- package/src/social/migrate.ts +123 -0
- package/src/social/open.ts +17 -0
- package/src/social/post-url.ts +158 -0
- package/src/social/presence.ts +332 -0
- package/src/social/public-read.ts +53 -0
- package/src/social/publish/bluesky.ts +168 -0
- package/src/social/publish/discord.ts +76 -0
- package/src/social/publish/index.ts +24 -0
- package/src/social/publish/secret.ts +13 -0
- package/src/social/push.ts +31 -0
- package/src/social/richtext.ts +37 -0
- package/src/social/routes.ts +180 -0
- package/src/social/stats.ts +134 -0
- package/src/social/text.ts +267 -0
- package/src/social/tracker-route.ts +39 -0
- package/src/social/tracker.ts +255 -0
- package/src/social/unit.ts +53 -0
- package/src/social/writes.ts +130 -0
- package/src/start-repo.ts +14 -9
- package/src/stores/collection.ts +27 -0
- package/src/stores/desk.ts +336 -0
- package/src/stores/model.ts +187 -0
- package/src/stores/routes.ts +126 -0
- package/src/stores/unit.ts +57 -0
- package/src/suite/calibrate.ts +127 -0
- package/src/suite/core-counters.ts +91 -0
- package/src/suite/judge-suites.ts +94 -34
- package/src/suite/suite-cli.ts +44 -10
- package/src/suite/suite-cpu-preload.ts +34 -9
- package/src/trailer/adapter.ts +4 -0
- package/src/trailer/build.ts +42 -11
- package/src/trailer/ffmpeg.ts +11 -0
- package/src/trailer/footage.ts +30 -13
- package/src/trailer/grammar.ts +18 -2
- package/src/trailer/graph.ts +28 -6
- package/src/trailer/passage.ts +21 -6
- package/src/trailer/plan.ts +74 -3
- package/src/trailer/shelf.ts +16 -0
- package/src/trailer/stitch.ts +67 -26
- package/src/trailer/url.ts +1 -1
- package/src/trailer/versions.ts +24 -0
- package/src/ts/gate-typecheck.ts +32 -0
- package/src/ts/typecheck-cli.ts +9 -11
- package/src/tui/tui-app.tsx +0 -1
- package/src/veille/asks.ts +155 -0
- package/src/veille/auto.ts +31 -0
- package/src/veille/batch.ts +27 -0
- package/src/veille/chrome.ts +127 -0
- package/src/veille/collection.ts +28 -0
- package/src/veille/desk.ts +242 -0
- package/src/veille/identity.ts +80 -0
- package/src/veille/import.ts +68 -0
- package/src/veille/log.ts +183 -0
- package/src/veille/platforms.ts +118 -0
- package/src/veille/reads.ts +66 -0
- package/src/veille/replied.ts +110 -0
- package/src/veille/routes.ts +185 -0
- package/src/veille/service.ts +81 -0
- package/src/veille/watch.ts +116 -0
- package/src/veille/worth.ts +46 -0
- package/src/wiki/scan-md.ts +18 -0
- package/src/collections/posts.ts +0 -142
- package/src/contracts/manifests/social.contract.ts +0 -20
- package/src/scaffold/files/agent-coding.md +0 -35
- package/src/ts/typecheck-cache.ts +0 -11
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
// a message's card (wiki build/shipkit/social.md, The desks in the hub): an account's own heading, or a group's shared
|
|
2
|
+
// by its accounts with a line a platform at its foot; the fields he fills on the platform (flair, title, text, tags,
|
|
3
|
+
// the reply, the footer), its media, « Post » or « Publish », the URL that turns it green. Communications and Social
|
|
4
|
+
// draw the same card
|
|
5
|
+
import { observer } from 'mobx-react-lite'
|
|
6
|
+
import { Fragment, useState, type CSSProperties, type ReactNode } from 'react'
|
|
7
|
+
import { CopyFrame, Count, ExpandButton, Field, Fold, FoldCard, Logo, Md, popup } from './kit.tsx'
|
|
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
|
+
import type { SocialSt } from './social-st.ts'
|
|
10
|
+
import { Caret } from '../icons.tsx'
|
|
11
|
+
|
|
12
|
+
/** the platforms of some messages, each lit once posted there; a group's accounts one stack of overlapping logos */
|
|
13
|
+
export const Logos = observer((p: { so: SocialSt; posts: readonly SocialPost[]; size: number }) => {
|
|
14
|
+
const identity = p.posts[0]?.identity ?? ''
|
|
15
|
+
const stacks = logoStacks(
|
|
16
|
+
p.posts.map((x) => x.platform),
|
|
17
|
+
(id) => p.so.accountOf(identity, id)?.group ?? '',
|
|
18
|
+
)
|
|
19
|
+
return (
|
|
20
|
+
<span className="so-logos">
|
|
21
|
+
{stacks.map((ids) => (
|
|
22
|
+
<span key={ids[0]} className="so-stack" style={{ '--overlap': `${-Math.round(p.size * 0.45)}px` } as CSSProperties}>
|
|
23
|
+
{ids.map((id) => (
|
|
24
|
+
<Logo key={id} id={id} name={p.so.accountOf(identity, id)?.name ?? id} size={p.size} muted={p.posts.some((x) => x.platform === id && x.posted === '')} />
|
|
25
|
+
))}
|
|
26
|
+
</span>
|
|
27
|
+
))}
|
|
28
|
+
</span>
|
|
29
|
+
)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
/** the angle as small cards, each folded to its title and its first words until a click opens it */
|
|
33
|
+
export function AngleCards(p: { angle: string }) {
|
|
34
|
+
const [open, setOpen] = useState<ReadonlySet<number>>(new Set())
|
|
35
|
+
const flip = (i: number): void => setOpen((o) => (o.has(i) ? new Set([...o].filter((x) => x !== i)) : new Set([...o, i])))
|
|
36
|
+
return (
|
|
37
|
+
<div className="so-angles">
|
|
38
|
+
{angleCards(p.angle).map((c, i) => (
|
|
39
|
+
<FoldCard key={c.title + i} title={c.title} open={open.has(i)} flip={() => flip(i)} summary={c.body}>
|
|
40
|
+
{c.body ? <Md text={c.body} /> : null}
|
|
41
|
+
</FoldCard>
|
|
42
|
+
))}
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** a still or a clip: « Copy image » for a still (the clipboard takes no clip), « ⬇ » for both, 📂 the Finder */
|
|
48
|
+
export const MediaTile = observer((p: { so: SocialSt; slug: string; m: Media; size: 'large' | 'side' | 'small' }) => {
|
|
49
|
+
const so = p.so
|
|
50
|
+
const url = so.mediaUrl(p.slug, p.m)
|
|
51
|
+
const key = `${p.slug}/media/${p.m.name}`
|
|
52
|
+
const clip = isClip(p.m.name)
|
|
53
|
+
const vertical = isVertical(p.m.name)
|
|
54
|
+
const [hover, setHover] = useState(false)
|
|
55
|
+
const cls = `so-media ${vertical ? 'vertical' : p.size}`
|
|
56
|
+
return (
|
|
57
|
+
<div className="so-mediatile">
|
|
58
|
+
<div className="so-mediaframe" onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}>
|
|
59
|
+
{clip ? <video src={url} autoPlay muted loop playsInline controls={p.size === 'large' || vertical} className={cls} /> : <img src={url} alt="" className={cls} />}
|
|
60
|
+
<ExpandButton shown={hover || so.phone} onClick={() => so.openLightbox(p.slug, p.m.name)} />
|
|
61
|
+
</div>
|
|
62
|
+
<div className="so-mediabar">
|
|
63
|
+
{!clip ? (
|
|
64
|
+
<button onClick={() => void so.copyImage(url, key)}>{so.copiedKey === key ? '✓ Copied' : '⧉ Copy image'}</button>
|
|
65
|
+
) : null}
|
|
66
|
+
<a className="so-btn" href={url} download={p.m.name.split('/').pop()} title="save the file">
|
|
67
|
+
⬇{clip ? ' the clip' : ''}
|
|
68
|
+
</a>
|
|
69
|
+
{!so.phone ? (
|
|
70
|
+
<button onClick={() => void so.reveal(p.slug, p.m)} title={`show ${p.m.path} in the Finder`}>
|
|
71
|
+
📂
|
|
72
|
+
</button>
|
|
73
|
+
) : null}
|
|
74
|
+
{p.size === 'large' ? (
|
|
75
|
+
<span className="rv-dim rv-small so-ellip" title={p.m.path}>
|
|
76
|
+
{p.m.name}
|
|
77
|
+
</span>
|
|
78
|
+
) : null}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
/** « Post »: the platform's write page, prefilled, else its profile, in a popup window; « Publish » where shipkit posts
|
|
85
|
+
* it. Greyed once the line has its URL */
|
|
86
|
+
const PosterButton = observer((p: { so: SocialSt; a: DeskAccount; post: SocialPost }) => {
|
|
87
|
+
const so = p.so
|
|
88
|
+
const done = p.post.posted !== ''
|
|
89
|
+
const key = so.postKey(p.post)
|
|
90
|
+
if (p.a.automation === 'live') {
|
|
91
|
+
const over = p.a.max !== null && so.length(p.post) > p.a.max
|
|
92
|
+
const err = so.publishError[key]
|
|
93
|
+
const busy = so.publishing[key] === true
|
|
94
|
+
return (
|
|
95
|
+
<button className={`so-pub${err ? ' t-red' : ''}`} title={err ?? (over ? 'over the platform max' : 'post it now, as the identity, in public')} disabled={done || over || busy || so.edit(p.post) !== null} onClick={() => void so.publish(p.a, p.post)}>
|
|
96
|
+
{busy ? <span className="so-spin" /> : '➤'} {err ? 'Failed, again' : 'Publish'}
|
|
97
|
+
</button>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
const href = p.post.href ?? (p.a.profile || null)
|
|
101
|
+
if (href == null) return null
|
|
102
|
+
const label = p.post.href ? 'Post' : 'Profile'
|
|
103
|
+
if (done)
|
|
104
|
+
return (
|
|
105
|
+
<button disabled title="posted: its link is on the line">
|
|
106
|
+
✎ {label}
|
|
107
|
+
</button>
|
|
108
|
+
)
|
|
109
|
+
return (
|
|
110
|
+
<a
|
|
111
|
+
className="so-btn primary"
|
|
112
|
+
href={href}
|
|
113
|
+
title={p.post.prefilled ? 'its write page, the text filled in' : 'its write page: the text goes on the clipboard first'}
|
|
114
|
+
onClick={(e) => {
|
|
115
|
+
// a page that takes no text: the caption on the clipboard first, for his paste there
|
|
116
|
+
if (p.post.href && !p.post.prefilled) void so.copyCaption(p.post)
|
|
117
|
+
popup(e, href, so.postKey(p.post))
|
|
118
|
+
so.opened(p.post)
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
✎ {label}
|
|
122
|
+
</a>
|
|
123
|
+
)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
/** « Open »: the post itself, once its URL is on the line */
|
|
127
|
+
function ViewButton(p: { post: SocialPost }) {
|
|
128
|
+
return p.post.posted === '' ? (
|
|
129
|
+
<button disabled>↗ Open</button>
|
|
130
|
+
) : (
|
|
131
|
+
<a className="so-btn t-ok so-toned" href={p.post.posted} target="_blank" rel="noreferrer">
|
|
132
|
+
↗ Open
|
|
133
|
+
</a>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** the field its link is pasted into: pasted (blur or Enter), the platform turns green; emptied, it waits again. While
|
|
138
|
+
* it waits, the post tracker's URLs seen on its platform (« here » writes one on this line) and « search », the
|
|
139
|
+
* identity's Chrome History read once */
|
|
140
|
+
const UrlField = observer((p: { so: SocialSt; post: SocialPost }) => {
|
|
141
|
+
const so = p.so
|
|
142
|
+
const key = so.postKey(p.post)
|
|
143
|
+
const waits = p.post.posted === ''
|
|
144
|
+
const found = so.searched[key]
|
|
145
|
+
return (
|
|
146
|
+
<span className="so-urlbox">
|
|
147
|
+
<span className="so-urlline">
|
|
148
|
+
<input
|
|
149
|
+
className={`so-url${waits ? '' : ' done'}${so.urlErrors[key] ? ' bad' : ''}`}
|
|
150
|
+
placeholder="the post's URL: pasted, the platform turns green"
|
|
151
|
+
title={so.debugFor(p.post)}
|
|
152
|
+
value={so.urlField(key, p.post.posted)}
|
|
153
|
+
disabled={so.busy}
|
|
154
|
+
onChange={(e) => so.setUrl(key, e.currentTarget.value)}
|
|
155
|
+
onBlur={() => void so.savePosted(p.post)}
|
|
156
|
+
onKeyDown={(e) => {
|
|
157
|
+
if (e.key === 'Enter') void so.savePosted(p.post)
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
{waits && !so.phone ? (
|
|
161
|
+
<button className="ghost so-mini" disabled={so.searching === key} onClick={() => void so.searchHistory(p.post)} title="look for the post in a copy of the identity's Chrome History, since its last open">
|
|
162
|
+
{so.searching === key ? '…' : 'search'}
|
|
163
|
+
</button>
|
|
164
|
+
) : null}
|
|
165
|
+
</span>
|
|
166
|
+
{so.urlErrors[key] ? <span className="so-error">{so.urlErrors[key]}</span> : null}
|
|
167
|
+
{so.seenFor(p.post).map((s) => (
|
|
168
|
+
<span key={s.url} className="so-seen">
|
|
169
|
+
<span className="so-ellip so-grow" title={s.url}>
|
|
170
|
+
seen, which post? {s.url.replace(/^https?:\/\/(www\.)?/, '')}
|
|
171
|
+
</span>
|
|
172
|
+
<button className="so-mini so-pub" disabled={so.busy} onClick={() => void so.takeSeen(s, p.post)}>
|
|
173
|
+
here
|
|
174
|
+
</button>
|
|
175
|
+
<button className="ghost so-mini" onClick={() => void so.dropSeen(s)} title="forget this URL">
|
|
176
|
+
✕
|
|
177
|
+
</button>
|
|
178
|
+
</span>
|
|
179
|
+
))}
|
|
180
|
+
{waits && found ? <span className="rv-dim rv-small">{found}</span> : null}
|
|
181
|
+
</span>
|
|
182
|
+
)
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
const Length = observer((p: { so: SocialSt; a: DeskAccount; post: SocialPost }) => <Count n={p.so.length(p.post)} max={p.a.max} title={`its length on ${p.a.name}`} />)
|
|
186
|
+
|
|
187
|
+
/** one account's part of a draft; `head` names the account (the draft's page), else its draft (the Social page) */
|
|
188
|
+
export const PostCard = observer((p: { so: SocialSt; a: DeskAccount; post: SocialPost; where?: boolean; head?: boolean }) => {
|
|
189
|
+
const so = p.so
|
|
190
|
+
const post = p.post
|
|
191
|
+
const posted = post.posted !== ''
|
|
192
|
+
const place = post.place === '' ? null : (p.a.places.find((x) => x.id === post.place) ?? null)
|
|
193
|
+
// a message already posted opens folded to its top line
|
|
194
|
+
const [open, setOpen] = useState(!posted)
|
|
195
|
+
const from = post.from.split('/')[0] ?? ''
|
|
196
|
+
return (
|
|
197
|
+
<div className={`so-card so-post${posted ? ' posted' : ''}${post.status === 'rejected' ? ' rejected' : ''}`}>
|
|
198
|
+
<div className="so-posthead">
|
|
199
|
+
<Fold open={open} flip={() => setOpen((o) => !o)} />
|
|
200
|
+
{p.head ? <Logo id={p.a.id} name={p.a.name} size={28} muted={p.a.live === ''} /> : null}
|
|
201
|
+
<span className={`so-posttitle${p.head ? '' : ' small'}`}>
|
|
202
|
+
{p.head ? (
|
|
203
|
+
<b>{p.a.name}</b>
|
|
204
|
+
) : (
|
|
205
|
+
<a href={`#page:comms:${post.slug}`} onClick={(e) => { e.preventDefault(); so.openDraft(post.slug) }} title="open it in Communications">
|
|
206
|
+
<b>{post.slug}</b>
|
|
207
|
+
</a>
|
|
208
|
+
)}
|
|
209
|
+
{post.name ? <span className="rv-dim"> · {post.name}</span> : null}
|
|
210
|
+
{post.from !== post.key ? <span className="rv-dim"> · the text of {so.accountOf(post.identity, from)?.name ?? from}</span> : null}
|
|
211
|
+
{!p.head && post.kind ? <span className="rv-dim"> · {post.kind}</span> : null}
|
|
212
|
+
{(p.where || p.head) && post.place !== '' ? (
|
|
213
|
+
<span className="so-place">
|
|
214
|
+
{' → '}
|
|
215
|
+
{place?.url ? (
|
|
216
|
+
<>
|
|
217
|
+
<a href={place.url} target="_blank" rel="noreferrer">
|
|
218
|
+
{place.name}
|
|
219
|
+
</a>
|
|
220
|
+
<a className="so-popup" href={place.url} onClick={(e) => popup(e, place.url, `place-${place.id}`)} title={`${place.name} in a window of its own`}>
|
|
221
|
+
↗
|
|
222
|
+
</a>
|
|
223
|
+
</>
|
|
224
|
+
) : (
|
|
225
|
+
so.placeName(p.a, post.place)
|
|
226
|
+
)}
|
|
227
|
+
</span>
|
|
228
|
+
) : null}
|
|
229
|
+
</span>
|
|
230
|
+
<PosterButton so={so} a={p.a} post={post} />
|
|
231
|
+
{posted ? <ViewButton post={post} /> : !p.head ? <span className={`so-badge ${post.status === 'picked' ? 't-warn' : 't-dim'}`}>{STATUS[post.status] ?? post.status}</span> : null}
|
|
232
|
+
</div>
|
|
233
|
+
{open ? (
|
|
234
|
+
<>
|
|
235
|
+
<Fields so={so} a={p.a} post={post} place={place} head={p.head} />
|
|
236
|
+
<div className="so-postfoot">
|
|
237
|
+
<Length so={so} a={p.a} post={post} />
|
|
238
|
+
<UrlField so={so} post={post} />
|
|
239
|
+
</div>
|
|
240
|
+
{!p.head ? <div className="rv-dim rv-small">{post.file}</div> : null}
|
|
241
|
+
</>
|
|
242
|
+
) : null}
|
|
243
|
+
</div>
|
|
244
|
+
)
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
/** one text for several accounts (a group heading and the accounts that take it): every logo on its top line, the text
|
|
248
|
+
* once, then a line an account to open it, post it and paste its link back */
|
|
249
|
+
const ShareCard = observer((p: { so: SocialSt; sends: readonly { a: DeskAccount; post: SocialPost }[] }) => {
|
|
250
|
+
const so = p.so
|
|
251
|
+
const first = p.sends[0]
|
|
252
|
+
const done = p.sends.filter((s) => s.post.posted !== '').length
|
|
253
|
+
const all = done === p.sends.length
|
|
254
|
+
// posted everywhere, it opens folded to its top line
|
|
255
|
+
const [open, setOpen] = useState(!all)
|
|
256
|
+
if (!first) return null
|
|
257
|
+
return (
|
|
258
|
+
<div className={`so-card so-post${all ? ' posted' : ''}${first.post.status === 'rejected' ? ' rejected' : ''}`}>
|
|
259
|
+
<div className="so-posthead">
|
|
260
|
+
<Fold open={open} flip={() => setOpen((o) => !o)} />
|
|
261
|
+
<span className="so-logos">
|
|
262
|
+
{p.sends.map(({ a }) => (
|
|
263
|
+
<Logo key={a.id} id={a.id} name={a.name} size={24} muted={a.live === ''} />
|
|
264
|
+
))}
|
|
265
|
+
</span>
|
|
266
|
+
<span className="so-posttitle">
|
|
267
|
+
<b>{p.sends.map(({ a }) => a.name).join(' · ')}</b>
|
|
268
|
+
{first.post.name ? <span className="rv-dim"> · {first.post.name}</span> : null}
|
|
269
|
+
</span>
|
|
270
|
+
{!so.phone && !all ? (
|
|
271
|
+
<button onClick={() => void so.openAll(first.post)} title="each write page in a window of its own, side by side, in the identity's Chrome profile, the media in the Finder under them">
|
|
272
|
+
⧉ Open all
|
|
273
|
+
</button>
|
|
274
|
+
) : null}
|
|
275
|
+
<span className={`so-badge ${all ? 't-ok' : 't-dim'}`}>
|
|
276
|
+
{done}/{p.sends.length} posted
|
|
277
|
+
</span>
|
|
278
|
+
</div>
|
|
279
|
+
{open ? (
|
|
280
|
+
<Fields
|
|
281
|
+
so={so}
|
|
282
|
+
a={first.a}
|
|
283
|
+
post={first.post}
|
|
284
|
+
place={null}
|
|
285
|
+
head
|
|
286
|
+
foot={
|
|
287
|
+
<div className={`so-lines${so.phone ? ' phone' : ''}`}>
|
|
288
|
+
{p.sends.map(({ a, post }) => (
|
|
289
|
+
<Fragment key={post.key}>
|
|
290
|
+
<Logo id={a.id} name={a.name} size={20} muted={a.live === ''} />
|
|
291
|
+
<b className="so-ellip rv-small">{a.name}</b>
|
|
292
|
+
<Length so={so} a={a} post={post} />
|
|
293
|
+
<span>
|
|
294
|
+
<PosterButton so={so} a={a} post={post} />
|
|
295
|
+
</span>
|
|
296
|
+
<span className="so-lineurl">
|
|
297
|
+
<UrlField so={so} post={post} />
|
|
298
|
+
</span>
|
|
299
|
+
<span>
|
|
300
|
+
<ViewButton post={post} />
|
|
301
|
+
</span>
|
|
302
|
+
</Fragment>
|
|
303
|
+
))}
|
|
304
|
+
</div>
|
|
305
|
+
}
|
|
306
|
+
/>
|
|
307
|
+
) : null}
|
|
308
|
+
</div>
|
|
309
|
+
)
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
/** a card a text: an account's own, or a group's shared by its accounts */
|
|
313
|
+
export const Cards = observer((p: { so: SocialSt; posts: readonly SocialPost[] }) => (
|
|
314
|
+
<>
|
|
315
|
+
{sharing(p.posts, (x) => p.so.postAccount(x)).map((sends) =>
|
|
316
|
+
sends.length === 1 && sends[0] ? <PostCard key={sends[0].post.key} so={p.so} a={sends[0].a} post={sends[0].post} head /> : <ShareCard key={sends[0]?.post.from} so={p.so} sends={sends} />,
|
|
317
|
+
)}
|
|
318
|
+
</>
|
|
319
|
+
))
|
|
320
|
+
|
|
321
|
+
/** what a card asks him to fill on the platform: its place's asks, the flair, the title and the text to copy, the media */
|
|
322
|
+
const Fields = observer((p: { so: SocialSt; a: DeskAccount; post: SocialPost; place: Place | null; head?: boolean; foot?: ReactNode }) => {
|
|
323
|
+
const so = p.so
|
|
324
|
+
const post = p.post
|
|
325
|
+
const place = p.place
|
|
326
|
+
const key = so.editKey(post)
|
|
327
|
+
const label = TEXT_FIELD[p.a.text] ?? 'Text'
|
|
328
|
+
const words = so.edit(post) ? (
|
|
329
|
+
<EditBox so={so} post={post} label={label} />
|
|
330
|
+
) : (
|
|
331
|
+
<>
|
|
332
|
+
{post.title ? (
|
|
333
|
+
<Field label="Title">
|
|
334
|
+
<CopyFrame so={so} text={post.title} k={`${key}/title`} title />
|
|
335
|
+
</Field>
|
|
336
|
+
) : null}
|
|
337
|
+
<Field label={label}>
|
|
338
|
+
<CopyFrame so={so} text={post.body} copy={post.text} k={key} onEdit={() => so.startEdit(post)} />
|
|
339
|
+
</Field>
|
|
340
|
+
{post.tags.length > 0 ? (
|
|
341
|
+
<Field label="Tags">
|
|
342
|
+
<div className="so-tags">{post.tags.join(' ')}</div>
|
|
343
|
+
</Field>
|
|
344
|
+
) : null}
|
|
345
|
+
{post.reply !== '' ? (
|
|
346
|
+
<Field label="Reply on X, its link">
|
|
347
|
+
<CopyFrame so={so} text={post.reply} k={`${key}/reply`} />
|
|
348
|
+
</Field>
|
|
349
|
+
) : null}
|
|
350
|
+
<Footer post={post} />
|
|
351
|
+
</>
|
|
352
|
+
)
|
|
353
|
+
return (
|
|
354
|
+
<>
|
|
355
|
+
{!p.head && post.angle ? <AngleCards angle={post.angle} /> : null}
|
|
356
|
+
{place ? <PlaceAsks place={place} /> : null}
|
|
357
|
+
{place?.flair ? (
|
|
358
|
+
<Field label="Flair">
|
|
359
|
+
<div className="so-flairline">
|
|
360
|
+
<span className="so-flair">🏷 {place.flair}</span>
|
|
361
|
+
<span className="rv-dim rv-small">to pick in {place.name}'s list of flairs</span>
|
|
362
|
+
</div>
|
|
363
|
+
</Field>
|
|
364
|
+
) : null}
|
|
365
|
+
{post.media && !so.phone ? (
|
|
366
|
+
// the desktop: the words on the left, the media on the right
|
|
367
|
+
<div className="so-sidebyside">
|
|
368
|
+
<div className="so-words">
|
|
369
|
+
{words}
|
|
370
|
+
{p.foot}
|
|
371
|
+
</div>
|
|
372
|
+
<div className="so-sidemedia">
|
|
373
|
+
<MediaTile so={so} slug={post.slug} m={post.media} size="side" />
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
) : (
|
|
377
|
+
<>
|
|
378
|
+
{words}
|
|
379
|
+
{post.media ? (
|
|
380
|
+
<Field label="Media">
|
|
381
|
+
<MediaTile so={so} slug={post.slug} m={post.media} size="small" />
|
|
382
|
+
</Field>
|
|
383
|
+
) : null}
|
|
384
|
+
{p.foot}
|
|
385
|
+
</>
|
|
386
|
+
)}
|
|
387
|
+
</>
|
|
388
|
+
)
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
/** a heading's text open in the editor: its title where it has one, its text, its tags; the counts on the card's foot
|
|
392
|
+
* follow each key, « Publish » waits while it is open */
|
|
393
|
+
const EditBox = observer((p: { so: SocialSt; post: SocialPost; label: string }) => {
|
|
394
|
+
const so = p.so
|
|
395
|
+
const e = so.edit(p.post)
|
|
396
|
+
if (e == null) return null
|
|
397
|
+
const keys = (ev: { key: string; metaKey: boolean; ctrlKey: boolean }): void => {
|
|
398
|
+
if (ev.key === 'Enter' && (ev.metaKey || ev.ctrlKey)) void so.saveEdit(p.post)
|
|
399
|
+
if (ev.key === 'Escape') so.cancelEdit(p.post)
|
|
400
|
+
}
|
|
401
|
+
return (
|
|
402
|
+
<>
|
|
403
|
+
{e.title !== null ? (
|
|
404
|
+
<Field label="YouTube title" note={<Count n={[...e.title].length} max={TITLE_MAX} />}>
|
|
405
|
+
<input className="so-input" value={e.title} onChange={(ev) => so.typeEdit(p.post, { title: ev.currentTarget.value })} onKeyDown={keys} />
|
|
406
|
+
</Field>
|
|
407
|
+
) : null}
|
|
408
|
+
<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
|
+
</Field>
|
|
411
|
+
<Field label="Tags">
|
|
412
|
+
<input className="so-input" placeholder="#gamedev #indiedev" value={e.tags} onChange={(ev) => so.typeEdit(p.post, { tags: ev.currentTarget.value })} onKeyDown={keys} />
|
|
413
|
+
</Field>
|
|
414
|
+
<Footer post={p.post} />
|
|
415
|
+
<div className="so-acts">
|
|
416
|
+
<button className="primary" disabled={so.busy || e.text.trim() === ''} onClick={() => void so.saveEdit(p.post)}>
|
|
417
|
+
✓ Save
|
|
418
|
+
</button>
|
|
419
|
+
<button className="ghost" onClick={() => so.cancelEdit(p.post)}>
|
|
420
|
+
Cancel
|
|
421
|
+
</button>
|
|
422
|
+
<span className="rv-dim rv-small">⌘ Enter · Escape</span>
|
|
423
|
+
</div>
|
|
424
|
+
</>
|
|
425
|
+
)
|
|
426
|
+
})
|
|
427
|
+
|
|
428
|
+
/** a vertical message's footer: the identity's links, read only and small under its text */
|
|
429
|
+
function Footer(p: { post: SocialPost }) {
|
|
430
|
+
if (p.post.footer === '') return null
|
|
431
|
+
return (
|
|
432
|
+
<Field label="Footer, copied with the description">
|
|
433
|
+
<div className="so-footer rv-pre">{p.post.footer}</div>
|
|
434
|
+
</Field>
|
|
435
|
+
)
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/** what a place asks of a post: its day, its rules and notes folded under it */
|
|
439
|
+
function PlaceAsks(p: { place: Place }) {
|
|
440
|
+
const [open, setOpen] = useState(false)
|
|
441
|
+
const pl = p.place
|
|
442
|
+
if (!pl.when && !pl.rules && !pl.notes) return null
|
|
443
|
+
return (
|
|
444
|
+
<div className="so-asks">
|
|
445
|
+
<div className="so-asksline">
|
|
446
|
+
{pl.when ? <span className="rv-dim rv-small">{pl.when}</span> : null}
|
|
447
|
+
{pl.rules || pl.notes ? (
|
|
448
|
+
<button className="so-linkbtn" onClick={() => setOpen((o) => !o)}>
|
|
449
|
+
<Caret open={open} /> Rules of {pl.name}
|
|
450
|
+
</button>
|
|
451
|
+
) : null}
|
|
452
|
+
</div>
|
|
453
|
+
{open ? <Md className="so-rules" text={[pl.rules, pl.notes].filter(Boolean).join('\n\n')} /> : null}
|
|
454
|
+
</div>
|
|
455
|
+
)
|
|
456
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// what the desk and the identities folder found wrong, as one folded row: its count, then one line a problem, a draft's
|
|
2
|
+
// named by its title and platform and a click to it in Communications, any other by its file in the identities folder.
|
|
3
|
+
// A problem never lands as a raw path at the top of a page
|
|
4
|
+
import { observer } from 'mobx-react-lite'
|
|
5
|
+
import { useState } from 'react'
|
|
6
|
+
import { Icon, ICON } from '../icons.tsx'
|
|
7
|
+
import type { SocialSt } from './social-st.ts'
|
|
8
|
+
|
|
9
|
+
type Problem = { key: string; what: string; why: string; slug: string | null }
|
|
10
|
+
|
|
11
|
+
const DRAFT = /(?:^|\/)\.shipkit\/social\/drafts\/([^/]+)\/(?:draft|post)\.md: (.*)$/
|
|
12
|
+
const OVER = /^## (\S+?)(?:\/\S+)? is (\d+) on (.+?), over its (\d+)$/
|
|
13
|
+
const FILE = /^\S*\/identities\/(\S+?): (.*)$/
|
|
14
|
+
|
|
15
|
+
/** one line of a load, in the words a row shows */
|
|
16
|
+
export function problemOf(line: string, titleOf: (slug: string) => string | null): Problem {
|
|
17
|
+
const d = DRAFT.exec(line)
|
|
18
|
+
if (d != null) {
|
|
19
|
+
const slug = d[1]!
|
|
20
|
+
const o = OVER.exec(d[2]!)
|
|
21
|
+
return { key: line, slug, what: titleOf(slug) ?? slug.replace(/^\d{8}-\d{6}-/, ''), why: o == null ? d[2]! : `${o[3]}: ${o[2]} of ${o[4]}` }
|
|
22
|
+
}
|
|
23
|
+
const f = FILE.exec(line)
|
|
24
|
+
if (f != null) return { key: line, slug: null, what: f[1]!, why: f[2]! }
|
|
25
|
+
return { key: line, slug: null, what: '', why: line }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Problems = observer(({ so, lines }: { so: SocialSt | null; lines: readonly string[] }) => {
|
|
29
|
+
const [open, setOpen] = useState(false)
|
|
30
|
+
if (lines.length === 0) return null
|
|
31
|
+
const titleOf = (slug: string): string | null => so?.desk?.drafts.find((d) => d.slug === slug)?.title || null
|
|
32
|
+
const all = lines.map((l) => problemOf(l, titleOf))
|
|
33
|
+
const drafts = all.filter((p) => p.slug != null).length
|
|
34
|
+
const label = drafts === all.length ? `${drafts} draft${drafts === 1 ? '' : 's'} with a problem` : `${all.length} problem${all.length === 1 ? '' : 's'}`
|
|
35
|
+
return (
|
|
36
|
+
<div className="so-problems">
|
|
37
|
+
<button className={`so-probhead${open ? ' open' : ''}`} aria-expanded={open} title="what the load found wrong: one line each" onClick={() => setOpen(!open)}>
|
|
38
|
+
<Icon d={ICON.asks} />
|
|
39
|
+
<span className="so-ellip so-grow">{label}</span>
|
|
40
|
+
<b className="rsecn nwarn">{all.length}</b>
|
|
41
|
+
<span className="so-probcaret">{open ? '▾' : '›'}</span>
|
|
42
|
+
</button>
|
|
43
|
+
{open
|
|
44
|
+
? all.map((p) => {
|
|
45
|
+
const body = (
|
|
46
|
+
<>
|
|
47
|
+
<b className="so-ellip">{p.what === '' ? p.why : p.what}</b>
|
|
48
|
+
{p.what === '' ? null : <span className="rv-dim so-ellip so-grow">{p.why}</span>}
|
|
49
|
+
</>
|
|
50
|
+
)
|
|
51
|
+
return p.slug != null && so != null ? (
|
|
52
|
+
<button key={p.key} className="so-probrow" title={`${p.key}: open the draft in Communications`} onClick={() => so.openDraft(p.slug!)}>{body}</button>
|
|
53
|
+
) : (
|
|
54
|
+
<div key={p.key} className="so-probrow" title={p.key}>{body}</div>
|
|
55
|
+
)
|
|
56
|
+
})
|
|
57
|
+
: null}
|
|
58
|
+
</div>
|
|
59
|
+
)
|
|
60
|
+
})
|