@peers-app/peers-ui 0.34.13 → 0.34.15

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 (126) hide show
  1. package/dist/apps-home/app-menu.d.ts +1 -2
  2. package/dist/apps-home/app-menu.js +29 -25
  3. package/dist/command-palette/command-palette-ui.js +13 -12
  4. package/dist/components/autocomplete-chips.d.ts +18 -0
  5. package/dist/components/autocomplete-chips.js +49 -0
  6. package/dist/components/autocomplete.d.ts +88 -0
  7. package/dist/components/autocomplete.js +346 -0
  8. package/dist/components/confirm-button.d.ts +26 -0
  9. package/dist/components/confirm-button.js +55 -0
  10. package/dist/components/data-grid/autocomplete.d.ts +1 -31
  11. package/dist/components/data-grid/autocomplete.js +5 -197
  12. package/dist/components/empty-state.d.ts +16 -0
  13. package/dist/components/empty-state.js +16 -0
  14. package/dist/components/group-switcher.d.ts +3 -3
  15. package/dist/components/group-switcher.js +22 -17
  16. package/dist/components/inline-create-form.d.ts +22 -0
  17. package/dist/components/inline-create-form.js +56 -0
  18. package/dist/components/list-row.d.ts +33 -0
  19. package/dist/components/list-row.js +30 -0
  20. package/dist/components/list-screen.d.ts +31 -3
  21. package/dist/components/list-screen.js +61 -28
  22. package/dist/components/markdown-editor/format-bar.js +15 -40
  23. package/dist/components/markdown-editor/link-plugin.js +38 -9
  24. package/dist/components/markdown-editor/selection-bar-place.d.ts +37 -0
  25. package/dist/components/markdown-editor/selection-bar-place.js +107 -0
  26. package/dist/components/menu-button.d.ts +34 -0
  27. package/dist/components/menu-button.js +66 -0
  28. package/dist/components/screen-header.d.ts +35 -0
  29. package/dist/components/screen-header.js +30 -0
  30. package/dist/components/search-field.d.ts +22 -0
  31. package/dist/components/search-field.js +22 -0
  32. package/dist/components/segmented-control.d.ts +25 -0
  33. package/dist/components/segmented-control.js +18 -0
  34. package/dist/components/typeahead.d.ts +9 -0
  35. package/dist/components/typeahead.js +7 -0
  36. package/dist/delegates/acts-for-you-panel.d.ts +2 -1
  37. package/dist/delegates/acts-for-you-panel.js +46 -17
  38. package/dist/delegates/delegate-request-dialog.d.ts +3 -1
  39. package/dist/delegates/delegate-request-dialog.js +6 -3
  40. package/dist/groups/groups-client.d.ts +23 -1
  41. package/dist/groups/groups-client.js +31 -0
  42. package/dist/index.d.ts +10 -0
  43. package/dist/index.js +14 -1
  44. package/dist/isolated-screens/config.js +1 -9
  45. package/dist/isolated-screens/folder-picker-control.d.ts +57 -0
  46. package/dist/isolated-screens/folder-picker-control.js +217 -0
  47. package/dist/isolated-screens/folder-picker-host.d.ts +57 -0
  48. package/dist/isolated-screens/folder-picker-host.js +178 -0
  49. package/dist/isolated-screens/folder-picker-protocol.d.ts +75 -0
  50. package/dist/isolated-screens/folder-picker-protocol.js +104 -0
  51. package/dist/isolated-screens/frame-bridge.js +8 -0
  52. package/dist/isolated-screens/frame-document.js +2 -1
  53. package/dist/isolated-screens/frame-microphone.d.ts +55 -0
  54. package/dist/isolated-screens/frame-microphone.js +265 -0
  55. package/dist/isolated-screens/frame-permissions.d.ts +19 -0
  56. package/dist/isolated-screens/frame-permissions.js +32 -0
  57. package/dist/isolated-screens/frame-protocol.d.ts +26 -0
  58. package/dist/isolated-screens/frame-protocol.js +9 -0
  59. package/dist/isolated-screens/frame-pvars.d.ts +27 -0
  60. package/dist/isolated-screens/frame-pvars.js +101 -14
  61. package/dist/isolated-screens/global-widgets.d.ts +1 -2
  62. package/dist/isolated-screens/index.d.ts +2 -0
  63. package/dist/isolated-screens/index.js +3 -1
  64. package/dist/isolated-screens/isolated-screen.d.ts +21 -0
  65. package/dist/isolated-screens/isolated-screen.js +88 -5
  66. package/dist/isolated-screens/local-folder-picker.d.ts +55 -0
  67. package/dist/isolated-screens/local-folder-picker.js +143 -0
  68. package/dist/isolated-screens/microphone-host.d.ts +110 -0
  69. package/dist/isolated-screens/microphone-host.js +397 -0
  70. package/dist/isolated-screens/microphone-prompt.d.ts +20 -0
  71. package/dist/isolated-screens/microphone-prompt.js +60 -0
  72. package/dist/isolated-screens/piece-frames.js +5 -94
  73. package/dist/isolated-screens/piece-reach.d.ts +1 -0
  74. package/dist/isolated-screens/port-channel.d.ts +21 -11
  75. package/dist/isolated-screens/port-channel.js +15 -5
  76. package/dist/isolated-screens/slot-rect.d.ts +38 -0
  77. package/dist/isolated-screens/slot-rect.js +121 -0
  78. package/dist/isolated-screens/test-ports.d.ts +17 -0
  79. package/dist/isolated-screens/test-ports.js +25 -3
  80. package/dist/mentions/mention-chooser.js +1 -1
  81. package/dist/notifications/notifications-screen.js +1 -1
  82. package/dist/screens/data-explorer/data-explorer.d.ts +1 -0
  83. package/dist/screens/data-explorer/data-explorer.js +28 -10
  84. package/dist/screens/data-explorer/query-executor.d.ts +1 -0
  85. package/dist/screens/data-explorer/query-executor.js +3 -1
  86. package/dist/screens/groups/group-list.d.ts +13 -3
  87. package/dist/screens/groups/group-list.js +88 -11
  88. package/dist/screens/identity/identity-routes.d.ts +16 -0
  89. package/dist/screens/identity/identity-routes.js +27 -10
  90. package/dist/screens/identity/identity-screen.js +4 -1
  91. package/dist/screens/invites/activity-view.d.ts +3 -1
  92. package/dist/screens/invites/activity-view.js +7 -3
  93. package/dist/screens/invites/pending-invites-list.d.ts +8 -4
  94. package/dist/screens/invites/pending-invites-list.js +44 -45
  95. package/dist/screens/network-viewer/graph/network-graph-controls.js +3 -3
  96. package/dist/screens/packages/local-folder-grants-panel.d.ts +2 -0
  97. package/dist/screens/packages/local-folder-grants-panel.js +1 -1
  98. package/dist/screens/packages/package-info.js +2 -1
  99. package/dist/screens/packages/package-list.d.ts +2 -2
  100. package/dist/screens/packages/package-list.js +89 -105
  101. package/dist/screens/packages/package-microphone-panel.d.ts +14 -0
  102. package/dist/screens/packages/package-microphone-panel.js +62 -0
  103. package/dist/screens/packages/package-runtime-status.d.ts +10 -2
  104. package/dist/screens/packages/package-runtime-status.js +17 -4
  105. package/dist/screens/peer-types/peer-type-details.js +3 -2
  106. package/dist/screens/peer-types/peer-type-list.d.ts +1 -1
  107. package/dist/screens/peer-types/peer-type-list.js +4 -4
  108. package/dist/screens/settings/settings-page.js +1 -4
  109. package/dist/screens/tools/tool-details.js +2 -1
  110. package/dist/screens/tools/tool-list.d.ts +1 -1
  111. package/dist/screens/tools/tool-list.js +22 -60
  112. package/dist/screens/variables/variable-details.js +5 -4
  113. package/dist/screens/variables/variable-list.d.ts +17 -0
  114. package/dist/screens/variables/variable-list.js +72 -28
  115. package/dist/tabs-layout/network-status-details.d.ts +4 -4
  116. package/dist/tabs-layout/network-status-details.js +6 -5
  117. package/dist/tabs-layout/network-status-indicator.d.ts +1 -0
  118. package/dist/tabs-layout/network-status-indicator.js +1 -0
  119. package/dist/tabs-layout/tab-bar-shortcuts.d.ts +46 -0
  120. package/dist/tabs-layout/tab-bar-shortcuts.js +140 -0
  121. package/dist/tabs-layout/tabs-layout.js +11 -9
  122. package/dist/theme.css +326 -6
  123. package/dist/ui-contracts/popover-surface.d.ts +3 -0
  124. package/dist/ui-contracts/popover-surface.js +6 -3
  125. package/dist/ui-defaults/list-screen.js +10 -4
  126. package/package.json +3 -3
@@ -1,5 +1,9 @@
1
1
  import { type GroupMemberRole, type IGroup, type UserContext } from "@peers-app/peers-sdk";
2
- /** Search, summarize, and create groups owned by the signed-in user. */
2
+ /**
3
+ * Search, summarize, and create groups owned by the signed-in user. The groups are listed in the
4
+ * person's order, and dragging one by its grip saves a new order (System Groups'
5
+ * `setGroupOrder`), which the group switcher and every app that lists groups follow.
6
+ */
3
7
  export declare function GroupList(props?: {
4
8
  creating?: boolean;
5
9
  }): import("react/jsx-runtime").JSX.Element;
@@ -17,7 +21,13 @@ export interface IGroupSummary {
17
21
  /** Signed-in user's role in this group. */
18
22
  myRole?: GroupMemberRole;
19
23
  }
20
- /** Compact, fully clickable group summary row. */
21
- export declare function GroupSummaryRow({ summary }: {
24
+ /**
25
+ * Compact, fully clickable group summary row.
26
+ *
27
+ * @param summary - The group and its counts.
28
+ * @param arrangeable - Show the grip that drags it to a new place in the list.
29
+ */
30
+ export declare function GroupSummaryRow({ summary, arrangeable, }: {
22
31
  summary: IGroupSummary;
32
+ arrangeable?: boolean;
23
33
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.GroupList = GroupList;
4
7
  exports.RemovedGroups = RemovedGroups;
@@ -6,6 +9,7 @@ exports.GroupSummaryRow = GroupSummaryRow;
6
9
  const jsx_runtime_1 = require("react/jsx-runtime");
7
10
  const peers_sdk_1 = require("@peers-app/peers-sdk");
8
11
  const react_1 = require("react");
12
+ const sortablejs_1 = __importDefault(require("sortablejs"));
9
13
  const color_picker_1 = require("../../components/color-picker");
10
14
  const icon_1 = require("../../components/icon");
11
15
  const loading_indicator_1 = require("../../components/loading-indicator");
@@ -18,7 +22,11 @@ const use_observable_1 = require("../../hooks/use-observable");
18
22
  const identity_routes_1 = require("../identity/identity-routes");
19
23
  const activity_view_1 = require("../invites/activity-view");
20
24
  const groups_ipc_1 = require("./groups-ipc");
21
- /** Search, summarize, and create groups owned by the signed-in user. */
25
+ /**
26
+ * Search, summarize, and create groups owned by the signed-in user. The groups are listed in the
27
+ * person's order, and dragging one by its grip saves a new order (System Groups'
28
+ * `setGroupOrder`), which the group switcher and every app that lists groups follow.
29
+ */
22
30
  function GroupList(props = {}) {
23
31
  const userContext = (0, hooks_1.usePromise)(peers_sdk_1.getUserContext);
24
32
  const creating = props.creating ?? false;
@@ -27,9 +35,18 @@ function GroupList(props = {}) {
27
35
  const [summaries, setSummaries] = (0, react_1.useState)();
28
36
  const [error, setError] = (0, react_1.useState)("");
29
37
  const [creatingBusy, setCreatingBusy] = (0, react_1.useState)(false);
30
- const [looks] = (0, use_observable_1.useObservable)(creating ? (0, groups_client_1.groupsObservable)() : undefined);
38
+ // System Groups' list: for the order, and the create form's color. Not read with nothing to
39
+ // order or create.
40
+ const [looks] = (0, use_observable_1.useObservable)(creating || summaries?.length ? (0, groups_client_1.groupsObservable)() : undefined);
31
41
  // A new group starts in the palette color its creator uses least.
32
- const suggestedColor = (0, react_1.useMemo)(() => looks && (0, peers_sdk_1.leastUsedPaletteColor)(looks.map((look) => look.color)), [looks]);
42
+ const suggestedColor = (0, react_1.useMemo)(() => (creating && looks ? (0, peers_sdk_1.leastUsedPaletteColor)(looks.map((look) => look.color)) : undefined), [creating, looks]);
43
+ // Show the drag (or its rollback) until System Groups publishes a list.
44
+ const [arranged, setArranged] = (0, react_1.useState)();
45
+ (0, react_1.useEffect)(() => {
46
+ if (looks)
47
+ setArranged(undefined);
48
+ }, [looks]);
49
+ const listRef = (0, react_1.useRef)(null);
33
50
  const [pickedColor, setPickedColor] = (0, react_1.useState)();
34
51
  const draftColor = pickedColor ?? suggestedColor;
35
52
  const [groupRevision, setGroupRevision] = (0, react_1.useState)(0);
@@ -76,13 +93,66 @@ function GroupList(props = {}) {
76
93
  setPickedColor(undefined);
77
94
  }, [creating]);
78
95
  const filtered = (0, react_1.useMemo)(() => {
96
+ const ordered = (0, groups_client_1.inGroupOrder)(summaries ?? [], arranged ?? (0, groups_client_1.listedGroupOrder)(looks), (s) => s.group);
79
97
  const query = searchText.trim().toLocaleLowerCase();
80
98
  if (!query) {
81
- return summaries ?? [];
99
+ return ordered;
82
100
  }
83
- return (summaries ?? []).filter(({ group }) => group.name.toLocaleLowerCase().includes(query) ||
101
+ return ordered.filter(({ group }) => group.name.toLocaleLowerCase().includes(query) ||
84
102
  group.description.toLocaleLowerCase().includes(query));
85
- }, [searchText, summaries]);
103
+ }, [searchText, summaries, arranged, looks]);
104
+ // Arranging needs the whole list, and System Groups to save it.
105
+ const hasRows = filtered.length > 0;
106
+ const canArrange = !searchText.trim() && !!looks && filtered.length > 1;
107
+ const arrange = (0, react_1.useRef)(() => { });
108
+ arrange.current = ({ item, from, newIndex }) => {
109
+ if (newIndex === undefined || item.parentElement !== from)
110
+ return;
111
+ const groupIds = filtered.map(({ group }) => group.groupId);
112
+ // A list update during the drag can change the row's index since pickup.
113
+ const index = groupIds.indexOf(item.dataset.groupId ?? "");
114
+ if (index < 0)
115
+ return;
116
+ // Restore the DOM order React rendered before asking it to move the row. Restore every row:
117
+ // React may have moved some during the drag (a host update, or a disconnect falling back to
118
+ // name order), and placed them relative to the dragged row's moved node.
119
+ const rows = new Map();
120
+ for (const row of Array.from(from.children)) {
121
+ rows.set(row.dataset.groupId, row);
122
+ }
123
+ groupIds.forEach((groupId, position) => {
124
+ const row = rows.get(groupId);
125
+ if (row && from.children[position] !== row) {
126
+ from.insertBefore(row, from.children[position] ?? null);
127
+ }
128
+ });
129
+ if (index === newIndex || !canArrange)
130
+ return;
131
+ const [moved] = groupIds.splice(index, 1);
132
+ groupIds.splice(newIndex, 0, moved);
133
+ setArranged(groupIds);
134
+ setError("");
135
+ (0, groups_client_1.saveGroupOrder)(groupIds).catch((err) => {
136
+ // Prefer the live order. If the host disconnected, restore the order it showed at drag
137
+ // time. A failure from an earlier drag must leave a newer drag in place.
138
+ const rollback = (0, groups_client_1.groupsObservable)()() ? undefined : (0, groups_client_1.listedGroupOrder)(looks);
139
+ setArranged((current) => (current && current !== groupIds ? current : rollback));
140
+ setError(err.message || "Could not save the groups' order.");
141
+ });
142
+ };
143
+ (0, react_1.useEffect)(() => {
144
+ const list = listRef.current;
145
+ if (!hasRows || !list)
146
+ return;
147
+ // Removing the grips prevents new drags. Keep Sortable on the list so a drag already
148
+ // underway can finish and restore the DOM even if the host disconnects.
149
+ const sortable = sortablejs_1.default.create(list, {
150
+ animation: 150,
151
+ handle: ".peers-group-grip",
152
+ onEnd: (event) => arrange.current(event),
153
+ });
154
+ return () => sortable.destroy();
155
+ }, [hasRows]);
86
156
  function startCreate() {
87
157
  setDraftName(searchText.trim());
88
158
  (0, globals_1.mainContentPath)(identity_routes_1.IDENTITY_GROUP_NEW_PATH);
@@ -122,7 +192,7 @@ function GroupList(props = {}) {
122
192
  void confirmCreate();
123
193
  }, children: [(0, jsx_runtime_1.jsx)("input", { id: "new-group-name", className: "form-control", value: draftName, onChange: (event) => setDraftName(event.target.value), placeholder: "Group name", "aria-label": "Group name" }), (0, jsx_runtime_1.jsx)("button", { type: "submit", className: "btn btn-primary", disabled: !draftName.trim() || creatingBusy, children: creatingBusy ? "Creating…" : "Create" }), (0, jsx_runtime_1.jsx)("a", { href: `#${identity_routes_1.IDENTITY_GROUPS_PATH}`, className: "btn btn-outline-secondary", children: "Cancel" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "small text-body-secondary mb-1", children: "Color" }), (0, jsx_runtime_1.jsx)(color_picker_1.ColorPicker, { value: draftColor, onChange: setPickedColor, label: "New group's color", disabled: creatingBusy })] })] }) })) : null, (0, jsx_runtime_1.jsx)(activity_view_1.PendingWorkLink, { type: "group" }), (0, jsx_runtime_1.jsxs)("div", { className: "position-relative my-3", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-search position-absolute text-muted", style: { left: 12, top: "50%", transform: "translateY(-50%)" } }), (0, jsx_runtime_1.jsx)("input", { type: "search", className: "form-control ps-5", value: searchText, onChange: (event) => setSearchText(event.target.value), placeholder: "Search groups", "aria-label": "Search groups" })] }), error ? (0, jsx_runtime_1.jsx)("div", { className: "alert alert-danger", children: error }) : null, userContext && !searchText.trim() ? ((0, jsx_runtime_1.jsx)("div", { className: "list-group mb-3", children: (0, jsx_runtime_1.jsx)(PersonalRow, { userId: userContext.userId }) })) : null, !summaries && !error ? (0, jsx_runtime_1.jsx)(loading_indicator_1.LoadingIndicator, {}) : null, summaries && filtered.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "border rounded p-4 text-center", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-people fs-2 text-muted" }), (0, jsx_runtime_1.jsx)("h6", { className: "mt-2", children: searchText ? "No matching groups" : "No groups yet" }), (0, jsx_runtime_1.jsx)("p", { className: "small text-muted", children: searchText
124
194
  ? "Try a different name or description."
125
- : "Create a shared space or use an invite to join one." }), !searchText ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-primary btn-sm", onClick: startCreate, children: "Create your first group" })) : null] })) : null, filtered.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "list-group", children: filtered.map((summary) => ((0, jsx_runtime_1.jsx)(GroupSummaryRow, { summary: summary }, summary.group.groupId))) })) : null, userContext ? (0, jsx_runtime_1.jsx)(RemovedGroups, { userContext: userContext, revision: groupRevision }) : null] }));
195
+ : "Create a shared space or use an invite to join one." }), !searchText ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-primary btn-sm", onClick: startCreate, children: "Create your first group" })) : null] })) : null, hasRows ? ((0, jsx_runtime_1.jsx)("div", { className: "list-group", ref: listRef, children: filtered.map((summary) => ((0, jsx_runtime_1.jsx)(GroupSummaryRow, { summary: summary, arrangeable: canArrange }, summary.group.groupId))) })) : null, userContext ? (0, jsx_runtime_1.jsx)(RemovedGroups, { userContext: userContext, revision: groupRevision }) : null] }));
126
196
  }
127
197
  /** Groups the user removed, collapsed under the list, each with a Restore button. */
128
198
  function RemovedGroups(props) {
@@ -181,13 +251,20 @@ async function loadGroupSummaries(userContext) {
181
251
  myRole: members.find((member) => member.userId === userContext.userId)?.role,
182
252
  };
183
253
  }));
184
- return summaries.sort((left, right) => left.group.name.localeCompare(right.group.name));
254
+ return summaries;
185
255
  }
186
- /** Compact, fully clickable group summary row. */
187
- function GroupSummaryRow({ summary }) {
256
+ /**
257
+ * Compact, fully clickable group summary row.
258
+ *
259
+ * @param summary - The group and its counts.
260
+ * @param arrangeable - Show the grip that drags it to a new place in the list.
261
+ */
262
+ function GroupSummaryRow({ summary, arrangeable = false, }) {
188
263
  const { group } = summary;
189
264
  const look = (0, groups_client_1.useGroup)(group.groupId);
190
- return ((0, jsx_runtime_1.jsxs)("a", { href: `#${identity_routes_1.IDENTITY_GROUPS_PATH}/${group.groupId}`, className: "list-group-item list-group-item-action d-flex align-items-center gap-3 py-3", children: [(0, jsx_runtime_1.jsx)(group_look_1.GroupIcon, { icon: look?.icon ?? group.iconClassName, color: look?.color, variant: "tile", size: "44px" }), (0, jsx_runtime_1.jsxs)("span", { className: "flex-grow-1 overflow-hidden", children: [(0, jsx_runtime_1.jsx)("span", { className: "fw-semibold d-block text-truncate", children: group.name || "Unnamed group" }), (0, jsx_runtime_1.jsx)("span", { className: "small text-muted d-block text-truncate", children: plainDescription(group.description) || "No description yet" })] }), (0, jsx_runtime_1.jsxs)("span", { className: "d-flex align-items-center gap-2 flex-wrap justify-content-end", children: [(0, jsx_runtime_1.jsxs)("span", { className: "badge text-bg-light border", children: [summary.memberCount, " member", summary.memberCount === 1 ? "" : "s"] }), summary.myRole !== undefined ? ((0, jsx_runtime_1.jsx)("span", { className: "badge text-bg-secondary", children: (0, peers_sdk_1.getRoleLabel)(summary.myRole) })) : null] }), (0, jsx_runtime_1.jsx)("i", { className: "bi bi-chevron-right text-muted", "aria-hidden": "true" })] }));
265
+ return ((0, jsx_runtime_1.jsxs)("a", { href: `#${identity_routes_1.IDENTITY_GROUPS_PATH}/${group.groupId}`, "data-group-id": group.groupId, className: "list-group-item list-group-item-action d-flex align-items-center gap-3 py-3", children: [arrangeable ? (
266
+ // Dragged with a pointer; a click on it doesn't open the group.
267
+ (0, jsx_runtime_1.jsx)("span", { className: "peers-group-grip text-muted", title: "Drag to reorder", "aria-hidden": "true", style: { cursor: "grab", marginRight: -6 }, onClick: (event) => event.preventDefault(), children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-grip-vertical" }) })) : null, (0, jsx_runtime_1.jsx)(group_look_1.GroupIcon, { icon: look?.icon ?? group.iconClassName, color: look?.color, variant: "tile", size: "44px" }), (0, jsx_runtime_1.jsxs)("span", { className: "flex-grow-1 overflow-hidden", children: [(0, jsx_runtime_1.jsx)("span", { className: "fw-semibold d-block text-truncate", children: group.name || "Unnamed group" }), (0, jsx_runtime_1.jsx)("span", { className: "small text-muted d-block text-truncate", children: plainDescription(group.description) || "No description yet" })] }), (0, jsx_runtime_1.jsxs)("span", { className: "d-flex align-items-center gap-2 flex-wrap justify-content-end", children: [(0, jsx_runtime_1.jsxs)("span", { className: "badge text-bg-light border", children: [summary.memberCount, " member", summary.memberCount === 1 ? "" : "s"] }), summary.myRole !== undefined ? ((0, jsx_runtime_1.jsx)("span", { className: "badge text-bg-secondary", children: (0, peers_sdk_1.getRoleLabel)(summary.myRole) })) : null] }), (0, jsx_runtime_1.jsx)("i", { className: "bi bi-chevron-right text-muted", "aria-hidden": "true" })] }));
191
268
  }
192
269
  /**
193
270
  * Personal, at the top of the list. It has no details page (no one else is in it), so the row
@@ -56,7 +56,15 @@ export interface IdentityLocation {
56
56
  type?: IdentityInviteType;
57
57
  groupId?: string;
58
58
  };
59
+ /**
60
+ * Activity's view, from the query string (`view=history`). It's in the route so that a link to
61
+ * Activity, such as an invite's notification, always opens on what waits, even when the screen
62
+ * stayed open on History.
63
+ */
64
+ activityView: IdentityActivityView;
59
65
  }
66
+ /** Activity's two views: invites that wait (`pending`), and answered or ended ones (`history`). */
67
+ export type IdentityActivityView = "pending" | "history";
60
68
  interface ParsedRoute {
61
69
  pathname: string;
62
70
  query: URLSearchParams;
@@ -105,4 +113,12 @@ export declare function parseIdentityLocation(raw: string | null | undefined): I
105
113
  * @param groupId - Group to limit the list to.
106
114
  */
107
115
  export declare function identityActivityFilterPath(type: IdentityInviteType, groupId?: string): string;
116
+ /**
117
+ * Path to one of Activity's views, keeping its filter.
118
+ *
119
+ * @param filter - Invite type, and a group with it; a group without a type isn't a filter.
120
+ * @param view - `history` for answered and ended invites; `pending` (the default) for what waits.
121
+ * @returns Route under `identity/activity`.
122
+ */
123
+ export declare function identityActivityPath(filter: IdentityLocation["activityFilter"], view?: IdentityActivityView): string;
108
124
  export {};
@@ -14,6 +14,7 @@ exports.isIdentityPath = isIdentityPath;
14
14
  exports.identitySectionFromPath = identitySectionFromPath;
15
15
  exports.parseIdentityLocation = parseIdentityLocation;
16
16
  exports.identityActivityFilterPath = identityActivityFilterPath;
17
+ exports.identityActivityPath = identityActivityPath;
17
18
  const monitoring_routes_1 = require("../monitoring/monitoring-routes");
18
19
  /** Top-level Identity app path. Opening this lands on Activity. */
19
20
  exports.IDENTITY_APP_PATH = "identity";
@@ -142,12 +143,12 @@ function parseIdentityLocation(raw) {
142
143
  deviceId: section === "devices" && !pairing ? detailId : undefined,
143
144
  pairing,
144
145
  accepting,
145
- activityFilter: {
146
- type: type && INVITE_TYPES.has(type)
147
- ? type
148
- : undefined,
149
- groupId: query.get("groupId") || undefined,
150
- },
146
+ // A link opened in place also carries a groupId. Only a recognized Activity filter
147
+ // associates that id with the invite list.
148
+ activityFilter: type && INVITE_TYPES.has(type)
149
+ ? { type: type, groupId: query.get("groupId") || undefined }
150
+ : {},
151
+ activityView: section === "activity" && query.get("view") === "history" ? "history" : "pending",
151
152
  };
152
153
  }
153
154
  /**
@@ -157,12 +158,28 @@ function parseIdentityLocation(raw) {
157
158
  * @param groupId - Group to limit the list to.
158
159
  */
159
160
  function identityActivityFilterPath(type, groupId) {
161
+ return identityActivityPath({ type, groupId });
162
+ }
163
+ /**
164
+ * Path to one of Activity's views, keeping its filter.
165
+ *
166
+ * @param filter - Invite type, and a group with it; a group without a type isn't a filter.
167
+ * @param view - `history` for answered and ended invites; `pending` (the default) for what waits.
168
+ * @returns Route under `identity/activity`.
169
+ */
170
+ function identityActivityPath(filter, view = "pending") {
160
171
  const query = new URLSearchParams();
161
- query.set("type", type);
162
- if (groupId) {
163
- query.set("groupId", groupId);
172
+ if (filter.type) {
173
+ query.set("type", filter.type);
174
+ if (filter.groupId) {
175
+ query.set("groupId", filter.groupId);
176
+ }
177
+ }
178
+ if (view === "history") {
179
+ query.set("view", "history");
164
180
  }
165
- return `${exports.IDENTITY_ACTIVITY_PATH}?${query.toString()}`;
181
+ const queryString = query.toString();
182
+ return queryString ? `${exports.IDENTITY_ACTIVITY_PATH}?${queryString}` : exports.IDENTITY_ACTIVITY_PATH;
166
183
  }
167
184
  function rewritePathname(pathname, query) {
168
185
  const parts = pathname.split("/").filter(Boolean);
@@ -88,7 +88,7 @@ function IdentityBody(props) {
88
88
  if (location.section === "account") {
89
89
  return (0, jsx_runtime_1.jsx)(account_screen_1.AccountScreen, {});
90
90
  }
91
- return ((0, jsx_runtime_1.jsx)("div", { className: "container-xxl p-3", children: (0, jsx_runtime_1.jsx)(activity_view_1.ActivityView, { filter: location.activityFilter }) }));
91
+ return ((0, jsx_runtime_1.jsx)("div", { className: "container-xxl p-3", children: (0, jsx_runtime_1.jsx)(activity_view_1.ActivityView, { filter: location.activityFilter, view: location.activityView }) }));
92
92
  }
93
93
  function IdentityQuickActions() {
94
94
  const [desktop] = (0, hooks_1.useObservable)(globals_1.isDesktop);
@@ -138,6 +138,9 @@ function badgeCount(rows, kind) {
138
138
  },
139
139
  uiCategory: "screen",
140
140
  priority: 3,
141
+ // Identity is the user's own, whichever group is active: a notification about an invite
142
+ // opens it in place rather than switching to Personal and reloading.
143
+ opensAnyGroup: true,
141
144
  },
142
145
  ],
143
146
  });
@@ -1,4 +1,4 @@
1
- import { type IdentityInviteType } from "../identity/identity-routes";
1
+ import { type IdentityActivityView, type IdentityInviteType } from "../identity/identity-routes";
2
2
  /** Props for {@link ActivityView}. */
3
3
  export interface ActivityViewProps {
4
4
  /** Optional type and group limit, taken from the route query. */
@@ -6,6 +6,8 @@ export interface ActivityViewProps {
6
6
  type?: IdentityInviteType;
7
7
  groupId?: string;
8
8
  };
9
+ /** The view the route asks for: what waits (the default), or History. */
10
+ view?: IdentityActivityView;
9
11
  }
10
12
  /**
11
13
  * Unified invite inbox.
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActivityView = ActivityView;
4
4
  exports.PendingWorkLink = PendingWorkLink;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
6
  const loading_indicator_1 = require("../../components/loading-indicator");
8
7
  const identity_routes_1 = require("../identity/identity-routes");
9
8
  const pending_invites_list_1 = require("./pending-invites-list");
@@ -16,7 +15,7 @@ const TERMINAL_STATUSES = ["accepted", "declined", "expired", "revoked"];
16
15
  * on someone else. History is a separate view, not a disclosure on each list.
17
16
  */
18
17
  function ActivityView(props) {
19
- const [view, setView] = (0, react_1.useState)("pending");
18
+ const view = props.view ?? "pending";
20
19
  const filter = props.filter;
21
20
  const query = (0, pending_invites_list_1.useInviteRows)({
22
21
  type: filter?.type,
@@ -27,7 +26,7 @@ function ActivityView(props) {
27
26
  const attention = rows.filter((row) => (0, pending_invites_list_1.classifyInvite)(row) === "attention");
28
27
  const waiting = rows.filter((row) => (0, pending_invites_list_1.classifyInvite)(row) === "waiting");
29
28
  const filtered = Boolean(filter?.type || filter?.groupId);
30
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex justify-content-between align-items-center gap-2 flex-wrap mb-3", children: [(0, jsx_runtime_1.jsxs)("h4", { className: "mb-0", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-inbox me-2" }), "Activity"] }), (0, jsx_runtime_1.jsxs)("div", { className: "d-flex gap-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "btn-group btn-group-sm", role: "group", "aria-label": "Invite view", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: `btn ${view === "pending" ? "btn-primary" : "btn-outline-primary"}`, onClick: () => setView("pending"), children: "Pending" }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: `btn ${view === "history" ? "btn-primary" : "btn-outline-primary"}`, onClick: () => setView("history"), children: "History" })] }), (0, jsx_runtime_1.jsxs)("a", { href: `#${identity_routes_1.IDENTITY_ACCEPT_PATH}`, className: "btn btn-outline-primary btn-sm", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-qr-code-scan me-1" }), "Enter or scan an invite"] })] })] }), filtered ? ((0, jsx_runtime_1.jsxs)("div", { className: "alert alert-secondary py-2 d-flex justify-content-between align-items-center", children: [(0, jsx_runtime_1.jsx)("span", { children: filterLabel(filter?.type, filter?.groupId) }), (0, jsx_runtime_1.jsx)("a", { href: "#identity/activity", children: "Show all" })] })) : null, !query ? ((0, jsx_runtime_1.jsx)(loading_indicator_1.LoadingIndicator, {})) : view === "history" ? ((0, jsx_runtime_1.jsx)(InviteBucket, { title: "History", rows: rows, empty: "No invite history." })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InviteBucket, { title: "Needs your attention", rows: attention, empty: waiting.length === 0 ? "No invites need attention." : "Nothing needs a decision." }), (0, jsx_runtime_1.jsx)(InviteBucket, { title: "Waiting on others", rows: waiting, empty: attention.length === 0 ? "" : "Nothing is waiting on someone else." })] }))] }));
29
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex justify-content-between align-items-center gap-2 flex-wrap mb-3", children: [(0, jsx_runtime_1.jsxs)("h4", { className: "mb-0", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-inbox me-2" }), "Activity"] }), (0, jsx_runtime_1.jsxs)("div", { className: "d-flex gap-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "btn-group btn-group-sm", role: "group", "aria-label": "Invite view", children: [(0, jsx_runtime_1.jsx)(ViewLink, { filter: filter, view: "pending", current: view, children: "Pending" }), (0, jsx_runtime_1.jsx)(ViewLink, { filter: filter, view: "history", current: view, children: "History" })] }), (0, jsx_runtime_1.jsxs)("a", { href: `#${identity_routes_1.IDENTITY_ACCEPT_PATH}`, className: "btn btn-outline-primary btn-sm", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-qr-code-scan me-1" }), "Enter or scan an invite"] })] })] }), filtered ? ((0, jsx_runtime_1.jsxs)("div", { className: "alert alert-secondary py-2 d-flex justify-content-between align-items-center", children: [(0, jsx_runtime_1.jsx)("span", { children: filterLabel(filter?.type, filter?.groupId) }), (0, jsx_runtime_1.jsx)("a", { href: `#${(0, identity_routes_1.identityActivityPath)({}, view)}`, children: "Show all" })] })) : null, !query ? ((0, jsx_runtime_1.jsx)(loading_indicator_1.LoadingIndicator, {})) : query.error !== undefined ? ((0, jsx_runtime_1.jsxs)("div", { className: "alert alert-danger", role: "alert", children: ["Couldn't read your invites", query.error ? `: ${query.error}` : "."] })) : view === "history" ? ((0, jsx_runtime_1.jsx)(InviteBucket, { title: "History", rows: rows, empty: "No invite history." })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InviteBucket, { title: "Needs your attention", rows: attention, empty: waiting.length === 0 ? "No invites need attention." : "Nothing needs a decision." }), (0, jsx_runtime_1.jsx)(InviteBucket, { title: "Waiting on others", rows: waiting, empty: attention.length === 0 ? "" : "Nothing is waiting on someone else." })] }))] }));
31
30
  }
32
31
  /**
33
32
  * Compact link from a resource screen to the matching Activity filter.
@@ -46,6 +45,11 @@ function PendingWorkLink(props) {
46
45
  const count = query.rows.length;
47
46
  return ((0, jsx_runtime_1.jsxs)("a", { href: `#${(0, identity_routes_1.identityActivityFilterPath)(props.type, props.groupId)}`, className: "alert alert-info py-2 px-3 d-flex justify-content-between align-items-center text-decoration-none", children: [(0, jsx_runtime_1.jsxs)("span", { children: [count, " pending ", noun, " invite", count === 1 ? "" : "s"] }), (0, jsx_runtime_1.jsx)("span", { children: "View in Activity" })] }));
48
47
  }
48
+ /** One of Activity's views, as a link to its route so that a link to Activity opens on Pending. */
49
+ function ViewLink(props) {
50
+ const active = props.view === props.current;
51
+ return ((0, jsx_runtime_1.jsx)("a", { href: `#${(0, identity_routes_1.identityActivityPath)(props.filter ?? {}, props.view)}`, className: `btn ${active ? "btn-primary" : "btn-outline-primary"}`, "aria-current": active ? "page" : undefined, children: props.children }));
52
+ }
49
53
  function InviteBucket(props) {
50
54
  if (props.rows.length === 0 && !props.empty) {
51
55
  return null;
@@ -5,12 +5,15 @@ export interface IInviteRowQuery {
5
5
  rows: IInvite[];
6
6
  /** True when at least one matching invite is not pending. */
7
7
  hasHistory: boolean;
8
+ /** Why the invites couldn't be read; `rows` is then empty. */
9
+ error?: string;
8
10
  }
9
11
  /**
10
12
  * Subscribe to the personal `Invites` table.
11
13
  *
12
14
  * @param filter Type, group, and statuses to include. Statuses default to pending.
13
- * @returns Matching rows and whether any non-pending row exists, or `undefined` while loading.
15
+ * @returns Matching rows and whether any non-pending row exists, an error if the read failed,
16
+ * or `undefined` while loading.
14
17
  */
15
18
  export declare function useInviteRows(filter: {
16
19
  type?: IInvite["type"];
@@ -36,10 +39,11 @@ export declare function classifyInvite(row: IInvite): InviteBucket;
36
39
  /** Action that the local user can take on an Activity row. */
37
40
  export type InviteRowAction = "accept" | "decline" | "approve" | "deny" | "revoke";
38
41
  /**
39
- * Return actions that are valid from the local user's perspective.
42
+ * Return actions that are valid from the local user's perspective: revoke for a pending invite
43
+ * they sent, and otherwise the answers the invite waits for from them (`inviteAnswers` in the
44
+ * SDK, the same rule the device notifies by).
40
45
  *
41
- * Inbound rows with `recipientUserId` were initiated locally and are waiting
42
- * for that recipient. Actionable profile requests and join requests omit it.
46
+ * @param row - Invite row from the personal Invites table.
43
47
  */
44
48
  export declare function actionsForInvite(row: IInvite): InviteRowAction[];
45
49
  /** One invite row and the actions its direction and status allow. */
@@ -13,45 +13,57 @@ const invites_ipc_1 = require("./invites-ipc");
13
13
  * Subscribe to the personal `Invites` table.
14
14
  *
15
15
  * @param filter Type, group, and statuses to include. Statuses default to pending.
16
- * @returns Matching rows and whether any non-pending row exists, or `undefined` while loading.
16
+ * @returns Matching rows and whether any non-pending row exists, an error if the read failed,
17
+ * or `undefined` while loading.
17
18
  */
18
19
  function useInviteRows(filter) {
19
20
  const [query, setQuery] = (0, react_1.useState)(undefined);
20
21
  const statuses = filter.statuses ?? ["pending"];
21
22
  const statusKey = statuses.join(",");
22
- const refresh = (0, react_1.useCallback)(async () => {
23
- const userContext = await (0, peers_sdk_1.getUserContext)();
24
- const table = (0, peers_sdk_1.Invites)(userContext.userDataContext);
25
- const all = await table.list({
26
- ...(filter.type ? { type: filter.type } : {}),
27
- ...(filter.groupId ? { groupId: filter.groupId } : {}),
28
- });
29
- const wanted = new Set(statusKey.split(","));
30
- setQuery({
31
- rows: all
32
- .filter((row) => wanted.has(row.status))
33
- .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()),
34
- hasHistory: all.some((row) => row.status !== "pending"),
35
- });
36
- }, [filter.type, filter.groupId, statusKey]);
37
23
  (0, react_1.useEffect)(() => {
38
24
  let disposed = false;
39
25
  let dispose;
40
- void refresh();
41
- void (0, peers_sdk_1.getUserContext)().then((userContext) => {
42
- if (disposed) {
26
+ setQuery(undefined);
27
+ const readFailed = (err) => {
28
+ if (disposed)
43
29
  return;
44
- }
45
- const sub = (0, peers_sdk_1.Invites)(userContext.userDataContext).dataChanged.subscribe(() => void refresh());
46
- dispose = () => {
47
- sub.unsubscribe();
30
+ console.warn("[invites] couldn't read invites", err);
31
+ setQuery({
32
+ rows: [],
33
+ hasHistory: false,
34
+ error: err instanceof Error ? err.message : String(err),
35
+ });
36
+ };
37
+ void (0, peers_sdk_1.getUserContext)()
38
+ .then((userContext) => {
39
+ if (disposed)
40
+ return;
41
+ const table = (0, peers_sdk_1.Invites)(userContext.userDataContext);
42
+ const wanted = new Set(statusKey.split(","));
43
+ const refresh = async () => {
44
+ const all = await table.list({
45
+ ...(filter.type ? { type: filter.type } : {}),
46
+ ...(filter.groupId ? { groupId: filter.groupId } : {}),
47
+ });
48
+ if (disposed)
49
+ return;
50
+ setQuery({
51
+ rows: all
52
+ .filter((row) => wanted.has(row.status))
53
+ .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()),
54
+ hasHistory: all.some((row) => row.status !== "pending"),
55
+ });
48
56
  };
49
- });
57
+ const sub = table.dataChanged.subscribe(() => void refresh().catch(readFailed));
58
+ dispose = () => sub.unsubscribe();
59
+ return refresh();
60
+ })
61
+ .catch(readFailed);
50
62
  return () => {
51
63
  disposed = true;
52
64
  dispose?.();
53
65
  };
54
- }, [refresh]);
66
+ }, [filter.type, filter.groupId, statusKey]);
55
67
  return query;
56
68
  }
57
69
  function counterpartLabel(row) {
@@ -133,33 +145,20 @@ function classifyInvite(row) {
133
145
  if (row.status !== "pending") {
134
146
  return "history";
135
147
  }
136
- return actionsForInvite(row).some((action) => action !== "revoke") ? "attention" : "waiting";
148
+ return (0, peers_sdk_1.inviteNeedsAnswer)(row) ? "attention" : "waiting";
137
149
  }
138
150
  /**
139
- * Return actions that are valid from the local user's perspective.
151
+ * Return actions that are valid from the local user's perspective: revoke for a pending invite
152
+ * they sent, and otherwise the answers the invite waits for from them (`inviteAnswers` in the
153
+ * SDK, the same rule the device notifies by).
140
154
  *
141
- * Inbound rows with `recipientUserId` were initiated locally and are waiting
142
- * for that recipient. Actionable profile requests and join requests omit it.
155
+ * @param row - Invite row from the personal Invites table.
143
156
  */
144
157
  function actionsForInvite(row) {
145
- if (row.status !== "pending" || row.type === "device") {
146
- return [];
147
- }
148
- if (row.direction === "out") {
158
+ if (row.status === "pending" && row.type !== "device" && row.direction === "out") {
149
159
  return ["revoke"];
150
160
  }
151
- if (row.recipientUserId) {
152
- return [];
153
- }
154
- if (row.direction === "in") {
155
- if (row.type === "contact" || row.mode === "direct") {
156
- return ["accept", "decline"];
157
- }
158
- if (row.type === "group" && row.mode === "approve" && row.counterpart) {
159
- return ["approve", "deny"];
160
- }
161
- }
162
- return [];
161
+ return (0, peers_sdk_1.inviteAnswers)(row);
163
162
  }
164
163
  const ACTION_LABELS = {
165
164
  accept: { text: "Accept", className: "btn-primary" },
@@ -51,7 +51,7 @@ function GroupFilter({ graph, short }) {
51
51
  ? names.join(", ")
52
52
  : `${names.length} of ${graph.groups.length}`;
53
53
  const toggle = (groupId) => (0, network_graph_settings_1.setNetworkGraphGroupIds)(known.includes(groupId) ? known.filter((id) => id !== groupId) : [...known, groupId]);
54
- return ((0, jsx_runtime_1.jsxs)(Popover, { on: known.length > 0, ariaLabel: `Groups shown: ${summary}`, label: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [short && !known.length ? "Groups" : `Groups: ${summary}`, (0, jsx_runtime_1.jsx)("i", { className: "bi bi-chevron-down", "aria-hidden": "true" })] }), children: [(0, jsx_runtime_1.jsxs)("div", { className: "peers-net-menu-head", children: [(0, jsx_runtime_1.jsx)("span", { children: "Others are dimmed, not hidden" }), (0, jsx_runtime_1.jsx)("span", { children: "Sync \u00B7 members" })] }), (0, jsx_runtime_1.jsxs)("label", { className: known.length ? "" : "is-on", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: !known.length, onChange: () => (0, network_graph_settings_1.setNetworkGraphGroupIds)([]) }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-menu-name", children: "All groups" }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-menu-state", children: graph.groups.length })] }), graph.groups.map((group) => ((0, jsx_runtime_1.jsxs)("label", { className: known.includes(group.groupId) ? "is-on" : "", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: known.includes(group.groupId), onChange: () => toggle(group.groupId) }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-menu-name", children: group.groupName }), (0, jsx_runtime_1.jsxs)("span", { className: "peers-net-menu-state", children: [(0, network_graph_model_1.syncStateWord)(group.syncState), " \u00B7 ", group.totalMembers ?? "?"] })] }, group.groupId)))] }));
54
+ return ((0, jsx_runtime_1.jsxs)(Popover, { on: known.length > 0, ariaLabel: `Groups shown: ${summary}`, label: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [short && !known.length ? "Groups" : `Groups: ${summary}`, (0, jsx_runtime_1.jsx)("i", { className: "bi bi-chevron-down", "aria-hidden": "true" })] }), children: [(0, jsx_runtime_1.jsxs)("div", { className: "peers-net-menu-head", children: [(0, jsx_runtime_1.jsx)("span", { children: "Others are dimmed, not hidden" }), (0, jsx_runtime_1.jsx)("span", { children: "Sync \u00B7 members" })] }), (0, jsx_runtime_1.jsxs)("label", { className: known.length ? "" : "is-on", children: [(0, jsx_runtime_1.jsx)("input", { className: "form-check-input", type: "checkbox", checked: !known.length, onChange: () => (0, network_graph_settings_1.setNetworkGraphGroupIds)([]) }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-menu-name", children: "All groups" }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-menu-state", children: graph.groups.length })] }), graph.groups.map((group) => ((0, jsx_runtime_1.jsxs)("label", { className: known.includes(group.groupId) ? "is-on" : "", children: [(0, jsx_runtime_1.jsx)("input", { className: "form-check-input", type: "checkbox", checked: known.includes(group.groupId), onChange: () => toggle(group.groupId) }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-menu-name", children: group.groupName }), (0, jsx_runtime_1.jsxs)("span", { className: "peers-net-menu-state", children: [(0, network_graph_model_1.syncStateWord)(group.syncState), " \u00B7 ", group.totalMembers ?? "?"] })] }, group.groupId)))] }));
55
55
  }
56
56
  /** A pill that turns one kind of node on or off. */
57
57
  function ShowToggle({ kind, label }) {
@@ -61,7 +61,7 @@ function ShowToggle({ kind, label }) {
61
61
  /** How many steps out the graph goes: this device's connections, or theirs too. */
62
62
  function StepsPicker({ short }) {
63
63
  const [shows] = (0, hooks_1.useObservable)(network_graph_settings_1.networkGraphShows);
64
- return ((0, jsx_runtime_1.jsxs)("label", { className: "peers-net-steps", children: [short ? null : "Steps", (0, jsx_runtime_1.jsxs)("select", { value: String(shows.steps), "aria-label": "How many steps out", onChange: (event) => (0, network_graph_settings_1.setNetworkGraphShows)({ steps: Number(event.target.value) }), children: [(0, jsx_runtime_1.jsx)("option", { value: "1", children: short ? "1 step" : "1" }), (0, jsx_runtime_1.jsx)("option", { value: "2", children: short ? "2 steps" : "2" })] })] }));
64
+ return ((0, jsx_runtime_1.jsxs)("label", { className: "peers-net-steps", children: [short ? null : "Steps", (0, jsx_runtime_1.jsxs)("select", { className: "form-select form-select-sm", value: String(shows.steps), "aria-label": "How many steps out", onChange: (event) => (0, network_graph_settings_1.setNetworkGraphShows)({ steps: Number(event.target.value) }), children: [(0, jsx_runtime_1.jsx)("option", { value: "1", children: short ? "1 step" : "1" }), (0, jsx_runtime_1.jsx)("option", { value: "2", children: short ? "2 steps" : "2" })] })] }));
65
65
  }
66
66
  function RefreshIcon({ spinning }) {
67
67
  return (0, jsx_runtime_1.jsx)("i", { className: `bi bi-arrow-clockwise${spinning ? " spin" : ""}`, "aria-hidden": "true" });
@@ -74,7 +74,7 @@ function TopBar(props) {
74
74
  const { graph, desktop, actions } = props;
75
75
  const [shows] = (0, hooks_1.useObservable)(network_graph_settings_1.networkGraphShows);
76
76
  if (!desktop) {
77
- return ((0, jsx_runtime_1.jsxs)("div", { className: "peers-net-top", children: [(0, jsx_runtime_1.jsx)(ViewSwitch, {}), (0, jsx_runtime_1.jsx)(GroupFilter, { graph: graph, short: true }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-gap" }), (0, jsx_runtime_1.jsx)(StepsPicker, { short: true }), (0, jsx_runtime_1.jsxs)(Popover, { alignEnd: true, ariaLabel: "More", label: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-three-dots", "aria-hidden": "true" }), children: [(0, jsx_runtime_1.jsxs)("label", { children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: shows.offline, onChange: () => (0, network_graph_settings_1.setNetworkGraphShows)({ offline: !shows.offline }) }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-menu-name", children: "Offline devices" })] }), (0, jsx_runtime_1.jsxs)("label", { children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: shows.service, onChange: () => (0, network_graph_settings_1.setNetworkGraphShows)({ service: !shows.service }) }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-menu-name", children: "peers.app" })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: actions.onRefresh, disabled: actions.refreshing, children: "Refresh" }), actions.onTroubleshoot ? ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: actions.onTroubleshoot, children: "Troubleshoot" })) : null, (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: actions.onSyncRecovery, children: "Sync recovery" })] })] }));
77
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "peers-net-top", children: [(0, jsx_runtime_1.jsx)(ViewSwitch, {}), (0, jsx_runtime_1.jsx)(GroupFilter, { graph: graph, short: true }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-gap" }), (0, jsx_runtime_1.jsx)(StepsPicker, { short: true }), (0, jsx_runtime_1.jsxs)(Popover, { alignEnd: true, ariaLabel: "More", label: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-three-dots", "aria-hidden": "true" }), children: [(0, jsx_runtime_1.jsxs)("label", { children: [(0, jsx_runtime_1.jsx)("input", { className: "form-check-input", type: "checkbox", checked: shows.offline, onChange: () => (0, network_graph_settings_1.setNetworkGraphShows)({ offline: !shows.offline }) }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-menu-name", children: "Offline devices" })] }), (0, jsx_runtime_1.jsxs)("label", { children: [(0, jsx_runtime_1.jsx)("input", { className: "form-check-input", type: "checkbox", checked: shows.service, onChange: () => (0, network_graph_settings_1.setNetworkGraphShows)({ service: !shows.service }) }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-menu-name", children: "peers.app" })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: actions.onRefresh, disabled: actions.refreshing, children: "Refresh" }), actions.onTroubleshoot ? ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: actions.onTroubleshoot, children: "Troubleshoot" })) : null, (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: actions.onSyncRecovery, children: "Sync recovery" })] })] }));
78
78
  }
79
79
  return ((0, jsx_runtime_1.jsxs)("div", { className: "peers-net-top", children: [(0, jsx_runtime_1.jsx)(ViewSwitch, {}), (0, jsx_runtime_1.jsx)(GroupFilter, { graph: graph }), (0, jsx_runtime_1.jsx)("span", { className: "peers-net-gap" }), (0, jsx_runtime_1.jsx)(StepsPicker, {}), (0, jsx_runtime_1.jsx)(ShowToggle, { kind: "offline", label: "Offline" }), (0, jsx_runtime_1.jsx)(ShowToggle, { kind: "service", label: "peers.app" }), actions.onTroubleshoot ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "peers-net-pill", onClick: actions.onTroubleshoot, children: "Troubleshoot" })) : null, (0, jsx_runtime_1.jsx)("button", { type: "button", className: "peers-net-pill", onClick: actions.onSyncRecovery, children: "Sync recovery" }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "peers-net-pill", "aria-label": "Refresh", title: "Ask every connected device for fresh network information", onClick: actions.onRefresh, disabled: actions.refreshing, children: (0, jsx_runtime_1.jsx)(RefreshIcon, { spinning: actions.refreshing }) })] }));
80
80
  }
@@ -5,6 +5,8 @@ export interface ILocalFolderGrantsPanelProps {
5
5
  * Omit it for the device-wide operator list.
6
6
  */
7
7
  packageId?: string;
8
+ /** Leaves out the panel's own heading, for a place that already names it. */
9
+ hideTitle?: boolean;
8
10
  }
9
11
  /**
10
12
  * Folder grants on this device, with add and revoke.
@@ -89,7 +89,7 @@ function LocalFolderGrantsPanel(props) {
89
89
  setBusy(false);
90
90
  }
91
91
  }
92
- return ((0, jsx_runtime_1.jsxs)("section", { className: "mb-4", children: [(0, jsx_runtime_1.jsx)("h5", { children: props.packageId ? "Folders" : "Local folders" }), (0, jsx_runtime_1.jsx)(FolderStatus, { unavailable: unavailable, transportError: transportError, loadError: loadError, loading: !!consumer && grants === undefined && !loadError }), consumer && !unavailable && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GrantTable, { grants: visible, names: names, busy: busy, onRevoke: revoke }), (0, jsx_runtime_1.jsx)(AddFolderForm, { fieldScope: props.packageId ?? "device", groupId: groupId, groups: groupList.map((group) => ({
92
+ return ((0, jsx_runtime_1.jsxs)("section", { className: "mb-4", children: [props.hideTitle ? null : (0, jsx_runtime_1.jsx)("h5", { children: props.packageId ? "Folders" : "Local folders" }), (0, jsx_runtime_1.jsx)(FolderStatus, { unavailable: unavailable, transportError: transportError, loadError: loadError, loading: !!consumer && grants === undefined && !loadError }), consumer && !unavailable && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GrantTable, { grants: visible, names: names, busy: busy, onRevoke: revoke }), (0, jsx_runtime_1.jsx)(AddFolderForm, { fieldScope: props.packageId ?? "device", groupId: groupId, groups: groupList.map((group) => ({
93
93
  groupId: group.groupId,
94
94
  name: group.name || group.groupId,
95
95
  })), mode: mode, busy: busy, onGroupId: setGroupId, onMode: setMode, onAdd: addFolder }), actionError && (0, jsx_runtime_1.jsx)("div", { className: "alert alert-danger mt-2 mb-0", children: actionError })] }))] }));
@@ -9,6 +9,7 @@ const tooltip_1 = require("../../components/tooltip");
9
9
  const acts_for_you_panel_1 = require("../../delegates/acts-for-you-panel");
10
10
  const hooks_1 = require("../../hooks");
11
11
  const host_shell_consumer_1 = require("../../host-shell/host-shell-consumer");
12
+ const package_microphone_panel_1 = require("./package-microphone-panel");
12
13
  const package_network_panel_1 = require("./package-network-panel");
13
14
  const package_widgets_panel_1 = require("./package-widgets-panel");
14
15
  /** Info tab for the package details screen. */
@@ -122,6 +123,6 @@ const PackageInfo = (props) => {
122
123
  await (0, peers_sdk_1.updatePackagePrefs)(pkg.packageId, {
123
124
  followTags: val === "stable" ? "stable" : val,
124
125
  });
125
- }, children: [(0, jsx_runtime_1.jsx)("option", { value: "stable", children: "Stable" }), (0, jsx_runtime_1.jsx)("option", { value: "stable,beta", children: "Stable + Beta" })] })] })] }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2", children: [(0, jsx_runtime_1.jsx)("hr", {}), (0, jsx_runtime_1.jsxs)("small", { children: ["Description:", (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { markdownContent: `This should be edited in the package's README.md. It will automatically update when you restart Peers or reload the package.` })] }), (0, jsx_runtime_1.jsx)(markdown_with_mentions_1.MarkdownWithMentions, { content: pkg.description || "" })] }), (0, jsx_runtime_1.jsx)(package_network_panel_1.PackageNetworkPanel, { packageId: pkg.packageId }), (0, jsx_runtime_1.jsx)(package_widgets_panel_1.PackageWidgetsPanel, { packageId: pkg.packageId, packageName: pkg.name || pkg.packageId, packageVersionId: activeVersionId }), (0, jsx_runtime_1.jsx)(acts_for_you_panel_1.ActsForYouPanel, { packageId: pkg.packageId, packageName: pkg.name || pkg.packageId })] }));
126
+ }, children: [(0, jsx_runtime_1.jsx)("option", { value: "stable", children: "Stable" }), (0, jsx_runtime_1.jsx)("option", { value: "stable,beta", children: "Stable + Beta" })] })] })] }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2", children: [(0, jsx_runtime_1.jsx)("hr", {}), (0, jsx_runtime_1.jsxs)("small", { children: ["Description:", (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { markdownContent: `This should be edited in the package's README.md. It will automatically update when you restart Peers or reload the package.` })] }), (0, jsx_runtime_1.jsx)(markdown_with_mentions_1.MarkdownWithMentions, { content: pkg.description || "" })] }), (0, jsx_runtime_1.jsx)(package_network_panel_1.PackageNetworkPanel, { packageId: pkg.packageId }), (0, jsx_runtime_1.jsx)(package_widgets_panel_1.PackageWidgetsPanel, { packageId: pkg.packageId, packageName: pkg.name || pkg.packageId, packageVersionId: activeVersionId }), (0, jsx_runtime_1.jsx)(package_microphone_panel_1.PackageMicrophonePanel, { packageId: pkg.packageId, packageName: pkg.name || pkg.packageId, packageVersionId: activeVersionId }), (0, jsx_runtime_1.jsx)(acts_for_you_panel_1.ActsForYouPanel, { packageId: pkg.packageId, packageName: pkg.name || pkg.packageId })] }));
126
127
  };
127
128
  exports.PackageInfo = PackageInfo;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Packages screen: search, create/import/install from the search box, local folder grants,
3
- * and the installed package list.
2
+ * The Packages screen: the group's packages with their versions, a search box, New package,
3
+ * and in ⋯, adding one from a link or id and opening the packages folder.
4
4
  */
5
5
  export declare const PackageList: () => import("react/jsx-runtime").JSX.Element;