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,352 @@
|
|
|
1
|
+
// `/identities#<id>[/<part>[/<place>]]`: one identity (wiki build/shipkit/social.md, Identities). On the left its
|
|
2
|
+
// head, its sections (profile, company, Veille, site), one row per account with the platform's logo and its state,
|
|
3
|
+
// the repos that speak as it; on the right the part picked: the profile (rows, brand, links, pictures, where its data
|
|
4
|
+
// lives), the company, the Veille, the site (site/site-part.tsx), or an account's whole page (its head, setup, places, profile, the drafts
|
|
5
|
+
// waiting for it). Its parts are the repo Social page's (social-page.tsx), on a desk the identity reads (identities-st.ts)
|
|
6
|
+
import { observer } from 'mobx-react-lite'
|
|
7
|
+
import { useEffect, type CSSProperties, type ReactNode } from 'react'
|
|
8
|
+
import { Group, Panel, Separator } from 'react-resizable-panels'
|
|
9
|
+
import type { DataPlace, MachineIdentity } from '../../identities/machine-route.ts'
|
|
10
|
+
import type { HomeSt } from './home-st.ts'
|
|
11
|
+
import { plainClick, repoPage } from './home-st.ts'
|
|
12
|
+
import type { IdentitiesSt } from './identities-st.ts'
|
|
13
|
+
import { identityAddress, isSection, type IdentityRow } from './identity-address.ts'
|
|
14
|
+
import { isTreeWalk, SEARCH_KEY } from './keys.ts'
|
|
15
|
+
import { useInSight } from './tree-row.tsx'
|
|
16
|
+
import { PANEL } from './review/review-page.tsx'
|
|
17
|
+
import { SitePart } from './site/site-part.tsx'
|
|
18
|
+
import { Icon, ICON } from './icons.tsx'
|
|
19
|
+
import { ErrorLine, KeptFold, Lightbox, Logo, Toast } from './social/kit.tsx'
|
|
20
|
+
import { Problems } from './social/problems.tsx'
|
|
21
|
+
import { AccountProfile, IdentityMedia, IdentityPage, LegalPage, LegalPlatforms, Messages, PlacePane, PlatformHeader } from './social/social-page.tsx'
|
|
22
|
+
import { LEGAL, ME, type DeskAccount, type DeskIdentity } from './social/social-model.ts'
|
|
23
|
+
import type { SocialSt } from './social/social-st.ts'
|
|
24
|
+
|
|
25
|
+
const Mark = ({ i, px }: { i: MachineIdentity; px: number }) => {
|
|
26
|
+
const style = { width: px, height: px, ...(i.colour == null ? {} : { '--idc': i.colour }) } as CSSProperties
|
|
27
|
+
return i.mark != null ? <img className="idmark" src={i.mark} alt="" width={px} height={px} style={style} /> : <span className="idmark idini" style={{ ...style, fontSize: px * 0.45 }}>{i.name.charAt(0).toUpperCase()}</span>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** a link of the view: an address of the home, opened in place on a plain click */
|
|
31
|
+
const Go = observer(({ app, to, cls, title, lit, children }: { app: HomeSt; to: { part: string | null; place?: string | null }; cls: string; title?: string; lit?: boolean; children: ReactNode }) => {
|
|
32
|
+
const sel = { id: app.identities.shownId, part: to.part, place: to.place ?? null }
|
|
33
|
+
const el = useInSight<HTMLAnchorElement>(lit === true)
|
|
34
|
+
return (
|
|
35
|
+
<a ref={el} className={cls} href={identityAddress(sel)} title={title} onClick={(e) => {
|
|
36
|
+
if (!plainClick(e)) return
|
|
37
|
+
e.preventDefault()
|
|
38
|
+
app.openIdentity(sel)
|
|
39
|
+
}}>{children}</a>
|
|
40
|
+
)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
/** a plain click on a link of the home: run it in place; any other click keeps the browser's own behaviour */
|
|
44
|
+
const inPlace = (run: () => void) => (e: { button: number; metaKey: boolean; ctrlKey: boolean; shiftKey: boolean; altKey: boolean; preventDefault(): void }): void => {
|
|
45
|
+
if (!plainClick(e)) return
|
|
46
|
+
e.preventDefault()
|
|
47
|
+
run()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const IdentitiesView = observer(({ app }: { app: HomeSt }) => {
|
|
51
|
+
const st = app.identities
|
|
52
|
+
const so = st.desk
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (so == null) return
|
|
55
|
+
st.ensureHub()
|
|
56
|
+
so.start()
|
|
57
|
+
return () => so.stop()
|
|
58
|
+
}, [so, st])
|
|
59
|
+
const i = st.shown
|
|
60
|
+
if (i == null)
|
|
61
|
+
return (
|
|
62
|
+
<div className="hall activity identities">
|
|
63
|
+
{st.error !== '' ? <div className="hnote">{st.error}</div> : null}
|
|
64
|
+
{st.data?.errors.map((e) => <div key={e} className="hnote">{e}</div>)}
|
|
65
|
+
{st.data == null && st.error === '' ? <div className="iddim"><span className="spin" />reading the identities folder…</div> : null}
|
|
66
|
+
{st.data != null && st.sel.id != null ? <div className="hnote">no identity « {st.sel.id} » in {st.data.dir ?? 'the house repo'}: {st.data.identities.map((x) => x.name).join(', ') || 'none'}</div> : null}
|
|
67
|
+
{st.data != null && st.data.identities.length === 0 ? <div className="iddim">no identity: write .shipkit/identities/<id>/identity.md in the house repo</div> : null}
|
|
68
|
+
</div>
|
|
69
|
+
)
|
|
70
|
+
return (
|
|
71
|
+
<div className="so-page idview">
|
|
72
|
+
<Group className="rv-cols" orientation="horizontal">
|
|
73
|
+
<Panel id="identity-list" defaultSize="30%" minSize={260} className="rv-pane" style={PANEL}>
|
|
74
|
+
<IdentityList app={app} i={i} />
|
|
75
|
+
</Panel>
|
|
76
|
+
<Separator className="rsep" />
|
|
77
|
+
<Panel id="identity-page" minSize={420} className="rv-pane" style={PANEL}>
|
|
78
|
+
<div className="rv-scroll so-ground">
|
|
79
|
+
<PartPage app={app} i={i} />
|
|
80
|
+
</div>
|
|
81
|
+
</Panel>
|
|
82
|
+
</Group>
|
|
83
|
+
{so == null ? null : <Lightbox so={so} />}
|
|
84
|
+
{so == null ? null : <Toast so={so} />}
|
|
85
|
+
</div>
|
|
86
|
+
)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
/** the desk's own view of the identity: its rows, pictures, company and accounts; null until the desk answers */
|
|
90
|
+
const deskOf = (so: SocialSt | null, i: MachineIdentity): DeskIdentity | null => so?.identityOf(i.id) ?? null
|
|
91
|
+
|
|
92
|
+
/** the list: its head and filter stay in reach, the problems and the blocks under them scroll as one column; every row is
|
|
93
|
+
* the walk's (identities-st.ts rows), lit where the cursor or the part shown sits */
|
|
94
|
+
const IdentityList = observer(({ app, i }: { app: HomeSt; i: MachineIdentity }) => {
|
|
95
|
+
const st = app.identities
|
|
96
|
+
const so = st.desk
|
|
97
|
+
const d = deskOf(so, i)
|
|
98
|
+
const online = i.accounts.filter((a) => a.live !== '').length
|
|
99
|
+
const style = i.colour == null ? undefined : ({ '--idc': i.colour } as CSSProperties)
|
|
100
|
+
const problems = [
|
|
101
|
+
...(st.error !== '' ? [st.error] : []),
|
|
102
|
+
...(st.data?.errors ?? []),
|
|
103
|
+
...(st.data?.strays.map((x) => `${x.repo} speaks as ${x.speaksAs}, which no folder holds`) ?? []),
|
|
104
|
+
...(so?.loadError ? [so.loadError] : []),
|
|
105
|
+
...(so?.errors ?? []),
|
|
106
|
+
]
|
|
107
|
+
const rows = st.rows
|
|
108
|
+
const block = (b: IdentityRow['block']) => rows.filter((r) => r.block === b)
|
|
109
|
+
const accounts = block('accounts')
|
|
110
|
+
const repos = block('repos')
|
|
111
|
+
const filtered = st.query.trim() !== ''
|
|
112
|
+
return (
|
|
113
|
+
<div className="idcol" style={style}>
|
|
114
|
+
<header className="idhead" title={`${i.id}${i.default ? ': the default identity, it speaks for every repo whose repo.config.ts names no speaksAs' : ''}`}>
|
|
115
|
+
<Mark i={i} px={28} />
|
|
116
|
+
<div className="idtitle">
|
|
117
|
+
<b>{i.name}</b>
|
|
118
|
+
{i.bio === '' ? null : <span className="iddim">{i.bio}</span>}
|
|
119
|
+
</div>
|
|
120
|
+
</header>
|
|
121
|
+
<div className="ssearch">
|
|
122
|
+
<span className="sfield">
|
|
123
|
+
<input ref={(el) => { st.searchEl = el }} placeholder="filter" aria-label="filter the accounts, sections and repos by name or handle" value={st.query}
|
|
124
|
+
onChange={(e) => st.setQuery(e.target.value)}
|
|
125
|
+
onKeyDown={(e) => { if (e.key === 'Escape') st.setQuery(''); else if (isTreeWalk(e.key) && st.key(e.key)) e.preventDefault() }} />
|
|
126
|
+
<kbd className="skey">{SEARCH_KEY}</kbd>
|
|
127
|
+
</span>
|
|
128
|
+
</div>
|
|
129
|
+
<div className="rv-scroll idlist">
|
|
130
|
+
<Problems so={so} lines={problems} />
|
|
131
|
+
<nav className="idrows" aria-label={`${i.name}: its sections`}>
|
|
132
|
+
{block('sections').map((r) => <SectionRow key={r.key} app={app} i={i} d={d} r={r} />)}
|
|
133
|
+
</nav>
|
|
134
|
+
{filtered && accounts.length === 0 ? null : <div className="idband">accounts <span>{filtered ? `${accounts.length} of ${i.accounts.length}` : `${online}/${i.accounts.length}`}</span></div>}
|
|
135
|
+
<nav className="idrows" aria-label={`${i.name}: its accounts`}>
|
|
136
|
+
{accounts.map((r) => <AccountRow key={r.key} app={app} i={i} d={d} r={r} />)}
|
|
137
|
+
</nav>
|
|
138
|
+
{filtered && repos.length === 0 ? null : <div className="idband">repos <span>{filtered ? `${repos.length} of ${i.repos.length}` : i.repos.length}</span></div>}
|
|
139
|
+
<nav className="idrows" aria-label={`${i.name}: its repos`}>
|
|
140
|
+
{i.repos.length === 0 ? <span className="iddim idrow">none speaks as it</span> : repos.map((r) => <RepoRow key={r.key} app={app} i={i} r={r} />)}
|
|
141
|
+
</nav>
|
|
142
|
+
{filtered && rows.length === 0 ? <div className="iddim idrow">nothing holds « {st.query.trim()} »</div> : null}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
)
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
const rowCls = (app: HomeSt, r: IdentityRow, more = ''): string => `idrow${app.identities.lit === r.key ? ' on' : ''}${more}`
|
|
149
|
+
|
|
150
|
+
const SectionRow = observer(({ app, i, d, r }: { app: HomeSt; i: MachineIdentity; d: DeskIdentity | null; r: IdentityRow }) => {
|
|
151
|
+
const so = app.identities.desk
|
|
152
|
+
const lit = app.identities.lit === r.key
|
|
153
|
+
if (r.part == null)
|
|
154
|
+
return (
|
|
155
|
+
<Go app={app} to={{ part: null }} cls={rowCls(app, r)} lit={lit} title="its profile rows, its brand, its links and pictures, where its data lives">
|
|
156
|
+
<Icon d={ICON.social} /><span className="idgrow">profile</span>
|
|
157
|
+
</Go>
|
|
158
|
+
)
|
|
159
|
+
if (r.part === LEGAL) {
|
|
160
|
+
const legal = d?.legal != null && so != null && so.legalLive(d)
|
|
161
|
+
return (
|
|
162
|
+
<Go app={app} to={{ part: LEGAL }} cls={rowCls(app, r)} lit={lit} title={`the company: every fact a form asks, payouts and taxes by platform; ${legal ? 'registered' : 'still to register'}`}>
|
|
163
|
+
<Icon d={ICON.contracts} /><span className="idgrow">company</span><i className={`iddot${legal ? ' live' : ''}`} />
|
|
164
|
+
</Go>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
if (r.part === '@veille')
|
|
168
|
+
return (
|
|
169
|
+
<Go app={app} to={{ part: '@veille' }} cls={rowCls(app, r)} lit={lit} title="the posts it scrolls past, ranked by the worth of a reply">
|
|
170
|
+
<Icon d={ICON.veille} /><span className="idgrow">veille</span>
|
|
171
|
+
</Go>
|
|
172
|
+
)
|
|
173
|
+
return (
|
|
174
|
+
<Go app={app} to={{ part: '@site' }} cls={rowCls(app, r)} lit={lit} title={i.site === '' ? 'its website: none named' : `its website, ${i.site}`}>
|
|
175
|
+
<Icon d={ICON.browser} /><span>site</span><span className="iddim idgrow so-ellip">{i.site.replace(/^https?:\/\/(www\.)?/, '')}</span>
|
|
176
|
+
</Go>
|
|
177
|
+
)
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
const AccountRow = observer(({ app, i, d, r }: { app: HomeSt; i: MachineIdentity; d: DeskIdentity | null; r: IdentityRow }) => {
|
|
181
|
+
const so = app.identities.desk
|
|
182
|
+
const m = i.accounts.find((x) => x.id === r.part)
|
|
183
|
+
if (m == null) return null
|
|
184
|
+
const a = d?.accounts.find((x) => x.id === m.id) ?? null
|
|
185
|
+
const c = a == null || so == null ? null : so.counts(a)
|
|
186
|
+
const stat = a == null ? undefined : so?.statOf(a)
|
|
187
|
+
const live = m.live !== ''
|
|
188
|
+
return (
|
|
189
|
+
<Go app={app} to={{ part: m.id }} cls={rowCls(app, r, live ? '' : ' off')} lit={app.identities.lit === r.key}
|
|
190
|
+
title={[`${m.name}${m.handle === '' ? '' : ` ${m.handle}`}`, live ? 'online' : 'still to create', stat, c != null && c.waiting > 0 ? `${c.waiting} messages to post` : ''].filter(Boolean).join(' · ')}>
|
|
191
|
+
<Logo id={m.id} name={m.name} size={16} muted={!live} />
|
|
192
|
+
<span className="idname">{m.name}</span>
|
|
193
|
+
<span className="iddim idgrow so-ellip">{m.handle}</span>
|
|
194
|
+
{c != null && c.waiting > 0 ? <b className="idnum">{c.waiting}</b> : null}
|
|
195
|
+
<i className={`iddot${live ? ' live' : ''}`} />
|
|
196
|
+
</Go>
|
|
197
|
+
)
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
/** a repo that speaks as it: the arrows only point at it, Enter or a click opens its Social page */
|
|
201
|
+
const RepoRow = observer(({ app, i, r }: { app: HomeSt; i: MachineIdentity; r: IdentityRow }) => {
|
|
202
|
+
const st = app.identities
|
|
203
|
+
const repo = r.repo!
|
|
204
|
+
const el = useInSight<HTMLAnchorElement>(st.lit === r.key)
|
|
205
|
+
return (
|
|
206
|
+
<a ref={el} className={rowCls(app, r)} href={`${repoPage(repo)}#page:social:${i.id}`} title={`${repo}: its Social page (Enter)`} onClick={inPlace(() => st.openRepo(repo, i.id))}>
|
|
207
|
+
<Icon d={ICON.repo} />
|
|
208
|
+
<span className="idgrow so-ellip">{repo}</span>
|
|
209
|
+
{draftsOf(i, repo) == null ? null : <span className="iddim" title="its drafts">{draftsOf(i, repo)}</span>}
|
|
210
|
+
</a>
|
|
211
|
+
)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
const draftsOf = (i: MachineIdentity, repo: string): number | null => {
|
|
215
|
+
const n = i.data.find((p) => p.place === 'drafts' && p.repo === repo)?.count ?? 0
|
|
216
|
+
return n > 0 ? n : null
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const PartPage = observer(({ app, i }: { app: HomeSt; i: MachineIdentity }) => {
|
|
220
|
+
const st = app.identities
|
|
221
|
+
const so = st.desk
|
|
222
|
+
const part = st.sel.part
|
|
223
|
+
if (part === '@veille') return <VeillePart app={app} i={i} />
|
|
224
|
+
if (part === '@site') return <SitePart app={app} i={i} />
|
|
225
|
+
const d = deskOf(so, i)
|
|
226
|
+
if (so == null || d == null) return <div className="rv-empty">{so?.loadError ?? so?.waitText ?? 'no repo to read the desk from'}</div>
|
|
227
|
+
if (part === LEGAL) {
|
|
228
|
+
if (d.legal == null) return <div className="rv-empty">{i.name} has no company: a legal.md in its folder</div>
|
|
229
|
+
return (
|
|
230
|
+
<div className="idpage">
|
|
231
|
+
<LegalPage so={so} i={d} />
|
|
232
|
+
<LegalPlatforms so={so} i={d} />
|
|
233
|
+
</div>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
if (part == null || isSection(part))
|
|
237
|
+
return (
|
|
238
|
+
<div className="idpage">
|
|
239
|
+
<IdentityPage so={so} i={d} />
|
|
240
|
+
{d.pictures.length > 0 ? <IdentityMedia so={so} i={d} /> : null}
|
|
241
|
+
<DataPlaces st={st} i={i} />
|
|
242
|
+
</div>
|
|
243
|
+
)
|
|
244
|
+
const a = d.accounts.find((x) => x.id === part)
|
|
245
|
+
if (a == null) return <div className="rv-empty">{i.name} has no account « {part} »: {d.accounts.map((x) => x.id).join(', ')}</div>
|
|
246
|
+
return <AccountPart app={app} i={i} so={so} a={a} />
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
/** an account's whole page: its head, setup and profile URL; its places; its profile; the drafts waiting for it */
|
|
250
|
+
const AccountPart = observer(({ app, i, so, a }: { app: HomeSt; i: MachineIdentity; so: SocialSt; a: DeskAccount }) => {
|
|
251
|
+
const st = app.identities
|
|
252
|
+
const place = so.currentPlace
|
|
253
|
+
const others = st.otherDrafts(i)
|
|
254
|
+
return (
|
|
255
|
+
<div className="idpage">
|
|
256
|
+
<div className="so-colin">
|
|
257
|
+
<ErrorLine so={so} />
|
|
258
|
+
<PlatformHeader so={so} a={a} />
|
|
259
|
+
{a.id === 'site' ? (
|
|
260
|
+
<Go app={app} to={{ part: '@site' }} cls="idrow" title="the site section: its pages live from the local preview, what changed since the deploy, the deploy">
|
|
261
|
+
<Icon d={ICON.browser} /><span className="idgrow">its pages, preview and deploy: the site section</span>
|
|
262
|
+
</Go>
|
|
263
|
+
) : null}
|
|
264
|
+
{a.places.length > 0 ? (
|
|
265
|
+
<KeptFold so={so} card={`places/${a.identity}/${a.id}`} title="Places" flush right={<span className="rv-dim rv-small">{a.places.length}</span>}>
|
|
266
|
+
{[{ id: ME, name: 'my profile', when: '' }, ...a.places].map((x) => {
|
|
267
|
+
const c = so.counts(a, x.id)
|
|
268
|
+
return (
|
|
269
|
+
<Go key={x.id} app={app} to={{ part: a.id, place: so.place === x.id ? null : x.id }} cls={`so-placerow${so.place === x.id ? ' on' : ''}`}>
|
|
270
|
+
<span className={`so-pdot${so.placeDone(a, x.id) ? ' done' : ''}`} />
|
|
271
|
+
<b className="so-ellip so-pname">{x.name}</b>
|
|
272
|
+
<span className="rv-dim so-ellip so-grow">{x.when}</span>
|
|
273
|
+
{c.waiting > 0 || c.posted > 0 ? <span className="rv-dim">{c.waiting > 0 ? `${c.waiting} to post` : `${c.posted} posted`}</span> : null}
|
|
274
|
+
</Go>
|
|
275
|
+
)
|
|
276
|
+
})}
|
|
277
|
+
</KeptFold>
|
|
278
|
+
) : null}
|
|
279
|
+
{place != null ? <PlacePane so={so} a={a} place={place} /> : null}
|
|
280
|
+
</div>
|
|
281
|
+
<AccountProfile so={so} a={a} />
|
|
282
|
+
<div className="so-colin">
|
|
283
|
+
<Messages so={so} a={a} />
|
|
284
|
+
<span className="rv-dim rv-small">
|
|
285
|
+
the drafts of {so.repoName}
|
|
286
|
+
{others.length === 0 ? null : (
|
|
287
|
+
<>
|
|
288
|
+
; the drafts of{' '}
|
|
289
|
+
{others.map((p, n) => (
|
|
290
|
+
<span key={p.repo}>
|
|
291
|
+
{n > 0 ? ', ' : ''}
|
|
292
|
+
<a href={`${repoPage(p.repo!)}#page:comms`} onClick={inPlace(() => st.openRepoPage(p.repo!, 'comms'))}>{p.repo}</a> ({p.count})
|
|
293
|
+
</span>
|
|
294
|
+
))}{' '}
|
|
295
|
+
are in their Communications
|
|
296
|
+
</>
|
|
297
|
+
)}
|
|
298
|
+
</span>
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
)
|
|
302
|
+
})
|
|
303
|
+
|
|
304
|
+
/** the Veille of the identity: its log on this machine, and each repo's Veille page, which reads it */
|
|
305
|
+
const VeillePart = observer(({ app, i }: { app: HomeSt; i: MachineIdentity }) => {
|
|
306
|
+
const st = app.identities
|
|
307
|
+
const log = i.data.filter((p) => p.place === 'veille')
|
|
308
|
+
return (
|
|
309
|
+
<div className="idpage so-colin">
|
|
310
|
+
<h2 className="so-h so-big">{i.name} <span className="rv-dim so-light">· the Veille</span></h2>
|
|
311
|
+
<p className="iddim">the posts its Chrome profile scrolls past, ranked by the worth of a reply: the extension posts them to the daemon, one log per identity, on this machine only</p>
|
|
312
|
+
<table className="iddata"><tbody>{log.map((p) => <DataRow key={p.place} st={st} i={i} p={p} />)}</tbody></table>
|
|
313
|
+
<b className="so-section">Open it</b>
|
|
314
|
+
{i.repos.length === 0 ? <span className="iddim">no repo speaks as it: a repo's Veille page shows the identity it speaks as</span> : i.repos.slice(0, 1).map((r) => (
|
|
315
|
+
<a key={r} className="idrow" href={`${repoPage(r)}#page:veille`} onClick={inPlace(() => st.openRepoPage(r, 'veille'))}>its Veille, in {r} ↗</a>
|
|
316
|
+
))}
|
|
317
|
+
</div>
|
|
318
|
+
)
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
const DataRow = observer(({ st, i, p }: { st: IdentitiesSt; i: MachineIdentity; p: DataPlace }) => (
|
|
322
|
+
<tr>
|
|
323
|
+
<td className="idwhat">{p.label}{p.count == null ? null : <span className="iddim"> · {p.count} {p.place === 'veille' ? `day${p.count === 1 ? '' : 's'}` : `draft${p.count === 1 ? '' : 's'}`}</span>}</td>
|
|
324
|
+
<td className="idpath"><code title={p.shown}>{p.shown}</code>{p.exists ? null : <span className="iddim"> not there yet</span>}</td>
|
|
325
|
+
<td className="idopen">
|
|
326
|
+
<button className="ghost" disabled={!p.exists} title={`open ${p.shown} in VS Code`} onClick={() => void st.open(i.id, p, 'code')}>VS Code</button>
|
|
327
|
+
<button className="ghost" disabled={!p.exists} title={`show ${p.shown} in the Finder`} onClick={() => void st.open(i.id, p, 'finder')}>Finder</button>
|
|
328
|
+
</td>
|
|
329
|
+
</tr>
|
|
330
|
+
))
|
|
331
|
+
|
|
332
|
+
/** where the identity's data lives on disk, each place a click to VS Code or the Finder */
|
|
333
|
+
const DataPlaces = observer(({ st, i }: { st: IdentitiesSt; i: MachineIdentity }) => {
|
|
334
|
+
const shown = i.data.filter((p) => p.exists || p.place !== 'drafts')
|
|
335
|
+
const empty = i.data.filter((p) => p.place === 'drafts' && !p.exists)
|
|
336
|
+
return (
|
|
337
|
+
<div className="so-colin">
|
|
338
|
+
<b className="so-section">Where its data lives</b>
|
|
339
|
+
{st.note !== '' ? <div className="iddim idnote">{st.note}</div> : null}
|
|
340
|
+
<table className="iddata">
|
|
341
|
+
<tbody>
|
|
342
|
+
{shown.map((p) => <DataRow key={`${p.place}/${p.repo ?? ''}`} st={st} i={i} p={p} />)}
|
|
343
|
+
{empty.length === 0 ? null : (
|
|
344
|
+
<tr>
|
|
345
|
+
<td colSpan={3} className="iddim" title={empty.map((p) => p.repo).join(', ')}>{empty.length} other repo{empty.length === 1 ? '' : 's'} speaking as it: no drafts yet (a repo's first draft makes its .shipkit/social/drafts/)</td>
|
|
346
|
+
</tr>
|
|
347
|
+
)}
|
|
348
|
+
</tbody>
|
|
349
|
+
</table>
|
|
350
|
+
</div>
|
|
351
|
+
)
|
|
352
|
+
})
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* the identity view (identities-view.tsx): two panels, the identity's list on the left (its head, its filter, its
|
|
2
|
+
sections, one row per account, its repos), the part picked on the right, drawn with the Social page's parts (social.css). The data
|
|
3
|
+
places a table of what, where, and two open buttons */
|
|
4
|
+
.idview{height:100%}
|
|
5
|
+
/* the head and the filter stay put, everything under them scrolls as ONE column: every block and row keeps its own
|
|
6
|
+
height, so no row is ever squeezed under the next block's title */
|
|
7
|
+
.idcol{display:flex;flex-direction:column;min-width:0;height:100%}
|
|
8
|
+
.idcol > :not(.idlist){flex:none}
|
|
9
|
+
.idlist{padding:0 0 var(--s3)}
|
|
10
|
+
.idlist > *,.idrows > *{flex:none}
|
|
11
|
+
/* the head: the avatar, the name, the bio dim under it, on the hub's type scale */
|
|
12
|
+
.idhead{display:flex;gap:var(--s2);align-items:center;padding:var(--s2) var(--s3);border-bottom:1px solid var(--line)}
|
|
13
|
+
.idmark{flex:none;width:28px;height:28px;border-radius:50%;object-fit:cover}
|
|
14
|
+
.idini{display:grid;place-items:center;background:var(--idc,var(--dim));color:var(--bg);font-weight:700;font-size:13px}
|
|
15
|
+
.idtitle{min-width:0;display:flex;flex-direction:column}
|
|
16
|
+
.idtitle b{font-size:13px}
|
|
17
|
+
.idtitle .iddim{font-size:11.5px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
|
18
|
+
.iddim{color:var(--dim)}
|
|
19
|
+
.idnote{margin-bottom:var(--s2);font-size:12px}
|
|
20
|
+
/* a band's title over its rows, the tree's rule between them */
|
|
21
|
+
.idband{display:flex;align-items:center;gap:var(--s1);height:24px;margin-top:var(--s2);padding:0 var(--s3);font-size:11px;color:var(--dim);box-shadow:inset 0 1px 0 var(--line)}
|
|
22
|
+
.idband span{margin-left:auto;font-variant-numeric:tabular-nums}
|
|
23
|
+
/* every row in the tree's shape (hub.css .tsec): 26px, its 16px icon, the name, what it carries at its end */
|
|
24
|
+
.idrows{display:flex;flex-direction:column;padding-top:var(--s1)}
|
|
25
|
+
.idrow{display:flex;align-items:center;gap:var(--s2);height:26px;padding:0 var(--s3);color:var(--dim);font-size:13px;text-decoration:none;white-space:nowrap;min-width:0;cursor:pointer}
|
|
26
|
+
.idrow .hico{flex:none;width:16px;height:16px}
|
|
27
|
+
.idrow:hover{background:var(--panel2);color:var(--ink)}
|
|
28
|
+
.idrow.on{background:var(--sel);color:var(--ink);box-shadow:inset 3px 0 0 var(--idc,var(--accent));font-weight:600}
|
|
29
|
+
.idrow.off .idname{opacity:.6}
|
|
30
|
+
.idname{flex:none;max-width:50%;overflow:hidden;text-overflow:ellipsis}
|
|
31
|
+
.idrow .iddim{font-size:11.5px;font-weight:400}
|
|
32
|
+
.idgrow{flex:1;min-width:0}
|
|
33
|
+
/* an account's messages to post, the tree's count badge; its state a dot: green online, a ring still to create */
|
|
34
|
+
.idnum{flex:none;min-width:16px;height:16px;padding:0 var(--s1);border-radius:8px;font-size:10px;line-height:16px;text-align:center;color:var(--dim);background:var(--panel2)}
|
|
35
|
+
.iddot{flex:none;width:7px;height:7px;border-radius:50%;box-shadow:inset 0 0 0 1px var(--dim)}
|
|
36
|
+
.iddot.live{background:var(--ok);box-shadow:none}
|
|
37
|
+
.idpage{display:flex;flex-direction:column;gap:var(--s3)}
|
|
38
|
+
.idfacts{display:grid;grid-template-columns:72px 1fr;gap:var(--s1) var(--s3);margin:var(--s3) 0;font-size:12.5px}
|
|
39
|
+
.idfacts dt{color:var(--dim)}
|
|
40
|
+
.idfacts dd{margin:0;min-width:0}
|
|
41
|
+
.idfacts a,.idpage .idrow{color:var(--accent);text-decoration:none}
|
|
42
|
+
.iddata{width:100%;table-layout:fixed;border-collapse:collapse;font-size:12px}
|
|
43
|
+
.iddata td{padding:var(--s0) var(--s1);border-top:1px solid var(--line);vertical-align:middle}
|
|
44
|
+
.idwhat{width:38%}
|
|
45
|
+
.idpath code{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:11.5px}
|
|
46
|
+
.idopen{width:132px;text-align:right;white-space:nowrap}
|
|
47
|
+
.idopen button{height:20px;padding:0 var(--s2);font-size:11px}
|
|
48
|
+
.idpage a.so-placerow{color:var(--ink);text-decoration:none}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// the address of the home's identity view (wiki build/shipkit/social.md, Identities): `/identities#<id>[/<part>[/<place>]]`,
|
|
2
|
+
// the part a section (`@legal`, `@veille`, `@site`) or an account, the place one of that account's; no part, the profile.
|
|
3
|
+
// And the rows of its list, in the order the arrows walk them
|
|
4
|
+
import type { MachineIdentity } from '../../identities/machine-route.ts'
|
|
5
|
+
|
|
6
|
+
const IDENTITIES_PATH = '/identities'
|
|
7
|
+
|
|
8
|
+
/** the sections of an identity beside its accounts; the profile is the identity alone */
|
|
9
|
+
const SECTIONS = ['@legal', '@veille', '@site'] as const
|
|
10
|
+
type Section = (typeof SECTIONS)[number]
|
|
11
|
+
const LEGAL_PART: Section = '@legal'
|
|
12
|
+
|
|
13
|
+
export type IdentitySel = { id: string | null; part: string | null; place: string | null }
|
|
14
|
+
|
|
15
|
+
export const isSection = (part: string | null): part is Section => SECTIONS.includes(part as Section)
|
|
16
|
+
|
|
17
|
+
/** the hash of a pick, empty for the view with nothing picked */
|
|
18
|
+
export function identityHash(s: IdentitySel): string {
|
|
19
|
+
if (s.id == null) return ''
|
|
20
|
+
const parts = [s.id, ...(s.part == null ? [] : [s.part]), ...(s.part != null && !isSection(s.part) && s.place != null ? [s.place] : [])]
|
|
21
|
+
return `#${parts.join('/')}`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** a hash read back; a word the view does not know is left to the view, which shows it is gone */
|
|
25
|
+
export function parseIdentityHash(hash: string): IdentitySel {
|
|
26
|
+
const [id = '', part = '', place = ''] = hash.replace(/^#/, '').split('/').map((x) => decodeURIComponent(x))
|
|
27
|
+
return { id: id === '' ? null : id, part: id === '' || part === '' ? null : part, place: part === '' || place === '' || isSection(part) ? null : place }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const identityAddress = (s: IdentitySel): string => `${IDENTITIES_PATH}${identityHash(s)}`
|
|
31
|
+
|
|
32
|
+
/** a row of the view's list, in the order the arrows walk it (list-walk.ts): the sections, each account, each repo.
|
|
33
|
+
* A row opens its part in place, a repo row leaves for that repo's Social page */
|
|
34
|
+
export type IdentityRow = { key: string; depth: 0; dir: false; block: 'sections' | 'accounts' | 'repos'; part: string | null; repo: string | null; words: string }
|
|
35
|
+
|
|
36
|
+
type Listed = Pick<MachineIdentity, 'site' | 'repos'> & { accounts: readonly Pick<MachineIdentity['accounts'][number], 'id' | 'name' | 'handle'>[] }
|
|
37
|
+
|
|
38
|
+
/** every row of an identity, the company only when it has one; `q` keeps the rows whose words hold it, as the repo
|
|
39
|
+
* tree's filter does */
|
|
40
|
+
export function identityRows(i: Listed, company: boolean, q = ''): IdentityRow[] {
|
|
41
|
+
const row = (block: IdentityRow['block'], key: string, part: string | null, repo: string | null, words: string): IdentityRow => ({ key, depth: 0, dir: false, block, part, repo, words: words.toLowerCase() })
|
|
42
|
+
const all = [
|
|
43
|
+
row('sections', 's:profile', null, null, 'profile'),
|
|
44
|
+
...(company ? [row('sections', `s:${LEGAL_PART}`, LEGAL_PART, null, 'company legal')] : []),
|
|
45
|
+
row('sections', 's:@veille', '@veille', null, 'veille'),
|
|
46
|
+
row('sections', 's:@site', '@site', null, `site ${i.site}`),
|
|
47
|
+
...i.accounts.map((a) => row('accounts', `a:${a.id}`, a.id, null, `${a.id} ${a.name} ${a.handle}`)),
|
|
48
|
+
...i.repos.map((r) => row('repos', `r:${r}`, null, r, r)),
|
|
49
|
+
]
|
|
50
|
+
const k = q.trim().toLowerCase()
|
|
51
|
+
return k === '' ? all : all.filter((r) => r.words.includes(k))
|
|
52
|
+
}
|
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
// the one constraint a reader breaks first: the address and the open item move together, through HomeSt.show; `open`
|
|
7
7
|
// only says which item the address names
|
|
8
8
|
import { makeAutoObservable, observableRef, runInAction } from 'mobx'
|
|
9
|
-
import { INBOX_PAGE, openOf, type InboxAnswer, type InboxRow } from '../../home/inbox-shape.ts'
|
|
10
|
-
import { etagLoader } from './review/review-kit.ts'
|
|
9
|
+
import { groupRows, INBOX_GROUPS, INBOX_PAGE, openOf, type InboxAnswer, type InboxGroup, type InboxGroupNode, type InboxRow, type InboxShow } from '../../home/inbox-shape.ts'
|
|
10
|
+
import { etagLoader, kept, type EtagLoader } from './review/review-kit.ts'
|
|
11
11
|
import { ownTrouble } from './reach.ts'
|
|
12
12
|
import { ClockSvc } from './clock-svc.ts'
|
|
13
13
|
import type { HomeSt } from './home-st.ts'
|
|
14
14
|
|
|
15
15
|
const POLL_MS = 4000
|
|
16
|
+
const PREFS = 'shipkit.inbox.prefs'
|
|
16
17
|
|
|
17
18
|
/** below this width the inbox is the phone's: one pane at a time, the list or the item */
|
|
18
19
|
export const INBOX_PHONE_PX = 768
|
|
@@ -23,6 +24,10 @@ export class InboxSt {
|
|
|
23
24
|
error = ''
|
|
24
25
|
/** the rows asked of the main list: a page more on « more » */
|
|
25
26
|
shown = INBOX_PAGE
|
|
27
|
+
/** the review cards only, or every kind */
|
|
28
|
+
show: InboxShow = 'cards'
|
|
29
|
+
/** what the rows group by, each on its own */
|
|
30
|
+
groupBy: InboxGroup[] = []
|
|
26
31
|
/** the folded list unfolded: read while it is */
|
|
27
32
|
yellowOpen = false
|
|
28
33
|
/** the item the address names */
|
|
@@ -32,15 +37,25 @@ export class InboxSt {
|
|
|
32
37
|
/** every row's age reads it, ticking while the page shows */
|
|
33
38
|
readonly clock = new ClockSvc()
|
|
34
39
|
private timer: ReturnType<typeof setInterval> | null = null
|
|
35
|
-
private readonly loadMain:
|
|
36
|
-
private readonly loadYellow:
|
|
40
|
+
private readonly loadMain: EtagLoader<InboxAnswer>
|
|
41
|
+
private readonly loadYellow: EtagLoader<InboxAnswer>
|
|
37
42
|
private readonly onVisible = (): void => {
|
|
38
43
|
if (document.visibilityState === 'visible' && this.timer != null) void this.poll()
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
constructor(private readonly home: HomeSt) {
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
try {
|
|
48
|
+
const p = JSON.parse(kept.get(PREFS) ?? '{}') as { show?: string; groupBy?: string[] }
|
|
49
|
+
if (p.show === 'all') this.show = 'all'
|
|
50
|
+
this.groupBy = INBOX_GROUPS.filter((g) => p.groupBy?.includes(g))
|
|
51
|
+
} catch {
|
|
52
|
+
// a broken pref is the default
|
|
53
|
+
}
|
|
54
|
+
// the last lists drawn in the first frame: the daemon answers after, and only what moved draws again
|
|
55
|
+
this.loadMain = etagLoader(() => `/api/inbox?show=${this.show}&limit=${this.shown}`, { keep: 'inbox.main' })
|
|
56
|
+
this.loadYellow = etagLoader(() => `/api/inbox?show=${this.show}&list=yellow&limit=500`, { keep: 'inbox.yellow' })
|
|
57
|
+
this.page = this.loadMain.held()
|
|
58
|
+
this.yellowPage = this.loadYellow.held()
|
|
44
59
|
makeAutoObservable<this, 'home' | 'timer' | 'loadMain' | 'loadYellow' | 'onVisible'>(this, { home: false, timer: false, loadMain: false, loadYellow: false, onVisible: false, clock: false, page: observableRef, yellowPage: observableRef })
|
|
45
60
|
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
|
|
46
61
|
const mq = window.matchMedia(`(max-width: ${INBOX_PHONE_PX - 1}px)`)
|
|
@@ -57,6 +72,24 @@ export class InboxSt {
|
|
|
57
72
|
return this.yellowPage?.rows ?? []
|
|
58
73
|
}
|
|
59
74
|
|
|
75
|
+
/** the main list as it draws: one group of every row, or nested by what is on */
|
|
76
|
+
get groups(): InboxGroupNode[] {
|
|
77
|
+
return groupRows(this.rows, this.groupBy)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get yellowGroups(): InboxGroupNode[] {
|
|
81
|
+
return groupRows(this.yellowRows, this.groupBy)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** what « all » would show beside the cards, both lists */
|
|
85
|
+
get allCount(): number {
|
|
86
|
+
return (this.page?.all?.main ?? 0) + (this.page?.all?.yellow ?? 0)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
get cardCount(): number {
|
|
90
|
+
return this.show === 'cards' ? this.count + this.yellowCount : 0
|
|
91
|
+
}
|
|
92
|
+
|
|
60
93
|
get count(): number {
|
|
61
94
|
return this.page?.counts.main ?? 0
|
|
62
95
|
}
|
|
@@ -120,6 +153,26 @@ export class InboxSt {
|
|
|
120
153
|
])
|
|
121
154
|
}
|
|
122
155
|
|
|
156
|
+
setShow(s: InboxShow): void {
|
|
157
|
+
if (this.show === s) return
|
|
158
|
+
this.show = s
|
|
159
|
+
this.shown = INBOX_PAGE
|
|
160
|
+
// the kept answer of the other mode, if any, draws at once
|
|
161
|
+
this.page = this.loadMain.held()
|
|
162
|
+
this.yellowPage = this.loadYellow.held()
|
|
163
|
+
this.save()
|
|
164
|
+
void this.poll()
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
toggleGroup(g: InboxGroup): void {
|
|
168
|
+
this.groupBy = this.groupBy.includes(g) ? this.groupBy.filter((x) => x !== g) : INBOX_GROUPS.filter((x) => x === g || this.groupBy.includes(x))
|
|
169
|
+
this.save()
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private save(): void {
|
|
173
|
+
kept.put(PREFS, JSON.stringify({ show: this.show, groupBy: this.groupBy }))
|
|
174
|
+
}
|
|
175
|
+
|
|
123
176
|
showMore(): void {
|
|
124
177
|
if (this.more === 0) return
|
|
125
178
|
this.shown += INBOX_PAGE
|