@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,282 +0,0 @@
|
|
|
1
|
-
import type { IInvite } from "@peers-app/peers-sdk";
|
|
2
|
-
import { type ReactNode, useState } from "react";
|
|
3
|
-
import { ResponsiveSectionNav } from "../../components/responsive-section-nav";
|
|
4
|
-
import { isDesktop, mainContentPath } from "../../globals";
|
|
5
|
-
import { useObservable } from "../../hooks";
|
|
6
|
-
import { registerInternalPeersUI } from "../../ui-router/ui-loader";
|
|
7
|
-
import { AccountScreen } from "../account/account-screen";
|
|
8
|
-
import { ContactDetails } from "../contacts/contact-details";
|
|
9
|
-
import { ContactList } from "../contacts/contact-list";
|
|
10
|
-
import { DevicesSection } from "../devices/devices-list";
|
|
11
|
-
import { GroupDetails } from "../groups/group-details";
|
|
12
|
-
import { GroupList } from "../groups/group-list";
|
|
13
|
-
import { AcceptInvite } from "../invites/accept-invite";
|
|
14
|
-
import { ActivityView } from "../invites/activity-view";
|
|
15
|
-
import { classifyInvite, useInviteRows } from "../invites/pending-invites-list";
|
|
16
|
-
import {
|
|
17
|
-
IDENTITY_ACCEPT_PATH,
|
|
18
|
-
IDENTITY_ACCOUNT_PATH,
|
|
19
|
-
IDENTITY_ACTIVITY_PATH,
|
|
20
|
-
IDENTITY_DEVICES_PATH,
|
|
21
|
-
IDENTITY_GROUP_NEW_PATH,
|
|
22
|
-
IDENTITY_GROUPS_PATH,
|
|
23
|
-
IDENTITY_PAIR_PATH,
|
|
24
|
-
IDENTITY_PEOPLE_INVITE_PATH,
|
|
25
|
-
IDENTITY_PEOPLE_PATH,
|
|
26
|
-
type IdentitySectionId,
|
|
27
|
-
parseIdentityLocation,
|
|
28
|
-
} from "./identity-routes";
|
|
29
|
-
|
|
30
|
-
const SECTION_PATHS: Record<IdentitySectionId, string> = {
|
|
31
|
-
activity: IDENTITY_ACTIVITY_PATH,
|
|
32
|
-
people: IDENTITY_PEOPLE_PATH,
|
|
33
|
-
groups: IDENTITY_GROUPS_PATH,
|
|
34
|
-
devices: IDENTITY_DEVICES_PATH,
|
|
35
|
-
account: IDENTITY_ACCOUNT_PATH,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Identity app shell.
|
|
40
|
-
*
|
|
41
|
-
* Activity, People, Groups, Devices, and Account stay one top-level tab. The
|
|
42
|
-
* route selects the section, and detail routes keep that section highlighted.
|
|
43
|
-
*/
|
|
44
|
-
export function IdentityScreen(props: { path?: string }) {
|
|
45
|
-
const [livePath] = useObservable(mainContentPath);
|
|
46
|
-
const location =
|
|
47
|
-
parseIdentityLocation(props.path ?? livePath) ?? parseIdentityLocation(IDENTITY_ACTIVITY_PATH);
|
|
48
|
-
const pending = useInviteRows({ statuses: ["pending"] });
|
|
49
|
-
const rows = pending?.rows;
|
|
50
|
-
if (!location) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<ResponsiveSectionNav
|
|
56
|
-
label="Identity"
|
|
57
|
-
activeSectionId={location.section}
|
|
58
|
-
onSelect={(sectionId) => mainContentPath(SECTION_PATHS[sectionId as IdentitySectionId])}
|
|
59
|
-
toolbar={<IdentityQuickActions />}
|
|
60
|
-
sections={[
|
|
61
|
-
{
|
|
62
|
-
id: "activity",
|
|
63
|
-
label: "Activity",
|
|
64
|
-
iconClassName: "bi-inbox",
|
|
65
|
-
badge: badgeCount(rows, "attention"),
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
id: "people",
|
|
69
|
-
label: "People",
|
|
70
|
-
iconClassName: "bi-person-fill-check",
|
|
71
|
-
badge: badgeCount(rows, "contact"),
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: "groups",
|
|
75
|
-
label: "Groups",
|
|
76
|
-
iconClassName: "bi-people-fill",
|
|
77
|
-
badge: badgeCount(rows, "group"),
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
id: "devices",
|
|
81
|
-
label: "Devices",
|
|
82
|
-
iconClassName: "bi-laptop",
|
|
83
|
-
badge: badgeCount(rows, "device"),
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
id: "account",
|
|
87
|
-
label: "Account",
|
|
88
|
-
iconClassName: "bi-person-circle",
|
|
89
|
-
},
|
|
90
|
-
]}
|
|
91
|
-
>
|
|
92
|
-
<IdentityBody location={location} />
|
|
93
|
-
</ResponsiveSectionNav>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function IdentityBody(props: { location: NonNullable<ReturnType<typeof parseIdentityLocation>> }) {
|
|
98
|
-
const { location } = props;
|
|
99
|
-
if (location.accepting) {
|
|
100
|
-
return (
|
|
101
|
-
<div className="container-fluid py-3" style={{ maxWidth: 720 }}>
|
|
102
|
-
<a href={`#${IDENTITY_ACTIVITY_PATH}`} className="btn btn-link btn-sm px-0 mb-2">
|
|
103
|
-
Back to Activity
|
|
104
|
-
</a>
|
|
105
|
-
<h4 className="mb-3">
|
|
106
|
-
<i className="bi bi-envelope-paper me-2" />
|
|
107
|
-
Accept an invite
|
|
108
|
-
</h4>
|
|
109
|
-
<div className="card">
|
|
110
|
-
<div className="card-body">
|
|
111
|
-
<AcceptInvite onDone={() => mainContentPath(IDENTITY_ACTIVITY_PATH)} />
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
if (location.section === "people") {
|
|
118
|
-
return location.personId ? (
|
|
119
|
-
<DetailFrame backHref={`#${IDENTITY_PEOPLE_PATH}`} backLabel="Back to people">
|
|
120
|
-
<ContactDetails userId={location.personId} />
|
|
121
|
-
</DetailFrame>
|
|
122
|
-
) : (
|
|
123
|
-
<ContactList action={location.peopleAction} />
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
if (location.section === "groups") {
|
|
127
|
-
return location.groupId ? (
|
|
128
|
-
<DetailFrame backHref={`#${IDENTITY_GROUPS_PATH}`} backLabel="Back to groups">
|
|
129
|
-
<GroupDetails groupId={location.groupId} />
|
|
130
|
-
</DetailFrame>
|
|
131
|
-
) : (
|
|
132
|
-
<GroupList creating={location.creatingGroup} />
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
if (location.section === "devices") {
|
|
136
|
-
const mode = location.pairing ? "pair" : location.deviceId ? "detail" : "list";
|
|
137
|
-
return <DevicesSection mode={mode} deviceId={location.deviceId} />;
|
|
138
|
-
}
|
|
139
|
-
if (location.section === "account") {
|
|
140
|
-
return <AccountScreen />;
|
|
141
|
-
}
|
|
142
|
-
return (
|
|
143
|
-
<div className="container-xxl p-3">
|
|
144
|
-
<ActivityView filter={location.activityFilter} />
|
|
145
|
-
</div>
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function IdentityQuickActions() {
|
|
150
|
-
const [desktop] = useObservable(isDesktop);
|
|
151
|
-
const [showAdd, setShowAdd] = useState(false);
|
|
152
|
-
const addActions = [
|
|
153
|
-
{
|
|
154
|
-
path: IDENTITY_PEOPLE_INVITE_PATH,
|
|
155
|
-
label: "Add person",
|
|
156
|
-
icon: "bi-person-plus",
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
path: IDENTITY_GROUP_NEW_PATH,
|
|
160
|
-
label: "Create group",
|
|
161
|
-
icon: "bi-people",
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
path: IDENTITY_PAIR_PATH,
|
|
165
|
-
label: "Add device",
|
|
166
|
-
icon: "bi-laptop",
|
|
167
|
-
},
|
|
168
|
-
];
|
|
169
|
-
|
|
170
|
-
if (desktop) {
|
|
171
|
-
return (
|
|
172
|
-
<div
|
|
173
|
-
className="d-grid align-items-center gap-2 border-bottom p-2"
|
|
174
|
-
style={{ gridTemplateColumns: "minmax(0, 1fr) auto minmax(0, 1fr)" }}
|
|
175
|
-
>
|
|
176
|
-
<div className="overflow-hidden">
|
|
177
|
-
<div className="fw-semibold">Identity</div>
|
|
178
|
-
<small className="text-muted text-truncate d-block">
|
|
179
|
-
People, groups, and your devices
|
|
180
|
-
</small>
|
|
181
|
-
</div>
|
|
182
|
-
<div className="d-flex align-items-center justify-content-center gap-2">
|
|
183
|
-
{addActions.map((action) => (
|
|
184
|
-
<a
|
|
185
|
-
key={action.path}
|
|
186
|
-
href={`#${action.path}`}
|
|
187
|
-
className="btn btn-outline-primary btn-sm"
|
|
188
|
-
>
|
|
189
|
-
<i className={`bi ${action.icon} me-1`} />
|
|
190
|
-
{action.label}
|
|
191
|
-
</a>
|
|
192
|
-
))}
|
|
193
|
-
<a href={`#${IDENTITY_ACCEPT_PATH}`} className="btn btn-primary btn-sm">
|
|
194
|
-
<i className="bi bi-qr-code-scan me-1" />
|
|
195
|
-
Use invite
|
|
196
|
-
</a>
|
|
197
|
-
</div>
|
|
198
|
-
<span aria-hidden="true" />
|
|
199
|
-
</div>
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return (
|
|
204
|
-
<div className="position-relative d-flex align-items-center gap-2 border-bottom p-2">
|
|
205
|
-
<div className="me-auto fw-semibold">Identity</div>
|
|
206
|
-
<button
|
|
207
|
-
type="button"
|
|
208
|
-
className="btn btn-outline-primary btn-sm"
|
|
209
|
-
aria-expanded={showAdd}
|
|
210
|
-
onClick={() => setShowAdd((open) => !open)}
|
|
211
|
-
>
|
|
212
|
-
<i className="bi bi-plus-lg me-1" />
|
|
213
|
-
Add
|
|
214
|
-
</button>
|
|
215
|
-
<a href={`#${IDENTITY_ACCEPT_PATH}`} className="btn btn-primary btn-sm">
|
|
216
|
-
<i className="bi bi-qr-code-scan me-1" />
|
|
217
|
-
Invite
|
|
218
|
-
</a>
|
|
219
|
-
{showAdd ? (
|
|
220
|
-
<div
|
|
221
|
-
className="card position-absolute end-0 top-100 mt-1 shadow-sm"
|
|
222
|
-
style={{ zIndex: 20, minWidth: 190 }}
|
|
223
|
-
>
|
|
224
|
-
<div className="list-group list-group-flush">
|
|
225
|
-
{addActions.map((action) => (
|
|
226
|
-
<a
|
|
227
|
-
key={action.path}
|
|
228
|
-
href={`#${action.path}`}
|
|
229
|
-
className="list-group-item list-group-item-action d-flex align-items-center gap-2"
|
|
230
|
-
onClick={() => setShowAdd(false)}
|
|
231
|
-
>
|
|
232
|
-
<i className={`bi ${action.icon}`} />
|
|
233
|
-
{action.label}
|
|
234
|
-
</a>
|
|
235
|
-
))}
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
) : null}
|
|
239
|
-
</div>
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function DetailFrame(props: { backHref: string; backLabel: string; children: ReactNode }) {
|
|
244
|
-
return (
|
|
245
|
-
<div>
|
|
246
|
-
<a href={props.backHref} className="btn btn-link btn-sm px-3 pt-3">
|
|
247
|
-
{props.backLabel}
|
|
248
|
-
</a>
|
|
249
|
-
{props.children}
|
|
250
|
-
</div>
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function badgeCount(
|
|
255
|
-
rows: IInvite[] | undefined,
|
|
256
|
-
kind: "attention" | "contact" | "group" | "device",
|
|
257
|
-
): number | undefined {
|
|
258
|
-
if (!rows) {
|
|
259
|
-
return undefined;
|
|
260
|
-
}
|
|
261
|
-
const count = rows.filter((row) =>
|
|
262
|
-
kind === "attention"
|
|
263
|
-
? classifyInvite(row) === "attention"
|
|
264
|
-
: row.type === kind && classifyInvite(row) === "attention",
|
|
265
|
-
).length;
|
|
266
|
-
return count > 0 ? count : undefined;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
registerInternalPeersUI({
|
|
270
|
-
peersUIId: "00identity0screen00000001",
|
|
271
|
-
component: IdentityScreen,
|
|
272
|
-
routes: [
|
|
273
|
-
{
|
|
274
|
-
isMatch: (_props, context) => {
|
|
275
|
-
const path = context.path.split("?")[0];
|
|
276
|
-
return path === "identity" || path.startsWith("identity/");
|
|
277
|
-
},
|
|
278
|
-
uiCategory: "screen",
|
|
279
|
-
priority: 3,
|
|
280
|
-
},
|
|
281
|
-
],
|
|
282
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ICreatedInvite } from "@peers-app/peers-sdk";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
4
|
-
import { InviteShare } from "../invites/invite-share";
|
|
5
|
-
import { inviteTools } from "../invites/invites-ipc";
|
|
6
|
-
|
|
7
|
-
/** Issues a one-off contact invite and shows it as a QR code and link. */
|
|
8
|
-
export function InviteContactPanel({ onClose }: { onClose: () => void }) {
|
|
9
|
-
const [invite, setInvite] = useState<ICreatedInvite | undefined>(undefined);
|
|
10
|
-
const [error, setError] = useState("");
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
let cancelled = false;
|
|
14
|
-
void inviteTools()
|
|
15
|
-
.then((tools) => tools.createContactInvite({}))
|
|
16
|
-
.then(({ invite: created }) => {
|
|
17
|
-
if (!cancelled) setInvite(created);
|
|
18
|
-
})
|
|
19
|
-
.catch((err) => {
|
|
20
|
-
if (!cancelled) setError((err as Error).message || "Could not create an invite.");
|
|
21
|
-
});
|
|
22
|
-
return () => {
|
|
23
|
-
cancelled = true;
|
|
24
|
-
};
|
|
25
|
-
}, []);
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div className="card mb-3">
|
|
29
|
-
<div className="card-body">
|
|
30
|
-
<h6 className="card-title">Invite someone</h6>
|
|
31
|
-
{error ? <div className="alert alert-danger py-2">{error}</div> : null}
|
|
32
|
-
{invite ? (
|
|
33
|
-
<InviteShare
|
|
34
|
-
invite={invite}
|
|
35
|
-
description="Send this link or show the QR. When they accept, you are connected — no need to be online at the same time."
|
|
36
|
-
shareText="Connect with me on Peers:"
|
|
37
|
-
onDone={onClose}
|
|
38
|
-
/>
|
|
39
|
-
) : !error ? (
|
|
40
|
-
<LoadingIndicator />
|
|
41
|
-
) : null}
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { ICreatedInvite } from "@peers-app/peers-sdk";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
4
|
-
import { Tooltip } from "../../components/tooltip";
|
|
5
|
-
import { InviteShare } from "../invites/invite-share";
|
|
6
|
-
import { inviteTools } from "../invites/invites-ipc";
|
|
7
|
-
|
|
8
|
-
const PROFILE_QR_INFO = `### Your profile QR
|
|
9
|
-
|
|
10
|
-
Anyone who scans this (or opens the link) can send you a contact request. Requests show up in **Identity → Activity** and nothing happens until you confirm.
|
|
11
|
-
|
|
12
|
-
### Regenerate
|
|
13
|
-
|
|
14
|
-
Regenerating invalidates this QR **and every other invite link you have issued**. Use it if the QR leaked somewhere you did not intend.`;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Reusable profile invite.
|
|
18
|
-
*
|
|
19
|
-
* Sharing it asks the other person to request a connection. Regenerating bumps
|
|
20
|
-
* the invite epoch and revokes outstanding links.
|
|
21
|
-
*/
|
|
22
|
-
export function ProfileInviteSection() {
|
|
23
|
-
const [invite, setInvite] = useState<ICreatedInvite | undefined>(undefined);
|
|
24
|
-
const [busy, setBusy] = useState(false);
|
|
25
|
-
const [error, setError] = useState<string | null>(null);
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
let cancelled = false;
|
|
29
|
-
void inviteTools()
|
|
30
|
-
.then((tools) => tools.createContactInvite({ profile: true }))
|
|
31
|
-
.then(({ invite: created }) => {
|
|
32
|
-
if (!cancelled) setInvite(created);
|
|
33
|
-
})
|
|
34
|
-
.catch((err) => {
|
|
35
|
-
if (!cancelled) setError((err as Error).message || "Could not load your profile QR.");
|
|
36
|
-
});
|
|
37
|
-
return () => {
|
|
38
|
-
cancelled = true;
|
|
39
|
-
};
|
|
40
|
-
}, []);
|
|
41
|
-
|
|
42
|
-
const regenerate = async () => {
|
|
43
|
-
if (
|
|
44
|
-
!confirm(
|
|
45
|
-
"Regenerate your profile QR? Every invite link you have issued so far will stop working.",
|
|
46
|
-
)
|
|
47
|
-
) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
setBusy(true);
|
|
51
|
-
setError(null);
|
|
52
|
-
try {
|
|
53
|
-
const tools = await inviteTools();
|
|
54
|
-
const { invite: created } = await tools.regenerateProfileInvite();
|
|
55
|
-
setInvite(created);
|
|
56
|
-
} catch (err) {
|
|
57
|
-
setError((err as Error).message || "Could not regenerate.");
|
|
58
|
-
} finally {
|
|
59
|
-
setBusy(false);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div className="card mb-3">
|
|
65
|
-
<div className="card-body">
|
|
66
|
-
<h5 className="card-title d-flex align-items-center gap-2">
|
|
67
|
-
Profile QR
|
|
68
|
-
<Tooltip markdownContent={PROFILE_QR_INFO} />
|
|
69
|
-
</h5>
|
|
70
|
-
{error ? <div className="alert alert-danger py-2">{error}</div> : null}
|
|
71
|
-
{invite ? (
|
|
72
|
-
<InviteShare
|
|
73
|
-
invite={invite}
|
|
74
|
-
description="Let people connect with you by scanning this or opening the link. You confirm each request."
|
|
75
|
-
shareText="Connect with me on Peers:"
|
|
76
|
-
/>
|
|
77
|
-
) : !error ? (
|
|
78
|
-
<LoadingIndicator />
|
|
79
|
-
) : null}
|
|
80
|
-
<div className="text-center mt-3">
|
|
81
|
-
<button
|
|
82
|
-
type="button"
|
|
83
|
-
className="btn btn-outline-danger btn-sm"
|
|
84
|
-
onClick={() => void regenerate()}
|
|
85
|
-
disabled={busy || !invite}
|
|
86
|
-
>
|
|
87
|
-
{busy ? "Regenerating…" : "Regenerate (revokes all invites)"}
|
|
88
|
-
</button>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getUserContext,
|
|
3
|
-
type IAcceptInviteResult,
|
|
4
|
-
type IInvite,
|
|
5
|
-
type IInvitePreview,
|
|
6
|
-
Invites,
|
|
7
|
-
} from "@peers-app/peers-sdk";
|
|
8
|
-
import { act, render, screen, waitFor } from "@testing-library/react";
|
|
9
|
-
import userEvent from "@testing-library/user-event";
|
|
10
|
-
import { AcceptInvite } from "./accept-invite";
|
|
11
|
-
import { inviteTools } from "./invites-ipc";
|
|
12
|
-
|
|
13
|
-
jest.mock("@peers-app/peers-sdk", () => {
|
|
14
|
-
const actual = jest.requireActual<typeof import("@peers-app/peers-sdk")>("@peers-app/peers-sdk");
|
|
15
|
-
return {
|
|
16
|
-
...actual,
|
|
17
|
-
getUserContext: jest.fn(actual.getUserContext),
|
|
18
|
-
Invites: jest.fn(),
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
jest.mock("./invites-ipc", () => ({
|
|
23
|
-
inviteTools: jest.fn(),
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
jest.mock("../../globals", () => ({
|
|
27
|
-
mainContentPath: jest.fn(),
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
const preview: IInvitePreview = {
|
|
31
|
-
type: "group",
|
|
32
|
-
inviter: {
|
|
33
|
-
userId: "abcdefghijklmnopqrstuvwxy",
|
|
34
|
-
publicKey: "a".repeat(43),
|
|
35
|
-
publicBoxKey: "b".repeat(43),
|
|
36
|
-
displayName: "Ada",
|
|
37
|
-
},
|
|
38
|
-
expiresAt: "2026-10-01T00:00:00.000Z",
|
|
39
|
-
expired: false,
|
|
40
|
-
knownContact: false,
|
|
41
|
-
group: {
|
|
42
|
-
groupId: "zyxwvutsrqponmlkjihgfedcb",
|
|
43
|
-
name: "Neighbors",
|
|
44
|
-
role: 20,
|
|
45
|
-
mode: "open",
|
|
46
|
-
alreadyMember: false,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const pendingResult: IAcceptInviteResult = {
|
|
51
|
-
inviteId: "openjoinrequest0000000001",
|
|
52
|
-
status: "pending",
|
|
53
|
-
deliveryState: "queued",
|
|
54
|
-
groupId: preview.group?.groupId,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
function invite(status: IInvite["status"], deliveryState: IInvite["deliveryState"]): IInvite {
|
|
58
|
-
return {
|
|
59
|
-
inviteId: pendingResult.inviteId,
|
|
60
|
-
direction: "in",
|
|
61
|
-
type: "group",
|
|
62
|
-
status,
|
|
63
|
-
mode: "open",
|
|
64
|
-
counterpart: preview.inviter,
|
|
65
|
-
groupId: preview.group?.groupId,
|
|
66
|
-
groupName: preview.group?.name,
|
|
67
|
-
role: preview.group?.role,
|
|
68
|
-
epoch: 0,
|
|
69
|
-
recipientUserId: preview.inviter.userId,
|
|
70
|
-
deliveryState,
|
|
71
|
-
createdAt: new Date("2026-09-22T00:00:00.000Z"),
|
|
72
|
-
expiresAt: new Date(preview.expiresAt),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
describe("AcceptInvite", () => {
|
|
77
|
-
beforeEach(() => {
|
|
78
|
-
jest.clearAllMocks();
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("shows automatic progress and reacts when the delayed approval arrives", async () => {
|
|
82
|
-
let row = invite("pending", "queued");
|
|
83
|
-
let onDataChanged: ((event: { dataObject: IInvite }) => void) | undefined;
|
|
84
|
-
const table = {
|
|
85
|
-
get: jest.fn(async () => row),
|
|
86
|
-
dataChanged: {
|
|
87
|
-
subscribe: jest.fn((listener: typeof onDataChanged) => {
|
|
88
|
-
onDataChanged = listener;
|
|
89
|
-
return { unsubscribe: jest.fn() };
|
|
90
|
-
}),
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
(getUserContext as jest.Mock).mockResolvedValue({ userDataContext: {} });
|
|
94
|
-
(Invites as jest.Mock).mockReturnValue(table);
|
|
95
|
-
(inviteTools as jest.Mock).mockResolvedValue({
|
|
96
|
-
previewInvite: jest.fn().mockResolvedValue({ preview }),
|
|
97
|
-
acceptInvite: jest.fn().mockResolvedValue({ result: pendingResult }),
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
render(<AcceptInvite initialToken="signed-token" />);
|
|
101
|
-
await userEvent.click(await screen.findByRole("button", { name: "Join" }));
|
|
102
|
-
|
|
103
|
-
expect(await screen.findByText("Finishing your automatic join to Neighbors.")).toBeVisible();
|
|
104
|
-
expect(screen.getByText("Waiting for a route; Peers will retry automatically.")).toBeVisible();
|
|
105
|
-
expect(screen.queryByText(/once it is approved/i)).not.toBeInTheDocument();
|
|
106
|
-
|
|
107
|
-
row = invite("accepted", "sent");
|
|
108
|
-
await act(async () => {
|
|
109
|
-
onDataChanged?.({ dataObject: row });
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
await waitFor(() => expect(screen.getByText("You joined Neighbors.")).toBeVisible());
|
|
113
|
-
expect(screen.getByRole("button", { name: "Open group" })).toBeEnabled();
|
|
114
|
-
});
|
|
115
|
-
});
|