@peers-app/peers-ui 0.14.0 → 0.15.0
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/.github/workflows/publish.yml +8 -5
- package/babel.config.js +4 -4
- package/biome.json +191 -0
- package/dist/command-palette/command-palette-ui.d.ts +1 -2
- package/dist/command-palette/command-palette-ui.js +175 -244
- package/dist/command-palette/command-palette.js +65 -64
- package/dist/components/chat-overlay.d.ts +2 -2
- package/dist/components/chat-overlay.js +160 -217
- package/dist/components/checkbox.d.ts +5 -4
- package/dist/components/checkbox.js +4 -7
- package/dist/components/group-switcher.d.ts +1 -2
- package/dist/components/group-switcher.js +119 -159
- package/dist/components/input-date.d.ts +3 -3
- package/dist/components/input-date.js +6 -6
- package/dist/components/input-number.d.ts +7 -6
- package/dist/components/input-number.js +25 -20
- package/dist/components/input.d.ts +5 -4
- package/dist/components/input.js +4 -7
- package/dist/components/inverse-lazy-list.d.ts +3 -3
- package/dist/components/inverse-lazy-list.js +13 -47
- package/dist/components/io-schema-values.d.ts +5 -6
- package/dist/components/io-schema-values.js +28 -65
- package/dist/components/io-schema.d.ts +4 -5
- package/dist/components/io-schema.js +42 -79
- package/dist/components/lazy-list.d.ts +3 -3
- package/dist/components/lazy-list.js +38 -58
- package/dist/components/list-screen.d.ts +3 -8
- package/dist/components/list-screen.js +28 -23
- package/dist/components/loading-indicator.d.ts +1 -2
- package/dist/components/loading-indicator.js +2 -6
- package/dist/components/markdown-editor/autolink-plugin.js +5 -8
- package/dist/components/markdown-editor/editor-inline.d.ts +2 -3
- package/dist/components/markdown-editor/editor-inline.js +2 -6
- package/dist/components/markdown-editor/editor.d.ts +6 -6
- package/dist/components/markdown-editor/editor.js +9 -19
- package/dist/components/markdown-editor/markdown-plugin.d.ts +1 -1
- package/dist/components/markdown-editor/markdown-plugin.js +20 -21
- package/dist/components/markdown-editor/mention-node.d.ts +2 -2
- package/dist/components/markdown-editor/mention-node.js +24 -24
- package/dist/components/markdown-editor/mentions-plugin.d.ts +2 -2
- package/dist/components/markdown-editor/mentions-plugin.js +61 -62
- package/dist/components/markdown-editor/theme.js +28 -28
- package/dist/components/markdown-editor/toolbar.d.ts +2 -3
- package/dist/components/markdown-editor/toolbar.js +32 -49
- package/dist/components/markdown-with-mentions.d.ts +1 -1
- package/dist/components/markdown-with-mentions.js +43 -43
- package/dist/components/message-logs/message-logs.d.ts +1 -2
- package/dist/components/message-logs/message-logs.js +91 -116
- package/dist/components/messages/avatar.d.ts +3 -4
- package/dist/components/messages/avatar.js +37 -46
- package/dist/components/messages/channel-message-list.d.ts +5 -6
- package/dist/components/messages/channel-message-list.js +34 -34
- package/dist/components/messages/channel-view.d.ts +1 -2
- package/dist/components/messages/channel-view.js +23 -57
- package/dist/components/messages/message-compose.d.ts +3 -4
- package/dist/components/messages/message-compose.js +27 -38
- package/dist/components/messages/message-display.d.ts +2 -3
- package/dist/components/messages/message-display.js +42 -95
- package/dist/components/messages/thread-message-list.d.ts +4 -5
- package/dist/components/messages/thread-message-list.js +29 -29
- package/dist/components/router.d.ts +1 -2
- package/dist/components/router.js +58 -66
- package/dist/components/save-button.d.ts +3 -3
- package/dist/components/save-button.js +23 -33
- package/dist/components/sortable-list.d.ts +11 -12
- package/dist/components/sortable-list.js +42 -22
- package/dist/components/tabs.d.ts +3 -3
- package/dist/components/tabs.js +16 -47
- package/dist/components/tooltip.d.ts +4 -4
- package/dist/components/tooltip.js +4 -9
- package/dist/components/trust-level-badge.d.ts +2 -3
- package/dist/components/trust-level-badge.js +16 -16
- package/dist/components/trust-level-dropdown.d.ts +3 -4
- package/dist/components/trust-level-dropdown.js +32 -55
- package/dist/components/typeahead.d.ts +3 -3
- package/dist/components/typeahead.js +48 -89
- package/dist/components/voice-indicator.d.ts +2 -2
- package/dist/components/voice-indicator.js +93 -106
- package/dist/components/voice-subscribe-events.d.ts +32 -0
- package/dist/components/voice-subscribe-events.js +2 -0
- package/dist/globals.d.ts +3 -5
- package/dist/globals.js +22 -33
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +22 -12
- package/dist/hooks.test.js +129 -145
- package/dist/index.d.ts +9 -8
- package/dist/index.js +13 -12
- package/dist/mention-configs.d.ts +2 -2
- package/dist/mention-configs.js +55 -42
- package/dist/screens/assistants/assistant-config.d.ts +2 -3
- package/dist/screens/assistants/assistant-config.js +9 -22
- package/dist/screens/assistants/assistant-details.d.ts +1 -2
- package/dist/screens/assistants/assistant-details.js +13 -28
- package/dist/screens/assistants/assistant-info.d.ts +2 -3
- package/dist/screens/assistants/assistant-info.js +3 -17
- package/dist/screens/assistants/assistant-list.d.ts +1 -2
- package/dist/screens/assistants/assistant-list.js +15 -56
- package/dist/screens/assistants/assistant-tools.d.ts +2 -3
- package/dist/screens/assistants/assistant-tools.js +10 -24
- package/dist/screens/console-logs/console-logs-list.d.ts +1 -2
- package/dist/screens/console-logs/console-logs-list.js +130 -134
- package/dist/screens/console-logs/log-display.d.ts +2 -3
- package/dist/screens/console-logs/log-display.js +40 -42
- package/dist/screens/console-logs/log-filters.d.ts +1 -2
- package/dist/screens/console-logs/log-filters.js +2 -24
- package/dist/screens/console-logs/mobile-log-card.d.ts +2 -3
- package/dist/screens/console-logs/mobile-log-card.js +64 -67
- package/dist/screens/console-logs/resizable-table-header.d.ts +1 -2
- package/dist/screens/console-logs/resizable-table-header.js +31 -67
- package/dist/screens/contacts/contact-details.d.ts +1 -2
- package/dist/screens/contacts/contact-details.js +16 -46
- package/dist/screens/contacts/contact-list.d.ts +1 -2
- package/dist/screens/contacts/contact-list.js +44 -103
- package/dist/screens/contacts/index.d.ts +4 -4
- package/dist/screens/contacts/index.js +1 -1
- package/dist/screens/contacts/user-connect.d.ts +1 -2
- package/dist/screens/contacts/user-connect.js +85 -186
- package/dist/screens/data-explorer/data-explorer.d.ts +1 -2
- package/dist/screens/data-explorer/data-explorer.js +61 -181
- package/dist/screens/data-explorer/index.d.ts +2 -2
- package/dist/screens/data-explorer/query-executor.d.ts +1 -2
- package/dist/screens/data-explorer/query-executor.js +56 -166
- package/dist/screens/groups/group-details.d.ts +1 -2
- package/dist/screens/groups/group-details.js +27 -122
- package/dist/screens/groups/group-invite-listener.d.ts +2 -3
- package/dist/screens/groups/group-invite-listener.js +8 -104
- package/dist/screens/groups/group-list.d.ts +1 -2
- package/dist/screens/groups/group-list.js +56 -133
- package/dist/screens/groups/group-members.d.ts +2 -3
- package/dist/screens/groups/group-members.js +62 -132
- package/dist/screens/groups/index.d.ts +4 -4
- package/dist/screens/groups/index.js +1 -1
- package/dist/screens/join-group/index.d.ts +2 -2
- package/dist/screens/join-group/join-group.d.ts +1 -2
- package/dist/screens/join-group/join-group.js +9 -109
- package/dist/screens/network-viewer/connection-troubleshooter.d.ts +2 -3
- package/dist/screens/network-viewer/connection-troubleshooter.js +89 -193
- package/dist/screens/network-viewer/cpu-usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/cpu-usage-graph.js +60 -99
- package/dist/screens/network-viewer/device-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/device-details-modal.js +25 -177
- package/dist/screens/network-viewer/group-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/group-details-modal.js +31 -142
- package/dist/screens/network-viewer/index.d.ts +4 -4
- package/dist/screens/network-viewer/index.js +3 -3
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +22 -0
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/network-viewer.d.ts +1 -2
- package/dist/screens/network-viewer/network-viewer.js +91 -296
- package/dist/screens/network-viewer/usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/usage-graph.js +78 -110
- package/dist/screens/packages/package-details.d.ts +1 -2
- package/dist/screens/packages/package-details.js +35 -41
- package/dist/screens/packages/package-info.d.ts +2 -2
- package/dist/screens/packages/package-info.js +33 -86
- package/dist/screens/packages/package-list.d.ts +1 -2
- package/dist/screens/packages/package-list.js +42 -106
- package/dist/screens/packages/package-new-local.d.ts +1 -2
- package/dist/screens/packages/package-new-local.js +13 -19
- package/dist/screens/packages/package-versions.d.ts +2 -3
- package/dist/screens/packages/package-versions.js +29 -96
- package/dist/screens/peer-types/peer-type-details.d.ts +3 -4
- package/dist/screens/peer-types/peer-type-details.js +26 -78
- package/dist/screens/peer-types/peer-type-list.d.ts +1 -2
- package/dist/screens/peer-types/peer-type-list.js +13 -24
- package/dist/screens/search/global-search.d.ts +1 -2
- package/dist/screens/search/global-search.js +104 -182
- package/dist/screens/settings/color-mode-dropdown.d.ts +3 -4
- package/dist/screens/settings/color-mode-dropdown.js +18 -37
- package/dist/screens/settings/settings-page.d.ts +1 -1
- package/dist/screens/settings/settings-page.js +86 -213
- package/dist/screens/settings/voice-settings-agent.d.ts +1 -1
- package/dist/screens/settings/voice-settings-agent.js +7 -44
- package/dist/screens/settings/voice-settings-api-keys.d.ts +2 -2
- package/dist/screens/settings/voice-settings-api-keys.js +2 -29
- package/dist/screens/settings/voice-settings-output.d.ts +2 -2
- package/dist/screens/settings/voice-settings-output.js +2 -40
- package/dist/screens/settings/voice-settings-providers.d.ts +2 -2
- package/dist/screens/settings/voice-settings-providers.js +2 -19
- package/dist/screens/settings/voice-settings-types.d.ts +4 -4
- package/dist/screens/settings/voice-settings-types.js +31 -31
- package/dist/screens/settings/voice-settings-wake-word.d.ts +2 -2
- package/dist/screens/settings/voice-settings-wake-word.js +2 -33
- package/dist/screens/settings/voice-settings.d.ts +1 -1
- package/dist/screens/settings/voice-settings.js +35 -112
- package/dist/screens/setup-user.d.ts +1 -2
- package/dist/screens/setup-user.js +38 -116
- package/dist/screens/tools/tool-code.d.ts +2 -3
- package/dist/screens/tools/tool-code.js +9 -13
- package/dist/screens/tools/tool-details.d.ts +1 -2
- package/dist/screens/tools/tool-details.js +26 -39
- package/dist/screens/tools/tool-info.d.ts +2 -3
- package/dist/screens/tools/tool-info.js +9 -48
- package/dist/screens/tools/tool-list.d.ts +1 -2
- package/dist/screens/tools/tool-list.js +33 -65
- package/dist/screens/tools/tool-schema.d.ts +2 -3
- package/dist/screens/tools/tool-schema.js +2 -13
- package/dist/screens/tools/tool-test-details.d.ts +1 -2
- package/dist/screens/tools/tool-test-details.js +12 -28
- package/dist/screens/tools/tool-test-list.d.ts +1 -2
- package/dist/screens/tools/tool-test-list.js +17 -56
- package/dist/screens/variables/variable-details.d.ts +1 -2
- package/dist/screens/variables/variable-details.js +19 -86
- package/dist/screens/variables/variable-list.d.ts +1 -2
- package/dist/screens/variables/variable-list.js +16 -27
- package/dist/screens/welcome-modal.d.ts +1 -2
- package/dist/screens/welcome-modal.js +44 -111
- package/dist/screens/workflows/workflow-details.d.ts +1 -2
- package/dist/screens/workflows/workflow-details.js +17 -31
- package/dist/screens/workflows/workflow-info.d.ts +2 -3
- package/dist/screens/workflows/workflow-info.js +2 -9
- package/dist/screens/workflows/workflow-instructions.d.ts +2 -3
- package/dist/screens/workflows/workflow-instructions.js +23 -55
- package/dist/screens/workflows/workflow-list.d.ts +1 -2
- package/dist/screens/workflows/workflow-list.js +23 -62
- package/dist/setupTests.d.ts +1 -1
- package/dist/setupTests.js +10 -11
- package/dist/system-apps/assistants.app.d.ts +1 -1
- package/dist/system-apps/assistants.app.js +3 -3
- package/dist/system-apps/console-logs.app.d.ts +1 -1
- package/dist/system-apps/console-logs.app.js +3 -3
- package/dist/system-apps/contacts.app.d.ts +1 -1
- package/dist/system-apps/contacts.app.js +4 -4
- package/dist/system-apps/data-explorer.app.d.ts +1 -1
- package/dist/system-apps/data-explorer.app.js +4 -4
- package/dist/system-apps/groups.app.d.ts +1 -1
- package/dist/system-apps/groups.app.js +4 -4
- package/dist/system-apps/index.d.ts +17 -17
- package/dist/system-apps/index.js +52 -52
- package/dist/system-apps/join-group.app.d.ts +1 -1
- package/dist/system-apps/join-group.app.js +4 -4
- package/dist/system-apps/mobile-settings.app.d.ts +1 -1
- package/dist/system-apps/mobile-settings.app.js +3 -3
- package/dist/system-apps/network-viewer.app.d.ts +1 -1
- package/dist/system-apps/network-viewer.app.js +4 -4
- package/dist/system-apps/packages.app.d.ts +1 -1
- package/dist/system-apps/packages.app.js +3 -3
- package/dist/system-apps/search.app.d.ts +1 -1
- package/dist/system-apps/search.app.js +4 -4
- package/dist/system-apps/settings.app.d.ts +1 -1
- package/dist/system-apps/settings.app.js +3 -3
- package/dist/system-apps/threads.app.d.ts +1 -1
- package/dist/system-apps/threads.app.js +3 -3
- package/dist/system-apps/tools.app.d.ts +1 -1
- package/dist/system-apps/tools.app.js +3 -3
- package/dist/system-apps/types.app.d.ts +1 -1
- package/dist/system-apps/types.app.js +3 -3
- package/dist/system-apps/variables.app.d.ts +1 -1
- package/dist/system-apps/variables.app.js +3 -3
- package/dist/system-apps/workflows.app.d.ts +1 -1
- package/dist/system-apps/workflows.app.js +3 -3
- package/dist/tabs-layout/tabs-layout.d.ts +2 -3
- package/dist/tabs-layout/tabs-layout.js +215 -246
- package/dist/tabs-layout/tabs-state.d.ts +2 -2
- package/dist/tabs-layout/tabs-state.js +73 -61
- package/dist/ui-defaults/index.d.ts +2 -2
- package/dist/ui-defaults/list-screen.d.ts +2 -3
- package/dist/ui-defaults/list-screen.js +33 -37
- package/dist/ui-defaults/markdown-field.js +24 -56
- package/dist/ui-router/routes-loader.d.ts +1 -1
- package/dist/ui-router/routes-loader.js +17 -13
- package/dist/ui-router/ui-loader.d.ts +6 -6
- package/dist/ui-router/ui-loader.js +172 -268
- package/dist/utils.js +49 -39
- package/jest.config.js +16 -16
- package/package.json +16 -14
- package/src/command-palette/command-palette-ui.tsx +261 -237
- package/src/command-palette/command-palette.ts +81 -78
- package/src/components/chat-overlay.tsx +366 -261
- package/src/components/checkbox.tsx +15 -12
- package/src/components/group-switcher.tsx +150 -105
- package/src/components/input-date.tsx +17 -16
- package/src/components/input-number.tsx +47 -31
- package/src/components/input.tsx +15 -12
- package/src/components/inverse-lazy-list.tsx +14 -13
- package/src/components/io-schema-values.tsx +51 -69
- package/src/components/io-schema.tsx +94 -69
- package/src/components/lazy-list.tsx +51 -34
- package/src/components/list-screen.tsx +51 -35
- package/src/components/loading-indicator.tsx +2 -4
- package/src/components/markdown-editor/autolink-plugin.tsx +4 -11
- package/src/components/markdown-editor/editor-inline.tsx +3 -4
- package/src/components/markdown-editor/editor.tsx +53 -51
- package/src/components/markdown-editor/markdown-plugin.tsx +48 -40
- package/src/components/markdown-editor/mention-node.ts +39 -38
- package/src/components/markdown-editor/mentions-plugin.tsx +99 -101
- package/src/components/markdown-editor/theme.ts +28 -29
- package/src/components/markdown-editor/toolbar.tsx +53 -47
- package/src/components/markdown-with-mentions.tsx +56 -46
- package/src/components/message-logs/message-logs.tsx +225 -165
- package/src/components/messages/avatar.tsx +70 -52
- package/src/components/messages/channel-message-list.tsx +80 -68
- package/src/components/messages/channel-view.tsx +34 -33
- package/src/components/messages/message-compose.tsx +84 -67
- package/src/components/messages/message-display.tsx +103 -89
- package/src/components/messages/thread-message-list.tsx +53 -44
- package/src/components/router.tsx +42 -43
- package/src/components/save-button.tsx +43 -39
- package/src/components/sortable-list.tsx +77 -49
- package/src/components/tabs.tsx +31 -31
- package/src/components/tooltip.tsx +21 -28
- package/src/components/trust-level-badge.tsx +15 -11
- package/src/components/trust-level-dropdown.tsx +49 -19
- package/src/components/typeahead.tsx +57 -59
- package/src/components/voice-indicator.tsx +158 -141
- package/src/components/voice-subscribe-events.ts +20 -0
- package/src/globals.tsx +42 -40
- package/src/hooks.test.tsx +141 -134
- package/src/hooks.ts +80 -48
- package/src/index.tsx +17 -10
- package/src/mention-configs.ts +122 -68
- package/src/screens/assistants/assistant-config.tsx +28 -18
- package/src/screens/assistants/assistant-details.tsx +35 -36
- package/src/screens/assistants/assistant-info.tsx +16 -11
- package/src/screens/assistants/assistant-list.tsx +37 -34
- package/src/screens/assistants/assistant-tools.tsx +41 -20
- package/src/screens/console-logs/console-logs-list.tsx +173 -140
- package/src/screens/console-logs/log-display.tsx +65 -38
- package/src/screens/console-logs/log-filters.tsx +4 -3
- package/src/screens/console-logs/mobile-log-card.tsx +78 -71
- package/src/screens/console-logs/resizable-table-header.tsx +29 -21
- package/src/screens/contacts/contact-details.tsx +29 -30
- package/src/screens/contacts/contact-list.tsx +71 -60
- package/src/screens/contacts/index.ts +5 -5
- package/src/screens/contacts/user-connect.tsx +177 -171
- package/src/screens/data-explorer/data-explorer.tsx +134 -98
- package/src/screens/data-explorer/index.ts +2 -3
- package/src/screens/data-explorer/query-executor.tsx +90 -80
- package/src/screens/groups/group-details.tsx +120 -101
- package/src/screens/groups/group-invite-listener.tsx +34 -37
- package/src/screens/groups/group-list.tsx +119 -103
- package/src/screens/groups/group-members.tsx +225 -164
- package/src/screens/groups/index.ts +5 -6
- package/src/screens/join-group/index.ts +2 -2
- package/src/screens/join-group/join-group.tsx +41 -39
- package/src/screens/network-viewer/connection-troubleshooter.tsx +145 -104
- package/src/screens/network-viewer/cpu-usage-graph.tsx +39 -43
- package/src/screens/network-viewer/device-details-modal.tsx +46 -59
- package/src/screens/network-viewer/group-details-modal.tsx +68 -49
- package/src/screens/network-viewer/index.ts +4 -5
- package/src/screens/network-viewer/network-viewer-ipc.ts +23 -0
- package/src/screens/network-viewer/network-viewer.tsx +261 -236
- package/src/screens/network-viewer/usage-graph.tsx +57 -49
- package/src/screens/packages/package-details.tsx +43 -35
- package/src/screens/packages/package-info.tsx +107 -66
- package/src/screens/packages/package-list.tsx +175 -98
- package/src/screens/packages/package-new-local.tsx +28 -26
- package/src/screens/packages/package-versions.tsx +102 -77
- package/src/screens/peer-types/peer-type-details.tsx +60 -50
- package/src/screens/peer-types/peer-type-list.tsx +20 -30
- package/src/screens/search/global-search.tsx +153 -137
- package/src/screens/settings/color-mode-dropdown.tsx +52 -35
- package/src/screens/settings/settings-page.tsx +215 -141
- package/src/screens/settings/voice-settings-agent.tsx +13 -12
- package/src/screens/settings/voice-settings-api-keys.tsx +14 -12
- package/src/screens/settings/voice-settings-output.tsx +12 -11
- package/src/screens/settings/voice-settings-providers.tsx +7 -3
- package/src/screens/settings/voice-settings-types.ts +52 -49
- package/src/screens/settings/voice-settings-wake-word.tsx +25 -9
- package/src/screens/settings/voice-settings.tsx +66 -43
- package/src/screens/setup-user.tsx +88 -41
- package/src/screens/tools/tool-code.tsx +12 -17
- package/src/screens/tools/tool-details.tsx +28 -28
- package/src/screens/tools/tool-info.tsx +14 -19
- package/src/screens/tools/tool-list.tsx +58 -40
- package/src/screens/tools/tool-schema.tsx +16 -9
- package/src/screens/tools/tool-test-details.tsx +11 -22
- package/src/screens/tools/tool-test-list.tsx +29 -30
- package/src/screens/variables/variable-details.tsx +63 -51
- package/src/screens/variables/variable-list.tsx +29 -30
- package/src/screens/welcome-modal.tsx +68 -48
- package/src/screens/workflows/workflow-details.tsx +40 -30
- package/src/screens/workflows/workflow-info.tsx +4 -11
- package/src/screens/workflows/workflow-instructions.tsx +35 -28
- package/src/screens/workflows/workflow-list.tsx +50 -40
- package/src/setupTests.ts +14 -13
- package/src/system-apps/assistants.app.ts +5 -5
- package/src/system-apps/console-logs.app.ts +4 -4
- package/src/system-apps/contacts.app.ts +6 -6
- package/src/system-apps/data-explorer.app.ts +5 -5
- package/src/system-apps/groups.app.ts +6 -6
- package/src/system-apps/index.ts +49 -49
- package/src/system-apps/join-group.app.ts +5 -5
- package/src/system-apps/mobile-settings.app.ts +4 -5
- package/src/system-apps/network-viewer.app.ts +5 -5
- package/src/system-apps/packages.app.ts +5 -5
- package/src/system-apps/search.app.ts +6 -6
- package/src/system-apps/settings.app.ts +5 -5
- package/src/system-apps/threads.app.ts +5 -5
- package/src/system-apps/tools.app.ts +5 -5
- package/src/system-apps/types.app.ts +5 -5
- package/src/system-apps/variables.app.ts +5 -5
- package/src/system-apps/workflows.app.ts +5 -5
- package/src/tabs-layout/tabs-layout.tsx +345 -254
- package/src/tabs-layout/tabs-state.ts +100 -81
- package/src/ui-defaults/index.ts +2 -3
- package/src/ui-defaults/list-screen.tsx +45 -40
- package/src/ui-defaults/markdown-field.tsx +22 -26
- package/src/ui-router/routes-loader.ts +40 -24
- package/src/ui-router/ui-loader.tsx +312 -214
- package/src/utils.ts +68 -81
- package/tsconfig.json +5 -10
- package/dist/components/input-datetime.d.ts +0 -7
- package/dist/components/input-datetime.js +0 -35
- package/dist/components/lazy-sortable-list.d.ts +0 -29
- package/dist/components/lazy-sortable-list.js +0 -12
- package/dist/components/left-bar.d.ts +0 -5
- package/dist/components/left-bar.js +0 -207
- package/dist/components/main-content-container.d.ts +0 -2
- package/dist/components/main-content-container.js +0 -92
- package/dist/components/messages/thread-view.d.ts +0 -6
- package/dist/components/messages/thread-view.js +0 -174
- package/dist/components/off-canvas.d.ts +0 -13
- package/dist/components/off-canvas.js +0 -89
- package/dist/components/text-list-editor.tsx/text-list-editor.d.ts +0 -6
- package/dist/components/text-list-editor.tsx/text-list-editor.js +0 -13
- package/dist/components/top-bar.d.ts +0 -2
- package/dist/components/top-bar.js +0 -51
- package/dist/components/typeahead/mentions-plugin.d.ts +0 -7
- package/dist/components/typeahead/mentions-plugin.js +0 -203
- package/dist/components/typeahead/typeahead-editor.d.ts +0 -15
- package/dist/components/typeahead/typeahead-editor.js +0 -134
- package/dist/components/typeahead/typeahead.d.ts +0 -12
- package/dist/components/typeahead/typeahead.js +0 -94
- package/dist/screens/profile.d.ts +0 -2
- package/dist/screens/profile.js +0 -76
- package/src/components/input-datetime.tsx +0 -41
- package/src/components/lazy-sortable-list.tsx +0 -51
- package/src/components/left-bar.tsx +0 -322
- package/src/components/main-content-container.tsx +0 -79
- package/src/components/messages/thread-view.tsx +0 -214
- package/src/components/off-canvas.tsx +0 -83
- package/src/components/text-list-editor.tsx/text-list-editor.tsx +0 -13
- package/src/components/top-bar.tsx +0 -119
- package/src/components/typeahead/mentions-plugin.tsx +0 -265
- package/src/components/typeahead/typeahead-editor.tsx +0 -140
- package/src/components/typeahead/typeahead.tsx +0 -77
- package/src/screens/profile.tsx +0 -75
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
Devices,
|
|
3
|
+
formatConnectionCode,
|
|
4
4
|
generateConfirmationHash,
|
|
5
|
+
generateConnectionCode,
|
|
5
6
|
getMe,
|
|
6
|
-
getUserContext,
|
|
7
|
-
IUser,
|
|
8
|
-
IUserConnectInfo,
|
|
9
|
-
setUserTrustLevel,
|
|
10
|
-
TrustLevel,
|
|
11
|
-
|
|
12
|
-
userConnectCodeAnswer,
|
|
7
|
+
getUserContext,
|
|
8
|
+
type IUser,
|
|
9
|
+
type IUserConnectInfo,
|
|
10
|
+
setUserTrustLevel,
|
|
11
|
+
TrustLevel,
|
|
12
|
+
Users,
|
|
13
|
+
userConnectCodeAnswer,
|
|
14
|
+
userConnectCodeOffer,
|
|
13
15
|
userConnectStatus,
|
|
14
|
-
Users,
|
|
15
|
-
Devices
|
|
16
16
|
} from "@peers-app/peers-sdk";
|
|
17
|
-
import
|
|
18
|
-
import { mainContentPath } from
|
|
19
|
-
import { useObservable } from
|
|
20
|
-
import { registerInternalPeersUI } from
|
|
17
|
+
import { useCallback, useEffect, useState } from "react";
|
|
18
|
+
import { mainContentPath } from "../../globals";
|
|
19
|
+
import { useObservable } from "../../hooks";
|
|
20
|
+
import { registerInternalPeersUI } from "../../ui-router/ui-loader";
|
|
21
21
|
|
|
22
|
-
type ConnectionMode =
|
|
23
|
-
type ConnectionStatus =
|
|
22
|
+
type ConnectionMode = "select" | "initiate" | "respond";
|
|
23
|
+
type ConnectionStatus = "idle" | "waiting" | "success" | "error";
|
|
24
24
|
|
|
25
25
|
interface ConnectionResult {
|
|
26
26
|
remoteUser: IUser;
|
|
@@ -28,17 +28,80 @@ interface ConnectionResult {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export function UserConnect() {
|
|
31
|
-
const [mode, setMode] = useState<ConnectionMode>(
|
|
32
|
-
const [status, setStatus] = useState<ConnectionStatus>(
|
|
33
|
-
const [connectionCode, setConnectionCode] = useState<string>(
|
|
34
|
-
const [inputCode, setInputCode] = useState<string>(
|
|
31
|
+
const [mode, setMode] = useState<ConnectionMode>("select");
|
|
32
|
+
const [status, setStatus] = useState<ConnectionStatus>("idle");
|
|
33
|
+
const [connectionCode, setConnectionCode] = useState<string>("");
|
|
34
|
+
const [inputCode, setInputCode] = useState<string>("");
|
|
35
35
|
const [result, setResult] = useState<ConnectionResult | null>(null);
|
|
36
|
-
const [error, setError] = useState<string>(
|
|
36
|
+
const [error, setError] = useState<string>("");
|
|
37
37
|
const [copied, setCopied] = useState(false);
|
|
38
38
|
|
|
39
39
|
// Subscribe to userConnectStatus from the device layer
|
|
40
40
|
const [connectStatus] = useObservable(userConnectStatus);
|
|
41
41
|
|
|
42
|
+
const handleConnectStatusChange = useCallback(
|
|
43
|
+
async (connectStatusValue: string) => {
|
|
44
|
+
if (!connectStatusValue || status === "success") return;
|
|
45
|
+
|
|
46
|
+
if (connectStatusValue.startsWith("Error:")) {
|
|
47
|
+
// Error status
|
|
48
|
+
setError(connectStatusValue.replace("Error: ", ""));
|
|
49
|
+
setStatus("error");
|
|
50
|
+
} else if (connectStatusValue.length > 0) {
|
|
51
|
+
// Success - connectStatus is the remote userId
|
|
52
|
+
const remoteUserId = connectStatusValue;
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
const userContext = await getUserContext();
|
|
56
|
+
const me = await getMe();
|
|
57
|
+
const remoteUser = await Users(userContext.userDataContext).get(remoteUserId);
|
|
58
|
+
|
|
59
|
+
if (!remoteUser) {
|
|
60
|
+
setError("Could not find connected user");
|
|
61
|
+
setStatus("error");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const remoteDevice = await Devices(userContext.userDataContext).findOne({
|
|
66
|
+
userId: remoteUserId,
|
|
67
|
+
});
|
|
68
|
+
if (!remoteDevice) {
|
|
69
|
+
setError("Could not find connected device but connection was successful");
|
|
70
|
+
setStatus("error");
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Build user connect info for confirmation hash
|
|
75
|
+
const myInfo: IUserConnectInfo = {
|
|
76
|
+
userId: me.userId,
|
|
77
|
+
publicKey: me.publicKey,
|
|
78
|
+
publicBoxKey: me.publicBoxKey,
|
|
79
|
+
deviceId: userContext.deviceId(),
|
|
80
|
+
};
|
|
81
|
+
const remoteInfo: IUserConnectInfo = {
|
|
82
|
+
userId: remoteUser.userId,
|
|
83
|
+
publicKey: remoteUser.publicKey,
|
|
84
|
+
publicBoxKey: remoteUser.publicBoxKey,
|
|
85
|
+
deviceId: remoteDevice.deviceId,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const confirmationHash = generateConfirmationHash(myInfo, remoteInfo);
|
|
89
|
+
|
|
90
|
+
setResult({ remoteUser, confirmationHash });
|
|
91
|
+
setStatus("success");
|
|
92
|
+
|
|
93
|
+
// Clear the codes
|
|
94
|
+
userConnectCodeOffer("");
|
|
95
|
+
userConnectCodeAnswer("");
|
|
96
|
+
} catch (err: unknown) {
|
|
97
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
98
|
+
setStatus("error");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
[status],
|
|
103
|
+
);
|
|
104
|
+
|
|
42
105
|
// Also set up a direct subscription after loading is complete
|
|
43
106
|
useEffect(() => {
|
|
44
107
|
let disposed = false;
|
|
@@ -49,7 +112,7 @@ export function UserConnect() {
|
|
|
49
112
|
subscription = userConnectStatus.subscribe(() => {
|
|
50
113
|
// Force a re-render by checking the current value
|
|
51
114
|
const currentStatus = userConnectStatus();
|
|
52
|
-
if (currentStatus && typeof currentStatus ===
|
|
115
|
+
if (currentStatus && typeof currentStatus === "string") {
|
|
53
116
|
handleConnectStatusChange(currentStatus);
|
|
54
117
|
}
|
|
55
118
|
});
|
|
@@ -59,70 +122,11 @@ export function UserConnect() {
|
|
|
59
122
|
disposed = true;
|
|
60
123
|
subscription?.dispose();
|
|
61
124
|
};
|
|
62
|
-
}, []);
|
|
63
|
-
|
|
64
|
-
// Handle connect status changes
|
|
65
|
-
const handleConnectStatusChange = useCallback(async (connectStatusValue: string) => {
|
|
66
|
-
if (!connectStatusValue || status === 'success') return;
|
|
67
|
-
|
|
68
|
-
if (connectStatusValue.startsWith('Error:')) {
|
|
69
|
-
// Error status
|
|
70
|
-
setError(connectStatusValue.replace('Error: ', ''));
|
|
71
|
-
setStatus('error');
|
|
72
|
-
} else if (connectStatusValue.length > 0) {
|
|
73
|
-
// Success - connectStatus is the remote userId
|
|
74
|
-
const remoteUserId = connectStatusValue;
|
|
75
|
-
|
|
76
|
-
try {
|
|
77
|
-
const userContext = await getUserContext();
|
|
78
|
-
const me = await getMe();
|
|
79
|
-
const remoteUser = await Users(userContext.userDataContext).get(remoteUserId);
|
|
80
|
-
|
|
81
|
-
if (!remoteUser) {
|
|
82
|
-
setError('Could not find connected user');
|
|
83
|
-
setStatus('error');
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const remoteDevice = await Devices(userContext.userDataContext).findOne({ userId: remoteUserId });
|
|
88
|
-
if (!remoteDevice) {
|
|
89
|
-
setError('Could not find connected device but connection was successful');
|
|
90
|
-
setStatus('error');
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Build user connect info for confirmation hash
|
|
95
|
-
const myInfo: IUserConnectInfo = {
|
|
96
|
-
userId: me.userId,
|
|
97
|
-
publicKey: me.publicKey,
|
|
98
|
-
publicBoxKey: me.publicBoxKey,
|
|
99
|
-
deviceId: userContext.deviceId(),
|
|
100
|
-
};
|
|
101
|
-
const remoteInfo: IUserConnectInfo = {
|
|
102
|
-
userId: remoteUser.userId,
|
|
103
|
-
publicKey: remoteUser.publicKey,
|
|
104
|
-
publicBoxKey: remoteUser.publicBoxKey,
|
|
105
|
-
deviceId: remoteDevice.deviceId,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const confirmationHash = generateConfirmationHash(myInfo, remoteInfo);
|
|
109
|
-
|
|
110
|
-
setResult({ remoteUser, confirmationHash });
|
|
111
|
-
setStatus('success');
|
|
112
|
-
|
|
113
|
-
// Clear the codes
|
|
114
|
-
userConnectCodeOffer('');
|
|
115
|
-
userConnectCodeAnswer('');
|
|
116
|
-
} catch (err: any) {
|
|
117
|
-
setError(err.message || 'Failed to complete connection');
|
|
118
|
-
setStatus('error');
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}, [status]);
|
|
125
|
+
}, [handleConnectStatusChange]);
|
|
122
126
|
|
|
123
127
|
// React to userConnectStatus changes from useObservable
|
|
124
128
|
useEffect(() => {
|
|
125
|
-
if (connectStatus && typeof connectStatus ===
|
|
129
|
+
if (connectStatus && typeof connectStatus === "string") {
|
|
126
130
|
handleConnectStatusChange(connectStatus);
|
|
127
131
|
}
|
|
128
132
|
}, [connectStatus, handleConnectStatusChange]);
|
|
@@ -130,18 +134,18 @@ export function UserConnect() {
|
|
|
130
134
|
// Clean up on unmount
|
|
131
135
|
useEffect(() => {
|
|
132
136
|
return () => {
|
|
133
|
-
if (mode ===
|
|
134
|
-
userConnectCodeOffer(
|
|
135
|
-
userConnectCodeAnswer(
|
|
137
|
+
if (mode === "initiate" && status === "waiting") {
|
|
138
|
+
userConnectCodeOffer("");
|
|
139
|
+
userConnectCodeAnswer("");
|
|
136
140
|
}
|
|
137
141
|
};
|
|
138
142
|
}, [mode, status]);
|
|
139
143
|
|
|
140
144
|
const handleInitiate = useCallback(async () => {
|
|
141
|
-
setMode(
|
|
142
|
-
setStatus(
|
|
143
|
-
setError(
|
|
144
|
-
userConnectStatus(
|
|
145
|
+
setMode("initiate");
|
|
146
|
+
setStatus("waiting");
|
|
147
|
+
setError("");
|
|
148
|
+
userConnectStatus(""); // Clear any previous status
|
|
145
149
|
|
|
146
150
|
// Generate the connection code
|
|
147
151
|
const code = generateConnectionCode();
|
|
@@ -151,37 +155,37 @@ export function UserConnect() {
|
|
|
151
155
|
}, []);
|
|
152
156
|
|
|
153
157
|
const handleRespond = useCallback(async () => {
|
|
154
|
-
if (inputCode.replace(/[^0-9A-Za-z]/g,
|
|
155
|
-
setError(
|
|
158
|
+
if (inputCode.replace(/[^0-9A-Za-z]/g, "").length !== 12) {
|
|
159
|
+
setError("Please enter a valid 12-character connection code");
|
|
156
160
|
return;
|
|
157
161
|
}
|
|
158
|
-
|
|
159
|
-
setStatus(
|
|
160
|
-
setError(
|
|
161
|
-
userConnectStatus(
|
|
162
|
+
|
|
163
|
+
setStatus("waiting");
|
|
164
|
+
setError("");
|
|
165
|
+
userConnectStatus(""); // Clear any previous status
|
|
162
166
|
userConnectCodeAnswer(inputCode);
|
|
163
167
|
}, [inputCode]);
|
|
164
168
|
|
|
165
169
|
const handleCancel = useCallback(async () => {
|
|
166
|
-
userConnectCodeOffer(
|
|
167
|
-
userConnectCodeAnswer(
|
|
168
|
-
userConnectStatus(
|
|
169
|
-
setMode(
|
|
170
|
-
setStatus(
|
|
171
|
-
setConnectionCode(
|
|
172
|
-
setError(
|
|
170
|
+
userConnectCodeOffer("");
|
|
171
|
+
userConnectCodeAnswer("");
|
|
172
|
+
userConnectStatus("");
|
|
173
|
+
setMode("select");
|
|
174
|
+
setStatus("idle");
|
|
175
|
+
setConnectionCode("");
|
|
176
|
+
setError("");
|
|
173
177
|
}, []);
|
|
174
178
|
|
|
175
179
|
const handleReset = useCallback(() => {
|
|
176
|
-
userConnectCodeOffer(
|
|
177
|
-
userConnectCodeAnswer(
|
|
178
|
-
userConnectStatus(
|
|
179
|
-
setMode(
|
|
180
|
-
setStatus(
|
|
181
|
-
setConnectionCode(
|
|
182
|
-
setInputCode(
|
|
180
|
+
userConnectCodeOffer("");
|
|
181
|
+
userConnectCodeAnswer("");
|
|
182
|
+
userConnectStatus("");
|
|
183
|
+
setMode("select");
|
|
184
|
+
setStatus("idle");
|
|
185
|
+
setConnectionCode("");
|
|
186
|
+
setInputCode("");
|
|
183
187
|
setResult(null);
|
|
184
|
-
setError(
|
|
188
|
+
setError("");
|
|
185
189
|
setCopied(false);
|
|
186
190
|
}, []);
|
|
187
191
|
|
|
@@ -190,14 +194,18 @@ export function UserConnect() {
|
|
|
190
194
|
|
|
191
195
|
try {
|
|
192
196
|
const userContext = await getUserContext();
|
|
193
|
-
|
|
197
|
+
|
|
194
198
|
// Contact is already saved by the device layer, just set trust level
|
|
195
|
-
await setUserTrustLevel(
|
|
199
|
+
await setUserTrustLevel(
|
|
200
|
+
result.remoteUser.userId,
|
|
201
|
+
TrustLevel.Trusted,
|
|
202
|
+
userContext.userDataContext,
|
|
203
|
+
);
|
|
196
204
|
|
|
197
205
|
// Navigate to contact details
|
|
198
206
|
mainContentPath(`contacts/${result.remoteUser.userId}`);
|
|
199
|
-
} catch (err:
|
|
200
|
-
setError(err
|
|
207
|
+
} catch (err: unknown) {
|
|
208
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
201
209
|
}
|
|
202
210
|
}, [result]);
|
|
203
211
|
|
|
@@ -208,13 +216,13 @@ export function UserConnect() {
|
|
|
208
216
|
await navigator.clipboard.writeText(connectionCode);
|
|
209
217
|
setCopied(true);
|
|
210
218
|
setTimeout(() => setCopied(false), 2000);
|
|
211
|
-
} catch (
|
|
219
|
+
} catch (_err) {
|
|
212
220
|
// Fallback for older browsers
|
|
213
|
-
const textArea = document.createElement(
|
|
221
|
+
const textArea = document.createElement("textarea");
|
|
214
222
|
textArea.value = connectionCode;
|
|
215
223
|
document.body.appendChild(textArea);
|
|
216
224
|
textArea.select();
|
|
217
|
-
document.execCommand(
|
|
225
|
+
document.execCommand("copy");
|
|
218
226
|
document.body.removeChild(textArea);
|
|
219
227
|
setCopied(true);
|
|
220
228
|
setTimeout(() => setCopied(false), 2000);
|
|
@@ -224,15 +232,15 @@ export function UserConnect() {
|
|
|
224
232
|
// Format input code as user types
|
|
225
233
|
const handleCodeInput = (value: string) => {
|
|
226
234
|
// Remove non-alphanumeric characters
|
|
227
|
-
const cleaned = value.toUpperCase().replace(/[^0-9A-Z]/g,
|
|
228
|
-
|
|
235
|
+
const cleaned = value.toUpperCase().replace(/[^0-9A-Z]/g, "");
|
|
236
|
+
|
|
229
237
|
// Format as XXXX-YYYY-ZZZZ
|
|
230
|
-
let formatted =
|
|
238
|
+
let formatted = "";
|
|
231
239
|
for (let i = 0; i < cleaned.length && i < 12; i++) {
|
|
232
|
-
if (i === 4 || i === 8) formatted +=
|
|
240
|
+
if (i === 4 || i === 8) formatted += "-";
|
|
233
241
|
formatted += cleaned[i];
|
|
234
242
|
}
|
|
235
|
-
|
|
243
|
+
|
|
236
244
|
setInputCode(formatted);
|
|
237
245
|
};
|
|
238
246
|
|
|
@@ -243,7 +251,7 @@ export function UserConnect() {
|
|
|
243
251
|
<i className="bi-person-plus-fill me-2" />
|
|
244
252
|
Connect to New User
|
|
245
253
|
</h4>
|
|
246
|
-
{mode !==
|
|
254
|
+
{mode !== "select" && (
|
|
247
255
|
<button className="btn btn-outline-secondary btn-sm" onClick={handleReset}>
|
|
248
256
|
<i className="bi-arrow-left me-1" />
|
|
249
257
|
Back
|
|
@@ -252,12 +260,12 @@ export function UserConnect() {
|
|
|
252
260
|
</div>
|
|
253
261
|
|
|
254
262
|
{/* Mode Selection */}
|
|
255
|
-
{mode ===
|
|
263
|
+
{mode === "select" && (
|
|
256
264
|
<div className="row g-3">
|
|
257
265
|
<div className="col-md-6">
|
|
258
|
-
<div
|
|
259
|
-
className="card h-100 border-primary"
|
|
260
|
-
style={{ cursor:
|
|
266
|
+
<div
|
|
267
|
+
className="card h-100 border-primary"
|
|
268
|
+
style={{ cursor: "pointer" }}
|
|
261
269
|
onClick={handleInitiate}
|
|
262
270
|
>
|
|
263
271
|
<div className="card-body text-center p-4">
|
|
@@ -270,10 +278,10 @@ export function UserConnect() {
|
|
|
270
278
|
</div>
|
|
271
279
|
</div>
|
|
272
280
|
<div className="col-md-6">
|
|
273
|
-
<div
|
|
274
|
-
className="card h-100 border-success"
|
|
275
|
-
style={{ cursor:
|
|
276
|
-
onClick={() => setMode(
|
|
281
|
+
<div
|
|
282
|
+
className="card h-100 border-success"
|
|
283
|
+
style={{ cursor: "pointer" }}
|
|
284
|
+
onClick={() => setMode("respond")}
|
|
277
285
|
>
|
|
278
286
|
<div className="card-body text-center p-4">
|
|
279
287
|
<i className="bi-keyboard display-4 text-success mb-3" />
|
|
@@ -288,32 +296,30 @@ export function UserConnect() {
|
|
|
288
296
|
)}
|
|
289
297
|
|
|
290
298
|
{/* Initiate Mode - Show Generated Code */}
|
|
291
|
-
{mode ===
|
|
299
|
+
{mode === "initiate" && status === "waiting" && (
|
|
292
300
|
<div className="text-center">
|
|
293
301
|
<div className="mb-4">
|
|
294
302
|
<p className="text-muted">Share this code with the person you want to connect with:</p>
|
|
295
303
|
</div>
|
|
296
|
-
|
|
297
|
-
<div className="mb-4" style={{ maxWidth:
|
|
304
|
+
|
|
305
|
+
<div className="mb-4" style={{ maxWidth: "400px", margin: "0 auto" }}>
|
|
298
306
|
<div className="input-group">
|
|
299
307
|
<input
|
|
300
308
|
type="text"
|
|
301
309
|
className="form-control form-control-lg text-center font-monospace"
|
|
302
|
-
value={connectionCode ||
|
|
310
|
+
value={connectionCode || "XXXX-YYYY-ZZZZ"}
|
|
303
311
|
readOnly
|
|
304
|
-
style={{ letterSpacing:
|
|
312
|
+
style={{ letterSpacing: "0.15em", fontSize: "1.5rem" }}
|
|
305
313
|
/>
|
|
306
|
-
<button
|
|
307
|
-
className="btn btn-outline-primary"
|
|
314
|
+
<button
|
|
315
|
+
className="btn btn-outline-primary"
|
|
308
316
|
onClick={handleCopyCode}
|
|
309
317
|
title="Copy to clipboard"
|
|
310
318
|
>
|
|
311
319
|
<i className={copied ? "bi-check-lg" : "bi-clipboard"} />
|
|
312
320
|
</button>
|
|
313
321
|
</div>
|
|
314
|
-
{copied &&
|
|
315
|
-
<small className="text-success mt-1 d-block">Copied!</small>
|
|
316
|
-
)}
|
|
322
|
+
{copied && <small className="text-success mt-1 d-block">Copied!</small>}
|
|
317
323
|
</div>
|
|
318
324
|
|
|
319
325
|
<div className="mb-4">
|
|
@@ -321,9 +327,7 @@ export function UserConnect() {
|
|
|
321
327
|
<span className="text-muted">Waiting for connection...</span>
|
|
322
328
|
</div>
|
|
323
329
|
|
|
324
|
-
<p className="text-muted small">
|
|
325
|
-
This code will expire in 10 minutes
|
|
326
|
-
</p>
|
|
330
|
+
<p className="text-muted small">This code will expire in 10 minutes</p>
|
|
327
331
|
|
|
328
332
|
<button className="btn btn-outline-secondary" onClick={handleCancel}>
|
|
329
333
|
Cancel
|
|
@@ -332,13 +336,13 @@ export function UserConnect() {
|
|
|
332
336
|
)}
|
|
333
337
|
|
|
334
338
|
{/* Respond Mode - Enter Code */}
|
|
335
|
-
{mode ===
|
|
339
|
+
{mode === "respond" && status !== "success" && (
|
|
336
340
|
<div className="text-center">
|
|
337
341
|
<div className="mb-4">
|
|
338
342
|
<p className="text-muted">Enter the connection code shared with you:</p>
|
|
339
343
|
</div>
|
|
340
344
|
|
|
341
|
-
<div className="mb-4" style={{ maxWidth:
|
|
345
|
+
<div className="mb-4" style={{ maxWidth: "400px", margin: "0 auto" }}>
|
|
342
346
|
<input
|
|
343
347
|
type="text"
|
|
344
348
|
className="form-control form-control-lg text-center font-monospace"
|
|
@@ -346,23 +350,25 @@ export function UserConnect() {
|
|
|
346
350
|
value={inputCode}
|
|
347
351
|
onChange={(e) => handleCodeInput(e.target.value)}
|
|
348
352
|
maxLength={14}
|
|
349
|
-
style={{ letterSpacing:
|
|
350
|
-
autoFocus
|
|
353
|
+
style={{ letterSpacing: "0.15em", fontSize: "1.5rem" }}
|
|
351
354
|
/>
|
|
352
355
|
</div>
|
|
353
356
|
|
|
354
357
|
{error && (
|
|
355
|
-
<div
|
|
358
|
+
<div
|
|
359
|
+
className="alert alert-danger"
|
|
360
|
+
style={{ maxWidth: "400px", margin: "0 auto 1rem" }}
|
|
361
|
+
>
|
|
356
362
|
{error}
|
|
357
363
|
</div>
|
|
358
364
|
)}
|
|
359
365
|
|
|
360
|
-
<button
|
|
366
|
+
<button
|
|
361
367
|
className="btn btn-primary btn-lg"
|
|
362
368
|
onClick={handleRespond}
|
|
363
|
-
disabled={status ===
|
|
369
|
+
disabled={status === "waiting" || inputCode.replace(/[^0-9A-Z]/gi, "").length !== 12}
|
|
364
370
|
>
|
|
365
|
-
{status ===
|
|
371
|
+
{status === "waiting" ? (
|
|
366
372
|
<>
|
|
367
373
|
<span className="spinner-border spinner-border-sm me-2" role="status" />
|
|
368
374
|
Connecting...
|
|
@@ -378,27 +384,27 @@ export function UserConnect() {
|
|
|
378
384
|
)}
|
|
379
385
|
|
|
380
386
|
{/* Success State */}
|
|
381
|
-
{status ===
|
|
387
|
+
{status === "success" && result && (
|
|
382
388
|
<div className="text-center">
|
|
383
389
|
<div className="mb-4">
|
|
384
390
|
<i className="bi-check-circle-fill text-success display-3" />
|
|
385
391
|
</div>
|
|
386
|
-
|
|
392
|
+
|
|
387
393
|
<h5 className="mb-4">Connection Successful!</h5>
|
|
388
394
|
|
|
389
|
-
<div className="card mb-4" style={{ maxWidth:
|
|
395
|
+
<div className="card mb-4" style={{ maxWidth: "400px", margin: "0 auto" }}>
|
|
390
396
|
<div className="card-body">
|
|
391
397
|
<p className="text-muted mb-2">Verify with the other person that you both see:</p>
|
|
392
|
-
<h3 className="font-monospace text-primary mb-3" style={{ letterSpacing:
|
|
398
|
+
<h3 className="font-monospace text-primary mb-3" style={{ letterSpacing: "0.2em" }}>
|
|
393
399
|
{result.confirmationHash}
|
|
394
400
|
</h3>
|
|
395
|
-
|
|
401
|
+
|
|
396
402
|
<hr />
|
|
397
|
-
|
|
403
|
+
|
|
398
404
|
<div className="text-start">
|
|
399
405
|
<small className="text-muted">Name:</small>
|
|
400
406
|
<p className="mb-2">{result.remoteUser.name}</p>
|
|
401
|
-
|
|
407
|
+
|
|
402
408
|
<small className="text-muted">User ID:</small>
|
|
403
409
|
<p className="font-monospace small mb-0">{result.remoteUser.userId}</p>
|
|
404
410
|
</div>
|
|
@@ -418,15 +424,15 @@ export function UserConnect() {
|
|
|
418
424
|
)}
|
|
419
425
|
|
|
420
426
|
{/* Error State */}
|
|
421
|
-
{status ===
|
|
427
|
+
{status === "error" && (
|
|
422
428
|
<div className="text-center">
|
|
423
429
|
<div className="mb-4">
|
|
424
430
|
<i className="bi-x-circle-fill text-danger display-3" />
|
|
425
431
|
</div>
|
|
426
|
-
|
|
432
|
+
|
|
427
433
|
<h5 className="mb-4">Connection Failed</h5>
|
|
428
434
|
|
|
429
|
-
<div className="alert alert-danger" style={{ maxWidth:
|
|
435
|
+
<div className="alert alert-danger" style={{ maxWidth: "400px", margin: "0 auto 1rem" }}>
|
|
430
436
|
{error}
|
|
431
437
|
</div>
|
|
432
438
|
|
|
@@ -440,13 +446,13 @@ export function UserConnect() {
|
|
|
440
446
|
}
|
|
441
447
|
|
|
442
448
|
registerInternalPeersUI({
|
|
443
|
-
peersUIId:
|
|
449
|
+
peersUIId: "000user00connect0screen01",
|
|
444
450
|
component: UserConnect,
|
|
445
451
|
routes: [
|
|
446
452
|
{
|
|
447
|
-
isMatch: (
|
|
448
|
-
uiCategory:
|
|
449
|
-
priority: 3
|
|
450
|
-
}
|
|
451
|
-
]
|
|
453
|
+
isMatch: (_props, context) => context.path === "contacts/connect",
|
|
454
|
+
uiCategory: "screen",
|
|
455
|
+
priority: 3,
|
|
456
|
+
},
|
|
457
|
+
],
|
|
452
458
|
});
|