@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,395 +0,0 @@
1
- import type React from "react";
2
- import { useCallback, useEffect, useRef, useState } from "react";
3
- import { getNetworkViewerPlatformApi } from "./network-viewer-ipc";
4
-
5
- export interface IDiagnosticCheck {
6
- id: string;
7
- label: string;
8
- layer: string;
9
- status: "pass" | "fail" | "warn" | "skip" | "running";
10
- detail: string;
11
- suggestion?: string;
12
- }
13
-
14
- interface Props {
15
- onBack: () => void;
16
- }
17
-
18
- const STATUS_ICON: Record<IDiagnosticCheck["status"], React.ReactNode> = {
19
- pass: <i className="bi bi-check-circle-fill text-success" />,
20
- fail: <i className="bi bi-x-circle-fill text-danger" />,
21
- warn: <i className="bi bi-exclamation-triangle-fill text-warning" />,
22
- skip: <i className="bi bi-dash-circle text-muted" />,
23
- running: (
24
- <span
25
- className="spinner-border spinner-border-sm text-primary"
26
- role="status"
27
- aria-hidden="true"
28
- />
29
- ),
30
- };
31
-
32
- const STATUS_BADGE_CLASS: Record<IDiagnosticCheck["status"], string> = {
33
- pass: "bg-success",
34
- fail: "bg-danger",
35
- warn: "bg-warning text-dark",
36
- skip: "bg-secondary",
37
- running: "bg-primary",
38
- };
39
-
40
- const LAYER_ORDER = [
41
- "Local System",
42
- "Cloud Relay",
43
- "Local Network",
44
- "Protocol Support",
45
- "WebRTC / TURN",
46
- "Peer State",
47
- "Active Connections",
48
- ];
49
-
50
- function groupByLayer(checks: IDiagnosticCheck[]): Record<string, IDiagnosticCheck[]> {
51
- const groups: Record<string, IDiagnosticCheck[]> = {};
52
- for (const check of checks) {
53
- if (!groups[check.layer]) groups[check.layer] = [];
54
- groups[check.layer].push(check);
55
- }
56
- return groups;
57
- }
58
-
59
- function getSummary(checks: IDiagnosticCheck[]): {
60
- issues: number;
61
- warnings: number;
62
- passes: number;
63
- skips: number;
64
- } {
65
- return {
66
- issues: checks.filter((c) => c.status === "fail").length,
67
- warnings: checks.filter((c) => c.status === "warn").length,
68
- passes: checks.filter((c) => c.status === "pass").length,
69
- skips: checks.filter((c) => c.status === "skip").length,
70
- };
71
- }
72
-
73
- function formatReportForAI(checks: IDiagnosticCheck[]): string {
74
- const lines: string[] = ["Connection Troubleshooter Report", "================================"];
75
- const groups = groupByLayer(checks);
76
-
77
- for (const layer of LAYER_ORDER) {
78
- const layerChecks = groups[layer];
79
- if (!layerChecks) continue;
80
- lines.push(`\n[${layer}]`);
81
- for (const check of layerChecks) {
82
- const statusStr = check.status.toUpperCase().padEnd(7);
83
- lines.push(` ${statusStr} ${check.label}: ${check.detail}`);
84
- if (check.suggestion) {
85
- lines.push(` Suggestion: ${check.suggestion}`);
86
- }
87
- }
88
- }
89
-
90
- const { issues, warnings, skips } = getSummary(checks);
91
- lines.push(`\nSummary: ${issues} issue(s), ${warnings} warning(s), ${skips} skipped.`);
92
-
93
- return lines.join("\n");
94
- }
95
-
96
- export function ConnectionTroubleshooter({ onBack }: Props) {
97
- const [checks, setChecks] = useState<IDiagnosticCheck[]>([]);
98
- const [running, setRunning] = useState(false);
99
- const [done, setDone] = useState(false);
100
- const [expanded, setExpanded] = useState<Set<string>>(new Set());
101
- const hasRun = useRef(false);
102
-
103
- const runDiagnostics = useCallback(async () => {
104
- setRunning(true);
105
- setDone(false);
106
- setChecks([]);
107
- setExpanded(new Set());
108
-
109
- const api = getNetworkViewerPlatformApi();
110
- if (!api) {
111
- setChecks([
112
- {
113
- id: "no-api",
114
- label: "Electron API unavailable",
115
- layer: "Local System",
116
- status: "fail",
117
- detail:
118
- "The Electron network API is not available. This tool only works in the desktop app.",
119
- },
120
- ]);
121
- setRunning(false);
122
- setDone(true);
123
- return;
124
- }
125
-
126
- try {
127
- // Stream results by running all checks on the backend and updating as they come in.
128
- // Show a placeholder "running" row immediately while the full batch executes.
129
- const placeholders: IDiagnosticCheck[] = LAYER_ORDER.map((layer) => ({
130
- id: `placeholder-${layer}`,
131
- label: `Checking ${layer}…`,
132
- layer,
133
- status: "running",
134
- detail: "",
135
- }));
136
- setChecks(placeholders);
137
-
138
- const results = (await api.runDiagnostics()) as IDiagnosticCheck[];
139
- setChecks(results);
140
-
141
- // Auto-expand all failed/warned checks so they're visible immediately
142
- const toExpand = new Set<string>();
143
- for (const r of results) {
144
- if ((r.status === "fail" || r.status === "warn") && r.suggestion) {
145
- toExpand.add(r.id);
146
- }
147
- }
148
- setExpanded(toExpand);
149
- } catch (err: unknown) {
150
- setChecks([
151
- {
152
- id: "run-error",
153
- label: "Diagnostics failed to run",
154
- layer: "Local System",
155
- status: "fail",
156
- detail: `Error: ${err instanceof Error ? err.message : "Unknown error"}`,
157
- suggestion: "Restart the application and try again.",
158
- },
159
- ]);
160
- } finally {
161
- setRunning(false);
162
- setDone(true);
163
- }
164
- }, []);
165
-
166
- useEffect(() => {
167
- if (!hasRun.current) {
168
- hasRun.current = true;
169
- void runDiagnostics();
170
- }
171
- }, [runDiagnostics]);
172
-
173
- const toggleExpand = (id: string) => {
174
- setExpanded((prev) => {
175
- const next = new Set(prev);
176
- if (next.has(id)) next.delete(id);
177
- else next.add(id);
178
- return next;
179
- });
180
- };
181
-
182
- const handleAskAssistant = () => {
183
- const report = formatReportForAI(checks.filter((c) => c.status !== "running"));
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}`;
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
- });
195
- };
196
-
197
- const groups = groupByLayer(checks.filter((c) => !c.id.startsWith("placeholder-")));
198
- const placeholders = checks.filter((c) => c.id.startsWith("placeholder-"));
199
- const summary = getSummary(checks);
200
- const completedCount = checks.filter((c) => c.status !== "running").length;
201
- const totalCount = checks.length;
202
- const progressPct = totalCount > 0 ? Math.round((completedCount / totalCount) * 100) : 0;
203
-
204
- const overallStatus: IDiagnosticCheck["status"] = !done
205
- ? "running"
206
- : summary.issues > 0
207
- ? "fail"
208
- : summary.warnings > 0
209
- ? "warn"
210
- : "pass";
211
-
212
- return (
213
- <div className="container-fluid p-4">
214
- {/* Header */}
215
- <div className="d-flex justify-content-between align-items-center mb-3">
216
- <div className="d-flex align-items-center gap-3">
217
- <button className="btn btn-sm btn-outline-secondary" onClick={onBack}>
218
- <i className="bi bi-arrow-left me-1" />
219
- Back
220
- </button>
221
- <h4 className="mb-0">
222
- <i className="bi bi-stethoscope me-2 text-primary" />
223
- Connection Troubleshooter
224
- </h4>
225
- </div>
226
- <button className="btn btn-sm btn-primary" onClick={runDiagnostics} disabled={running}>
227
- {running ? (
228
- <>
229
- <span
230
- className="spinner-border spinner-border-sm me-1"
231
- role="status"
232
- aria-hidden="true"
233
- />
234
- Running…
235
- </>
236
- ) : (
237
- <>
238
- <i className="bi bi-arrow-clockwise me-1" />
239
- Re-run
240
- </>
241
- )}
242
- </button>
243
- </div>
244
-
245
- {/* Progress bar */}
246
- {running && (
247
- <div className="mb-4">
248
- <div className="d-flex justify-content-between mb-1">
249
- <small className="text-muted">Running diagnostics…</small>
250
- <small className="text-muted">
251
- {completedCount} / {totalCount}
252
- </small>
253
- </div>
254
- <div className="progress" style={{ height: "6px" }}>
255
- <div
256
- className="progress-bar progress-bar-striped progress-bar-animated"
257
- style={{ width: `${progressPct}%` }}
258
- />
259
- </div>
260
- </div>
261
- )}
262
-
263
- {/* Summary card — shown when done */}
264
- {done && checks.length > 0 && (
265
- <div
266
- className={`alert ${overallStatus === "pass" ? "alert-success" : overallStatus === "warn" ? "alert-warning" : "alert-danger"} d-flex justify-content-between align-items-center mb-4`}
267
- >
268
- <div className="d-flex align-items-center gap-2">
269
- {overallStatus === "pass" && <i className="bi bi-check-circle-fill fs-5" />}
270
- {overallStatus === "warn" && <i className="bi bi-exclamation-triangle-fill fs-5" />}
271
- {overallStatus === "fail" && <i className="bi bi-x-circle-fill fs-5" />}
272
- <div>
273
- {overallStatus === "pass" && <strong>All checks passed.</strong>}
274
- {overallStatus === "warn" && (
275
- <strong>
276
- {summary.warnings} warning{summary.warnings > 1 ? "s" : ""} found.
277
- </strong>
278
- )}
279
- {overallStatus === "fail" && (
280
- <strong>
281
- {summary.issues} issue{summary.issues > 1 ? "s" : ""} found
282
- {summary.warnings > 0
283
- ? `, ${summary.warnings} warning${summary.warnings > 1 ? "s" : ""}`
284
- : ""}
285
- .
286
- </strong>
287
- )}{" "}
288
- <span className="opacity-75">
289
- {summary.passes} passed · {summary.issues} failed · {summary.warnings} warnings ·{" "}
290
- {summary.skips} skipped
291
- </span>
292
- </div>
293
- </div>
294
- <button
295
- className="btn btn-sm btn-dark d-flex align-items-center gap-1"
296
- onClick={handleAskAssistant}
297
- >
298
- <i className="bi bi-chat-dots-fill" />
299
- Ask AI Assistant
300
- </button>
301
- </div>
302
- )}
303
-
304
- {/* Placeholder rows while waiting for full results */}
305
- {running && placeholders.length > 0 && (
306
- <div className="card mb-3">
307
- <div className="card-body p-2">
308
- {placeholders.map((p) => (
309
- <div key={p.id} className="d-flex align-items-center gap-2 p-2 border-bottom">
310
- {STATUS_ICON[p.status]}
311
- <span className="text-muted small">{p.label}</span>
312
- </div>
313
- ))}
314
- </div>
315
- </div>
316
- )}
317
-
318
- {/* Results grouped by layer */}
319
- {LAYER_ORDER.map((layer) => {
320
- const layerChecks = groups[layer];
321
- if (!layerChecks || layerChecks.length === 0) return null;
322
-
323
- const layerStatus: IDiagnosticCheck["status"] = layerChecks.some((c) => c.status === "fail")
324
- ? "fail"
325
- : layerChecks.some((c) => c.status === "warn")
326
- ? "warn"
327
- : layerChecks.some((c) => c.status === "running")
328
- ? "running"
329
- : layerChecks.every((c) => c.status === "skip")
330
- ? "skip"
331
- : "pass";
332
-
333
- return (
334
- <div className="card mb-3" key={layer}>
335
- <div className="card-header d-flex align-items-center justify-content-between py-2">
336
- <div className="d-flex align-items-center gap-2">
337
- {STATUS_ICON[layerStatus]}
338
- <strong className="small">{layer}</strong>
339
- </div>
340
- <span className={`badge ${STATUS_BADGE_CLASS[layerStatus]}`}>
341
- {layerStatus === "running" ? "running" : layerStatus}
342
- </span>
343
- </div>
344
- <div className="list-group list-group-flush">
345
- {layerChecks.map((check) => (
346
- <div key={check.id} className="list-group-item p-0">
347
- <div
348
- className={`d-flex align-items-start gap-2 px-3 py-2 ${check.suggestion ? "cursor-pointer" : ""}`}
349
- style={{ cursor: check.suggestion ? "pointer" : "default" }}
350
- onClick={() => check.suggestion && toggleExpand(check.id)}
351
- role={check.suggestion ? "button" : undefined}
352
- >
353
- <div className="pt-1 flex-shrink-0">{STATUS_ICON[check.status]}</div>
354
- <div className="flex-grow-1 min-width-0">
355
- <div className="d-flex justify-content-between align-items-start">
356
- <span className="small fw-medium">{check.label}</span>
357
- {check.suggestion && (
358
- <i
359
- className={`bi bi-chevron-${expanded.has(check.id) ? "up" : "down"} text-muted ms-2 flex-shrink-0 small`}
360
- />
361
- )}
362
- </div>
363
- <div className="small text-muted mt-1">{check.detail}</div>
364
- </div>
365
- </div>
366
- {check.suggestion && expanded.has(check.id) && (
367
- <div className="px-3 pb-2 pt-0 ms-4">
368
- <div className="alert alert-info py-2 px-3 mb-0 small d-flex gap-2">
369
- <i className="bi bi-lightbulb-fill text-info flex-shrink-0 mt-1" />
370
- <span>{check.suggestion}</span>
371
- </div>
372
- </div>
373
- )}
374
- </div>
375
- ))}
376
- </div>
377
- </div>
378
- );
379
- })}
380
-
381
- {/* Ask AI Assistant button at bottom (when done, as a secondary option) */}
382
- {done && checks.length > 0 && (
383
- <div className="text-center py-3">
384
- <button className="btn btn-outline-primary" onClick={handleAskAssistant}>
385
- <i className="bi bi-chat-dots-fill me-2" />
386
- Ask AI Assistant for Help
387
- </button>
388
- <p className="text-muted small mt-2 mb-0">
389
- Sends the full diagnostic report to the AI assistant for guided troubleshooting.
390
- </p>
391
- </div>
392
- )}
393
- </div>
394
- );
395
- }
@@ -1,294 +0,0 @@
1
- import { useEffect, useRef, useState } from "react";
2
-
3
- interface ICpuDataPoint {
4
- timestamp: number;
5
- value: number;
6
- }
7
-
8
- interface ICpuUsageGraphProps {
9
- /**
10
- * Function to fetch current CPU usage percentage
11
- */
12
- fetchCpuUsage: () => Promise<number>;
13
- /**
14
- * Duration in minutes to display
15
- */
16
- durationMinutes?: number;
17
- /**
18
- * Update interval in milliseconds
19
- */
20
- updateInterval?: number;
21
- /**
22
- * Minimum height in pixels (optional, defaults to 80)
23
- */
24
- minHeight?: number;
25
- }
26
-
27
- export function CpuUsageGraph({
28
- fetchCpuUsage,
29
- durationMinutes = 5,
30
- updateInterval = 5000,
31
- minHeight = 80,
32
- }: ICpuUsageGraphProps) {
33
- const [dataPoints, setDataPoints] = useState<ICpuDataPoint[]>([]);
34
- const [currentCpu, setCurrentCpu] = useState<number>(0);
35
- const [width, setWidth] = useState<number>(400);
36
- const [height, setHeight] = useState<number>(minHeight);
37
- const containerRef = useRef<HTMLDivElement>(null);
38
- const intervalRef = useRef<NodeJS.Timeout | null>(null);
39
-
40
- const maxDataPoints = (durationMinutes * 60 * 1000) / updateInterval;
41
-
42
- // Observe container size and update width and height
43
- useEffect(() => {
44
- if (!containerRef.current) return;
45
-
46
- const resizeObserver = new ResizeObserver((entries) => {
47
- for (const entry of entries) {
48
- const newWidth = entry.contentRect.width;
49
- const newHeight = entry.contentRect.height;
50
- if (newWidth > 0) {
51
- setWidth(newWidth);
52
- }
53
- if (newHeight > 0) {
54
- setHeight(Math.max(newHeight, minHeight));
55
- }
56
- }
57
- });
58
-
59
- resizeObserver.observe(containerRef.current);
60
-
61
- return () => {
62
- resizeObserver.disconnect();
63
- };
64
- }, [minHeight]);
65
-
66
- useEffect(() => {
67
- const updateData = async () => {
68
- try {
69
- const cpuValue = await fetchCpuUsage();
70
- setCurrentCpu(cpuValue);
71
-
72
- setDataPoints((prev) => {
73
- const newPoint: ICpuDataPoint = {
74
- timestamp: Date.now(),
75
- value: cpuValue,
76
- };
77
-
78
- const updated = [...prev, newPoint];
79
-
80
- // Keep only last N data points
81
- if (updated.length > maxDataPoints) {
82
- return updated.slice(updated.length - maxDataPoints);
83
- }
84
-
85
- return updated;
86
- });
87
- } catch (error) {
88
- console.error("Error fetching CPU usage:", error);
89
- }
90
- };
91
-
92
- // Initial fetch
93
- updateData();
94
-
95
- // Set up interval
96
- intervalRef.current = setInterval(updateData, updateInterval);
97
-
98
- return () => {
99
- if (intervalRef.current) {
100
- clearInterval(intervalRef.current);
101
- }
102
- };
103
- }, [fetchCpuUsage, updateInterval, maxDataPoints]);
104
-
105
- // Calculate SVG path
106
- const getLinePath = (): string => {
107
- if (dataPoints.length < 2) return "";
108
-
109
- const paddingLeft = 25;
110
- const paddingRight = 10;
111
- const paddingTop = 10;
112
- const paddingBottom = 10;
113
- const chartWidth = width - paddingLeft - paddingRight;
114
- const chartHeight = height - paddingTop - paddingBottom;
115
-
116
- // Calculate time range
117
- const now = Date.now();
118
- const timeRange = durationMinutes * 60 * 1000;
119
- const minTime = now - timeRange;
120
-
121
- const points = dataPoints.map((point) => {
122
- // X: Map timestamp to chart width
123
- const x = paddingLeft + ((point.timestamp - minTime) / timeRange) * chartWidth;
124
-
125
- // Y: Map value (0-100) to chart height (inverted because SVG Y grows downward)
126
- const y = paddingTop + chartHeight - (point.value / 100) * chartHeight;
127
-
128
- return { x, y };
129
- });
130
-
131
- // Create SVG path
132
- const pathData = points
133
- .map((point, idx) => {
134
- if (idx === 0) {
135
- return `M ${point.x} ${point.y}`;
136
- }
137
- return `L ${point.x} ${point.y}`;
138
- })
139
- .join(" ");
140
-
141
- return pathData;
142
- };
143
-
144
- // Get gradient path for fill
145
- const getGradientPath = (): string => {
146
- const linePath = getLinePath();
147
- if (!linePath) return "";
148
-
149
- const paddingLeft = 25;
150
- const paddingRight = 10;
151
- const paddingBottom = 10;
152
-
153
- // Close the path at the bottom
154
- return `${linePath} L ${width - paddingRight} ${height - paddingBottom} L ${paddingLeft} ${height - paddingBottom} Z`;
155
- };
156
-
157
- const linePath = getLinePath();
158
- const gradientPath = getGradientPath();
159
-
160
- return (
161
- <div
162
- ref={containerRef}
163
- className="cpu-usage-graph"
164
- style={{
165
- margin: 0,
166
- padding: 0,
167
- position: "relative",
168
- width: "100%",
169
- height: "100%",
170
- minHeight: `${minHeight}px`,
171
- }}
172
- >
173
- <svg
174
- width={width}
175
- height={height}
176
- style={{
177
- border: "1px solid rgba(128, 128, 128, 0.2)",
178
- borderRadius: "4px",
179
- backgroundColor: "rgba(0, 0, 0, 0.02)",
180
- display: "block",
181
- }}
182
- >
183
- <defs>
184
- <linearGradient id="cpuGradient" x1="0%" y1="0%" x2="0%" y2="100%">
185
- <stop offset="0%" stopColor="rgba(13, 110, 253, 0.3)" />
186
- <stop offset="100%" stopColor="rgba(13, 110, 253, 0.05)" />
187
- </linearGradient>
188
- </defs>
189
-
190
- {/* Grid lines */}
191
- {[0, 25, 50, 75, 100].map((value) => {
192
- const paddingLeft = 25;
193
- const paddingRight = 10;
194
- const paddingTop = 10;
195
- const paddingBottom = 10;
196
- const chartHeight = height - paddingTop - paddingBottom;
197
- const y = paddingTop + chartHeight - (value / 100) * chartHeight;
198
- return (
199
- <g key={value}>
200
- <line
201
- x1={paddingLeft}
202
- y1={y}
203
- x2={width - paddingRight}
204
- y2={y}
205
- stroke="rgba(128, 128, 128, 0.1)"
206
- strokeWidth="1"
207
- />
208
- <text
209
- x={paddingLeft - 5}
210
- y={y + 4}
211
- fontSize="10"
212
- fill="rgba(128, 128, 128, 0.6)"
213
- textAnchor="end"
214
- >
215
- {value}
216
- </text>
217
- </g>
218
- );
219
- })}
220
-
221
- {/* Fill area under the line */}
222
- {gradientPath && <path d={gradientPath} fill="url(#cpuGradient)" />}
223
-
224
- {/* Line */}
225
- {linePath && (
226
- <path
227
- d={linePath}
228
- stroke="#0d6efd"
229
- strokeWidth="2"
230
- fill="none"
231
- strokeLinecap="round"
232
- strokeLinejoin="round"
233
- />
234
- )}
235
-
236
- {/* Data points */}
237
- {dataPoints.map((point, idx) => {
238
- const paddingLeft = 25;
239
- const paddingRight = 10;
240
- const paddingTop = 10;
241
- const paddingBottom = 10;
242
- const chartWidth = width - paddingLeft - paddingRight;
243
- const chartHeight = height - paddingTop - paddingBottom;
244
- const now = Date.now();
245
- const timeRange = durationMinutes * 60 * 1000;
246
- const minTime = now - timeRange;
247
-
248
- const x = paddingLeft + ((point.timestamp - minTime) / timeRange) * chartWidth;
249
- const y = paddingTop + chartHeight - (point.value / 100) * chartHeight;
250
-
251
- // Only show the last point as a visible dot
252
- if (idx !== dataPoints.length - 1) return null;
253
-
254
- return (
255
- <circle key={idx} cx={x} cy={y} r="3" fill="#0d6efd" stroke="white" strokeWidth="1.5" />
256
- );
257
- })}
258
-
259
- {/* No data message */}
260
- {dataPoints.length === 0 && (
261
- <text
262
- x={width / 2}
263
- y={height / 2}
264
- fontSize="12"
265
- fill="rgba(128, 128, 128, 0.6)"
266
- textAnchor="middle"
267
- >
268
- Collecting data...
269
- </text>
270
- )}
271
- </svg>
272
-
273
- {/* Centered CPU percentage overlay */}
274
- <div
275
- style={{
276
- position: "absolute",
277
- top: "50%",
278
- left: "50%",
279
- transform: "translate(-50%, -50%)",
280
- fontSize: "2rem",
281
- fontWeight: "bold",
282
- color: "rgba(255, 255, 255, 0.7)",
283
- pointerEvents: "none",
284
- userSelect: "none",
285
- textAlign: "center",
286
- lineHeight: "1.2",
287
- }}
288
- >
289
- CPU &nbsp;
290
- {Math.round(currentCpu)}%
291
- </div>
292
- </div>
293
- );
294
- }