@peers-app/peers-ui 0.27.2 → 0.27.4
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.
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +3 -1
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/sync-recovery.js +103 -1
- package/dist/screens/variables/variable-details.js +2 -1
- package/dist/tabs-layout/network-status-indicator.js +26 -12
- package/dist/tabs-layout/use-network-status.d.ts +6 -1
- package/dist/tabs-layout/use-network-status.js +27 -4
- package/package.json +9 -3
- package/.claude/settings.local.json +0 -34
- package/.github/README.md +0 -52
- package/.github/workflows/delete-all-artifacts.yml +0 -49
- package/.github/workflows/publish.yml +0 -51
- package/babel.config.js +0 -7
- package/biome.json +0 -198
- package/dist/app-updates/app-updates-consumer.test.d.ts +0 -1
- package/dist/app-updates/app-updates-consumer.test.js +0 -56
- package/dist/app-updates/app-updates-settings.test.d.ts +0 -1
- package/dist/app-updates/app-updates-settings.test.js +0 -93
- package/dist/app-updates/remote-app-update-panel.test.d.ts +0 -1
- package/dist/app-updates/remote-app-update-panel.test.js +0 -165
- package/dist/components/access-level-field.test.d.ts +0 -1
- package/dist/components/access-level-field.test.js +0 -28
- package/dist/components/message-logs/tool-access-approval-card.test.d.ts +0 -1
- package/dist/components/message-logs/tool-access-approval-card.test.js +0 -102
- package/dist/components/responsive-section-nav.test.d.ts +0 -1
- package/dist/components/responsive-section-nav.test.js +0 -45
- package/dist/globals-hash.test.d.ts +0 -1
- package/dist/globals-hash.test.js +0 -16
- package/dist/hooks/use-observable-state.test.d.ts +0 -1
- package/dist/hooks/use-observable-state.test.js +0 -64
- package/dist/hooks/use-observable.test.d.ts +0 -1
- package/dist/hooks/use-observable.test.js +0 -191
- package/dist/hooks/use-rows.test.d.ts +0 -1
- package/dist/hooks/use-rows.test.js +0 -175
- package/dist/hooks/use-tool.test.d.ts +0 -1
- package/dist/hooks/use-tool.test.js +0 -190
- package/dist/host-shell/host-shell-consumer.test.d.ts +0 -1
- package/dist/host-shell/host-shell-consumer.test.js +0 -28
- package/dist/root-layout/root-layout-host.test.d.ts +0 -1
- package/dist/root-layout/root-layout-host.test.js +0 -86
- package/dist/screens/account/account-screen.test.d.ts +0 -1
- package/dist/screens/account/account-screen.test.js +0 -51
- package/dist/screens/assistants/assistant-config.test.d.ts +0 -1
- package/dist/screens/assistants/assistant-config.test.js +0 -57
- package/dist/screens/contacts/contact-list.test.d.ts +0 -1
- package/dist/screens/contacts/contact-list.test.js +0 -48
- package/dist/screens/device-pairing/device-pairing.test.d.ts +0 -1
- package/dist/screens/device-pairing/device-pairing.test.js +0 -119
- package/dist/screens/devices/devices-list.test.d.ts +0 -1
- package/dist/screens/devices/devices-list.test.js +0 -53
- package/dist/screens/groups/group-list.test.d.ts +0 -1
- package/dist/screens/groups/group-list.test.js +0 -38
- package/dist/screens/identity/identity-routes.test.d.ts +0 -1
- package/dist/screens/identity/identity-routes.test.js +0 -51
- package/dist/screens/identity/identity-screen.test.d.ts +0 -1
- package/dist/screens/identity/identity-screen.test.js +0 -103
- package/dist/screens/invites/accept-invite.test.d.ts +0 -1
- package/dist/screens/invites/accept-invite.test.js +0 -103
- package/dist/screens/invites/activity-view.test.d.ts +0 -1
- package/dist/screens/invites/activity-view.test.js +0 -108
- package/dist/screens/invites/invite-classify.test.d.ts +0 -1
- package/dist/screens/invites/invite-classify.test.js +0 -115
- package/dist/screens/network-viewer/network-viewer-ipc.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer-ipc.test.js +0 -61
- package/dist/screens/network-viewer/network-viewer.section.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer.section.test.js +0 -63
- package/dist/screens/network-viewer/sync-recovery.test.d.ts +0 -1
- package/dist/screens/network-viewer/sync-recovery.test.js +0 -104
- package/dist/screens/packages/package-helpers.test.d.ts +0 -1
- package/dist/screens/packages/package-helpers.test.js +0 -53
- package/dist/screens/packages/package-runtime-status.test.d.ts +0 -1
- package/dist/screens/packages/package-runtime-status.test.js +0 -50
- package/dist/screens/packages/packages-ipc.test.d.ts +0 -1
- package/dist/screens/packages/packages-ipc.test.js +0 -43
- package/dist/screens/settings/settings-page.test.d.ts +0 -1
- package/dist/screens/settings/settings-page.test.js +0 -19
- package/dist/screens/tools/tool-access-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-access-ipc.test.js +0 -40
- package/dist/screens/tools/tool-catalog-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-catalog-ipc.test.js +0 -52
- package/dist/tabs-layout/network-status-indicator.test.d.ts +0 -1
- package/dist/tabs-layout/network-status-indicator.test.js +0 -665
- package/dist/tabs-layout/tabs-state.test.d.ts +0 -1
- package/dist/tabs-layout/tabs-state.test.js +0 -110
- package/dist/tabs-layout/use-network-status.test.d.ts +0 -1
- package/dist/tabs-layout/use-network-status.test.js +0 -45
- package/dist/ui-router/ui-loader.test.d.ts +0 -1
- package/dist/ui-router/ui-loader.test.js +0 -91
- package/jest.config.js +0 -25
- package/release-guard.js +0 -10
- package/src/app-updates/app-update-controls.tsx +0 -73
- package/src/app-updates/app-updates-consumer.test.ts +0 -83
- package/src/app-updates/app-updates-consumer.ts +0 -121
- package/src/app-updates/app-updates-settings.test.tsx +0 -109
- package/src/app-updates/app-updates-settings.tsx +0 -136
- package/src/app-updates/remote-app-update-panel.test.tsx +0 -205
- package/src/app-updates/remote-app-update-panel.tsx +0 -210
- package/src/app-updates/use-app-update-status.ts +0 -16
- package/src/command-palette/command-palette-ui.tsx +0 -564
- package/src/command-palette/command-palette.ts +0 -242
- package/src/components/access-level-field.test.tsx +0 -32
- package/src/components/access-level-field.tsx +0 -68
- package/src/components/checkbox.tsx +0 -25
- package/src/components/group-switcher.tsx +0 -526
- package/src/components/input-date.tsx +0 -29
- package/src/components/input-number.tsx +0 -83
- package/src/components/input.tsx +0 -25
- package/src/components/inverse-lazy-list.tsx +0 -107
- package/src/components/io-schema-values.tsx +0 -103
- package/src/components/io-schema.tsx +0 -259
- package/src/components/lazy-list.tsx +0 -115
- package/src/components/list-screen.tsx +0 -126
- package/src/components/loading-indicator.tsx +0 -7
- package/src/components/markdown-editor/autolink-plugin.tsx +0 -29
- package/src/components/markdown-editor/editor-inline.tsx +0 -9
- package/src/components/markdown-editor/editor.tsx +0 -158
- package/src/components/markdown-editor/markdown-plugin.tsx +0 -202
- package/src/components/markdown-editor/mention-node.ts +0 -204
- package/src/components/markdown-editor/mentions-plugin.tsx +0 -354
- package/src/components/markdown-editor/move-line-plugin.tsx +0 -186
- package/src/components/markdown-editor/select-line-boundary-plugin.tsx +0 -95
- package/src/components/markdown-editor/theme.ts +0 -46
- package/src/components/markdown-editor/toolbar.tsx +0 -269
- package/src/components/markdown-with-mentions.tsx +0 -198
- package/src/components/message-logs/message-logs.tsx +0 -523
- package/src/components/message-logs/tool-access-approval-card.test.tsx +0 -127
- package/src/components/message-logs/tool-access-approval-card.tsx +0 -178
- package/src/components/messages/avatar.tsx +0 -171
- package/src/components/messages/channel-message-list.tsx +0 -189
- package/src/components/messages/channel-view.tsx +0 -92
- package/src/components/messages/message-compose.tsx +0 -192
- package/src/components/messages/message-display.tsx +0 -231
- package/src/components/messages/thread-message-list.tsx +0 -135
- package/src/components/qr-scanner.tsx +0 -180
- package/src/components/responsive-section-nav.test.tsx +0 -88
- package/src/components/responsive-section-nav.tsx +0 -92
- package/src/components/router.tsx +0 -175
- package/src/components/save-button.tsx +0 -134
- package/src/components/sortable-list.tsx +0 -130
- package/src/components/tabs.tsx +0 -76
- package/src/components/tooltip.tsx +0 -43
- package/src/components/trust-level-badge.tsx +0 -44
- package/src/components/trust-level-dropdown.tsx +0 -136
- package/src/components/typeahead.tsx +0 -357
- package/src/globals-hash.test.ts +0 -19
- package/src/globals.tsx +0 -226
- package/src/hooks/index.ts +0 -8
- package/src/hooks/use-host-contract.ts +0 -75
- package/src/hooks/use-observable-state.test.tsx +0 -101
- package/src/hooks/use-observable-state.ts +0 -29
- package/src/hooks/use-observable.test.tsx +0 -258
- package/src/hooks/use-observable.ts +0 -67
- package/src/hooks/use-on-screen.ts +0 -24
- package/src/hooks/use-promise.ts +0 -34
- package/src/hooks/use-rows.test.tsx +0 -196
- package/src/hooks/use-rows.ts +0 -120
- package/src/hooks/use-subscription.ts +0 -24
- package/src/hooks/use-tool.test.tsx +0 -225
- package/src/hooks/use-tool.ts +0 -116
- package/src/host-shell/host-shell-consumer.test.ts +0 -32
- package/src/host-shell/host-shell-consumer.ts +0 -53
- package/src/index.tsx +0 -42
- package/src/mention-configs.ts +0 -185
- package/src/operator-console/operator-console-state.ts +0 -119
- package/src/operator-console/operator-console.tsx +0 -233
- package/src/peers-services-registration.ts +0 -6
- package/src/root-layout/global-overlays.ts +0 -50
- package/src/root-layout/layout-picker.tsx +0 -47
- package/src/root-layout/layouts/full-screen-layout.tsx +0 -144
- package/src/root-layout/layouts/tabs-with-console-layout.tsx +0 -260
- package/src/root-layout/root-layout-host.test.tsx +0 -108
- package/src/root-layout/root-layout-host.tsx +0 -147
- package/src/root-layout/root-layout-registry.ts +0 -51
- package/src/root-layout/root-layout-state.ts +0 -55
- package/src/root-layout/root-layout.ts +0 -32
- package/src/screens/account/account-screen.test.tsx +0 -65
- package/src/screens/account/account-screen.tsx +0 -942
- package/src/screens/assistants/assistant-config.test.tsx +0 -54
- package/src/screens/assistants/assistant-config.tsx +0 -121
- package/src/screens/assistants/assistant-details.tsx +0 -89
- package/src/screens/assistants/assistant-info.tsx +0 -66
- package/src/screens/assistants/assistant-list.tsx +0 -145
- package/src/screens/assistants/assistant-tools.tsx +0 -82
- package/src/screens/console-logs/console-logs-list.tsx +0 -374
- package/src/screens/console-logs/log-display.tsx +0 -137
- package/src/screens/console-logs/log-filters.tsx +0 -64
- package/src/screens/console-logs/mobile-log-card.tsx +0 -161
- package/src/screens/console-logs/resizable-table-header.tsx +0 -110
- package/src/screens/contacts/contact-details.tsx +0 -123
- package/src/screens/contacts/contact-list.test.tsx +0 -59
- package/src/screens/contacts/contact-list.tsx +0 -286
- package/src/screens/contacts/index.ts +0 -2
- package/src/screens/data-explorer/data-explorer.tsx +0 -633
- package/src/screens/data-explorer/index.ts +0 -6
- package/src/screens/data-explorer/query-executor.tsx +0 -520
- package/src/screens/device-pairing/device-pairing.test.tsx +0 -143
- package/src/screens/device-pairing/device-pairing.tsx +0 -461
- package/src/screens/device-pairing/identity-ipc.ts +0 -25
- package/src/screens/device-pairing/index.ts +0 -2
- package/src/screens/device-pairing/use-device-pairing-state.ts +0 -15
- package/src/screens/devices/devices-list.test.tsx +0 -68
- package/src/screens/devices/devices-list.tsx +0 -365
- package/src/screens/devices/index.ts +0 -1
- package/src/screens/groups/group-details.tsx +0 -160
- package/src/screens/groups/group-invite-panel.tsx +0 -311
- package/src/screens/groups/group-list.test.tsx +0 -44
- package/src/screens/groups/group-list.tsx +0 -317
- package/src/screens/groups/group-members.tsx +0 -343
- package/src/screens/groups/index.ts +0 -3
- package/src/screens/identity/identity-routes.test.ts +0 -70
- package/src/screens/identity/identity-routes.ts +0 -301
- package/src/screens/identity/identity-screen.test.tsx +0 -138
- package/src/screens/identity/identity-screen.tsx +0 -282
- package/src/screens/identity/index.ts +0 -2
- package/src/screens/identity/invite-contact-panel.tsx +0 -45
- package/src/screens/identity/profile-invite.tsx +0 -93
- package/src/screens/invites/accept-invite.test.tsx +0 -115
- package/src/screens/invites/accept-invite.tsx +0 -318
- package/src/screens/invites/activity-view.test.tsx +0 -127
- package/src/screens/invites/activity-view.tsx +0 -162
- package/src/screens/invites/index.ts +0 -6
- package/src/screens/invites/invite-capture.ts +0 -104
- package/src/screens/invites/invite-classify.test.ts +0 -129
- package/src/screens/invites/invite-share.tsx +0 -104
- package/src/screens/invites/invites-ipc.ts +0 -25
- package/src/screens/invites/pending-invites-list.tsx +0 -256
- package/src/screens/network-viewer/connection-troubleshooter.tsx +0 -395
- package/src/screens/network-viewer/cpu-usage-graph.tsx +0 -294
- package/src/screens/network-viewer/device-details-modal.tsx +0 -339
- package/src/screens/network-viewer/group-details-modal.tsx +0 -421
- package/src/screens/network-viewer/index.ts +0 -8
- package/src/screens/network-viewer/network-viewer-ipc.test.ts +0 -72
- package/src/screens/network-viewer/network-viewer-ipc.ts +0 -39
- package/src/screens/network-viewer/network-viewer-section.ts +0 -12
- package/src/screens/network-viewer/network-viewer.section.test.tsx +0 -68
- package/src/screens/network-viewer/network-viewer.tsx +0 -708
- package/src/screens/network-viewer/remote-logs-panel.tsx +0 -190
- package/src/screens/network-viewer/sync-recovery.test.tsx +0 -114
- package/src/screens/network-viewer/sync-recovery.tsx +0 -461
- package/src/screens/network-viewer/usage-graph.tsx +0 -455
- package/src/screens/packages/local-folder-grants-panel.tsx +0 -290
- package/src/screens/packages/local-folders-ipc.ts +0 -28
- package/src/screens/packages/package-details.tsx +0 -166
- package/src/screens/packages/package-helpers.test.ts +0 -57
- package/src/screens/packages/package-helpers.ts +0 -137
- package/src/screens/packages/package-info.tsx +0 -354
- package/src/screens/packages/package-list.tsx +0 -519
- package/src/screens/packages/package-network-panel.tsx +0 -82
- package/src/screens/packages/package-new-local.tsx +0 -100
- package/src/screens/packages/package-runtime-status.test.tsx +0 -58
- package/src/screens/packages/package-runtime-status.tsx +0 -68
- package/src/screens/packages/package-versions.tsx +0 -298
- package/src/screens/packages/packages-ipc.test.ts +0 -47
- package/src/screens/packages/packages-ipc.ts +0 -125
- package/src/screens/peer-types/peer-type-details.tsx +0 -172
- package/src/screens/peer-types/peer-type-list.tsx +0 -64
- package/src/screens/search/global-search.tsx +0 -406
- package/src/screens/settings/color-mode-dropdown.tsx +0 -82
- package/src/screens/settings/settings-page.test.tsx +0 -24
- package/src/screens/settings/settings-page.tsx +0 -426
- package/src/screens/setup-user.tsx +0 -355
- package/src/screens/tools/tool-access-ipc.test.ts +0 -55
- package/src/screens/tools/tool-access-ipc.ts +0 -27
- package/src/screens/tools/tool-catalog-ipc.test.ts +0 -52
- package/src/screens/tools/tool-catalog-ipc.ts +0 -51
- package/src/screens/tools/tool-details.tsx +0 -52
- package/src/screens/tools/tool-info.tsx +0 -45
- package/src/screens/tools/tool-list.tsx +0 -106
- package/src/screens/tools/tool-schema.tsx +0 -44
- package/src/screens/tools/tool-test-details.tsx +0 -89
- package/src/screens/tools/tool-test-list.tsx +0 -73
- package/src/screens/variables/variable-details.tsx +0 -289
- package/src/screens/variables/variable-list.tsx +0 -110
- package/src/screens/welcome-modal.tsx +0 -294
- package/src/screens/workflows/workflow-details.tsx +0 -115
- package/src/screens/workflows/workflow-info.tsx +0 -22
- package/src/screens/workflows/workflow-instructions.tsx +0 -134
- package/src/screens/workflows/workflow-list.tsx +0 -117
- package/src/setupTests.ts +0 -38
- package/src/system-apps/assistants.app.ts +0 -7
- package/src/system-apps/console-logs.app.ts +0 -7
- package/src/system-apps/data-explorer.app.ts +0 -8
- package/src/system-apps/identity.app.ts +0 -9
- package/src/system-apps/index.ts +0 -77
- package/src/system-apps/mobile-settings.app.ts +0 -7
- package/src/system-apps/network-viewer.app.ts +0 -8
- package/src/system-apps/packages.app.ts +0 -7
- package/src/system-apps/search.app.ts +0 -8
- package/src/system-apps/settings.app.ts +0 -7
- package/src/system-apps/threads.app.ts +0 -7
- package/src/system-apps/tools.app.ts +0 -7
- package/src/system-apps/types.app.ts +0 -7
- package/src/system-apps/variables.app.ts +0 -7
- package/src/system-apps/workflows.app.ts +0 -7
- package/src/tabs-layout/network-status-indicator.test.tsx +0 -799
- package/src/tabs-layout/network-status-indicator.tsx +0 -756
- package/src/tabs-layout/tabs-layout.tsx +0 -857
- package/src/tabs-layout/tabs-state.test.ts +0 -152
- package/src/tabs-layout/tabs-state.ts +0 -587
- package/src/tabs-layout/use-network-status.test.tsx +0 -58
- package/src/tabs-layout/use-network-status.ts +0 -68
- package/src/ui-defaults/index.ts +0 -2
- package/src/ui-defaults/list-screen.tsx +0 -94
- package/src/ui-defaults/markdown-field.tsx +0 -87
- package/src/ui-router/routes-loader.ts +0 -193
- package/src/ui-router/ui-loader.test.tsx +0 -108
- package/src/ui-router/ui-loader.tsx +0 -606
- package/src/utils.ts +0 -95
- package/tsconfig.json +0 -18
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { fromJSONString, type IConsoleLog } from "@peers-app/peers-sdk";
|
|
2
|
-
import moment from "moment";
|
|
3
|
-
|
|
4
|
-
interface MobileLogCardProps {
|
|
5
|
-
log: IConsoleLog;
|
|
6
|
-
colorMode: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const getLevelColor = (level: string) => {
|
|
10
|
-
switch (level) {
|
|
11
|
-
case "error":
|
|
12
|
-
return "#dc3545";
|
|
13
|
-
case "warn":
|
|
14
|
-
return "#ffc107";
|
|
15
|
-
case "info":
|
|
16
|
-
return "#0dcaf0";
|
|
17
|
-
case "log":
|
|
18
|
-
return "#6c757d";
|
|
19
|
-
case "debug":
|
|
20
|
-
return "#6c757d";
|
|
21
|
-
default:
|
|
22
|
-
return "#6c757d";
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const getProcessColor = (process: string) => {
|
|
27
|
-
switch (process) {
|
|
28
|
-
case "ui":
|
|
29
|
-
case "renderer":
|
|
30
|
-
return "#0dcaf0";
|
|
31
|
-
case "electron":
|
|
32
|
-
case "main":
|
|
33
|
-
return "#d946ef";
|
|
34
|
-
case "react-native":
|
|
35
|
-
return "#61dafb";
|
|
36
|
-
default:
|
|
37
|
-
return "#6c757d";
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const getLevelIcon = (level: string) => {
|
|
42
|
-
switch (level) {
|
|
43
|
-
case "error":
|
|
44
|
-
return "bi-x-circle-fill";
|
|
45
|
-
case "warn":
|
|
46
|
-
return "bi-exclamation-triangle-fill";
|
|
47
|
-
case "info":
|
|
48
|
-
return "bi-info-circle-fill";
|
|
49
|
-
case "debug":
|
|
50
|
-
return "bi-bug-fill";
|
|
51
|
-
default:
|
|
52
|
-
return "bi-chat-square-text";
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const MobileLogCard = ({ log, colorMode }: MobileLogCardProps) => {
|
|
57
|
-
const isDark = colorMode === "dark";
|
|
58
|
-
|
|
59
|
-
// Parse context if it's a string
|
|
60
|
-
let context = log.context;
|
|
61
|
-
if (typeof context === "string") {
|
|
62
|
-
try {
|
|
63
|
-
context = fromJSONString(context);
|
|
64
|
-
} catch (_err) {}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<div
|
|
69
|
-
style={{
|
|
70
|
-
padding: "10px 12px",
|
|
71
|
-
borderBottom: `1px solid ${isDark ? "#333" : "#e9ecef"}`,
|
|
72
|
-
backgroundColor: isDark ? "#1a1a1a" : "#fff",
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
{/* Header row: timestamp, level, process */}
|
|
76
|
-
<div className="d-flex align-items-center gap-2 mb-1" style={{ flexWrap: "wrap" }}>
|
|
77
|
-
<span style={{ fontSize: "0.7rem", color: isDark ? "#888" : "#666" }}>
|
|
78
|
-
{moment(log.timestamp).format("HH:mm:ss.SSS")}
|
|
79
|
-
</span>
|
|
80
|
-
<span
|
|
81
|
-
className="badge text-white"
|
|
82
|
-
style={{
|
|
83
|
-
backgroundColor: getLevelColor(log.level),
|
|
84
|
-
fontSize: "0.65rem",
|
|
85
|
-
padding: "2px 6px",
|
|
86
|
-
}}
|
|
87
|
-
>
|
|
88
|
-
<i className={`${getLevelIcon(log.level)} me-1`}></i>
|
|
89
|
-
{log.level}
|
|
90
|
-
</span>
|
|
91
|
-
<span
|
|
92
|
-
className="badge text-white"
|
|
93
|
-
style={{
|
|
94
|
-
backgroundColor: getProcessColor(log.process),
|
|
95
|
-
fontSize: "0.65rem",
|
|
96
|
-
padding: "2px 6px",
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
{log.process}
|
|
100
|
-
</span>
|
|
101
|
-
{log.source && (
|
|
102
|
-
<span style={{ fontSize: "0.65rem", color: isDark ? "#666" : "#999" }}>{log.source}</span>
|
|
103
|
-
)}
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
{/* Message */}
|
|
107
|
-
<div
|
|
108
|
-
style={{
|
|
109
|
-
fontSize: "0.8rem",
|
|
110
|
-
wordBreak: "break-word",
|
|
111
|
-
color: isDark ? "#e0e0e0" : "#333",
|
|
112
|
-
}}
|
|
113
|
-
>
|
|
114
|
-
{log.message}
|
|
115
|
-
</div>
|
|
116
|
-
|
|
117
|
-
{/* Context (collapsible) */}
|
|
118
|
-
{context && (
|
|
119
|
-
<details className="mt-1">
|
|
120
|
-
<summary className="text-muted" style={{ cursor: "pointer", fontSize: "0.7rem" }}>
|
|
121
|
-
<i className="bi bi-code-square me-1"></i>
|
|
122
|
-
Context
|
|
123
|
-
</summary>
|
|
124
|
-
<pre
|
|
125
|
-
className="mt-1 p-2 rounded"
|
|
126
|
-
style={{
|
|
127
|
-
fontSize: "0.65rem",
|
|
128
|
-
backgroundColor: isDark ? "#252525" : "#f8f9fa",
|
|
129
|
-
color: isDark ? "#aaa" : "#333",
|
|
130
|
-
overflow: "auto",
|
|
131
|
-
maxHeight: "150px",
|
|
132
|
-
}}
|
|
133
|
-
>
|
|
134
|
-
{JSON.stringify(context, null, 2)}
|
|
135
|
-
</pre>
|
|
136
|
-
</details>
|
|
137
|
-
)}
|
|
138
|
-
|
|
139
|
-
{/* Stack trace (collapsible) */}
|
|
140
|
-
{log.stackTrace && (
|
|
141
|
-
<details className="mt-1">
|
|
142
|
-
<summary className="text-danger" style={{ cursor: "pointer", fontSize: "0.7rem" }}>
|
|
143
|
-
<i className="bi bi-bug me-1"></i>
|
|
144
|
-
Stack Trace
|
|
145
|
-
</summary>
|
|
146
|
-
<pre
|
|
147
|
-
className="mt-1 p-2 rounded text-danger"
|
|
148
|
-
style={{
|
|
149
|
-
fontSize: "0.6rem",
|
|
150
|
-
backgroundColor: isDark ? "#2a1a1a" : "#fff0f0",
|
|
151
|
-
overflow: "auto",
|
|
152
|
-
maxHeight: "150px",
|
|
153
|
-
}}
|
|
154
|
-
>
|
|
155
|
-
{log.stackTrace}
|
|
156
|
-
</pre>
|
|
157
|
-
</details>
|
|
158
|
-
)}
|
|
159
|
-
</div>
|
|
160
|
-
);
|
|
161
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
|
|
4
|
-
interface Column {
|
|
5
|
-
key: string;
|
|
6
|
-
label: string;
|
|
7
|
-
width: number;
|
|
8
|
-
minWidth?: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface ResizableTableHeaderProps {
|
|
12
|
-
columns: Column[];
|
|
13
|
-
onColumnsChange: (columns: Column[]) => void;
|
|
14
|
-
colorMode: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const ResizableTableHeader = ({
|
|
18
|
-
columns,
|
|
19
|
-
onColumnsChange,
|
|
20
|
-
colorMode,
|
|
21
|
-
}: ResizableTableHeaderProps) => {
|
|
22
|
-
const [resizingColumn, setResizingColumn] = useState<string | null>(null);
|
|
23
|
-
const startXRef = useRef<number>(0);
|
|
24
|
-
const startWidthRef = useRef<number>(0);
|
|
25
|
-
|
|
26
|
-
const handleMouseDown = (e: React.MouseEvent, columnKey: string, currentWidth: number) => {
|
|
27
|
-
e.preventDefault();
|
|
28
|
-
setResizingColumn(columnKey);
|
|
29
|
-
startXRef.current = e.clientX;
|
|
30
|
-
startWidthRef.current = currentWidth;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
const handleMouseMove = (e: MouseEvent) => {
|
|
35
|
-
if (!resizingColumn) return;
|
|
36
|
-
|
|
37
|
-
const diff = e.clientX - startXRef.current;
|
|
38
|
-
const newWidth = Math.max(startWidthRef.current + diff, 50); // Min width 50px
|
|
39
|
-
|
|
40
|
-
const updatedColumns = columns.map((col) =>
|
|
41
|
-
col.key === resizingColumn ? { ...col, width: newWidth } : col,
|
|
42
|
-
);
|
|
43
|
-
onColumnsChange(updatedColumns);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const handleMouseUp = () => {
|
|
47
|
-
setResizingColumn(null);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
if (resizingColumn) {
|
|
51
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
52
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
53
|
-
|
|
54
|
-
return () => {
|
|
55
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
56
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}, [resizingColumn, columns, onColumnsChange]);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<table
|
|
63
|
-
className="table table-sm mb-0"
|
|
64
|
-
style={{ fontSize: "0.85rem", tableLayout: "fixed", width: "100%" }}
|
|
65
|
-
>
|
|
66
|
-
<thead style={{ backgroundColor: colorMode === "dark" ? "#2a2a2a" : "#ffffff" }}>
|
|
67
|
-
<tr>
|
|
68
|
-
{columns.map((column) => (
|
|
69
|
-
<th
|
|
70
|
-
key={column.key}
|
|
71
|
-
style={{
|
|
72
|
-
width: `${column.width}px`,
|
|
73
|
-
position: "relative",
|
|
74
|
-
padding: "0.5rem",
|
|
75
|
-
borderRight: "1px solid #dee2e6",
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
78
|
-
{column.label}
|
|
79
|
-
{column.key !== "message" && (
|
|
80
|
-
<div
|
|
81
|
-
onMouseDown={(e) => handleMouseDown(e, column.key, column.width)}
|
|
82
|
-
style={{
|
|
83
|
-
position: "absolute",
|
|
84
|
-
right: 0,
|
|
85
|
-
top: 0,
|
|
86
|
-
bottom: 0,
|
|
87
|
-
width: "5px",
|
|
88
|
-
cursor: "col-resize",
|
|
89
|
-
userSelect: "none",
|
|
90
|
-
backgroundColor: resizingColumn === column.key ? "#0d6efd" : "transparent",
|
|
91
|
-
}}
|
|
92
|
-
onMouseEnter={(e) => {
|
|
93
|
-
if (!resizingColumn) {
|
|
94
|
-
e.currentTarget.style.backgroundColor = "#dee2e6";
|
|
95
|
-
}
|
|
96
|
-
}}
|
|
97
|
-
onMouseLeave={(e) => {
|
|
98
|
-
if (!resizingColumn) {
|
|
99
|
-
e.currentTarget.style.backgroundColor = "transparent";
|
|
100
|
-
}
|
|
101
|
-
}}
|
|
102
|
-
/>
|
|
103
|
-
)}
|
|
104
|
-
</th>
|
|
105
|
-
))}
|
|
106
|
-
</tr>
|
|
107
|
-
</thead>
|
|
108
|
-
</table>
|
|
109
|
-
);
|
|
110
|
-
};
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { getUserContext, type IDoc, type IUser, Users } from "@peers-app/peers-sdk";
|
|
2
|
-
import { Input } from "../../components/input";
|
|
3
|
-
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
4
|
-
import { SaveButton } from "../../components/save-button";
|
|
5
|
-
import { Tabs } from "../../components/tabs";
|
|
6
|
-
import { TrustLevelDropdown } from "../../components/trust-level-dropdown";
|
|
7
|
-
import { usePromise } from "../../hooks";
|
|
8
|
-
|
|
9
|
-
interface IProps {
|
|
10
|
-
userId: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/** Edit a contact's signed profile fields and personal-context trust assignment. */
|
|
14
|
-
export const ContactDetails = (props: IProps) => {
|
|
15
|
-
const contact = usePromise(
|
|
16
|
-
async () => {
|
|
17
|
-
const userContext = await getUserContext();
|
|
18
|
-
const contact = await Users(userContext.userDataContext).get(props.userId);
|
|
19
|
-
if (!contact) {
|
|
20
|
-
throw new Error("Contact not found");
|
|
21
|
-
}
|
|
22
|
-
return Users(userContext.userDataContext).initDoc(contact);
|
|
23
|
-
},
|
|
24
|
-
undefined,
|
|
25
|
-
[props.userId],
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
if (!contact) {
|
|
29
|
-
return <LoadingIndicator />;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div className="container-xxl p-3">
|
|
34
|
-
<div className="d-flex">
|
|
35
|
-
<div>
|
|
36
|
-
<h4>
|
|
37
|
-
<i className="bi-person-fill-check me-2"></i>
|
|
38
|
-
</h4>
|
|
39
|
-
</div>
|
|
40
|
-
<div className="flex-grow-1">
|
|
41
|
-
<h4>
|
|
42
|
-
<Input
|
|
43
|
-
key={contact.userId}
|
|
44
|
-
className="border border-0"
|
|
45
|
-
style={{ width: "100%", outline: "none", backgroundColor: "transparent" }}
|
|
46
|
-
value={contact.qs.name}
|
|
47
|
-
/>
|
|
48
|
-
</h4>
|
|
49
|
-
</div>
|
|
50
|
-
<div>
|
|
51
|
-
<SaveButton key={contact.userId} doc={contact} />
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<Tabs
|
|
56
|
-
key={contact.userId}
|
|
57
|
-
tabs={[
|
|
58
|
-
{
|
|
59
|
-
name: "Info",
|
|
60
|
-
content: (
|
|
61
|
-
<div>
|
|
62
|
-
<ContactInfo contact={contact} />
|
|
63
|
-
</div>
|
|
64
|
-
),
|
|
65
|
-
},
|
|
66
|
-
]}
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const ContactInfo = (props: { contact: IDoc<IUser> }) => {
|
|
73
|
-
const { contact } = props;
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<div>
|
|
77
|
-
<div className="mb-3">
|
|
78
|
-
<div className="d-flex align-items-center gap-3">
|
|
79
|
-
<div className="flex-grow-1">
|
|
80
|
-
<small className="text-muted d-block mb-1">Name</small>
|
|
81
|
-
<Input
|
|
82
|
-
value={contact.qs.name}
|
|
83
|
-
className="form-control mb-3 ps-2"
|
|
84
|
-
placeholder="Contact name"
|
|
85
|
-
title="Contact name"
|
|
86
|
-
/>
|
|
87
|
-
</div>
|
|
88
|
-
<div className="border-start ps-3">
|
|
89
|
-
<small className="text-muted d-block mb-1">User ID</small>
|
|
90
|
-
<code className="small">{contact.userId}</code>
|
|
91
|
-
</div>
|
|
92
|
-
<div className="border-start ps-3">
|
|
93
|
-
<small className="text-muted d-block mb-1">Trust Level</small>
|
|
94
|
-
<TrustLevelDropdown userId={contact.userId} />
|
|
95
|
-
<small className="text-muted d-block mt-1">
|
|
96
|
-
Self grants this user full remote contract access.
|
|
97
|
-
</small>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<div className="mb-3">
|
|
103
|
-
<small>Public Key:</small>
|
|
104
|
-
<Input
|
|
105
|
-
value={contact.qs.publicKey}
|
|
106
|
-
className="form-control mb-3 p-0 ps-2"
|
|
107
|
-
placeholder="Public key"
|
|
108
|
-
title="Public key"
|
|
109
|
-
/>
|
|
110
|
-
</div>
|
|
111
|
-
|
|
112
|
-
<div className="mb-3">
|
|
113
|
-
<small>Public Box Key:</small>
|
|
114
|
-
<Input
|
|
115
|
-
value={contact.qs.publicBoxKey}
|
|
116
|
-
className="form-control mb-3 p-0 ps-2"
|
|
117
|
-
placeholder="Public box key"
|
|
118
|
-
title="Public box key"
|
|
119
|
-
/>
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
);
|
|
123
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { TrustLevel } from "@peers-app/peers-sdk";
|
|
2
|
-
import { render, screen } from "@testing-library/react";
|
|
3
|
-
import { type IPersonSummary, PersonRow } from "./contact-list";
|
|
4
|
-
|
|
5
|
-
jest.mock("../../globals", () => ({
|
|
6
|
-
mainContentPath: jest.fn(),
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
|
-
jest.mock("../../hooks", () => ({
|
|
10
|
-
usePromise: jest.fn(),
|
|
11
|
-
}));
|
|
12
|
-
|
|
13
|
-
jest.mock("../../ui-router/ui-loader", () => ({
|
|
14
|
-
registerInternalPeersUI: jest.fn(),
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
jest.mock("../identity/invite-contact-panel", () => ({
|
|
18
|
-
InviteContactPanel: () => null,
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
jest.mock("../identity/profile-invite", () => ({
|
|
22
|
-
ProfileInviteSection: () => null,
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
jest.mock("../invites/activity-view", () => ({
|
|
26
|
-
PendingWorkLink: () => null,
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
const person: IPersonSummary = {
|
|
30
|
-
user: {
|
|
31
|
-
userId: "abcdefghijklmnopqrstuvwxy",
|
|
32
|
-
name: "Alex",
|
|
33
|
-
publicKey: "signing-key",
|
|
34
|
-
publicBoxKey: "box-key",
|
|
35
|
-
},
|
|
36
|
-
isContact: true,
|
|
37
|
-
trustLevel: TrustLevel.Known,
|
|
38
|
-
sharedGroups: [{ groupId: "zyxwvutsrqponmlkjihgfedcb", name: "Neighbors" }],
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
describe("PersonRow", () => {
|
|
42
|
-
it("shows useful relationship context without exposing an ordinary user id", () => {
|
|
43
|
-
render(<PersonRow row={person} duplicateName={false} />);
|
|
44
|
-
|
|
45
|
-
expect(screen.getByText("Alex")).toBeInTheDocument();
|
|
46
|
-
expect(screen.getByText("Contact · Shared group: Neighbors")).toBeInTheDocument();
|
|
47
|
-
expect(screen.queryByText(person.user.userId)).not.toBeInTheDocument();
|
|
48
|
-
expect(screen.getByRole("link")).toHaveAttribute(
|
|
49
|
-
"href",
|
|
50
|
-
`#identity/people/${person.user.userId}`,
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("adds only a short discriminator when names collide", () => {
|
|
55
|
-
render(<PersonRow row={person} duplicateName />);
|
|
56
|
-
|
|
57
|
-
expect(screen.getByText(`…${person.user.userId.slice(-6)}`)).toBeInTheDocument();
|
|
58
|
-
});
|
|
59
|
-
});
|