@peers-app/peers-ui 0.19.10 → 0.19.13

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 (57) hide show
  1. package/README.md +7 -2
  2. package/dist/components/group-switcher.js +3 -4
  3. package/dist/components/voice-playback.d.ts +15 -0
  4. package/dist/components/voice-playback.js +86 -0
  5. package/dist/components/voice-subscribe-events.d.ts +0 -4
  6. package/dist/index.d.ts +10 -2
  7. package/dist/index.js +23 -2
  8. package/dist/operator-console/operator-console-state.d.ts +49 -0
  9. package/dist/operator-console/operator-console-state.js +97 -0
  10. package/dist/operator-console/operator-console.d.ts +32 -0
  11. package/dist/operator-console/operator-console.js +88 -0
  12. package/dist/root-layout/global-overlays.d.ts +37 -0
  13. package/dist/root-layout/global-overlays.js +37 -0
  14. package/dist/root-layout/layout-picker.d.ts +9 -0
  15. package/dist/root-layout/layout-picker.js +22 -0
  16. package/dist/root-layout/layouts/full-screen-layout.d.ts +12 -0
  17. package/dist/root-layout/layouts/full-screen-layout.js +60 -0
  18. package/dist/root-layout/layouts/tabs-with-console-layout.d.ts +20 -0
  19. package/dist/root-layout/layouts/tabs-with-console-layout.js +158 -0
  20. package/dist/root-layout/root-layout-host.d.ts +19 -0
  21. package/dist/root-layout/root-layout-host.js +88 -0
  22. package/dist/root-layout/root-layout-registry.d.ts +15 -0
  23. package/dist/root-layout/root-layout-registry.js +50 -0
  24. package/dist/root-layout/root-layout-state.d.ts +23 -0
  25. package/dist/root-layout/root-layout-state.js +54 -0
  26. package/dist/root-layout/root-layout.d.ts +30 -0
  27. package/dist/root-layout/root-layout.js +12 -0
  28. package/dist/screens/network-viewer/connection-troubleshooter.js +7 -11
  29. package/dist/screens/settings/settings-page.js +2 -1
  30. package/dist/screens/setup-user.js +2 -7
  31. package/dist/tabs-layout/tabs-layout.d.ts +48 -4
  32. package/dist/tabs-layout/tabs-layout.js +27 -53
  33. package/dist/tabs-layout/tabs-state.d.ts +10 -0
  34. package/dist/tabs-layout/tabs-state.js +33 -1
  35. package/package.json +3 -3
  36. package/src/components/group-switcher.tsx +5 -7
  37. package/src/components/voice-playback.tsx +97 -0
  38. package/src/components/voice-subscribe-events.ts +0 -4
  39. package/src/index.tsx +24 -2
  40. package/src/operator-console/operator-console-state.ts +119 -0
  41. package/src/operator-console/operator-console.tsx +233 -0
  42. package/src/root-layout/global-overlays.ts +50 -0
  43. package/src/root-layout/layout-picker.tsx +47 -0
  44. package/src/root-layout/layouts/full-screen-layout.tsx +144 -0
  45. package/src/root-layout/layouts/tabs-with-console-layout.tsx +260 -0
  46. package/src/root-layout/root-layout-host.tsx +113 -0
  47. package/src/root-layout/root-layout-registry.ts +51 -0
  48. package/src/root-layout/root-layout-state.ts +55 -0
  49. package/src/root-layout/root-layout.ts +32 -0
  50. package/src/screens/network-viewer/connection-troubleshooter.tsx +10 -14
  51. package/src/screens/settings/settings-page.tsx +7 -1
  52. package/src/screens/setup-user.tsx +2 -9
  53. package/src/tabs-layout/tabs-layout.tsx +28 -74
  54. package/src/tabs-layout/tabs-state.ts +31 -0
  55. package/dist/components/chat-overlay.d.ts +0 -14
  56. package/dist/components/chat-overlay.js +0 -477
  57. package/src/components/chat-overlay.tsx +0 -854
@@ -0,0 +1,260 @@
1
+ /**
2
+ * Tabs + Console root layout.
3
+ *
4
+ * Renders the standard tab UI and the Operator Console as two real, side-by-side panels
5
+ * in a flex split — not an overlay. Neither panel covers the other; each scrolls
6
+ * independently and the tab UI is sized to the space the console does not occupy.
7
+ *
8
+ * This layout owns everything the old overlay used to self-manage: the split sizing, the
9
+ * drag-to-resize divider, the collapsed edge strip, and the docked edge. The console's
10
+ * own chrome is the presentational {@link OperatorConsolePanel}. Panel state (expanded,
11
+ * dock edge, sizes, maximized) is read reactively from `operatorConsolePanel`, the same
12
+ * per-device state the `Ctrl+`` `` shortcut and the "Toggle Console" command drive.
13
+ */
14
+
15
+ import type React from "react";
16
+ import { useEffect, useRef, useState } from "react";
17
+ import { useObservable } from "../../hooks";
18
+ import { getConsoleTheme, OperatorConsolePanel } from "../../operator-console/operator-console";
19
+ import {
20
+ type ConsoleDock,
21
+ openConsole,
22
+ operatorConsolePanel,
23
+ setConsoleSize,
24
+ } from "../../operator-console/operator-console-state";
25
+ import { colorMode } from "../../screens/settings/color-mode-dropdown";
26
+ import { TabsLayoutInternal } from "../../tabs-layout/tabs-layout";
27
+
28
+ const STRIP_THICKNESS = 26;
29
+ const HANDLE_THICKNESS = 6;
30
+ const MIN_SIZE = 120;
31
+
32
+ function clamp(value: number, min: number, max: number): number {
33
+ return Math.max(min, Math.min(max, value));
34
+ }
35
+
36
+ /** Pixels occupied by the fixed titlebar (macOS = 25, hidden elsewhere). */
37
+ function getTopOffset(): number {
38
+ if (typeof document === "undefined") return 0;
39
+ return Number.parseInt(getComputedStyle(document.body).paddingTop, 10) || 0;
40
+ }
41
+
42
+ /**
43
+ * The `tabs-with-console` layout body. Splits its area between the tab UI and the
44
+ * Operator Console along the docked edge, with a drag-to-resize divider. Collapses the
45
+ * console to a thin clickable strip and supports maximizing it to fill the layout body.
46
+ */
47
+ export function TabsWithConsoleLayout() {
48
+ const [state] = useObservable(operatorConsolePanel);
49
+ const [mode] = useObservable(colorMode);
50
+ const [topOffset] = useState(getTopOffset);
51
+
52
+ const [dragSize, setDragSize] = useState<number | null>(null);
53
+ const [isResizing, setIsResizing] = useState(false);
54
+ const dragStartRef = useRef<{ startX: number; startY: number; startSize: number } | null>(null);
55
+ const latestSizeRef = useRef<number | null>(null);
56
+
57
+ const { expanded, dock, bottomHeight, sideWidth, maximized } = state;
58
+
59
+ useEffect(() => {
60
+ if (!isResizing) return;
61
+
62
+ const onMove = (e: MouseEvent) => {
63
+ const start = dragStartRef.current;
64
+ if (!start) return;
65
+ let next: number;
66
+ if (dock === "bottom") {
67
+ next = clamp(
68
+ start.startSize + (start.startY - e.clientY),
69
+ MIN_SIZE,
70
+ window.innerHeight - topOffset - MIN_SIZE,
71
+ );
72
+ } else if (dock === "left") {
73
+ next = clamp(
74
+ start.startSize + (e.clientX - start.startX),
75
+ MIN_SIZE,
76
+ window.innerWidth - MIN_SIZE,
77
+ );
78
+ } else {
79
+ next = clamp(
80
+ start.startSize + (start.startX - e.clientX),
81
+ MIN_SIZE,
82
+ window.innerWidth - MIN_SIZE,
83
+ );
84
+ }
85
+ latestSizeRef.current = next;
86
+ setDragSize(next);
87
+ };
88
+
89
+ const onUp = () => {
90
+ setIsResizing(false);
91
+ const finalSize = latestSizeRef.current;
92
+ if (finalSize != null) {
93
+ setConsoleSize(dock === "bottom" ? { bottomHeight: finalSize } : { sideWidth: finalSize });
94
+ }
95
+ setDragSize(null);
96
+ latestSizeRef.current = null;
97
+ dragStartRef.current = null;
98
+ };
99
+
100
+ document.addEventListener("mousemove", onMove);
101
+ document.addEventListener("mouseup", onUp);
102
+ return () => {
103
+ document.removeEventListener("mousemove", onMove);
104
+ document.removeEventListener("mouseup", onUp);
105
+ };
106
+ }, [isResizing, dock, topOffset]);
107
+
108
+ const theme = getConsoleTheme(mode === "dark");
109
+ const isVertical = dock !== "bottom";
110
+ const consoleSize = dragSize ?? (dock === "bottom" ? bottomHeight : sideWidth);
111
+
112
+ const onResizeStart = (e: React.MouseEvent) => {
113
+ e.preventDefault();
114
+ const startSize = dock === "bottom" ? bottomHeight : sideWidth;
115
+ dragStartRef.current = { startX: e.clientX, startY: e.clientY, startSize };
116
+ latestSizeRef.current = startSize;
117
+ setIsResizing(true);
118
+ };
119
+
120
+ // Tabs panel stays mounted across maximize so the tab subtree keeps its state; it is
121
+ // hidden (not unmounted) when the console is maximized.
122
+ const tabsHidden = expanded && maximized;
123
+ const tabsPanel = (
124
+ <div
125
+ key="tabs"
126
+ style={{
127
+ flex: 1,
128
+ minWidth: 0,
129
+ minHeight: 0,
130
+ overflow: "hidden",
131
+ display: tabsHidden ? "none" : "block",
132
+ }}
133
+ >
134
+ <TabsLayoutInternal fillContainer />
135
+ </div>
136
+ );
137
+
138
+ let consoleRegion: React.ReactNode;
139
+ if (!expanded) {
140
+ consoleRegion = <CollapsedStrip key="console" dock={dock} theme={theme} />;
141
+ } else if (maximized) {
142
+ consoleRegion = (
143
+ <div key="console" style={{ flex: 1, minWidth: 0, minHeight: 0 }}>
144
+ <OperatorConsolePanel />
145
+ </div>
146
+ );
147
+ } else {
148
+ consoleRegion = (
149
+ <div
150
+ key="console"
151
+ style={{
152
+ flex: "0 0 auto",
153
+ minWidth: 0,
154
+ minHeight: 0,
155
+ ...(dock === "bottom" ? { height: `${consoleSize}px` } : { width: `${consoleSize}px` }),
156
+ }}
157
+ >
158
+ <OperatorConsolePanel />
159
+ </div>
160
+ );
161
+ }
162
+
163
+ const divider =
164
+ expanded && !maximized ? (
165
+ <ResizeDivider
166
+ key="divider"
167
+ isVertical={isVertical}
168
+ isResizing={isResizing}
169
+ theme={theme}
170
+ onMouseDown={onResizeStart}
171
+ />
172
+ ) : null;
173
+
174
+ const children =
175
+ dock === "left" ? [consoleRegion, divider, tabsPanel] : [tabsPanel, divider, consoleRegion];
176
+
177
+ return (
178
+ <div
179
+ style={{
180
+ height: "calc(100vh - 25px)",
181
+ display: "flex",
182
+ flexDirection: isVertical ? "row" : "column",
183
+ overflow: "hidden",
184
+ userSelect: isResizing ? "none" : undefined,
185
+ }}
186
+ >
187
+ {children}
188
+ </div>
189
+ );
190
+ }
191
+
192
+ interface CollapsedStripProps {
193
+ dock: ConsoleDock;
194
+ theme: ReturnType<typeof getConsoleTheme>;
195
+ }
196
+
197
+ /** Thin clickable edge strip shown when the console is collapsed; opens it on click. */
198
+ function CollapsedStrip({ dock, theme }: CollapsedStripProps) {
199
+ const isVertical = dock !== "bottom";
200
+ return (
201
+ <button
202
+ type="button"
203
+ onClick={openConsole}
204
+ title="Open Console (Ctrl+`)"
205
+ style={{
206
+ flex: `0 0 ${STRIP_THICKNESS}px`,
207
+ display: "flex",
208
+ alignItems: "center",
209
+ justifyContent: "center",
210
+ gap: "6px",
211
+ border: "none",
212
+ padding: 0,
213
+ backgroundColor: theme.headerBg,
214
+ color: theme.muted,
215
+ cursor: "pointer",
216
+ userSelect: "none",
217
+ fontSize: "12px",
218
+ ...(dock === "bottom"
219
+ ? { width: "100%", borderTop: `1px solid ${theme.border}` }
220
+ : dock === "left"
221
+ ? { height: "100%", borderRight: `1px solid ${theme.border}` }
222
+ : { height: "100%", borderLeft: `1px solid ${theme.border}` }),
223
+ }}
224
+ >
225
+ <i className="bi-terminal" style={{ fontSize: "14px" }} />
226
+ {!isVertical && <span>Console</span>}
227
+ <i className={isVertical ? "bi-chevron-left" : "bi-chevron-up"} />
228
+ </button>
229
+ );
230
+ }
231
+
232
+ interface ResizeDividerProps {
233
+ isVertical: boolean;
234
+ isResizing: boolean;
235
+ theme: ReturnType<typeof getConsoleTheme>;
236
+ onMouseDown: (e: React.MouseEvent) => void;
237
+ }
238
+
239
+ /** Drag handle between the tabs and console panels; resizes the console along the dock edge. */
240
+ function ResizeDivider({ isVertical, isResizing, theme, onMouseDown }: ResizeDividerProps) {
241
+ return (
242
+ // biome-ignore lint/a11y/noStaticElementInteractions: pointer-only resize gutter; size is also adjustable via persisted state
243
+ <div
244
+ onMouseDown={onMouseDown}
245
+ onMouseEnter={(e) => {
246
+ if (!isResizing) e.currentTarget.style.backgroundColor = theme.accent;
247
+ }}
248
+ onMouseLeave={(e) => {
249
+ if (!isResizing) e.currentTarget.style.backgroundColor = "transparent";
250
+ }}
251
+ style={{
252
+ flex: `0 0 ${HANDLE_THICKNESS}px`,
253
+ backgroundColor: isResizing ? theme.accent : "transparent",
254
+ cursor: isVertical ? "ew-resize" : "ns-resize",
255
+ }}
256
+ />
257
+ );
258
+ }
259
+
260
+ export default TabsWithConsoleLayout;
@@ -0,0 +1,113 @@
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 {
16
+ hasShownWelcomeModal,
17
+ rpcServerCalls,
18
+ setDefaultClientUserContext,
19
+ } from "@peers-app/peers-sdk";
20
+ import { useEffect, useState } from "react";
21
+ import { CommandPaletteOverlay } from "../command-palette/command-palette-ui";
22
+ import { loadGlobals } from "../globals";
23
+ import { useObservable, usePromise } from "../hooks";
24
+ import { colorMode } from "../screens/settings/color-mode-dropdown";
25
+ import { SetupUser } from "../screens/setup-user";
26
+ import { WelcomeModal } from "../screens/welcome-modal";
27
+ import { activeTabId, activeTabs, recentlyUsedApps } from "../tabs-layout/tabs-state";
28
+ import { loadAllRoutes } from "../ui-router/routes-loader";
29
+ import { globalOverlays } from "./global-overlays";
30
+ import { DEFAULT_ROOT_LAYOUT_ID, getRootLayout } from "./root-layout-registry";
31
+ import { selectedRootLayoutId } from "./root-layout-state";
32
+
33
+ /**
34
+ * Top-level host mounted by the client. Resolves the user, then hands off to the
35
+ * bootstrap component once a user exists. Kept as a thin outer component so the hook
36
+ * order downstream is stable across the user/no-user branches.
37
+ */
38
+ export function RootLayoutHost() {
39
+ const userId = usePromise(async () => {
40
+ const _userId = await rpcServerCalls.getUserId();
41
+ return _userId || (null as string | null);
42
+ });
43
+
44
+ if (userId === undefined) {
45
+ return;
46
+ }
47
+
48
+ if (!userId) {
49
+ document.getElementById("appLoadingDiv")?.remove();
50
+ return <SetupUser />;
51
+ }
52
+
53
+ return <RootLayoutBootstrap userId={userId} />;
54
+ }
55
+
56
+ let userContextInitialized = false;
57
+
58
+ /**
59
+ * Inner bootstrap: initializes the user context, awaits global/route/tab loading, then
60
+ * renders the selected layout body alongside the always-available command palette and
61
+ * the first-run welcome modal.
62
+ */
63
+ function RootLayoutBootstrap(props: { userId: string }) {
64
+ if (!userContextInitialized) {
65
+ setDefaultClientUserContext(props.userId);
66
+ userContextInitialized = true;
67
+ }
68
+
69
+ const loaded = usePromise(async () => {
70
+ await loadGlobals();
71
+ await loadAllRoutes();
72
+ await Promise.all([
73
+ activeTabs.loadingPromise,
74
+ activeTabId.loadingPromise,
75
+ recentlyUsedApps.loadingPromise,
76
+ hasShownWelcomeModal.loadingPromise,
77
+ ]);
78
+ return true;
79
+ });
80
+
81
+ const [showWelcomeModal, setShowWelcomeModal] = useState(false);
82
+ const [_colorMode] = useObservable(colorMode);
83
+ const [layoutId] = useObservable(selectedRootLayoutId);
84
+ const [overlays] = useObservable(globalOverlays);
85
+
86
+ // Check if we should show the welcome modal after loading
87
+ useEffect(() => {
88
+ if (loaded && !hasShownWelcomeModal()) {
89
+ setShowWelcomeModal(true);
90
+ }
91
+ }, [loaded]);
92
+
93
+ if (!loaded) return false;
94
+
95
+ document.getElementById("appLoadingDiv")?.remove();
96
+
97
+ const layout =
98
+ getRootLayout(layoutId ?? DEFAULT_ROOT_LAYOUT_ID) ?? getRootLayout(DEFAULT_ROOT_LAYOUT_ID);
99
+ const Body = layout?.Component;
100
+
101
+ return (
102
+ <>
103
+ {Body && <Body />}
104
+ <CommandPaletteOverlay />
105
+ {overlays.map(({ id, Component }) => (
106
+ <Component key={id} />
107
+ ))}
108
+ {showWelcomeModal && (
109
+ <WelcomeModal colorMode={_colorMode} onClose={() => setShowWelcomeModal(false)} />
110
+ )}
111
+ </>
112
+ );
113
+ }
@@ -0,0 +1,51 @@
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
+ }
@@ -0,0 +1,55 @@
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();
@@ -0,0 +1,32 @@
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,4 +1,3 @@
1
- import { emit } from "@peers-app/peers-sdk";
2
1
  import type React from "react";
3
2
  import { useCallback, useEffect, useRef, useState } from "react";
4
3
  import { getNetworkViewerApi } from "./network-viewer-ipc";
@@ -183,19 +182,16 @@ export function ConnectionTroubleshooter({ onBack }: Props) {
183
182
  const handleAskAssistant = () => {
184
183
  const report = formatReportForAI(checks.filter((c) => c.status !== "running"));
185
184
  const message = `I ran the Peers connection troubleshooter and got the following results. Please help me understand what's wrong and how to fix it:\n\n${report}`;
186
- emit({ name: "chat:openWithMessage", data: { message } }).catch(() => {
187
- // Fallback: copy to clipboard
188
- navigator.clipboard
189
- .writeText(message)
190
- .then(() => {
191
- alert("Diagnostic report copied to clipboard. Paste it into the AI assistant chat.");
192
- })
193
- .catch(() => {
194
- alert(
195
- "Could not open AI assistant. Please open the chat manually and paste the diagnostic report.",
196
- );
197
- });
198
- });
185
+ navigator.clipboard
186
+ .writeText(message)
187
+ .then(() => {
188
+ alert("Diagnostic report copied to clipboard. Paste it into the AI assistant chat.");
189
+ })
190
+ .catch(() => {
191
+ alert(
192
+ "Could not copy the diagnostic report. Please open the chat manually and describe the results.",
193
+ );
194
+ });
199
195
  };
200
196
 
201
197
  const groups = groupByLayer(checks.filter((c) => !c.id.startsWith("placeholder-")));
@@ -17,6 +17,7 @@ import { Tabs } from "../../components/tabs";
17
17
  import { Tooltip } from "../../components/tooltip";
18
18
  import * as globals from "../../globals";
19
19
  import { useObservable, useObservableState, usePromise } from "../../hooks";
20
+ import { LayoutPicker } from "../../root-layout/layout-picker";
20
21
  import { ColorModeDropdown } from "./color-mode-dropdown";
21
22
  import { VoiceSettings } from "./voice-settings";
22
23
 
@@ -77,7 +78,12 @@ const AppearanceSettingsTab: React.FC = () => {
77
78
  return (
78
79
  <>
79
80
  <h5 className="mb-3">Appearance</h5>
80
- <ColorModeDropdown />
81
+ <div className="mb-3">
82
+ <ColorModeDropdown />
83
+ </div>
84
+ <div className="mb-3">
85
+ <LayoutPicker />
86
+ </div>
81
87
  </>
82
88
  );
83
89
  };
@@ -4,7 +4,6 @@ import {
4
4
  newid,
5
5
  newKeys,
6
6
  openMessageWithPublicKey,
7
- peersCorePackageId,
8
7
  rpcServerCalls,
9
8
  signMessageWithSecretKey,
10
9
  } from "@peers-app/peers-sdk";
@@ -36,16 +35,10 @@ export const SetupUser = () => {
36
35
  const keys = newKeys();
37
36
  const _userId = newid();
38
37
 
39
- // Call setUserIdAndSecretKey
38
+ // Call setUserIdAndSecretKey. This triggers device init, which installs
39
+ // peers-core into the personal context (S3-first, bundle fallback).
40
40
  await rpcServerCalls.setUserIdAndSecretKey(_userId, keys.secretKey);
41
41
 
42
- // Auto-install peers-core for the new user
43
- await rpcServerCalls
44
- .addOrUpdatePackage(peersCorePackageId, { dataContextId: _userId })
45
- .catch((err: unknown) => {
46
- console.error("Error auto-installing peers-core:", err);
47
- });
48
-
49
42
  // Success - reload the app (peers-services registration runs after Welcome modal)
50
43
  window.location.reload();
51
44
  } catch (err) {