@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,24 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
deviceVar,
|
|
3
|
+
type IFile,
|
|
4
|
+
type IMessage,
|
|
5
|
+
newid,
|
|
6
|
+
type Observable,
|
|
7
|
+
observable,
|
|
8
|
+
type PersistentVar,
|
|
9
|
+
type Subscription,
|
|
10
|
+
userVar,
|
|
11
|
+
} from "@peers-app/peers-sdk";
|
|
12
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
13
|
+
import { me } from "../../globals";
|
|
6
14
|
import { useObservable } from "../../hooks";
|
|
7
|
-
import { IEditorEffects, MarkdownEditor } from
|
|
8
|
-
|
|
15
|
+
import { type IEditorEffects, MarkdownEditor } from "../markdown-editor/editor";
|
|
9
16
|
|
|
10
17
|
const pVarCache: { [key: string]: PersistentVar<string> } = {};
|
|
11
18
|
|
|
12
19
|
export function getContentPersistenceValue(channelId: string, threadId?: string) {
|
|
13
|
-
const contentPersistenceName = `messageCompose-channel-${channelId}${threadId ?
|
|
20
|
+
const contentPersistenceName = `messageCompose-channel-${channelId}${threadId ? `-thread-${threadId}` : ""}`;
|
|
14
21
|
if (!pVarCache[contentPersistenceName]) {
|
|
15
|
-
const pVar = userVar<string>(contentPersistenceName, { defaultValue:
|
|
22
|
+
const pVar = userVar<string>(contentPersistenceName, { defaultValue: "" });
|
|
16
23
|
pVarCache[contentPersistenceName] = pVar;
|
|
17
|
-
|
|
24
|
+
|
|
18
25
|
// Auto-delete the pvar when content is cleared (message sent or editor cleared)
|
|
19
26
|
// This ensures drafts don't accumulate in the database
|
|
20
27
|
pVar.loadingPromise.then(() => {
|
|
21
|
-
pVar.subscribe(value => {
|
|
28
|
+
pVar.subscribe((value) => {
|
|
22
29
|
if (!value) {
|
|
23
30
|
pVar.delete();
|
|
24
31
|
}
|
|
@@ -29,31 +36,31 @@ export function getContentPersistenceValue(channelId: string, threadId?: string)
|
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
interface IProps {
|
|
32
|
-
channelId: string
|
|
33
|
-
threadId?: string
|
|
34
|
-
onMessageSubmit: (message: IMessage, files?: IFile[]) =>
|
|
35
|
-
initialMessage?: string
|
|
39
|
+
channelId: string;
|
|
40
|
+
threadId?: string;
|
|
41
|
+
onMessageSubmit: (message: IMessage, files?: IFile[]) => void | Promise<void>;
|
|
42
|
+
initialMessage?: string;
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
export const MessageCompose = (props: IProps) => {
|
|
39
46
|
const { channelId, threadId, onMessageSubmit, initialMessage } = props;
|
|
40
47
|
|
|
41
|
-
const [contentObs] = useState(() => observable(
|
|
48
|
+
const [contentObs] = useState(() => observable(""));
|
|
42
49
|
const [mdEffects] = useState<IEditorEffects>(() => ({}));
|
|
43
50
|
const composeBottomRef = React.useRef<HTMLDivElement>(null);
|
|
44
51
|
|
|
45
|
-
|
|
52
|
+
const scrollToBottom = useCallback(() => {
|
|
46
53
|
if (composeBottomRef?.current) {
|
|
47
|
-
composeBottomRef.current.scrollIntoView({ behavior:
|
|
54
|
+
composeBottomRef.current.scrollIntoView({ behavior: "instant" });
|
|
48
55
|
}
|
|
49
|
-
}
|
|
56
|
+
}, []);
|
|
50
57
|
|
|
51
58
|
useEffect(() => {
|
|
52
59
|
let disposed = false;
|
|
53
60
|
let sub: Subscription | undefined;
|
|
54
|
-
getContentPersistenceValue(channelId, threadId).loadingPromise.then(pVar => {
|
|
61
|
+
getContentPersistenceValue(channelId, threadId).loadingPromise.then((pVar) => {
|
|
55
62
|
if (!disposed) {
|
|
56
|
-
const persistedValue = pVar() ??
|
|
63
|
+
const persistedValue = pVar() ?? "";
|
|
57
64
|
contentObs(initialMessage ?? persistedValue);
|
|
58
65
|
sub = contentObs.subscribe(() => pVar(contentObs()));
|
|
59
66
|
setTimeout(() => scrollToBottom(), 100);
|
|
@@ -62,17 +69,17 @@ export const MessageCompose = (props: IProps) => {
|
|
|
62
69
|
return () => {
|
|
63
70
|
disposed = true;
|
|
64
71
|
sub?.dispose();
|
|
65
|
-
}
|
|
66
|
-
}, [channelId, threadId]);
|
|
72
|
+
};
|
|
73
|
+
}, [channelId, threadId, contentObs, initialMessage, scrollToBottom]);
|
|
67
74
|
|
|
68
75
|
useEffect(() => {
|
|
69
76
|
const sub = contentObs.subscribe(() => scrollToBottom());
|
|
70
77
|
return () => sub.dispose();
|
|
71
|
-
}, [contentObs]);
|
|
78
|
+
}, [contentObs, scrollToBottom]);
|
|
72
79
|
|
|
73
80
|
function submitMessage() {
|
|
74
|
-
const markdown = contentObs() ??
|
|
75
|
-
contentObs(
|
|
81
|
+
const markdown = contentObs() ?? "";
|
|
82
|
+
contentObs("");
|
|
76
83
|
if (!markdown.trim()) {
|
|
77
84
|
return;
|
|
78
85
|
}
|
|
@@ -83,51 +90,48 @@ export const MessageCompose = (props: IProps) => {
|
|
|
83
90
|
channelId,
|
|
84
91
|
messageParentId: threadId,
|
|
85
92
|
createdAt: new Date(),
|
|
86
|
-
}
|
|
93
|
+
};
|
|
87
94
|
onMessageSubmit(userMessage);
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
return (
|
|
91
|
-
<div className="border rounded border-dark-subtle" style={{ overflowY:
|
|
98
|
+
<div className="border rounded border-dark-subtle" style={{ overflowY: "auto" }}>
|
|
92
99
|
<MarkdownEditor
|
|
93
100
|
value={contentObs}
|
|
94
101
|
effects={mdEffects}
|
|
95
102
|
autoFocus={!!threadId}
|
|
96
|
-
maxHeight={
|
|
97
|
-
/>
|
|
98
|
-
<BottomControls
|
|
99
|
-
submitMessage={submitMessage}
|
|
100
|
-
contentObs={contentObs}
|
|
101
|
-
mdEffects={mdEffects}
|
|
103
|
+
maxHeight={"50vh"}
|
|
102
104
|
/>
|
|
105
|
+
<BottomControls submitMessage={submitMessage} contentObs={contentObs} mdEffects={mdEffects} />
|
|
103
106
|
<div ref={composeBottomRef} />
|
|
104
107
|
</div>
|
|
105
|
-
)
|
|
106
|
-
}
|
|
108
|
+
);
|
|
109
|
+
};
|
|
107
110
|
|
|
108
111
|
const BottomControls = (props: {
|
|
109
|
-
submitMessage: () => void
|
|
110
|
-
contentObs: Observable<string
|
|
111
|
-
mdEffects:
|
|
112
|
+
submitMessage: () => void;
|
|
113
|
+
contentObs: Observable<string>;
|
|
114
|
+
mdEffects: IEditorEffects;
|
|
112
115
|
}) => {
|
|
113
116
|
const { submitMessage, contentObs } = props;
|
|
114
117
|
const [content] = useObservable(contentObs, [contentObs]);
|
|
115
118
|
|
|
116
|
-
const [submitOnEnter] = useState(() =>
|
|
119
|
+
const [submitOnEnter] = useState(() =>
|
|
120
|
+
deviceVar<boolean>(`messageCompose-submitOnEnter`, { defaultValue: true }),
|
|
121
|
+
);
|
|
117
122
|
useObservable(submitOnEnter);
|
|
118
123
|
if (isMobile()) {
|
|
119
124
|
submitOnEnter(false);
|
|
120
125
|
}
|
|
121
126
|
|
|
122
|
-
function onKeyDown(evt: KeyboardEvent) {
|
|
123
|
-
if (evt.code ===
|
|
127
|
+
function onKeyDown(evt: React.KeyboardEvent) {
|
|
128
|
+
if (evt.code === "Enter" && !evt.ctrlKey && !evt.shiftKey && !evt.altKey && !evt.metaKey) {
|
|
124
129
|
if (submitOnEnter()) {
|
|
125
130
|
submitMessage();
|
|
126
131
|
evt.preventDefault();
|
|
127
132
|
return true;
|
|
128
133
|
}
|
|
129
|
-
}
|
|
130
|
-
else if (evt.code === 'Enter' && (evt.ctrlKey || evt.metaKey)) {
|
|
134
|
+
} else if (evt.code === "Enter" && (evt.ctrlKey || evt.metaKey)) {
|
|
131
135
|
if (!submitOnEnter()) {
|
|
132
136
|
submitMessage();
|
|
133
137
|
evt.preventDefault();
|
|
@@ -139,37 +143,50 @@ const BottomControls = (props: {
|
|
|
139
143
|
|
|
140
144
|
return (
|
|
141
145
|
<div>
|
|
142
|
-
<div className=
|
|
143
|
-
<span className=
|
|
144
|
-
<input
|
|
146
|
+
<div className="float-end small">
|
|
147
|
+
<span className="small" hidden={isMobile()}>
|
|
148
|
+
<input
|
|
149
|
+
type="checkbox"
|
|
150
|
+
id="sendOnEnter"
|
|
151
|
+
checked={!!submitOnEnter()}
|
|
152
|
+
onChange={(evt) => submitOnEnter(evt.target.checked)}
|
|
153
|
+
/>{" "}
|
|
154
|
+
Send on Enter
|
|
145
155
|
</span>
|
|
146
156
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
<i className="bi bi-send-fill"></i>
|
|
159
|
-
</button>
|
|
160
|
-
)
|
|
161
|
-
}
|
|
157
|
+
{content.trim()?.length === 0 ? (
|
|
158
|
+
<button className="btn btn-sm btn-outline" type="button" disabled>
|
|
159
|
+
Send
|
|
160
|
+
<i className="bi bi-send-fill"></i>
|
|
161
|
+
</button>
|
|
162
|
+
) : (
|
|
163
|
+
<button className="btn btn-sm btn-success" type="button" onClick={props.submitMessage}>
|
|
164
|
+
Send
|
|
165
|
+
<i className="bi bi-send-fill"></i>
|
|
166
|
+
</button>
|
|
167
|
+
)}
|
|
162
168
|
</div>
|
|
163
169
|
</div>
|
|
164
|
-
)
|
|
165
|
-
}
|
|
170
|
+
);
|
|
171
|
+
};
|
|
166
172
|
|
|
167
173
|
export function isMobile() {
|
|
168
|
-
|
|
174
|
+
const nav = navigator as Navigator & { userAgentData?: { mobile?: boolean } };
|
|
175
|
+
if (nav.userAgentData?.mobile) {
|
|
169
176
|
return true;
|
|
170
177
|
}
|
|
171
178
|
let check = false;
|
|
172
|
-
|
|
173
|
-
(
|
|
179
|
+
const legacyWindow = window as Window & { opera?: string };
|
|
180
|
+
((a: string) => {
|
|
181
|
+
if (
|
|
182
|
+
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(
|
|
183
|
+
a,
|
|
184
|
+
) ||
|
|
185
|
+
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(
|
|
186
|
+
a.substr(0, 4),
|
|
187
|
+
)
|
|
188
|
+
)
|
|
189
|
+
check = true;
|
|
190
|
+
})(navigator.userAgent || navigator.vendor || legacyWindow.opera || "");
|
|
174
191
|
return check;
|
|
175
192
|
}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Avatar } from './avatar';
|
|
3
1
|
// import { FileListDisplay } from './file-list-display';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import {
|
|
3
|
+
Assistants,
|
|
4
|
+
type IMessage,
|
|
5
|
+
type IUser,
|
|
6
|
+
Messages,
|
|
7
|
+
type Observable,
|
|
8
|
+
observable,
|
|
9
|
+
} from "@peers-app/peers-sdk";
|
|
10
|
+
import moment from "moment";
|
|
11
|
+
import { useEffect, useState } from "react";
|
|
12
|
+
import { openThread } from "../../globals";
|
|
13
|
+
import { useObservable, usePromise } from "../../hooks";
|
|
14
|
+
import { MarkdownWithMentions } from "../markdown-with-mentions";
|
|
15
|
+
import { MessageLogs } from "../message-logs/message-logs";
|
|
16
|
+
import { Avatar } from "./avatar";
|
|
11
17
|
|
|
12
18
|
interface IProps {
|
|
13
|
-
message: IMessage
|
|
14
|
-
messageAbove?: IMessage
|
|
15
|
-
isThreadParent?: boolean
|
|
16
|
-
index?: number
|
|
19
|
+
message: IMessage;
|
|
20
|
+
messageAbove?: IMessage;
|
|
21
|
+
isThreadParent?: boolean;
|
|
22
|
+
index?: number;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
export const MessageDisplay = (props: IProps) => {
|
|
@@ -21,19 +27,23 @@ export const MessageDisplay = (props: IProps) => {
|
|
|
21
27
|
|
|
22
28
|
const [messageId, setMessageId] = useState(message.messageId);
|
|
23
29
|
|
|
24
|
-
useSubscription(openThreads, () => {
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
|
|
28
30
|
const [user, setUser] = useState<IUser>();
|
|
29
31
|
const [messageChangedTime, setMessageChangedTime] = useState(0);
|
|
30
|
-
const assistant = usePromise(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const assistant = usePromise(
|
|
33
|
+
async () => {
|
|
34
|
+
if (message.assistantId) {
|
|
35
|
+
return Assistants().get(message.assistantId);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
undefined,
|
|
39
|
+
[message.assistantId],
|
|
40
|
+
);
|
|
35
41
|
|
|
36
|
-
const countReplies = usePromise(() => Messages().count({ messageParentId: messageId }),
|
|
42
|
+
const countReplies = usePromise(() => Messages().count({ messageParentId: messageId }), 0, [
|
|
43
|
+
messageId,
|
|
44
|
+
messageChangedTime,
|
|
45
|
+
]);
|
|
46
|
+
const replyCount = countReplies ?? 0;
|
|
37
47
|
|
|
38
48
|
const [showMenu] = useState(() => observable(false));
|
|
39
49
|
|
|
@@ -47,13 +57,13 @@ export const MessageDisplay = (props: IProps) => {
|
|
|
47
57
|
});
|
|
48
58
|
return () => {
|
|
49
59
|
sub.unsubscribe();
|
|
50
|
-
}
|
|
51
|
-
}, [message]);
|
|
60
|
+
};
|
|
61
|
+
}, [message, messageId]);
|
|
52
62
|
|
|
53
63
|
// calculate short time string
|
|
54
|
-
const messageDate = new Date(message.createdAt)
|
|
55
|
-
let hour
|
|
56
|
-
const minute = messageDate.getMinutes().toString().padStart(2,
|
|
64
|
+
const messageDate = new Date(message.createdAt);
|
|
65
|
+
let hour = messageDate.getHours();
|
|
66
|
+
const minute = messageDate.getMinutes().toString().padStart(2, "0");
|
|
57
67
|
let ampm = "AM";
|
|
58
68
|
if (hour > 11) {
|
|
59
69
|
ampm = "PM";
|
|
@@ -61,34 +71,35 @@ export const MessageDisplay = (props: IProps) => {
|
|
|
61
71
|
if (hour > 12) {
|
|
62
72
|
hour = hour - 12;
|
|
63
73
|
}
|
|
64
|
-
let timeStr = `${hour || 12}:${minute} ${ampm}
|
|
65
|
-
|
|
66
|
-
const showDateDivider =
|
|
67
|
-
&& messageDate.toDateString() !==
|
|
68
|
-
const showUserInfo =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
||
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
let timeStr = `${hour || 12}:${minute} ${ampm}`;
|
|
75
|
+
|
|
76
|
+
const showDateDivider =
|
|
77
|
+
messageAbove && messageDate.toDateString() !== new Date(messageAbove.createdAt).toDateString();
|
|
78
|
+
const showUserInfo =
|
|
79
|
+
showDateDivider ||
|
|
80
|
+
!messageAbove ||
|
|
81
|
+
!message ||
|
|
82
|
+
messageAbove.userId !== message.userId ||
|
|
83
|
+
messageAbove.assistantId !== message.assistantId ||
|
|
84
|
+
messageDate.getHours() !== new Date(messageAbove.createdAt).getHours() ||
|
|
85
|
+
replyCount > 0;
|
|
75
86
|
|
|
76
87
|
// // show time of this message if hour is different than last message
|
|
77
|
-
// const showTime = !showUserInfo
|
|
78
|
-
// && messageDate.getHours() !== (new Date(messageAbove.modified)).getHours();
|
|
88
|
+
// const showTime = !showUserInfo
|
|
89
|
+
// && messageDate.getHours() !== (new Date(messageAbove.modified)).getHours();
|
|
79
90
|
|
|
80
91
|
const isThreadView = isThreadParent || message.messageParentId;
|
|
81
92
|
|
|
82
|
-
const dateTimeStr = moment(message.createdAt).calendar().split(
|
|
93
|
+
const dateTimeStr = `${moment(message.createdAt).calendar().split(" at ")[0]} ${timeStr}`;
|
|
83
94
|
if (isThreadParent) {
|
|
84
95
|
timeStr = dateTimeStr;
|
|
85
96
|
}
|
|
86
97
|
|
|
87
|
-
|
|
98
|
+
const messageParsed = message.message.trim();
|
|
88
99
|
|
|
89
100
|
return (
|
|
90
101
|
<div
|
|
91
|
-
className={isThreadParent ?
|
|
102
|
+
className={isThreadParent ? "" : `peers-message-container`}
|
|
92
103
|
onMouseEnter={() => showMenu(true)}
|
|
93
104
|
onMouseLeave={() => showMenu(false)}
|
|
94
105
|
>
|
|
@@ -99,20 +110,18 @@ export const MessageDisplay = (props: IProps) => {
|
|
|
99
110
|
<hr />
|
|
100
111
|
<div className="d-flex justify-content-center">
|
|
101
112
|
<span
|
|
102
|
-
className=
|
|
113
|
+
className="message-display-list-date"
|
|
103
114
|
style={{
|
|
104
|
-
position:
|
|
105
|
-
top:
|
|
106
|
-
paddingLeft:
|
|
107
|
-
paddingRight:
|
|
108
|
-
fontSize:
|
|
109
|
-
borderRadius:
|
|
115
|
+
position: "relative",
|
|
116
|
+
top: "-29px",
|
|
117
|
+
paddingLeft: "11px",
|
|
118
|
+
paddingRight: "11px",
|
|
119
|
+
fontSize: "16px",
|
|
120
|
+
borderRadius: "20px",
|
|
110
121
|
}}
|
|
111
122
|
>
|
|
112
123
|
<strong>
|
|
113
|
-
{
|
|
114
|
-
moment(message.createdAt).calendar().split(' at ')[0].replace('Last', '')
|
|
115
|
-
}
|
|
124
|
+
{moment(message.createdAt).calendar().split(" at ")[0].replace("Last", "")}
|
|
116
125
|
</strong>
|
|
117
126
|
</span>
|
|
118
127
|
</div>
|
|
@@ -120,40 +129,44 @@ export const MessageDisplay = (props: IProps) => {
|
|
|
120
129
|
)}
|
|
121
130
|
|
|
122
131
|
{/* new block so add some padding */}
|
|
123
|
-
{showUserInfo &&
|
|
124
|
-
<div style={{ marginTop: '15px' }}></div>
|
|
125
|
-
)}
|
|
132
|
+
{showUserInfo && <div style={{ marginTop: "15px" }}></div>}
|
|
126
133
|
|
|
127
134
|
<div className="d-flex">
|
|
128
|
-
<div
|
|
135
|
+
<div
|
|
136
|
+
className="p-0 flex-shrink-0 justify-content-center align-items-center"
|
|
129
137
|
style={{
|
|
130
|
-
width:
|
|
131
|
-
height:
|
|
132
|
-
overflow:
|
|
138
|
+
width: "46px",
|
|
139
|
+
height: "20px",
|
|
140
|
+
overflow: "visible",
|
|
133
141
|
// zIndex: message.modified,
|
|
134
|
-
position:
|
|
135
|
-
top:
|
|
136
|
-
left:
|
|
142
|
+
position: "relative",
|
|
143
|
+
top: "4px",
|
|
144
|
+
left: "3px",
|
|
137
145
|
}}
|
|
138
146
|
>
|
|
139
|
-
{showUserInfo &&
|
|
147
|
+
{showUserInfo && (
|
|
148
|
+
<Avatar userId={message.userId} assistantId={message.assistantId} setUser={setUser} />
|
|
149
|
+
)}
|
|
140
150
|
</div>
|
|
141
|
-
<div
|
|
151
|
+
<div
|
|
142
152
|
className="p-1 flex-grow-1 justify-content-start text-break"
|
|
143
153
|
style={{
|
|
144
|
-
maxWidth:
|
|
154
|
+
maxWidth: "calc(100% - 50px)",
|
|
145
155
|
}}
|
|
146
156
|
>
|
|
147
|
-
|
|
148
157
|
{showUserInfo && (
|
|
149
158
|
<div className="peers-message">
|
|
150
|
-
<span style={{ fontSize:
|
|
151
|
-
<b>
|
|
152
|
-
{assistant?.name || message?.assistantId || user?.name || message.userId}
|
|
153
|
-
</b>
|
|
159
|
+
<span style={{ fontSize: "9pt" }}>
|
|
160
|
+
<b>{assistant?.name || message?.assistantId || user?.name || message.userId}</b>
|
|
154
161
|
</span>
|
|
155
162
|
{/* TODO show status */}
|
|
156
|
-
<span
|
|
163
|
+
<span
|
|
164
|
+
className="text-muted sub-sup-font-size"
|
|
165
|
+
style={{ fontSize: "8pt" }}
|
|
166
|
+
title={dateTimeStr}
|
|
167
|
+
>
|
|
168
|
+
{timeStr}
|
|
169
|
+
</span>
|
|
157
170
|
</div>
|
|
158
171
|
)}
|
|
159
172
|
|
|
@@ -166,7 +179,7 @@ export const MessageDisplay = (props: IProps) => {
|
|
|
166
179
|
<MessageLogs key={messageId} messageId={messageId} />
|
|
167
180
|
|
|
168
181
|
{/* replies info and link */}
|
|
169
|
-
{!isThreadView &&
|
|
182
|
+
{!isThreadView && replyCount > 0 && (
|
|
170
183
|
<div className="d-inline">
|
|
171
184
|
{/* this space prevents the logs and replies indicator from being included when selecting and copying a message text */}
|
|
172
185
|
|
|
@@ -175,27 +188,28 @@ export const MessageDisplay = (props: IProps) => {
|
|
|
175
188
|
onClick={() => openThread(message.messageParentId || messageId)}
|
|
176
189
|
tabIndex={props.index}
|
|
177
190
|
>
|
|
178
|
-
{
|
|
191
|
+
{replyCount === 1 ? "1 reply" : `${replyCount} replies`}
|
|
179
192
|
</button>
|
|
180
193
|
</div>
|
|
181
|
-
)}
|
|
182
|
-
|
|
194
|
+
)}
|
|
183
195
|
</div>
|
|
184
196
|
</div>
|
|
185
197
|
|
|
186
|
-
{message?.fileIds?.length && (
|
|
187
|
-
<div style={{ marginLeft:
|
|
198
|
+
{(message?.fileIds?.length && (
|
|
199
|
+
<div style={{ marginLeft: "46px" }}>
|
|
188
200
|
{/* <FileListDisplay files={message.fileIds} /> */}
|
|
189
201
|
</div>
|
|
190
|
-
) ||
|
|
191
|
-
|
|
192
|
-
|
|
202
|
+
)) ||
|
|
203
|
+
undefined}
|
|
193
204
|
</div>
|
|
194
|
-
)
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const MessageMenu = (props: {
|
|
198
|
-
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const MessageMenu = (props: {
|
|
209
|
+
message: IMessage;
|
|
210
|
+
showMenu: Observable<boolean>;
|
|
211
|
+
isThreadView: boolean;
|
|
212
|
+
}) => {
|
|
199
213
|
const { message, isThreadView, showMenu } = props;
|
|
200
214
|
useObservable(showMenu);
|
|
201
215
|
|
|
@@ -213,5 +227,5 @@ const MessageMenu = (props: { message: IMessage, showMenu: Observable<boolean>,
|
|
|
213
227
|
</div>
|
|
214
228
|
)}
|
|
215
229
|
</>
|
|
216
|
-
)
|
|
217
|
-
}
|
|
230
|
+
);
|
|
231
|
+
};
|