@peers-app/peers-ui 0.27.3 → 0.27.5

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 (311) hide show
  1. package/dist/screens/network-viewer/group-details-modal.d.ts +4 -0
  2. package/dist/screens/network-viewer/group-details-modal.js +6 -46
  3. package/dist/screens/network-viewer/network-viewer-ipc.d.ts +3 -2
  4. package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
  5. package/dist/screens/network-viewer/sync-recovery.js +103 -1
  6. package/dist/screens/variables/variable-details.js +2 -1
  7. package/dist/tabs-layout/network-status-indicator.js +26 -12
  8. package/dist/tabs-layout/use-network-status.d.ts +6 -1
  9. package/dist/tabs-layout/use-network-status.js +27 -4
  10. package/package.json +9 -3
  11. package/.claude/settings.local.json +0 -34
  12. package/.github/README.md +0 -52
  13. package/.github/workflows/delete-all-artifacts.yml +0 -49
  14. package/.github/workflows/publish.yml +0 -51
  15. package/babel.config.js +0 -7
  16. package/biome.json +0 -198
  17. package/dist/app-updates/app-updates-consumer.test.d.ts +0 -1
  18. package/dist/app-updates/app-updates-consumer.test.js +0 -56
  19. package/dist/app-updates/app-updates-settings.test.d.ts +0 -1
  20. package/dist/app-updates/app-updates-settings.test.js +0 -93
  21. package/dist/app-updates/remote-app-update-panel.test.d.ts +0 -1
  22. package/dist/app-updates/remote-app-update-panel.test.js +0 -165
  23. package/dist/components/access-level-field.test.d.ts +0 -1
  24. package/dist/components/access-level-field.test.js +0 -28
  25. package/dist/components/message-logs/tool-access-approval-card.test.d.ts +0 -1
  26. package/dist/components/message-logs/tool-access-approval-card.test.js +0 -102
  27. package/dist/components/responsive-section-nav.test.d.ts +0 -1
  28. package/dist/components/responsive-section-nav.test.js +0 -45
  29. package/dist/globals-hash.test.d.ts +0 -1
  30. package/dist/globals-hash.test.js +0 -16
  31. package/dist/hooks/use-observable-state.test.d.ts +0 -1
  32. package/dist/hooks/use-observable-state.test.js +0 -64
  33. package/dist/hooks/use-observable.test.d.ts +0 -1
  34. package/dist/hooks/use-observable.test.js +0 -191
  35. package/dist/hooks/use-rows.test.d.ts +0 -1
  36. package/dist/hooks/use-rows.test.js +0 -175
  37. package/dist/hooks/use-tool.test.d.ts +0 -1
  38. package/dist/hooks/use-tool.test.js +0 -190
  39. package/dist/host-shell/host-shell-consumer.test.d.ts +0 -1
  40. package/dist/host-shell/host-shell-consumer.test.js +0 -28
  41. package/dist/root-layout/root-layout-host.test.d.ts +0 -1
  42. package/dist/root-layout/root-layout-host.test.js +0 -86
  43. package/dist/screens/account/account-screen.test.d.ts +0 -1
  44. package/dist/screens/account/account-screen.test.js +0 -51
  45. package/dist/screens/assistants/assistant-config.test.d.ts +0 -1
  46. package/dist/screens/assistants/assistant-config.test.js +0 -57
  47. package/dist/screens/contacts/contact-list.test.d.ts +0 -1
  48. package/dist/screens/contacts/contact-list.test.js +0 -48
  49. package/dist/screens/device-pairing/device-pairing.test.d.ts +0 -1
  50. package/dist/screens/device-pairing/device-pairing.test.js +0 -119
  51. package/dist/screens/devices/devices-list.test.d.ts +0 -1
  52. package/dist/screens/devices/devices-list.test.js +0 -53
  53. package/dist/screens/groups/group-list.test.d.ts +0 -1
  54. package/dist/screens/groups/group-list.test.js +0 -38
  55. package/dist/screens/identity/identity-routes.test.d.ts +0 -1
  56. package/dist/screens/identity/identity-routes.test.js +0 -51
  57. package/dist/screens/identity/identity-screen.test.d.ts +0 -1
  58. package/dist/screens/identity/identity-screen.test.js +0 -103
  59. package/dist/screens/invites/accept-invite.test.d.ts +0 -1
  60. package/dist/screens/invites/accept-invite.test.js +0 -103
  61. package/dist/screens/invites/activity-view.test.d.ts +0 -1
  62. package/dist/screens/invites/activity-view.test.js +0 -108
  63. package/dist/screens/invites/invite-classify.test.d.ts +0 -1
  64. package/dist/screens/invites/invite-classify.test.js +0 -115
  65. package/dist/screens/network-viewer/network-viewer-ipc.test.d.ts +0 -1
  66. package/dist/screens/network-viewer/network-viewer-ipc.test.js +0 -61
  67. package/dist/screens/network-viewer/network-viewer.section.test.d.ts +0 -1
  68. package/dist/screens/network-viewer/network-viewer.section.test.js +0 -63
  69. package/dist/screens/network-viewer/sync-recovery.test.d.ts +0 -1
  70. package/dist/screens/network-viewer/sync-recovery.test.js +0 -104
  71. package/dist/screens/packages/package-helpers.test.d.ts +0 -1
  72. package/dist/screens/packages/package-helpers.test.js +0 -53
  73. package/dist/screens/packages/package-runtime-status.test.d.ts +0 -1
  74. package/dist/screens/packages/package-runtime-status.test.js +0 -50
  75. package/dist/screens/packages/packages-ipc.test.d.ts +0 -1
  76. package/dist/screens/packages/packages-ipc.test.js +0 -43
  77. package/dist/screens/settings/settings-page.test.d.ts +0 -1
  78. package/dist/screens/settings/settings-page.test.js +0 -19
  79. package/dist/screens/tools/tool-access-ipc.test.d.ts +0 -1
  80. package/dist/screens/tools/tool-access-ipc.test.js +0 -40
  81. package/dist/screens/tools/tool-catalog-ipc.test.d.ts +0 -1
  82. package/dist/screens/tools/tool-catalog-ipc.test.js +0 -52
  83. package/dist/tabs-layout/network-status-indicator.test.d.ts +0 -1
  84. package/dist/tabs-layout/network-status-indicator.test.js +0 -665
  85. package/dist/tabs-layout/tabs-state.test.d.ts +0 -1
  86. package/dist/tabs-layout/tabs-state.test.js +0 -110
  87. package/dist/tabs-layout/use-network-status.test.d.ts +0 -1
  88. package/dist/tabs-layout/use-network-status.test.js +0 -45
  89. package/dist/ui-router/ui-loader.test.d.ts +0 -1
  90. package/dist/ui-router/ui-loader.test.js +0 -91
  91. package/jest.config.js +0 -25
  92. package/release-guard.js +0 -10
  93. package/src/app-updates/app-update-controls.tsx +0 -73
  94. package/src/app-updates/app-updates-consumer.test.ts +0 -83
  95. package/src/app-updates/app-updates-consumer.ts +0 -121
  96. package/src/app-updates/app-updates-settings.test.tsx +0 -109
  97. package/src/app-updates/app-updates-settings.tsx +0 -136
  98. package/src/app-updates/remote-app-update-panel.test.tsx +0 -205
  99. package/src/app-updates/remote-app-update-panel.tsx +0 -210
  100. package/src/app-updates/use-app-update-status.ts +0 -16
  101. package/src/command-palette/command-palette-ui.tsx +0 -564
  102. package/src/command-palette/command-palette.ts +0 -242
  103. package/src/components/access-level-field.test.tsx +0 -32
  104. package/src/components/access-level-field.tsx +0 -68
  105. package/src/components/checkbox.tsx +0 -25
  106. package/src/components/group-switcher.tsx +0 -526
  107. package/src/components/input-date.tsx +0 -29
  108. package/src/components/input-number.tsx +0 -83
  109. package/src/components/input.tsx +0 -25
  110. package/src/components/inverse-lazy-list.tsx +0 -107
  111. package/src/components/io-schema-values.tsx +0 -103
  112. package/src/components/io-schema.tsx +0 -259
  113. package/src/components/lazy-list.tsx +0 -115
  114. package/src/components/list-screen.tsx +0 -126
  115. package/src/components/loading-indicator.tsx +0 -7
  116. package/src/components/markdown-editor/autolink-plugin.tsx +0 -29
  117. package/src/components/markdown-editor/editor-inline.tsx +0 -9
  118. package/src/components/markdown-editor/editor.tsx +0 -158
  119. package/src/components/markdown-editor/markdown-plugin.tsx +0 -202
  120. package/src/components/markdown-editor/mention-node.ts +0 -204
  121. package/src/components/markdown-editor/mentions-plugin.tsx +0 -354
  122. package/src/components/markdown-editor/move-line-plugin.tsx +0 -186
  123. package/src/components/markdown-editor/select-line-boundary-plugin.tsx +0 -95
  124. package/src/components/markdown-editor/theme.ts +0 -46
  125. package/src/components/markdown-editor/toolbar.tsx +0 -269
  126. package/src/components/markdown-with-mentions.tsx +0 -198
  127. package/src/components/message-logs/message-logs.tsx +0 -523
  128. package/src/components/message-logs/tool-access-approval-card.test.tsx +0 -127
  129. package/src/components/message-logs/tool-access-approval-card.tsx +0 -178
  130. package/src/components/messages/avatar.tsx +0 -171
  131. package/src/components/messages/channel-message-list.tsx +0 -189
  132. package/src/components/messages/channel-view.tsx +0 -92
  133. package/src/components/messages/message-compose.tsx +0 -192
  134. package/src/components/messages/message-display.tsx +0 -231
  135. package/src/components/messages/thread-message-list.tsx +0 -135
  136. package/src/components/qr-scanner.tsx +0 -180
  137. package/src/components/responsive-section-nav.test.tsx +0 -88
  138. package/src/components/responsive-section-nav.tsx +0 -92
  139. package/src/components/router.tsx +0 -175
  140. package/src/components/save-button.tsx +0 -134
  141. package/src/components/sortable-list.tsx +0 -130
  142. package/src/components/tabs.tsx +0 -76
  143. package/src/components/tooltip.tsx +0 -43
  144. package/src/components/trust-level-badge.tsx +0 -44
  145. package/src/components/trust-level-dropdown.tsx +0 -136
  146. package/src/components/typeahead.tsx +0 -357
  147. package/src/globals-hash.test.ts +0 -19
  148. package/src/globals.tsx +0 -226
  149. package/src/hooks/index.ts +0 -8
  150. package/src/hooks/use-host-contract.ts +0 -75
  151. package/src/hooks/use-observable-state.test.tsx +0 -101
  152. package/src/hooks/use-observable-state.ts +0 -29
  153. package/src/hooks/use-observable.test.tsx +0 -258
  154. package/src/hooks/use-observable.ts +0 -67
  155. package/src/hooks/use-on-screen.ts +0 -24
  156. package/src/hooks/use-promise.ts +0 -34
  157. package/src/hooks/use-rows.test.tsx +0 -196
  158. package/src/hooks/use-rows.ts +0 -120
  159. package/src/hooks/use-subscription.ts +0 -24
  160. package/src/hooks/use-tool.test.tsx +0 -225
  161. package/src/hooks/use-tool.ts +0 -116
  162. package/src/host-shell/host-shell-consumer.test.ts +0 -32
  163. package/src/host-shell/host-shell-consumer.ts +0 -53
  164. package/src/index.tsx +0 -42
  165. package/src/mention-configs.ts +0 -185
  166. package/src/operator-console/operator-console-state.ts +0 -119
  167. package/src/operator-console/operator-console.tsx +0 -233
  168. package/src/peers-services-registration.ts +0 -6
  169. package/src/root-layout/global-overlays.ts +0 -50
  170. package/src/root-layout/layout-picker.tsx +0 -47
  171. package/src/root-layout/layouts/full-screen-layout.tsx +0 -144
  172. package/src/root-layout/layouts/tabs-with-console-layout.tsx +0 -260
  173. package/src/root-layout/root-layout-host.test.tsx +0 -108
  174. package/src/root-layout/root-layout-host.tsx +0 -147
  175. package/src/root-layout/root-layout-registry.ts +0 -51
  176. package/src/root-layout/root-layout-state.ts +0 -55
  177. package/src/root-layout/root-layout.ts +0 -32
  178. package/src/screens/account/account-screen.test.tsx +0 -65
  179. package/src/screens/account/account-screen.tsx +0 -942
  180. package/src/screens/assistants/assistant-config.test.tsx +0 -54
  181. package/src/screens/assistants/assistant-config.tsx +0 -121
  182. package/src/screens/assistants/assistant-details.tsx +0 -89
  183. package/src/screens/assistants/assistant-info.tsx +0 -66
  184. package/src/screens/assistants/assistant-list.tsx +0 -145
  185. package/src/screens/assistants/assistant-tools.tsx +0 -82
  186. package/src/screens/console-logs/console-logs-list.tsx +0 -374
  187. package/src/screens/console-logs/log-display.tsx +0 -137
  188. package/src/screens/console-logs/log-filters.tsx +0 -64
  189. package/src/screens/console-logs/mobile-log-card.tsx +0 -161
  190. package/src/screens/console-logs/resizable-table-header.tsx +0 -110
  191. package/src/screens/contacts/contact-details.tsx +0 -123
  192. package/src/screens/contacts/contact-list.test.tsx +0 -59
  193. package/src/screens/contacts/contact-list.tsx +0 -286
  194. package/src/screens/contacts/index.ts +0 -2
  195. package/src/screens/data-explorer/data-explorer.tsx +0 -633
  196. package/src/screens/data-explorer/index.ts +0 -6
  197. package/src/screens/data-explorer/query-executor.tsx +0 -520
  198. package/src/screens/device-pairing/device-pairing.test.tsx +0 -143
  199. package/src/screens/device-pairing/device-pairing.tsx +0 -461
  200. package/src/screens/device-pairing/identity-ipc.ts +0 -25
  201. package/src/screens/device-pairing/index.ts +0 -2
  202. package/src/screens/device-pairing/use-device-pairing-state.ts +0 -15
  203. package/src/screens/devices/devices-list.test.tsx +0 -68
  204. package/src/screens/devices/devices-list.tsx +0 -365
  205. package/src/screens/devices/index.ts +0 -1
  206. package/src/screens/groups/group-details.tsx +0 -160
  207. package/src/screens/groups/group-invite-panel.tsx +0 -311
  208. package/src/screens/groups/group-list.test.tsx +0 -44
  209. package/src/screens/groups/group-list.tsx +0 -317
  210. package/src/screens/groups/group-members.tsx +0 -343
  211. package/src/screens/groups/index.ts +0 -3
  212. package/src/screens/identity/identity-routes.test.ts +0 -70
  213. package/src/screens/identity/identity-routes.ts +0 -301
  214. package/src/screens/identity/identity-screen.test.tsx +0 -138
  215. package/src/screens/identity/identity-screen.tsx +0 -282
  216. package/src/screens/identity/index.ts +0 -2
  217. package/src/screens/identity/invite-contact-panel.tsx +0 -45
  218. package/src/screens/identity/profile-invite.tsx +0 -93
  219. package/src/screens/invites/accept-invite.test.tsx +0 -115
  220. package/src/screens/invites/accept-invite.tsx +0 -318
  221. package/src/screens/invites/activity-view.test.tsx +0 -127
  222. package/src/screens/invites/activity-view.tsx +0 -162
  223. package/src/screens/invites/index.ts +0 -6
  224. package/src/screens/invites/invite-capture.ts +0 -104
  225. package/src/screens/invites/invite-classify.test.ts +0 -129
  226. package/src/screens/invites/invite-share.tsx +0 -104
  227. package/src/screens/invites/invites-ipc.ts +0 -25
  228. package/src/screens/invites/pending-invites-list.tsx +0 -256
  229. package/src/screens/network-viewer/connection-troubleshooter.tsx +0 -395
  230. package/src/screens/network-viewer/cpu-usage-graph.tsx +0 -294
  231. package/src/screens/network-viewer/device-details-modal.tsx +0 -339
  232. package/src/screens/network-viewer/group-details-modal.tsx +0 -421
  233. package/src/screens/network-viewer/index.ts +0 -8
  234. package/src/screens/network-viewer/network-viewer-ipc.test.ts +0 -72
  235. package/src/screens/network-viewer/network-viewer-ipc.ts +0 -39
  236. package/src/screens/network-viewer/network-viewer-section.ts +0 -12
  237. package/src/screens/network-viewer/network-viewer.section.test.tsx +0 -68
  238. package/src/screens/network-viewer/network-viewer.tsx +0 -708
  239. package/src/screens/network-viewer/remote-logs-panel.tsx +0 -190
  240. package/src/screens/network-viewer/sync-recovery.test.tsx +0 -114
  241. package/src/screens/network-viewer/sync-recovery.tsx +0 -461
  242. package/src/screens/network-viewer/usage-graph.tsx +0 -455
  243. package/src/screens/packages/local-folder-grants-panel.tsx +0 -290
  244. package/src/screens/packages/local-folders-ipc.ts +0 -28
  245. package/src/screens/packages/package-details.tsx +0 -166
  246. package/src/screens/packages/package-helpers.test.ts +0 -57
  247. package/src/screens/packages/package-helpers.ts +0 -137
  248. package/src/screens/packages/package-info.tsx +0 -354
  249. package/src/screens/packages/package-list.tsx +0 -519
  250. package/src/screens/packages/package-network-panel.tsx +0 -82
  251. package/src/screens/packages/package-new-local.tsx +0 -100
  252. package/src/screens/packages/package-runtime-status.test.tsx +0 -58
  253. package/src/screens/packages/package-runtime-status.tsx +0 -68
  254. package/src/screens/packages/package-versions.tsx +0 -298
  255. package/src/screens/packages/packages-ipc.test.ts +0 -47
  256. package/src/screens/packages/packages-ipc.ts +0 -125
  257. package/src/screens/peer-types/peer-type-details.tsx +0 -172
  258. package/src/screens/peer-types/peer-type-list.tsx +0 -64
  259. package/src/screens/search/global-search.tsx +0 -406
  260. package/src/screens/settings/color-mode-dropdown.tsx +0 -82
  261. package/src/screens/settings/settings-page.test.tsx +0 -24
  262. package/src/screens/settings/settings-page.tsx +0 -426
  263. package/src/screens/setup-user.tsx +0 -355
  264. package/src/screens/tools/tool-access-ipc.test.ts +0 -55
  265. package/src/screens/tools/tool-access-ipc.ts +0 -27
  266. package/src/screens/tools/tool-catalog-ipc.test.ts +0 -52
  267. package/src/screens/tools/tool-catalog-ipc.ts +0 -51
  268. package/src/screens/tools/tool-details.tsx +0 -52
  269. package/src/screens/tools/tool-info.tsx +0 -45
  270. package/src/screens/tools/tool-list.tsx +0 -106
  271. package/src/screens/tools/tool-schema.tsx +0 -44
  272. package/src/screens/tools/tool-test-details.tsx +0 -89
  273. package/src/screens/tools/tool-test-list.tsx +0 -73
  274. package/src/screens/variables/variable-details.tsx +0 -289
  275. package/src/screens/variables/variable-list.tsx +0 -110
  276. package/src/screens/welcome-modal.tsx +0 -294
  277. package/src/screens/workflows/workflow-details.tsx +0 -115
  278. package/src/screens/workflows/workflow-info.tsx +0 -22
  279. package/src/screens/workflows/workflow-instructions.tsx +0 -134
  280. package/src/screens/workflows/workflow-list.tsx +0 -117
  281. package/src/setupTests.ts +0 -38
  282. package/src/system-apps/assistants.app.ts +0 -7
  283. package/src/system-apps/console-logs.app.ts +0 -7
  284. package/src/system-apps/data-explorer.app.ts +0 -8
  285. package/src/system-apps/identity.app.ts +0 -9
  286. package/src/system-apps/index.ts +0 -77
  287. package/src/system-apps/mobile-settings.app.ts +0 -7
  288. package/src/system-apps/network-viewer.app.ts +0 -8
  289. package/src/system-apps/packages.app.ts +0 -7
  290. package/src/system-apps/search.app.ts +0 -8
  291. package/src/system-apps/settings.app.ts +0 -7
  292. package/src/system-apps/threads.app.ts +0 -7
  293. package/src/system-apps/tools.app.ts +0 -7
  294. package/src/system-apps/types.app.ts +0 -7
  295. package/src/system-apps/variables.app.ts +0 -7
  296. package/src/system-apps/workflows.app.ts +0 -7
  297. package/src/tabs-layout/network-status-indicator.test.tsx +0 -799
  298. package/src/tabs-layout/network-status-indicator.tsx +0 -756
  299. package/src/tabs-layout/tabs-layout.tsx +0 -857
  300. package/src/tabs-layout/tabs-state.test.ts +0 -152
  301. package/src/tabs-layout/tabs-state.ts +0 -587
  302. package/src/tabs-layout/use-network-status.test.tsx +0 -58
  303. package/src/tabs-layout/use-network-status.ts +0 -68
  304. package/src/ui-defaults/index.ts +0 -2
  305. package/src/ui-defaults/list-screen.tsx +0 -94
  306. package/src/ui-defaults/markdown-field.tsx +0 -87
  307. package/src/ui-router/routes-loader.ts +0 -193
  308. package/src/ui-router/ui-loader.test.tsx +0 -108
  309. package/src/ui-router/ui-loader.tsx +0 -606
  310. package/src/utils.ts +0 -95
  311. package/tsconfig.json +0 -18
@@ -1,147 +0,0 @@
1
- /**
2
- * Root layout host — the single thing a Peers client mounts.
3
- *
4
- * `RootLayoutHost` owns everything that must exist regardless of which layout is active:
5
- * the user gate / setup flow, user-context init, global + route loading, the
6
- * always-available command palette, and the first-run welcome modal. It then delegates
7
- * the visible shell to the selected {@link RootLayout}, swapping it live when the
8
- * per-device selection changes.
9
- *
10
- * This is the bootstrap logic that previously lived (tangled with the tab UI) in
11
- * `TabsLayoutApp` / `TabsLayout`; the tab UI itself is now just the `tabs` layout body
12
- * (`TabsLayoutInternal`).
13
- */
14
-
15
- import { hasShownWelcomeModal, setDefaultClientUserContext } from "@peers-app/peers-sdk";
16
- import { useEffect, useRef, useState } from "react";
17
- import { CommandPaletteOverlay } from "../command-palette/command-palette-ui";
18
- import { initializeHashNavigation, loadGlobals, mainContentPath } from "../globals";
19
- import { useObservable, usePromise } from "../hooks";
20
- import { identityTools } from "../screens/device-pairing/identity-ipc";
21
- import { IDENTITY_ACCEPT_PATH } from "../screens/identity/identity-routes";
22
- import {
23
- captureInviteFromLocation,
24
- inviteCaptured,
25
- listenForOpenUrlInvites,
26
- peekPendingInvite,
27
- } from "../screens/invites/invite-capture";
28
- import { colorMode } from "../screens/settings/color-mode-dropdown";
29
- import { SetupUser } from "../screens/setup-user";
30
- import { WelcomeModal } from "../screens/welcome-modal";
31
- import { activeTabId, activeTabs, recentlyUsedApps } from "../tabs-layout/tabs-state";
32
- import { loadAllRoutes } from "../ui-router/routes-loader";
33
- import { globalOverlays } from "./global-overlays";
34
- import { DEFAULT_ROOT_LAYOUT_ID, getRootLayout } from "./root-layout-registry";
35
- import { selectedRootLayoutId } from "./root-layout-state";
36
-
37
- /**
38
- * Top-level host mounted by the client. Resolves the user, then hands off to the
39
- * bootstrap component once a user exists. Kept as a thin outer component so the hook
40
- * order downstream is stable across the user/no-user branches.
41
- */
42
- export function RootLayoutHost() {
43
- useState(() => {
44
- captureInviteFromLocation();
45
- return true;
46
- });
47
-
48
- const userIdRef = useRef<string | null | undefined>(undefined);
49
- const userId = usePromise(async () => {
50
- const session = await (await identityTools()).getSession();
51
- return session.userId || (null as string | null);
52
- });
53
- userIdRef.current = userId;
54
-
55
- useEffect(() => {
56
- // Tokens arriving after startup: a hash change in the browser/PWA, or a peers:// open
57
- // forwarded by the Electron main process. Signed-out captures stay stashed until setup
58
- // finishes; signed-in captures route straight to the Accept screen.
59
- const onHashChange = () => captureInviteFromLocation();
60
- window.addEventListener("hashchange", onHashChange);
61
- const stopOpenUrl = listenForOpenUrlInvites();
62
- const sub = inviteCaptured.subscribe(() => {
63
- if (userIdRef.current && peekPendingInvite()) {
64
- mainContentPath(IDENTITY_ACCEPT_PATH);
65
- }
66
- });
67
- return () => {
68
- window.removeEventListener("hashchange", onHashChange);
69
- stopOpenUrl();
70
- sub.dispose();
71
- };
72
- }, []);
73
-
74
- if (userId === undefined) {
75
- return;
76
- }
77
-
78
- if (!userId) {
79
- document.getElementById("appLoadingDiv")?.remove();
80
- return <SetupUser />;
81
- }
82
-
83
- return <RootLayoutBootstrap userId={userId} />;
84
- }
85
-
86
- let userContextInitialized = false;
87
-
88
- /**
89
- * Inner bootstrap: initializes the user context, awaits global/route/tab loading, then
90
- * renders the selected layout body alongside the always-available command palette and
91
- * the first-run welcome modal.
92
- */
93
- function RootLayoutBootstrap(props: { userId: string }) {
94
- if (!userContextInitialized) {
95
- setDefaultClientUserContext(props.userId);
96
- userContextInitialized = true;
97
- }
98
-
99
- const loaded = usePromise(async () => {
100
- await loadGlobals();
101
- await loadAllRoutes();
102
- await Promise.all([
103
- activeTabs.loadingPromise,
104
- activeTabId.loadingPromise,
105
- recentlyUsedApps.loadingPromise,
106
- hasShownWelcomeModal.loadingPromise,
107
- ]);
108
- initializeHashNavigation();
109
- if (peekPendingInvite()) {
110
- mainContentPath(IDENTITY_ACCEPT_PATH);
111
- }
112
- return true;
113
- });
114
-
115
- const [showWelcomeModal, setShowWelcomeModal] = useState(false);
116
- const [_colorMode] = useObservable(colorMode);
117
- const [layoutId] = useObservable(selectedRootLayoutId);
118
- const [overlays] = useObservable(globalOverlays);
119
-
120
- // Check if we should show the welcome modal after loading
121
- useEffect(() => {
122
- if (loaded && !hasShownWelcomeModal()) {
123
- setShowWelcomeModal(true);
124
- }
125
- }, [loaded]);
126
-
127
- if (!loaded) return false;
128
-
129
- document.getElementById("appLoadingDiv")?.remove();
130
-
131
- const layout =
132
- getRootLayout(layoutId ?? DEFAULT_ROOT_LAYOUT_ID) ?? getRootLayout(DEFAULT_ROOT_LAYOUT_ID);
133
- const Body = layout?.Component;
134
-
135
- return (
136
- <>
137
- {Body && <Body />}
138
- <CommandPaletteOverlay />
139
- {overlays.map(({ id, Component }) => (
140
- <Component key={id} />
141
- ))}
142
- {showWelcomeModal && (
143
- <WelcomeModal colorMode={_colorMode} onClose={() => setShowWelcomeModal(false)} />
144
- )}
145
- </>
146
- );
147
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * Root layout registry — the static list of built-in layouts owned by peers-ui.
3
- *
4
- * For now this is a hardcoded list. The accessor functions ({@link getRootLayouts} /
5
- * {@link getRootLayout}) intentionally hide the underlying array so that dynamic,
6
- * package-contributed layouts (a future `registerRootLayout`) can be added later
7
- * without changing any consumer.
8
- */
9
-
10
- import { TabsLayoutInternal } from "../tabs-layout/tabs-layout";
11
- import { FullScreenLayout } from "./layouts/full-screen-layout";
12
- import { TabsWithConsoleLayout } from "./layouts/tabs-with-console-layout";
13
- import type { RootLayout } from "./root-layout";
14
-
15
- /** Id of the layout used when no selection has been made (or the selection is unknown). */
16
- export const DEFAULT_ROOT_LAYOUT_ID = "tabs";
17
-
18
- /** Built-in layouts, in picker display order. */
19
- const builtInLayouts: RootLayout[] = [
20
- {
21
- id: "tabs",
22
- name: "Tabs",
23
- description: "The classic Peers shell: a tab strip with one app per tab.",
24
- iconClassName: "bi-window-stack",
25
- Component: TabsLayoutInternal,
26
- },
27
- {
28
- id: "tabs-with-console",
29
- name: "Tabs + Console",
30
- description: "The tab strip with the Operator Console docked alongside as a resizable panel.",
31
- iconClassName: "bi-layout-split",
32
- Component: TabsWithConsoleLayout,
33
- },
34
- {
35
- id: "fullscreen",
36
- name: "Full-screen",
37
- description: "One screen at a time, no tabs — navigate with the Cmd/Ctrl+K command palette.",
38
- iconClassName: "bi-fullscreen",
39
- Component: FullScreenLayout,
40
- },
41
- ];
42
-
43
- /** Returns all registered root layouts, in display order. */
44
- export function getRootLayouts(): RootLayout[] {
45
- return builtInLayouts;
46
- }
47
-
48
- /** Returns the layout with the given id, or `undefined` if none is registered. */
49
- export function getRootLayout(id: string): RootLayout | undefined {
50
- return builtInLayouts.find((layout) => layout.id === id);
51
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * Root layout selection — persistent, per-device state plus palette integration.
3
- *
4
- * The selected layout id is stored in a `deviceVar` (per-device, not synced) to match
5
- * the precedent of other root-UI preferences (`colorMode`, the operator console panel):
6
- * layout choice is tightly coupled to the device/form factor. `RootLayoutHost` reads
7
- * this reactively and swaps the layout live when it changes.
8
- */
9
-
10
- import { deviceVar } from "@peers-app/peers-sdk";
11
- import { closeCommandPalette, registerCommand } from "../command-palette/command-palette";
12
- import { DEFAULT_ROOT_LAYOUT_ID, getRootLayouts } from "./root-layout-registry";
13
-
14
- /**
15
- * Per-device id of the currently selected root layout. Defaults to
16
- * {@link DEFAULT_ROOT_LAYOUT_ID}. Observable — subscribers (the host, the picker)
17
- * re-render when it changes.
18
- */
19
- export const selectedRootLayoutId = deviceVar<string>("rootLayout:selectedId", {
20
- defaultValue: DEFAULT_ROOT_LAYOUT_ID,
21
- });
22
-
23
- /** Select the root layout with the given id (persists per-device). */
24
- export function setRootLayout(id: string): void {
25
- selectedRootLayoutId(id);
26
- }
27
-
28
- let initialized = false;
29
-
30
- /**
31
- * Register a `"Use <name> Layout"` command per layout so the selector is keyboard-driven
32
- * and discoverable from the command palette (mirrors the operator console's "Toggle
33
- * Console" command). Idempotent. The registry is static today, so this runs once at
34
- * module load.
35
- */
36
- export function registerLayoutCommands(): void {
37
- if (initialized) return;
38
- initialized = true;
39
-
40
- for (const layout of getRootLayouts()) {
41
- registerCommand({
42
- id: `use-root-layout:${layout.id}`,
43
- label: `Use ${layout.name} Layout`,
44
- description: layout.description,
45
- iconClassName: layout.iconClassName,
46
- category: "View",
47
- action: () => {
48
- closeCommandPalette();
49
- setRootLayout(layout.id);
50
- },
51
- });
52
- }
53
- }
54
-
55
- registerLayoutCommands();
@@ -1,32 +0,0 @@
1
- /**
2
- * Root layout system — the layout interface.
3
- *
4
- * A {@link RootLayout} is a top-level, swappable app shell. The user (and, in the
5
- * future, a package) can choose which root layout owns the visible chrome. Layouts
6
- * are rendered *inside* `RootLayoutHost`, which has already done all bootstrapping
7
- * (user context, route loading) and mounted the always-available command palette.
8
- * A layout therefore owns 100% of the visible chrome (tab strip, content panels,
9
- * console panel, etc.) while the host owns the invisible foundation.
10
- */
11
-
12
- import type React from "react";
13
-
14
- /**
15
- * A selectable top-level app layout. The `Component` is the layout body rendered by
16
- * `RootLayoutHost`; everything visible on screen is the layout's responsibility.
17
- */
18
- export interface RootLayout {
19
- /** Stable id persisted in the layout-selection pvar (e.g. `"tabs"`). */
20
- id: string;
21
- /** User-facing name shown in the layout picker. */
22
- name: string;
23
- /** One-line description shown in the picker. */
24
- description: string;
25
- /** bootstrap-icon class used in the picker. */
26
- iconClassName: string;
27
- /**
28
- * The layout body. Rendered inside `RootLayoutHost` after bootstrapping is
29
- * complete and the command palette is mounted. The body owns all visible chrome.
30
- */
31
- Component: React.ComponentType;
32
- }
@@ -1,65 +0,0 @@
1
- import { render, screen } from "@testing-library/react";
2
- import { AccountScreen } from "./account-screen";
3
-
4
- jest.mock("../../components/tooltip", () => ({
5
- Tooltip: () => null,
6
- }));
7
-
8
- jest.mock("../../hooks", () => ({
9
- useObservable: (value: unknown) =>
10
- value === "device-observable" ? ["device0000000000000000001"] : [undefined],
11
- // One result for every usePromise on the screen. getKeyInfo reads previousPublicKeys
12
- // and canRotate; the profile card reads the rest.
13
- usePromise: () => ({
14
- userId: "user00000000000000000001",
15
- name: "Taylor Example",
16
- publicKey: "public-signing-key",
17
- publicBoxKey: "public-encryption-key",
18
- previousPublicKeys: [],
19
- canRotate: false,
20
- }),
21
- }));
22
-
23
- jest.mock("../../peers-services-registration", () => ({
24
- persistPeersServicesRegistration: jest.fn(),
25
- registrationStatusPvar: "registration-observable",
26
- }));
27
-
28
- jest.mock("../device-pairing/identity-ipc", () => ({
29
- identityTools: jest.fn(),
30
- }));
31
-
32
- jest.mock("@peers-app/peers-sdk", () => {
33
- const actual = jest.requireActual<typeof import("@peers-app/peers-sdk")>("@peers-app/peers-sdk");
34
- return {
35
- ...actual,
36
- copyToClipboard: jest.fn(async () => true),
37
- getMe: jest.fn(),
38
- thisDeviceId: "device-observable",
39
- };
40
- });
41
-
42
- describe("AccountScreen", () => {
43
- it("shows profile actions and copyable identity diagnostics", () => {
44
- render(<AccountScreen />);
45
-
46
- expect(screen.getByText("Taylor Example")).toBeInTheDocument();
47
- expect(screen.getByText("user00000000000000000001")).toBeInTheDocument();
48
- expect(screen.getAllByText("public-signing-key")).toHaveLength(2);
49
- expect(screen.getByText("public-encryption-key")).toBeInTheDocument();
50
- expect(screen.getByText("device0000000000000000001")).toBeInTheDocument();
51
- expect(screen.getByRole("link", { name: "Edit display name" })).toHaveAttribute(
52
- "href",
53
- "#settings",
54
- );
55
- expect(screen.getByRole("link", { name: "Manage devices" })).toHaveAttribute(
56
- "href",
57
- "#identity/devices",
58
- );
59
- expect(screen.getByRole("link", { name: "Add device" })).toHaveAttribute(
60
- "href",
61
- "#identity/devices/pair",
62
- );
63
- expect(screen.getByRole("button", { name: "Copy User ID" })).toBeInTheDocument();
64
- });
65
- });