rvlib-shipkit 2.12.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/CHANGELOG.md +75 -21
  2. package/README.md +1 -1
  3. package/package.json +4 -2
  4. package/src/agent-time/store.ts +2 -2
  5. package/src/assets/run-assets.ts +2 -2
  6. package/src/assets/server/studio-server.ts +27 -23
  7. package/src/check.ts +4 -4
  8. package/src/checks/SK001-package-json-shape.check.ts +8 -4
  9. package/src/checks/SK002-contracts-fulfillness.check.ts +2 -2
  10. package/src/checks/SK003-claude-md-shape.check.ts +20 -13
  11. package/src/checks/SK004-gitignore-policy.check.ts +45 -6
  12. package/src/checks/SK005-rvlib-versions.check.ts +2 -2
  13. package/src/checks/SK006-npm-publish-safety.check.ts +3 -3
  14. package/src/checks/SK007-github-visibility.check.ts +2 -2
  15. package/src/checks/SK008-reviewer-agent.check.ts +3 -3
  16. package/src/checks/SK010-undeclared-unit.check.ts +2 -2
  17. package/src/checks/SK011-sibling-unit-ranges.check.ts +2 -2
  18. package/src/checks/SK012-config-barrel-import.check.ts +2 -2
  19. package/src/checks/SK013-one-way-in-policy.check.ts +2 -2
  20. package/src/checks/SK015-nested-repo.check.ts +3 -3
  21. package/src/checks/SK016-legacy-check-shapes.check.ts +2 -2
  22. package/src/checks/SK017-vscode-hub-task.check.ts +2 -2
  23. package/src/checks/SK018-test-files-run.check.ts +2 -2
  24. package/src/checks/SK019-tests-run-in-units.check.ts +2 -2
  25. package/src/checks/SK020-self-spawning-check.check.ts +2 -2
  26. package/src/checks/SK022-machine-runs-the-pin.check.ts +2 -2
  27. package/src/checks/SK024-identity-colors.check.ts +1 -1
  28. package/src/checks/SK025-release-drift.check.ts +2 -2
  29. package/src/checks/SK026-asks-autoclose.check.ts +2 -2
  30. package/src/checks/SK027-agent-wiki-links.check.ts +8 -2
  31. package/src/checks/SK028-readme.check.ts +2 -2
  32. package/src/checks/SK029-explicit-check-files.check.ts +3 -3
  33. package/src/checks/SK030-cache-audit.check.ts +7 -5
  34. package/src/checks/SK031-trace-audit.check.ts +7 -7
  35. package/src/checks/SK032-ignored-inputs.check.ts +3 -3
  36. package/src/checks/SK033-global-contribution.check.ts +11 -4
  37. package/src/checks/SK034-commit-gates-armed.check.ts +2 -2
  38. package/src/checks/SK035-public-clean.check.ts +46 -0
  39. package/src/checks/SK036-draft-media-size.check.ts +28 -0
  40. package/src/checks/SK037-keyword-additions.check.ts +43 -0
  41. package/src/cli/cmd_Backup.ts +152 -0
  42. package/src/cli/cmd_Ci.ts +8 -11
  43. package/src/cli/cmd_Commands.ts +4 -4
  44. package/src/cli/cmd_ConfigKeys.ts +2 -2
  45. package/src/cli/cmd_Drill.ts +145 -0
  46. package/src/cli/cmd_Home.ts +50 -3
  47. package/src/cli/cmd_Init.ts +1 -1
  48. package/src/cli/cmd_Media.ts +10 -8
  49. package/src/cli/cmd_Mv.ts +14 -7
  50. package/src/cli/cmd_Review.ts +6 -4
  51. package/src/cli/cmd_Shot.ts +5 -2
  52. package/src/cli/cmd_Smoke.ts +5 -2
  53. package/src/cli/cmd_Social.ts +226 -0
  54. package/src/cli/cmd_Sound.ts +1 -1
  55. package/src/cli/cmd_Start.ts +1 -1
  56. package/src/cli/cmd_Time.ts +1 -1
  57. package/src/cli/cmd_TraceAudit.ts +6 -6
  58. package/src/cli/cmd_Trailer.ts +7 -4
  59. package/src/cli/cmd_Veille.ts +173 -0
  60. package/src/cli/cmd_When.ts +2 -2
  61. package/src/cli/family-pages.ts +19 -16
  62. package/src/cli/registry.ts +13 -2
  63. package/src/cli.ts +5 -2
  64. package/src/collections/actions.ts +1 -49
  65. package/src/collections/checks.ts +2 -1
  66. package/src/collections/collection-types.ts +12 -3
  67. package/src/collections/providers.ts +4 -4
  68. package/src/collections/review.ts +3 -2
  69. package/src/collections/tests.ts +19 -8
  70. package/src/comfy/comfy-panel.ts +2 -2
  71. package/src/contracts/apply-contracts.ts +1 -3
  72. package/src/contracts/contract-manifests.ts +2 -3
  73. package/src/contracts/contract-types.ts +0 -1
  74. package/src/contracts/contracts-engine.ts +0 -3
  75. package/src/contracts/manifests/discord.contract.ts +1 -1
  76. package/src/contracts/manifests/identity.contract.ts +1 -1
  77. package/src/contracts/manifests/itch.contract.ts +1 -1
  78. package/src/contracts/manifests/steam.contract.ts +1 -1
  79. package/src/core/agent-dir-at.ts +12 -0
  80. package/src/core/agent-dir.ts +16 -0
  81. package/src/core/app-icon.ts +9 -3
  82. package/src/core/budget.ts +1 -1
  83. package/src/core/bun-builtins.ts +2 -2
  84. package/src/core/canonical-scripts.ts +2 -2
  85. package/src/core/discover-checks.ts +38 -6
  86. package/src/core/fix-scope.ts +4 -2
  87. package/src/core/floor-resolve.ts +68 -48
  88. package/src/core/floor.ts +9 -0
  89. package/src/core/git-root.ts +24 -0
  90. package/src/core/global-contribution.ts +4 -1
  91. package/src/core/ignored-block.ts +1 -1
  92. package/src/core/ignored-inputs.ts +3 -2
  93. package/src/core/last-good.ts +3 -1
  94. package/src/core/layout.ts +8 -0
  95. package/src/core/log-stamp.ts +36 -0
  96. package/src/core/loop-watch.ts +93 -0
  97. package/src/core/machine-link.ts +134 -0
  98. package/src/core/memory-watch.ts +41 -0
  99. package/src/core/motherhome.ts +2 -2
  100. package/src/core/one-way-in-policy.ts +34 -26
  101. package/src/core/run-ci.ts +9 -11
  102. package/src/core/run-fixers.ts +9 -9
  103. package/src/core/runs-matrix.ts +1 -1
  104. package/src/core/slots.ts +30 -0
  105. package/src/core/trace-audit.ts +50 -9
  106. package/src/core/tree-rev.ts +60 -0
  107. package/src/core/unit-files.ts +42 -0
  108. package/src/drill/render.ts +140 -0
  109. package/src/drill/run.ts +269 -0
  110. package/src/fleet/scan-fleet.ts +6 -5
  111. package/src/home/daemon-jobs.ts +201 -0
  112. package/src/home/global-context.ts +44 -8
  113. package/src/home/gui-app/ShipkitGui.swift +91 -2
  114. package/src/home/home-routes.ts +22 -15
  115. package/src/home/hubs.ts +10 -3
  116. package/src/home/inbox-shape.ts +54 -5
  117. package/src/home/inbox.ts +17 -2
  118. package/src/home/lib-watch.ts +10 -3
  119. package/src/home/machine-stores.ts +15 -29
  120. package/src/home/pm-config.ts +4 -1
  121. package/src/home/pm-inputs.ts +2 -0
  122. package/src/home/resources.ts +7 -2
  123. package/src/home/run-daemon.ts +15 -18
  124. package/src/home/run-pm.ts +3 -1
  125. package/src/home/serve-daemon.ts +4 -3
  126. package/src/home/serve-web.ts +104 -1
  127. package/src/hooks/commit-message.ts +29 -20
  128. package/src/hooks/hook-gates.ts +1 -1
  129. package/src/hooks/leak-guard.ts +69 -9
  130. package/src/hooks/run-hooks.ts +18 -22
  131. package/src/identities/identities.ts +334 -0
  132. package/src/identities/machine-route.ts +126 -0
  133. package/src/identities/machine.ts +62 -0
  134. package/src/init-repo.ts +3 -3
  135. package/src/ledger/check-stats.ts +10 -9
  136. package/src/ledger/gate-checks.ts +32 -1
  137. package/src/ledger/record-kept.ts +112 -0
  138. package/src/ledger/repo-view.ts +10 -0
  139. package/src/ledger/run-log.ts +17 -12
  140. package/src/ledger/run-timeline.ts +8 -4
  141. package/src/ledger/store.ts +7 -0
  142. package/src/ledger/suite-log.ts +17 -13
  143. package/src/media-kinds.ts +3 -2
  144. package/src/media-store/backup/daemon.ts +73 -0
  145. package/src/media-store/backup/keys.ts +25 -0
  146. package/src/media-store/backup/manifest.ts +193 -0
  147. package/src/media-store/backup/restore.ts +192 -0
  148. package/src/media-store/backup/run.ts +278 -0
  149. package/src/media-store/backup/secret.ts +86 -0
  150. package/src/media-store/backup/snapshot.ts +64 -0
  151. package/src/media-store/backup/sources.ts +199 -0
  152. package/src/media-store/content.ts +1 -1
  153. package/src/media-store/daemon.ts +56 -70
  154. package/src/media-store/db.ts +1 -1
  155. package/src/media-store/fact.ts +1 -1
  156. package/src/media-store/hand.ts +1 -1
  157. package/src/media-store/kind.ts +1 -1
  158. package/src/media-store/purge.ts +1 -1
  159. package/src/media-store/put.ts +5 -3
  160. package/src/media-store/remote.ts +1 -1
  161. package/src/media-store/space.ts +24 -5
  162. package/src/mv/mv-md.ts +63 -22
  163. package/src/pages/forward.ts +35 -0
  164. package/src/pages/frame-client.ts +118 -0
  165. package/src/pages/routes.ts +29 -0
  166. package/src/pages/unit.ts +92 -0
  167. package/src/plan/planner.ts +12 -0
  168. package/src/plan/repo-source.ts +19 -5
  169. package/src/reflect/transcript.ts +35 -10
  170. package/src/release/public-clean.ts +319 -0
  171. package/src/release/published-here.ts +22 -0
  172. package/src/release/run-bump.ts +3 -2
  173. package/src/release/run-release.ts +7 -4
  174. package/src/repo-config.ts +71 -13
  175. package/src/review/anim.ts +1 -1
  176. package/src/review/auto.ts +1 -1
  177. package/src/review/cells.ts +15 -1
  178. package/src/review/format.ts +2 -2
  179. package/src/review/http.ts +16 -2
  180. package/src/review/marks.ts +1 -1
  181. package/src/review/media-kind.ts +1 -1
  182. package/src/review/media-read.ts +1 -1
  183. package/src/review/model.ts +27 -6
  184. package/src/review/notes.ts +125 -0
  185. package/src/review/previews.ts +1 -1
  186. package/src/review/project.ts +7 -39
  187. package/src/review/role.ts +1 -1
  188. package/src/review/routes.ts +18 -14
  189. package/src/review/store.ts +42 -2
  190. package/src/review/threads.ts +1 -1
  191. package/src/review/trailer-desk.ts +3 -3
  192. package/src/review/trailer-media.ts +8 -5
  193. package/src/review/trailer-model.ts +1 -1
  194. package/src/review/trailer-routes.ts +1 -1
  195. package/src/review/trailer-shots.ts +22 -5
  196. package/src/review/unit.ts +2 -2
  197. package/src/scaffold/files/agent-handoff.md +3 -0
  198. package/src/scaffold/files/agent-index.md +4 -12
  199. package/src/scaffold/files/tsconfig.json +1 -1
  200. package/src/scaffold/project-scaffold.ts +6 -5
  201. package/src/serve/embed.ts +2 -2
  202. package/src/serve/hub-app/check-words.ts +1 -1
  203. package/src/serve/hub-app/col-card.tsx +3 -17
  204. package/src/serve/hub-app/col-tables-view.tsx +2 -1
  205. package/src/serve/hub-app/cols-svc.ts +0 -13
  206. package/src/serve/hub-app/dock-st.ts +4 -2
  207. package/src/serve/hub-app/dock-view.tsx +2 -0
  208. package/src/serve/hub-app/frames-st.ts +35 -0
  209. package/src/serve/hub-app/hash-route.ts +64 -1
  210. package/src/serve/hub-app/home-st.ts +32 -8
  211. package/src/serve/hub-app/home-strip.css +9 -1
  212. package/src/serve/hub-app/home-strip.tsx +7 -6
  213. package/src/serve/hub-app/home.html +5 -0
  214. package/src/serve/hub-app/hub-app.tsx +51 -7
  215. package/src/serve/hub-app/hub.css +29 -11
  216. package/src/serve/hub-app/icons.tsx +16 -1
  217. package/src/serve/hub-app/identities-st.ts +210 -0
  218. package/src/serve/hub-app/identities-view.tsx +353 -0
  219. package/src/serve/hub-app/identities.css +48 -0
  220. package/src/serve/hub-app/identity-address.ts +52 -0
  221. package/src/serve/hub-app/inbox-st.ts +60 -7
  222. package/src/serve/hub-app/inbox-view.tsx +49 -7
  223. package/src/serve/hub-app/inbox.css +12 -1
  224. package/src/serve/hub-app/index.html +3 -0
  225. package/src/serve/hub-app/kept-cols.tsx +30 -0
  226. package/src/serve/hub-app/keys.ts +10 -2
  227. package/src/serve/hub-app/list-walk.ts +89 -0
  228. package/src/serve/hub-app/machine-st.ts +12 -0
  229. package/src/serve/hub-app/media-svc.ts +1 -1
  230. package/src/serve/hub-app/media-view.tsx +2 -1
  231. package/src/serve/hub-app/pages-frames.tsx +134 -0
  232. package/src/serve/hub-app/pages-svc.ts +111 -0
  233. package/src/serve/hub-app/palette-st.ts +18 -3
  234. package/src/serve/hub-app/palette-view.tsx +9 -2
  235. package/src/serve/hub-app/planned-view.tsx +2 -1
  236. package/src/serve/hub-app/project-list.css +18 -14
  237. package/src/serve/hub-app/project-list.tsx +88 -49
  238. package/src/serve/hub-app/projects-svc.ts +33 -3
  239. package/src/serve/hub-app/repo-sections.ts +19 -2
  240. package/src/serve/hub-app/repo-st.ts +76 -20
  241. package/src/serve/hub-app/review/review-board.tsx +1 -1
  242. package/src/serve/hub-app/review/review-cells.tsx +6 -5
  243. package/src/serve/hub-app/review/review-kit.ts +30 -7
  244. package/src/serve/hub-app/review/review-page.tsx +6 -5
  245. package/src/serve/hub-app/review/review-st.ts +34 -15
  246. package/src/serve/hub-app/review/review-thread.tsx +63 -14
  247. package/src/serve/hub-app/review/review-views.tsx +133 -51
  248. package/src/serve/hub-app/review/thread-st.ts +80 -37
  249. package/src/serve/hub-app/review/trailer-page.tsx +7 -5
  250. package/src/serve/hub-app/review/trailer-st.ts +1 -1
  251. package/src/serve/hub-app/review.css +26 -9
  252. package/src/serve/hub-app/site/site-part.tsx +173 -0
  253. package/src/serve/hub-app/site/site-st.ts +157 -0
  254. package/src/serve/hub-app/site.css +35 -0
  255. package/src/serve/hub-app/social/calendar.tsx +182 -0
  256. package/src/serve/hub-app/social/comms-page.tsx +330 -0
  257. package/src/serve/hub-app/social/kit.tsx +244 -0
  258. package/src/serve/hub-app/social/post-card.tsx +456 -0
  259. package/src/serve/hub-app/social/problems.tsx +60 -0
  260. package/src/serve/hub-app/social/social-model.ts +154 -0
  261. package/src/serve/hub-app/social/social-page.tsx +681 -0
  262. package/src/serve/hub-app/social/social-st.ts +1014 -0
  263. package/src/serve/hub-app/social.css +289 -0
  264. package/src/serve/hub-app/stores/stores-page.tsx +312 -0
  265. package/src/serve/hub-app/stores/stores-st.ts +286 -0
  266. package/src/serve/hub-app/stores.css +54 -0
  267. package/src/serve/hub-app/timeline-geometry.ts +1 -1
  268. package/src/serve/hub-app/timeline-view.tsx +3 -2
  269. package/src/serve/hub-app/tree-build.ts +6 -0
  270. package/src/serve/hub-app/tree-row.tsx +27 -4
  271. package/src/serve/hub-app/tree-svc.ts +18 -49
  272. package/src/serve/hub-app/veille/veille-page.tsx +515 -0
  273. package/src/serve/hub-app/veille/veille-st.ts +443 -0
  274. package/src/serve/hub-app/veille.css +84 -0
  275. package/src/serve/hub-runtime.ts +20 -11
  276. package/src/serve/project-gutter-route.ts +44 -12
  277. package/src/serve/run-lanes.ts +7 -4
  278. package/src/serve/same-origin.ts +1 -1
  279. package/src/serve/serve-hub.ts +20 -12
  280. package/src/serve/tracked-watch.ts +24 -3
  281. package/src/serve/warm-cell.ts +5 -1
  282. package/src/shipkit-files.ts +15 -4
  283. package/src/shipkit.ts +0 -1
  284. package/src/shot/box.ts +160 -0
  285. package/src/shot/browser-slot.ts +74 -0
  286. package/src/shot/client.ts +42 -7
  287. package/src/shot/clip-encoder.ts +108 -24
  288. package/src/shot/film-box.ts +292 -0
  289. package/src/shot/shooter.ts +71 -17
  290. package/src/shot/shot-ask.ts +10 -2
  291. package/src/shot/stepped-clip.ts +5 -4
  292. package/src/site/desk.ts +242 -0
  293. package/src/site/routes.ts +66 -0
  294. package/src/site/unit.ts +62 -0
  295. package/src/social/brands.ts +22 -0
  296. package/src/social/card-drafts.ts +24 -0
  297. package/src/social/compose.ts +97 -0
  298. package/src/social/desk-index.ts +123 -0
  299. package/src/social/desk-wire.ts +64 -0
  300. package/src/social/drafts.ts +183 -0
  301. package/src/social/house.ts +24 -0
  302. package/src/social/load.ts +332 -0
  303. package/src/social/md.ts +70 -0
  304. package/src/social/media-facts.ts +53 -0
  305. package/src/social/media-kind.ts +189 -0
  306. package/src/social/media-limit.ts +42 -0
  307. package/src/social/media-of.ts +30 -0
  308. package/src/social/migrate.ts +123 -0
  309. package/src/social/open.ts +17 -0
  310. package/src/social/post-url.ts +158 -0
  311. package/src/social/presence.ts +332 -0
  312. package/src/social/public-read.ts +53 -0
  313. package/src/social/publish/bluesky.ts +168 -0
  314. package/src/social/publish/discord.ts +76 -0
  315. package/src/social/publish/index.ts +24 -0
  316. package/src/social/publish/secret.ts +13 -0
  317. package/src/social/push.ts +37 -0
  318. package/src/social/richtext.ts +37 -0
  319. package/src/social/routes.ts +186 -0
  320. package/src/social/stats.ts +134 -0
  321. package/src/social/text.ts +267 -0
  322. package/src/social/tracker-route.ts +39 -0
  323. package/src/social/tracker.ts +255 -0
  324. package/src/social/unit.ts +53 -0
  325. package/src/social/writes.ts +130 -0
  326. package/src/start-repo.ts +14 -9
  327. package/src/stores/collection.ts +27 -0
  328. package/src/stores/desk.ts +336 -0
  329. package/src/stores/model.ts +187 -0
  330. package/src/stores/routes.ts +126 -0
  331. package/src/stores/unit.ts +57 -0
  332. package/src/suite/calibrate.ts +127 -0
  333. package/src/suite/core-counters.ts +91 -0
  334. package/src/suite/judge-suites.ts +95 -35
  335. package/src/suite/suite-cli.ts +44 -10
  336. package/src/suite/suite-cpu-preload.ts +34 -9
  337. package/src/trace/tracer.ts +12 -5
  338. package/src/trailer/adapter.ts +5 -1
  339. package/src/trailer/build.ts +45 -12
  340. package/src/trailer/ffmpeg.ts +11 -0
  341. package/src/trailer/footage.ts +30 -13
  342. package/src/trailer/grammar.ts +18 -2
  343. package/src/trailer/graph.ts +28 -6
  344. package/src/trailer/holes.ts +1 -1
  345. package/src/trailer/passage.ts +18 -6
  346. package/src/trailer/plan.ts +74 -3
  347. package/src/trailer/prune.ts +1 -1
  348. package/src/trailer/states.ts +1 -1
  349. package/src/trailer/stitch.ts +67 -26
  350. package/src/trailer/url.ts +1 -1
  351. package/src/trailer/versions.ts +24 -0
  352. package/src/trailer/words.ts +1 -1
  353. package/src/ts/gate-typecheck.ts +32 -0
  354. package/src/ts/typecheck-cli.ts +9 -11
  355. package/src/tui/run-tui.ts +1 -1
  356. package/src/tui/tui-app.tsx +0 -1
  357. package/src/tui/tui-store.ts +1 -1
  358. package/src/veille/asks.ts +155 -0
  359. package/src/veille/auto.ts +31 -0
  360. package/src/veille/batch.ts +27 -0
  361. package/src/veille/chrome.ts +127 -0
  362. package/src/veille/collection.ts +28 -0
  363. package/src/veille/desk.ts +242 -0
  364. package/src/veille/identity.ts +80 -0
  365. package/src/veille/import.ts +68 -0
  366. package/src/veille/log.ts +183 -0
  367. package/src/veille/platforms.ts +118 -0
  368. package/src/veille/reads.ts +66 -0
  369. package/src/veille/replied.ts +110 -0
  370. package/src/veille/routes.ts +185 -0
  371. package/src/veille/service.ts +81 -0
  372. package/src/veille/watch.ts +116 -0
  373. package/src/veille/worth.ts +46 -0
  374. package/src/wiki/scan-md.ts +18 -0
  375. package/src/collections/posts.ts +0 -142
  376. package/src/contracts/manifests/social.contract.ts +0 -20
  377. package/src/scaffold/files/agent-coding.md +0 -35
  378. package/src/ts/typecheck-cache.ts +0 -11
@@ -0,0 +1,681 @@
1
+ // a repo's Social page (`#page:social`, wiki tools/shipkit/social.md, The desks in the hub): the identity the repo
2
+ // speaks as on the left, open on its company and its accounts with their places; in the middle the identity, the
3
+ // company or the account (its head, what can be automated, its setup, its messages); on the right its pictures, its
4
+ // payouts, its profile or the place's rules. Its parts are the home's identity view too (identities-view.tsx). Green
5
+ // is only ever a link he pasted
6
+ import { observer } from 'mobx-react-lite'
7
+ import { useEffect, type CSSProperties } from 'react'
8
+ import { Panel, Separator } from 'react-resizable-panels'
9
+ import { KeptCols } from '../kept-cols.tsx'
10
+ import { plainClick } from '../home-st.ts'
11
+ import type { RepoSt } from '../repo-st.ts'
12
+ import { PANEL, PhoneTop } from '../review/review-page.tsx'
13
+ import { brandVar, CopyIcon, CopyRow, ErrorLine, Go, KeptFold, Lightbox, Logo, Md, MdInline, Toast } from './kit.tsx'
14
+ import { PostCard } from './post-card.tsx'
15
+ import { Problems } from './problems.tsx'
16
+ import { AUTOMATION, fileName, LEGAL, linksText, ME, type DeskAccount, type DeskIdentity, type Picture, type Place, type Row } from './social-model.ts'
17
+ import type { SocialSt } from './social-st.ts'
18
+
19
+ export const SocialPage = observer(({ app }: { app: RepoSt }) => {
20
+ const so = app.social
21
+ useEffect(() => {
22
+ so.start()
23
+ return () => so.stop()
24
+ }, [so])
25
+ if (so.phone)
26
+ return (
27
+ <div className="so-phone">
28
+ {so.phonePane === 'list' ? (
29
+ <>
30
+ <PhoneTop app={app} />
31
+ <IdentityList so={so} />
32
+ </>
33
+ ) : (
34
+ <>
35
+ <div className="rv-phonetop">
36
+ <button className="ghost" onClick={() => so.showPhoneList()}>
37
+ ◂ accounts
38
+ </button>
39
+ <b className="so-ellip">{so.currentAccount?.name ?? (so.onLegal ? 'company and legal' : so.socialIdentity?.name)}</b>
40
+ </div>
41
+ <Middle so={so} />
42
+ <Right so={so} />
43
+ </>
44
+ )}
45
+ <Lightbox so={so} />
46
+ <Toast so={so} />
47
+ </div>
48
+ )
49
+ return (
50
+ <div className="so-page">
51
+ <KeptCols id="social">
52
+ <Panel id="social-list" defaultSize="22%" minSize={240} className="rv-pane" style={PANEL}>
53
+ <IdentityList so={so} />
54
+ </Panel>
55
+ <Separator className="rsep" />
56
+ <Panel id="social-middle" defaultSize="44%" minSize={360} className="rv-pane" style={PANEL}>
57
+ <div className="rv-scroll so-ground">
58
+ <Middle so={so} />
59
+ </div>
60
+ </Panel>
61
+ <Separator className="rsep" />
62
+ <Panel id="social-right" defaultSize="34%" minSize={300} className="rv-pane" style={PANEL}>
63
+ <div className="rv-scroll so-ground">
64
+ <Right so={so} />
65
+ </div>
66
+ </Panel>
67
+ </KeptCols>
68
+ <Lightbox so={so} />
69
+ <Toast so={so} />
70
+ </div>
71
+ )
72
+ })
73
+
74
+
75
+ /** the identity the repo speaks as (or the one its address names): its card, its company and its accounts; every
76
+ * identity side by side is the home's identity view */
77
+ const IdentityList = observer(({ so }: { so: SocialSt }) => {
78
+ const picked = so.socialIdentity
79
+ return (
80
+ <div className="so-listcol">
81
+ <div className="so-filters">
82
+ <input ref={(el) => { so.searchEl = el }} className="rv-search" placeholder="search the accounts" value={so.accountQuery} onChange={(e) => so.setAccountQuery(e.currentTarget.value)} />
83
+ </div>
84
+ <Problems so={so} lines={[...(so.loadError ? [so.loadError] : []), ...so.errors]} />
85
+ <div className="rv-listscroll so-cards">
86
+ {!so.desk && !so.loadError ? <div className="rv-empty">{so.waitText}</div> : null}
87
+ {picked ? (
88
+ <>
89
+ <IdentityCard so={so} i={picked} on={so.onIdentity} open />
90
+ {so.homeLink(picked.id) == null ? null : (
91
+ <a className="rv-small so-small" href={so.homeLink(picked.id)!} title="every identity, each account its own page: the home's identities" onClick={(e) => {
92
+ if (!plainClick(e)) return
93
+ e.preventDefault()
94
+ so.openHome(picked.id)
95
+ }}>
96
+ every identity on the home ↗
97
+ </a>
98
+ )}
99
+ <Totals so={so} i={picked} />
100
+ {picked.legal ? <LegalCard so={so} i={picked} on={so.onLegal} /> : null}
101
+ {so.visibleAccounts(picked).map((a) => (
102
+ <AccountCard key={a.id} so={so} a={a} on={a.id === so.currentAccount?.id} />
103
+ ))}
104
+ </>
105
+ ) : null}
106
+ </div>
107
+ </div>
108
+ )
109
+ })
110
+
111
+ const Totals = observer(({ so, i }: { so: SocialSt; i: DeskIdentity }) => {
112
+ const t = so.identityTotals(i)
113
+ return (
114
+ <span className="rv-count so-totals">
115
+ {t.online}/{t.of} accounts online · {t.waiting} to post
116
+ </span>
117
+ )
118
+ })
119
+
120
+ const avatarOf = (i: DeskIdentity): Picture | null => {
121
+ const file = i.rows.find((r) => r.field === 'avatar')?.files[0]
122
+ return file ? (i.pictures.find((f) => f.file === file) ?? { file, w: null, h: null }) : null
123
+ }
124
+ const firstColour = (i: DeskIdentity): string | null => i.brand.find((r) => /^#[0-9a-f]{6}$/i.test(r.value))?.value ?? null
125
+
126
+ /** an identity's card: its avatar, its name, its bio's first words, the repo's own marked; a click picks it */
127
+ const IdentityCard = observer(({ so, i, on, open }: { so: SocialSt; i: DeskIdentity; on: boolean; open: boolean }) => {
128
+ const avatar = avatarOf(i)
129
+ const bio = i.rows.find((r) => r.field === 'bio')?.value ?? ''
130
+ const hex = firstColour(i)
131
+ const own = i.id === so.desk?.speaksAs
132
+ return (
133
+ <button className={`so-identity${on ? ' on' : ''}${open ? ' open' : ''}`} style={hex ? ({ '--brand': hex } as CSSProperties) : undefined} onClick={() => so.pickSocial(i.id)} title={own ? 'the identity this repo speaks as (speaksAs in repo.config.ts)' : `${i.name}: another identity of this machine`}>
134
+ {avatar ? <img className="so-avatar" src={so.pictureUrl(i.id, avatar.file)} alt="" /> : <span className="so-avatar so-initial">{i.name.slice(0, 1)}</span>}
135
+ <span className="so-identitytext">
136
+ <b className="so-identityname">
137
+ {i.name}
138
+ {own ? <span className="so-own">this repo</span> : null}
139
+ </b>
140
+ <span className="so-bio">{bio}</span>
141
+ </span>
142
+ </button>
143
+ )
144
+ })
145
+
146
+ /** the company card, first of the account cards and drawn like them: green once the company is registered */
147
+ const LegalCard = observer(({ so, i, on }: { so: SocialSt; i: DeskIdentity; on: boolean }) => {
148
+ const live = so.legalLive(i)
149
+ return (
150
+ <div className={`so-acard${live ? ' live' : ''}${on ? ' picked' : ''}`} style={{ '--brand': 'var(--k5)' } as CSSProperties}>
151
+ <button className={`so-ahead${on ? ' on' : ''}`} onClick={() => so.pickSocial(i.id, LEGAL)}>
152
+ <span className={`so-logo legal${live ? '' : ' muted'}`} style={{ width: 30, height: 30, borderRadius: 8 }}>
153
+ ⚖
154
+ </span>
155
+ <span className="so-atext">
156
+ <b className="so-ellip">Company and legal</b>
157
+ <span className="rv-dim rv-small so-ellip">{i.legal?.rows.length ?? 0} facts for the forms · payouts, taxes</span>
158
+ </span>
159
+ <span className={`so-badge ${live ? 't-ok solid' : 't-dim'}`}>{live ? 'online' : 'to create'}</span>
160
+ </button>
161
+ </div>
162
+ )
163
+ })
164
+
165
+ const AccountCard = observer(({ so, a, on }: { so: SocialSt; a: DeskAccount; on: boolean }) => {
166
+ const c = so.counts(a)
167
+ const live = a.live !== ''
168
+ const stats = so.statOf(a)
169
+ return (
170
+ <div className={`so-acard${live ? ' live' : ''}${on ? ' picked' : ''}`} style={brandVar(a.id)}>
171
+ <button className={`so-ahead${on && so.place === null ? ' on' : ''}`} onClick={() => so.pickSocial(a.identity, a.id)}>
172
+ <Logo id={a.id} name={a.name} size={30} muted={!live} />
173
+ <span className="so-atext">
174
+ <b className="so-ellip">{a.name}</b>
175
+ {a.handle ? <span className="rv-dim rv-small so-ellip">{a.handle}</span> : null}
176
+ {stats ? <span className="so-stats so-ellip">{stats}</span> : null}
177
+ {c.waiting > 0 || c.posted > 0 ? (
178
+ <span className="rv-dim rv-small">
179
+ {c.waiting} to post · {c.posted} posted
180
+ </span>
181
+ ) : null}
182
+ </span>
183
+ <span className={`so-badge ${live ? 't-ok solid' : 't-dim'}`}>{live ? 'online' : 'to create'}</span>
184
+ </button>
185
+ {a.places.length > 0 ? (
186
+ <>
187
+ <PlaceRow so={so} a={a} id={ME} name="my profile" when="" on={on} />
188
+ {a.places.map((x) => (
189
+ <PlaceRow key={x.id} so={so} a={a} id={x.id} name={x.name} when={x.when} on={on} />
190
+ ))}
191
+ </>
192
+ ) : null}
193
+ </div>
194
+ )
195
+ })
196
+
197
+ /** one place of the card: its dot, its name, its day, its messages */
198
+ const PlaceRow = observer(({ so, a, id, name, when, on }: { so: SocialSt; a: DeskAccount; id: string; name: string; when: string; on: boolean }) => {
199
+ const c = so.counts(a, id)
200
+ return (
201
+ <button className={`so-placerow${on && so.place === id ? ' on' : ''}`} onClick={() => so.pickSocial(a.identity, a.id, id)}>
202
+ <span className={`so-pdot${so.placeDone(a, id) ? ' done' : ''}`} />
203
+ <b className="so-ellip so-pname">{name}</b>
204
+ <span className="rv-dim so-ellip so-grow">{when}</span>
205
+ {c.waiting > 0 || c.posted > 0 ? <span className="rv-dim">{c.waiting > 0 ? `${c.waiting} to post` : `${c.posted} posted`}</span> : null}
206
+ </button>
207
+ )
208
+ })
209
+
210
+ const Middle = observer(({ so }: { so: SocialSt }) => {
211
+ const i = so.socialIdentity
212
+ if (!i) return <div className="rv-empty">{so.desk ? 'no identity: write .shipkit/identities/<id>/identity.md in the house repo' : so.loadError ?? so.waitText}</div>
213
+ if (so.onLegal) return <LegalPage so={so} i={i} />
214
+ const a = so.currentAccount
215
+ if (!a) return <IdentityPage so={so} i={i} />
216
+ return <AccountPage so={so} a={a} />
217
+ })
218
+
219
+ const Right = observer(({ so }: { so: SocialSt }) => {
220
+ const i = so.socialIdentity
221
+ if (!i) return null
222
+ if (so.onLegal) return <LegalPlatforms so={so} i={i} />
223
+ const a = so.currentAccount
224
+ if (!a) return <IdentityMedia so={so} i={i} />
225
+ const place = so.currentPlace
226
+ return place ? <PlacePane so={so} a={a} place={place} /> : <AccountProfile so={so} a={a} />
227
+ })
228
+
229
+ /** the middle of an identity: the shared rows, the brand, every account */
230
+ export const IdentityPage = observer(({ so, i }: { so: SocialSt; i: DeskIdentity }) => {
231
+ const colours = i.brand.filter((r) => /^#[0-9a-f]{6}$/i.test(r.value))
232
+ return (
233
+ <div className="so-colin">
234
+ <ErrorLine so={so} />
235
+ <h2 className="so-h so-big">
236
+ {i.name} <span className="rv-dim so-light">· the identity</span>
237
+ </h2>
238
+ <div className="so-meta">
239
+ {i.site ? (
240
+ <a href={i.site} target="_blank" rel="noreferrer">
241
+ {i.site} ↗
242
+ </a>
243
+ ) : null}
244
+ {i.siteRepo ? <span className="rv-dim">built by {i.siteRepo}</span> : null}
245
+ <a href={so.editorUrl(i.file)}>identity.md ↗</a>
246
+ </div>
247
+ <KeptFold so={so} card="identity/profile" title="The profile" flush>
248
+ {i.rows
249
+ .filter((r) => r.files.length === 0)
250
+ .map((r) => (
251
+ <CopyRow key={r.field} so={so} k={`${i.id}/row/${r.field}`} field={r.field} value={r.value} />
252
+ ))}
253
+ </KeptFold>
254
+ {i.brand.length > 0 ? (
255
+ <KeptFold so={so} card="identity/brand" title="The brand" flush>
256
+ {colours.length > 0 ? (
257
+ <div className="so-swatches">
258
+ {colours.map((r) => (
259
+ <button key={r.field} className="so-swatch" onClick={() => void so.copy(r.value, `${i.id}/brand/${r.field}`)} title="copy its hex">
260
+ <span className="so-swatchcolour" style={{ '--sw': r.value } as CSSProperties} />
261
+ <b className="rv-small">{r.field}</b>
262
+ <span className="rv-dim rv-small">{so.copiedKey === `${i.id}/brand/${r.field}` ? 'copied' : r.value}</span>
263
+ </button>
264
+ ))}
265
+ </div>
266
+ ) : null}
267
+ {i.brand
268
+ .filter((r) => !colours.includes(r))
269
+ .map((r) => (
270
+ <CopyRow key={r.field} so={so} k={`${i.id}/brand/${r.field}`} field={r.field} value={r.value} />
271
+ ))}
272
+ </KeptFold>
273
+ ) : null}
274
+ <KeptFold
275
+ so={so}
276
+ card="identity/accounts"
277
+ title="The accounts"
278
+ flush
279
+ right={
280
+ <button onClick={() => void so.copy(linksText(i.accounts), `${i.id}/links`)} title="every account online, a line each, to paste in another profile">
281
+ {so.copiedKey === `${i.id}/links` ? '✓ copied' : '⧉ copy the links'}
282
+ </button>
283
+ }
284
+ >
285
+ {i.accounts.map((a) => (
286
+ <div key={a.id} className="so-row">
287
+ <Logo id={a.id} name={a.name} size={22} muted={a.live === ''} />
288
+ <b className="so-rowname">{a.name}</b>
289
+ <span className="so-rowvalue so-ellip">{a.handle}</span>
290
+ <span className={`so-badge ${a.live ? 't-ok solid' : 't-dim'}`}>{a.live ? 'online' : 'to create'}</span>
291
+ {a.live ? <CopyIcon so={so} text={a.live} k={`${i.id}/link/${a.id}`} title="copy the link" /> : null}
292
+ {a.live || a.profile ? (
293
+ <a className="so-icon" href={a.live || a.profile} target="_blank" rel="noreferrer" title="open">
294
+ ↗
295
+ </a>
296
+ ) : null}
297
+ </div>
298
+ ))}
299
+ </KeptFold>
300
+ </div>
301
+ )
302
+ })
303
+
304
+ /** the right of an identity: the avatars in one row, the banners at full width, then its other pictures; each with its
305
+ * size, « copy » (the image on the clipboard) and « ⬇ » */
306
+ export const IdentityMedia = observer(({ so, i }: { so: SocialSt; i: DeskIdentity }) => {
307
+ const name = (f: Picture): string => fileName(f.file).replace(/\.\w+$/, '')
308
+ const avatars = i.pictures.filter((f) => name(f).startsWith('avatar-')).sort((a, b) => name(a).localeCompare(name(b)))
309
+ const banners = i.pictures.filter((f) => name(f).startsWith('banner-')).sort((a, b) => name(a).localeCompare(name(b)))
310
+ const rest = i.pictures.filter((f) => !avatars.includes(f) && !banners.includes(f))
311
+ if (i.pictures.length === 0) return <div className="rv-empty">no picture: `files` and `pictures` in {i.id}'s identity.md</div>
312
+ return (
313
+ <div className="so-colin">
314
+ {avatars.length > 0 ? (
315
+ <KeptFold so={so} card="identity/avatars" title="Avatars" right={<span className="rv-dim rv-small">{avatars.length}</span>}>
316
+ <div className="so-tiles">
317
+ {avatars.map((f) => (
318
+ <PictureTile key={f.file} so={so} i={i} f={f} width={112} />
319
+ ))}
320
+ </div>
321
+ </KeptFold>
322
+ ) : null}
323
+ {banners.length > 0 ? (
324
+ <KeptFold so={so} card="identity/banners" title="Banners" right={<span className="rv-dim rv-small">{banners.length}</span>}>
325
+ <div className="so-tilestack">
326
+ {banners.map((f) => (
327
+ <PictureTile key={f.file} so={so} i={i} f={f} />
328
+ ))}
329
+ </div>
330
+ </KeptFold>
331
+ ) : null}
332
+ {rest.length > 0 ? (
333
+ <KeptFold so={so} card="identity/files" title="The brand's pictures" right={<span className="rv-dim rv-small">{rest.length}</span>}>
334
+ <div className="so-tiles">
335
+ {rest.map((f) => (
336
+ <PictureTile key={f.file} so={so} i={i} f={f} width={200} />
337
+ ))}
338
+ </div>
339
+ </KeptFold>
340
+ ) : null}
341
+ </div>
342
+ )
343
+ })
344
+
345
+ /** what each screen shows of a 2560 x 1440 YouTube banner: a computer the middle band, a phone its middle 1546 x 423 */
346
+ const YOUTUBE_AREAS = [
347
+ { w: 2560, label: 'computer', cls: '' },
348
+ { w: 1546, label: 'phone', cls: ' phone' },
349
+ ]
350
+
351
+ /** one picture: the image (a clip plays muted), its name and size, « copy », « ⬇ » and 📂 the Finder (the desktop has
352
+ * one, a phone none); `width` a tile, else full width */
353
+ const PictureTile = observer(({ so, i, f, width, tile }: { so: SocialSt; i: DeskIdentity; f: Picture; width?: number; tile?: boolean }) => {
354
+ const { url, clip } = so.picture(i, f)
355
+ const size = f.w !== null ? ` · ${f.w}×${f.h}` : ''
356
+ const key = `${i.id}/pic/${f.file}`
357
+ return (
358
+ <div className="so-card so-pic" style={width ? { width } : undefined}>
359
+ <div className="so-picframe">
360
+ {clip ? <video src={url} muted loop autoPlay playsInline /> : <img src={url} alt="" />}
361
+ {f.file.endsWith('-youtube.jpg')
362
+ ? YOUTUBE_AREAS.map((a) => (
363
+ <div key={a.label} className={`so-ytarea${a.cls}`} style={{ left: `${((2560 - a.w) / 2 / 2560) * 100}%`, width: `${(a.w / 2560) * 100}%`, top: `${((1440 - 423) / 2 / 1440) * 100}%`, height: `${(423 / 1440) * 100}%` }}>
364
+ <span>{a.label}</span>
365
+ </div>
366
+ ))
367
+ : null}
368
+ </div>
369
+ <div className="so-picrow">
370
+ <b className="rv-small so-ellip so-grow" title={`${fileName(f.file)}${size}`}>
371
+ {fileName(f.file).replace(/^(avatar|banner)-(caid-)?/, '').replace(/\.\w+$/, '').replace(/-round$/, ' round')}
372
+ {!width && !tile ? <span className="rv-dim">{size}</span> : null}
373
+ </b>
374
+ {!clip ? (
375
+ <button className="so-icon" onClick={() => void so.copyImage(url, key)} title="copy the image, to paste in the account's page">
376
+ {so.copiedKey === key ? '✓' : '⧉'}
377
+ </button>
378
+ ) : null}
379
+ <a className="so-icon" href={url} download={fileName(f.file)} title="download">
380
+ ⬇
381
+ </a>
382
+ {!so.phone ? (
383
+ <button className="so-icon" onClick={() => void so.revealPicture(i.id, f.file)} title={`show ${fileName(f.file)} in the Finder`}>
384
+ 📂
385
+ </button>
386
+ ) : null}
387
+ </div>
388
+ </div>
389
+ )
390
+ })
391
+
392
+ /** the middle of the company: every row a form asks, the private ones under a lock, then the open questions */
393
+ export const LegalPage = observer(({ so, i }: { so: SocialSt; i: DeskIdentity }) => {
394
+ const l = i.legal
395
+ if (!l) return null
396
+ return (
397
+ <div className="so-colin">
398
+ <ErrorLine so={so} />
399
+ <h2 className="so-h so-big">Company and legal</h2>
400
+ <div className="rv-dim rv-small">{i.id}/legal.md, and the 🔒 rows of legal.local.md (out of git, never published)</div>
401
+ <KeptFold so={so} card="legal/rows" title="For the forms" right={<span className="rv-dim rv-small">{l.rows.length}</span>} flush>
402
+ {l.rows.map((r) => (
403
+ <CopyRow key={`${r.private}/${r.field}`} so={so} k={`${i.id}/legal/${r.field}`} field={`${r.private ? '🔒 ' : ''}${r.field}`} value={r.value} />
404
+ ))}
405
+ </KeptFold>
406
+ {l.open ? (
407
+ <KeptFold so={so} card="legal/open" title="Open questions (an accountant answers them)" summary={l.open} tone="warn">
408
+ <Md text={l.open} />
409
+ </KeptFold>
410
+ ) : null}
411
+ </div>
412
+ )
413
+ })
414
+
415
+ /** the right of the company: each platform's payout and tax state */
416
+ export const LegalPlatforms = observer(({ so, i }: { so: SocialSt; i: DeskIdentity }) => {
417
+ const l = i.legal
418
+ if (!l) return null
419
+ return (
420
+ <div className="so-colin">
421
+ <KeptFold so={so} card="legal/platforms" title="Payouts and taxes, by platform" right={<span className="rv-dim rv-small">{l.platforms.length}</span>} flush>
422
+ {l.platforms.map((x) => (
423
+ <div key={x.platform} className="so-row so-col">
424
+ <b>{x.platform}</b>
425
+ <span className="rv-small">
426
+ <b>payout</b> · {x.payout}
427
+ </span>
428
+ <span className="rv-small">
429
+ <b>taxes</b> · {x.tax}
430
+ </span>
431
+ </div>
432
+ ))}
433
+ </KeptFold>
434
+ </div>
435
+ )
436
+ })
437
+
438
+ /** an account picked: its head (or the place's), then its messages, waiting first */
439
+ const AccountPage = observer(({ so, a }: { so: SocialSt; a: DeskAccount }) => {
440
+ const place = so.currentPlace
441
+ return (
442
+ <div className="so-colin">
443
+ <ErrorLine so={so} />
444
+ {place ? (
445
+ <div className="so-pagehead">
446
+ <Logo id={a.id} name={a.name} size={26} />
447
+ <h2 className="so-h so-grow">
448
+ {a.name}
449
+ <span className="rv-dim so-light"> › {place.name}</span>
450
+ </h2>
451
+ <Go href={place.url} label="Open" icon="↗" />
452
+ <Go href={place.write.replace('{text}', '')} label="Write" icon="✎" />
453
+ </div>
454
+ ) : so.place === ME ? (
455
+ <div className="so-pagehead">
456
+ <Logo id={a.id} name={a.name} size={26} />
457
+ <h2 className="so-h so-grow">
458
+ {a.name}
459
+ <span className="rv-dim so-light"> › my profile</span>
460
+ </h2>
461
+ </div>
462
+ ) : (
463
+ <PlatformHeader so={so} a={a} />
464
+ )}
465
+ <Messages so={so} a={a} />
466
+ </div>
467
+ )
468
+ })
469
+
470
+ /** an account's messages in the place picked, waiting first; the rejected on demand */
471
+ export const Messages = observer(({ so, a }: { so: SocialSt; a: DeskAccount }) => {
472
+ const shown = so.shownPosts(a)
473
+ const rejected = so.rejectedCount(a)
474
+ const place = so.currentPlace
475
+ return (
476
+ <>
477
+ <b className="so-section">{so.place === null ? 'The messages' : `The messages · ${place?.name ?? 'my profile'}`}</b>
478
+ {shown.length === 0 ? (
479
+ <div className="rv-dim rv-small">
480
+ none from this repo: a « ## {a.id}
481
+ {place ? ` (place: ${place.id})` : ''} » in .shipkit/social/drafts/&lt;slug&gt;/draft.md
482
+ </div>
483
+ ) : null}
484
+ {shown.map((post) => (
485
+ <PostCard key={`${post.slug}/${post.key}`} so={so} a={a} post={post} where={so.place === null && a.places.length > 0} />
486
+ ))}
487
+ {rejected > 0 ? (
488
+ <label className="rv-switch">
489
+ <input type="checkbox" checked={so.showRejected} onChange={(e) => so.setShowRejected(e.currentTarget.checked)} /> show the {rejected} rejected
490
+ </label>
491
+ ) : null}
492
+ </>
493
+ )
494
+ })
495
+
496
+ /** a platform's head: its mark large on its colour, its state, its links; what can be automated; its setup; its URL */
497
+ export const PlatformHeader = observer(({ so, a }: { so: SocialSt; a: DeskAccount }) => {
498
+ const live = a.live !== ''
499
+ const stats = so.statOf(a)
500
+ const auto = AUTOMATION[a.automation] ?? AUTOMATION.none!
501
+ const k = `${a.identity}/${a.id}`
502
+ return (
503
+ <>
504
+ <div className="so-banner" style={brandVar(a.id)}>
505
+ <div className="so-bannerline">
506
+ <span className="so-bannerlogo">
507
+ <Logo id={a.id} name={a.name} size={48} />
508
+ </span>
509
+ <span className="so-atext">
510
+ <b className="so-bannername">{a.name}</b>
511
+ <span className="so-ellip">
512
+ {a.handle}
513
+ {stats ? ` · ${stats}` : ''}
514
+ </span>
515
+ </span>
516
+ <span className={`so-bannerstate${live ? ' live' : ''}`}>{live ? 'online' : 'to create'}</span>
517
+ </div>
518
+ <div className="so-acts">
519
+ <Go href={a.live || a.profile} label="Profile" icon="👤" solid />
520
+ <Go href={a.write.replace('{text}', '')} label="Write" icon="✎" solid />
521
+ <Go href={a.inbox} label="Replies" icon="🔔" solid />
522
+ <Go href={a.stats} label="Stats" icon="▥" solid />
523
+ </div>
524
+ </div>
525
+ <KeptFold so={so} card="automation" title="What can be automated" open={false} summary={a.automationText} right={<span className={`so-badge t-${auto.tone}`}>{auto.label}</span>}>
526
+ {a.automationText ? <Md text={a.automationText} /> : <span className="rv-dim">no ## Automation in its account.md</span>}
527
+ </KeptFold>
528
+ <Checklist so={so} a={a} />
529
+ <input
530
+ className={`so-url${live ? ' done' : ''}${so.urlErrors[k] ? ' bad' : ''}`}
531
+ placeholder="the profile's URL: pasted, the account turns green"
532
+ value={so.urlField(k, a.live)}
533
+ disabled={so.busy}
534
+ onChange={(e) => so.setUrl(k, e.currentTarget.value)}
535
+ onBlur={() => void so.saveLive(a)}
536
+ onKeyDown={(e) => {
537
+ if (e.key === 'Enter') void so.saveLive(a)
538
+ }}
539
+ />
540
+ {so.urlErrors[k] ? <div className="so-error">{so.urlErrors[k]}</div> : null}
541
+ </>
542
+ )
543
+ })
544
+
545
+ /** the `## Setup` steps, numbered, each ticked by a click; a `[[ref]]` draws what it names */
546
+ const Checklist = observer(({ so, a }: { so: SocialSt; a: DeskAccount }) => {
547
+ if (a.steps.length === 0) return null
548
+ const done = a.steps.filter((x) => x.done).length
549
+ const all = done === a.steps.length
550
+ return (
551
+ <KeptFold so={so} card={`setup/${a.identity}/${a.id}`} title="Setup" open={!all} flush right={<span className={`rv-small ${all ? 'so-good' : 'rv-dim'}`}>{done}/{a.steps.length}{all ? ' · all done' : ''}</span>}>
552
+ <div className="so-progress" style={{ '--p': `${(100 * done) / a.steps.length}%` } as CSSProperties} />
553
+ {a.steps.map((step, i) => (
554
+ <div key={i} className={`so-step${step.done ? ' done' : ''}`}>
555
+ <input type="checkbox" checked={step.done} disabled={so.busy} onChange={() => void so.toggleStep(a, i)} aria-label={`step ${i + 1}`} />
556
+ <b className="rv-dim so-stepn">{i + 1}</b>
557
+ <div className="so-steptext">
558
+ <StepText so={so} a={a} index={i} text={step.text} />
559
+ </div>
560
+ </div>
561
+ ))}
562
+ </KeptFold>
563
+ )
564
+ })
565
+
566
+ const REF = /\[\[([^\]]+)\]\]/g
567
+
568
+ /** a step's words, its refs drawn inline: a row's value with « copy », an image with « ⬇ », a draft to copy */
569
+ const StepText = observer(({ so, a, index, text }: { so: SocialSt; a: DeskAccount; index: number; text: string }) => {
570
+ const parts = text.split(REF)
571
+ const i = so.identityOf(a.identity)
572
+ return (
573
+ <>
574
+ {parts.map((part, j) => {
575
+ if (j % 2 === 0) return <MdInline key={j} text={part} />
576
+ const key = `${a.identity}/${a.id}/step/${index}/${part}`
577
+ const draft = so.refDraft(a, part)
578
+ if (draft)
579
+ return (
580
+ <span key={j} className="so-chip">
581
+ <button className="primary" onClick={() => void so.copy(draft.text, key)} title="copy that draft's text">
582
+ {so.copiedKey === key ? '✓ copied' : `⧉ « ${draft.title || draft.slug.replace(/^\d{8}-\d{6}-/, '')} »`}
583
+ </button>
584
+ {draft.media ? (
585
+ <a className="so-btn" href={so.mediaUrl(draft.slug, draft.media)} download={fileName(draft.media.name)}>
586
+ ⬇ image
587
+ </a>
588
+ ) : null}
589
+ </span>
590
+ )
591
+ const row: Row | undefined = a.rows.find((r) => r.field === part)
592
+ if (row?.files.length && i)
593
+ return (
594
+ <span key={j} className="so-chip">
595
+ {row.files.map((file) => (
596
+ <span key={file} className="so-chip">
597
+ <img className="so-stepimg" src={so.pictureUrl(i.id, file)} alt="" />
598
+ <a className="so-btn" href={so.pictureUrl(i.id, file)} download={fileName(file)}>
599
+ ⬇
600
+ </a>
601
+ </span>
602
+ ))}
603
+ </span>
604
+ )
605
+ if (row)
606
+ return (
607
+ <span key={j} className="so-chip">
608
+ <button className="primary so-chipvalue" onClick={() => void so.copy(row.value, key)} title={row.value}>
609
+ <span className="so-ellip">{row.value}</span> {so.copiedKey === key ? '✓' : '⧉'}
610
+ </button>
611
+ </span>
612
+ )
613
+ return (
614
+ <span key={j} className="so-badref">
615
+ [[{part}]]
616
+ </span>
617
+ )
618
+ })}
619
+ </>
620
+ )
621
+ })
622
+
623
+ /** the account: its profile row by row (the identity's rows with its own over them), then its notes */
624
+ export const AccountProfile = observer(({ so, a }: { so: SocialSt; a: DeskAccount }) => {
625
+ const i = so.identityOf(a.identity)
626
+ return (
627
+ <div className="so-colin">
628
+ <KeptFold so={so} card="profile" title="The profile" flush>
629
+ {a.rows.map((r) =>
630
+ r.files.length && i ? (
631
+ <CopyRow key={r.field} so={so} k={`${a.identity}/${a.id}/row/${r.field}`} field={r.field} value={r.value}>
632
+ <div className={`so-rowpics n${Math.min(r.files.length, 2)}`}>
633
+ {r.files.map((f) => (
634
+ <PictureTile key={f} so={so} i={i} f={i.pictures.find((x) => x.file === f) ?? { file: f, w: null, h: null }} tile />
635
+ ))}
636
+ </div>
637
+ </CopyRow>
638
+ ) : (
639
+ <CopyRow key={r.field} so={so} k={`${a.identity}/${a.id}/row/${r.field}`} field={r.field} value={r.value} />
640
+ ),
641
+ )}
642
+ </KeptFold>
643
+ {a.notes ? (
644
+ <KeptFold so={so} card="notes" title="Notes" open={false} summary={a.notes}>
645
+ <Md text={a.notes} />
646
+ </KeptFold>
647
+ ) : null}
648
+ <a className="so-small" href={so.editorUrl(a.file)}>
649
+ open in VS Code ↗
650
+ </a>
651
+ </div>
652
+ )
653
+ })
654
+
655
+ /** a place: where it is, when, what it allows */
656
+ export const PlacePane = observer(({ so, a, place }: { so: SocialSt; a: DeskAccount; place: Place }) => (
657
+ <div className="so-colin">
658
+ <div className="so-card">
659
+ <b>{place.name}</b>
660
+ <span className="rv-dim rv-small">{[place.kind, place.when].filter(Boolean).join(' · ')}</span>
661
+ {place.url ? (
662
+ <a href={place.url} target="_blank" rel="noreferrer" className="rv-small rv-pre">
663
+ {place.url}
664
+ </a>
665
+ ) : null}
666
+ </div>
667
+ {place.rules ? (
668
+ <KeptFold so={so} card="rules" title="The rules" summary={place.rules}>
669
+ <Md text={place.rules} />
670
+ </KeptFold>
671
+ ) : null}
672
+ {place.notes ? (
673
+ <KeptFold so={so} card="notes" title="Notes" open={false} summary={place.notes}>
674
+ <Md text={place.notes} />
675
+ </KeptFold>
676
+ ) : null}
677
+ <a className="so-small" href={so.editorUrl(place.file || `${a.dir}/places/${place.id}.md`)}>
678
+ open in VS Code ↗
679
+ </a>
680
+ </div>
681
+ ))