@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,6 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
Devices,
|
|
3
|
+
getMe,
|
|
4
|
+
getUserContext,
|
|
5
|
+
hasShownWelcomeModal,
|
|
6
|
+
type IDevice,
|
|
7
|
+
TrustLevel,
|
|
8
|
+
thisDeviceId,
|
|
9
|
+
Users,
|
|
10
|
+
} from "@peers-app/peers-sdk";
|
|
11
|
+
import type React from "react";
|
|
12
|
+
import { useEffect, useState } from "react";
|
|
13
|
+
import { useObservable, usePromise } from "../hooks";
|
|
4
14
|
|
|
5
15
|
interface WelcomeModalProps {
|
|
6
16
|
colorMode: string;
|
|
@@ -8,13 +18,13 @@ interface WelcomeModalProps {
|
|
|
8
18
|
}
|
|
9
19
|
|
|
10
20
|
export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
11
|
-
const [displayName, setDisplayName] = useState(
|
|
12
|
-
const [deviceName, setDeviceName] = useState(
|
|
21
|
+
const [displayName, setDisplayName] = useState("");
|
|
22
|
+
const [deviceName, setDeviceName] = useState("");
|
|
13
23
|
const [isSaving, setIsSaving] = useState(false);
|
|
14
24
|
const [error, setError] = useState<string | null>(null);
|
|
15
25
|
const [deviceId] = useObservable(thisDeviceId);
|
|
16
26
|
|
|
17
|
-
const isDark = colorMode ===
|
|
27
|
+
const isDark = colorMode === "dark";
|
|
18
28
|
|
|
19
29
|
// Load current user data
|
|
20
30
|
const me = usePromise(async () => getMe());
|
|
@@ -36,7 +46,7 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
36
46
|
setDeviceName(device.name);
|
|
37
47
|
}
|
|
38
48
|
} catch (err) {
|
|
39
|
-
console.error(
|
|
49
|
+
console.error("Error loading device name:", err);
|
|
40
50
|
}
|
|
41
51
|
};
|
|
42
52
|
loadDeviceName();
|
|
@@ -58,7 +68,7 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
58
68
|
// Save device name
|
|
59
69
|
if (deviceId && deviceName.trim()) {
|
|
60
70
|
const devicesTable = Devices(userContext.userDataContext);
|
|
61
|
-
const device: IDevice = await devicesTable.get(deviceId) || {
|
|
71
|
+
const device: IDevice = (await devicesTable.get(deviceId)) || {
|
|
62
72
|
deviceId,
|
|
63
73
|
userId: userContext.userId,
|
|
64
74
|
firstSeen: new Date(),
|
|
@@ -71,11 +81,11 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
71
81
|
|
|
72
82
|
// Mark the welcome modal as shown
|
|
73
83
|
hasShownWelcomeModal(true);
|
|
74
|
-
|
|
84
|
+
|
|
75
85
|
onClose();
|
|
76
|
-
} catch (err:
|
|
77
|
-
console.error(
|
|
78
|
-
setError(err.message
|
|
86
|
+
} catch (err: unknown) {
|
|
87
|
+
console.error("Error saving profile:", err);
|
|
88
|
+
setError(err instanceof Error ? err.message : "Failed to save. Please try again.");
|
|
79
89
|
setIsSaving(false);
|
|
80
90
|
}
|
|
81
91
|
};
|
|
@@ -87,10 +97,10 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
87
97
|
};
|
|
88
98
|
|
|
89
99
|
const handleKeyDown = (e: React.KeyboardEvent) => {
|
|
90
|
-
if (e.key ===
|
|
100
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
91
101
|
e.preventDefault();
|
|
92
102
|
handleSave();
|
|
93
|
-
} else if (e.key ===
|
|
103
|
+
} else if (e.key === "Escape") {
|
|
94
104
|
handleSkip();
|
|
95
105
|
}
|
|
96
106
|
};
|
|
@@ -106,34 +116,35 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
106
116
|
top: 0,
|
|
107
117
|
left: 0,
|
|
108
118
|
zIndex: 1050,
|
|
109
|
-
backgroundColor:
|
|
110
|
-
backdropFilter:
|
|
111
|
-
paddingTop:
|
|
119
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
120
|
+
backdropFilter: "blur(4px)",
|
|
121
|
+
paddingTop: "10vh",
|
|
112
122
|
}}
|
|
113
123
|
>
|
|
114
124
|
<div
|
|
115
|
-
className={`${isDark ?
|
|
125
|
+
className={`${isDark ? "bg-dark text-light" : "bg-white text-dark"}`}
|
|
116
126
|
style={{
|
|
117
|
-
width:
|
|
118
|
-
maxWidth:
|
|
119
|
-
borderRadius:
|
|
120
|
-
boxShadow: isDark
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
border: isDark ? '1px solid #495057' : '1px solid #dee2e6',
|
|
124
|
-
overflow: 'hidden'
|
|
127
|
+
width: "90%",
|
|
128
|
+
maxWidth: "500px",
|
|
129
|
+
borderRadius: "12px",
|
|
130
|
+
boxShadow: isDark ? "0 20px 40px rgba(0, 0, 0, 0.5)" : "0 20px 40px rgba(0, 0, 0, 0.1)",
|
|
131
|
+
border: isDark ? "1px solid #495057" : "1px solid #dee2e6",
|
|
132
|
+
overflow: "hidden",
|
|
125
133
|
}}
|
|
126
134
|
>
|
|
127
135
|
{/* Header */}
|
|
128
136
|
<div
|
|
129
137
|
className="p-4 text-center"
|
|
130
138
|
style={{
|
|
131
|
-
borderBottom: `1px solid ${isDark ?
|
|
139
|
+
borderBottom: `1px solid ${isDark ? "#495057" : "#dee2e6"}`,
|
|
132
140
|
}}
|
|
133
141
|
>
|
|
134
|
-
<i className="bi-person-circle text-primary d-block mb-3" style={{ fontSize:
|
|
142
|
+
<i className="bi-person-circle text-primary d-block mb-3" style={{ fontSize: "48px" }} />
|
|
135
143
|
<h4 className="mb-2">Welcome to Peers!</h4>
|
|
136
|
-
<p
|
|
144
|
+
<p
|
|
145
|
+
className={`mb-0 ${isDark ? "text-light opacity-75" : "text-muted"}`}
|
|
146
|
+
style={{ fontSize: "14px" }}
|
|
147
|
+
>
|
|
137
148
|
Let's personalize your experience. You can change these anytime in Settings.
|
|
138
149
|
</p>
|
|
139
150
|
</div>
|
|
@@ -142,7 +153,7 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
142
153
|
<div className="p-4">
|
|
143
154
|
{/* Error Alert */}
|
|
144
155
|
{error && (
|
|
145
|
-
<div className="alert alert-danger py-2 px-3 mb-3" style={{ fontSize:
|
|
156
|
+
<div className="alert alert-danger py-2 px-3 mb-3" style={{ fontSize: "14px" }}>
|
|
146
157
|
<i className="bi-exclamation-triangle me-2" />
|
|
147
158
|
{error}
|
|
148
159
|
</div>
|
|
@@ -156,7 +167,7 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
156
167
|
</label>
|
|
157
168
|
<input
|
|
158
169
|
type="text"
|
|
159
|
-
className={`form-control ${isDark ?
|
|
170
|
+
className={`form-control ${isDark ? "bg-dark text-light border-secondary" : ""}`}
|
|
160
171
|
placeholder="How should others see you?"
|
|
161
172
|
value={displayName}
|
|
162
173
|
onChange={(e) => {
|
|
@@ -164,15 +175,17 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
164
175
|
setError(null);
|
|
165
176
|
}}
|
|
166
177
|
onKeyDown={handleKeyDown}
|
|
167
|
-
autoFocus
|
|
168
178
|
disabled={isSaving}
|
|
169
179
|
maxLength={100}
|
|
170
180
|
style={{
|
|
171
|
-
fontSize:
|
|
172
|
-
backgroundColor: isDark ?
|
|
181
|
+
fontSize: "14px",
|
|
182
|
+
backgroundColor: isDark ? "#343a40" : "#ffffff",
|
|
173
183
|
}}
|
|
174
184
|
/>
|
|
175
|
-
<small
|
|
185
|
+
<small
|
|
186
|
+
className={isDark ? "text-light opacity-50" : "text-muted"}
|
|
187
|
+
style={{ fontSize: "11px" }}
|
|
188
|
+
>
|
|
176
189
|
This name will be visible to others when you connect
|
|
177
190
|
</small>
|
|
178
191
|
</div>
|
|
@@ -185,7 +198,7 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
185
198
|
</label>
|
|
186
199
|
<input
|
|
187
200
|
type="text"
|
|
188
|
-
className={`form-control ${isDark ?
|
|
201
|
+
className={`form-control ${isDark ? "bg-dark text-light border-secondary" : ""}`}
|
|
189
202
|
placeholder="e.g., My Laptop, Work Computer"
|
|
190
203
|
value={deviceName}
|
|
191
204
|
onChange={(e) => {
|
|
@@ -196,11 +209,14 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
196
209
|
disabled={isSaving}
|
|
197
210
|
maxLength={100}
|
|
198
211
|
style={{
|
|
199
|
-
fontSize:
|
|
200
|
-
backgroundColor: isDark ?
|
|
212
|
+
fontSize: "14px",
|
|
213
|
+
backgroundColor: isDark ? "#343a40" : "#ffffff",
|
|
201
214
|
}}
|
|
202
215
|
/>
|
|
203
|
-
<small
|
|
216
|
+
<small
|
|
217
|
+
className={isDark ? "text-light opacity-50" : "text-muted"}
|
|
218
|
+
style={{ fontSize: "11px" }}
|
|
219
|
+
>
|
|
204
220
|
Helps you identify this device when syncing across multiple devices
|
|
205
221
|
</small>
|
|
206
222
|
</div>
|
|
@@ -210,12 +226,12 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
210
226
|
<div
|
|
211
227
|
className="p-3 d-flex justify-content-between align-items-center"
|
|
212
228
|
style={{
|
|
213
|
-
borderTop: `1px solid ${isDark ?
|
|
214
|
-
backgroundColor: isDark ?
|
|
229
|
+
borderTop: `1px solid ${isDark ? "#495057" : "#dee2e6"}`,
|
|
230
|
+
backgroundColor: isDark ? "#2d3238" : "#f8f9fa",
|
|
215
231
|
}}
|
|
216
232
|
>
|
|
217
233
|
<button
|
|
218
|
-
className={`btn btn-sm ${isDark ?
|
|
234
|
+
className={`btn btn-sm ${isDark ? "btn-outline-light" : "btn-outline-secondary"}`}
|
|
219
235
|
onClick={handleSkip}
|
|
220
236
|
disabled={isSaving}
|
|
221
237
|
>
|
|
@@ -225,11 +241,15 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
225
241
|
className="btn btn-sm btn-primary"
|
|
226
242
|
onClick={handleSave}
|
|
227
243
|
disabled={isSaving}
|
|
228
|
-
style={{ minWidth:
|
|
244
|
+
style={{ minWidth: "100px" }}
|
|
229
245
|
>
|
|
230
246
|
{isSaving ? (
|
|
231
247
|
<>
|
|
232
|
-
<span
|
|
248
|
+
<span
|
|
249
|
+
className="spinner-border spinner-border-sm me-1"
|
|
250
|
+
role="status"
|
|
251
|
+
aria-hidden="true"
|
|
252
|
+
/>
|
|
233
253
|
Saving...
|
|
234
254
|
</>
|
|
235
255
|
) : (
|
|
@@ -243,11 +263,11 @@ export function WelcomeModal({ colorMode, onClose }: WelcomeModalProps) {
|
|
|
243
263
|
|
|
244
264
|
{/* Keyboard Shortcuts Helper */}
|
|
245
265
|
<div
|
|
246
|
-
className={`px-3 py-2 small text-center ${isDark ?
|
|
266
|
+
className={`px-3 py-2 small text-center ${isDark ? "text-light opacity-50" : "text-muted"}`}
|
|
247
267
|
style={{
|
|
248
|
-
borderTop: `1px solid ${isDark ?
|
|
249
|
-
fontSize:
|
|
250
|
-
backgroundColor: isDark ?
|
|
268
|
+
borderTop: `1px solid ${isDark ? "#495057" : "#dee2e6"}`,
|
|
269
|
+
fontSize: "11px",
|
|
270
|
+
backgroundColor: isDark ? "#212529" : "#ffffff",
|
|
251
271
|
}}
|
|
252
272
|
>
|
|
253
273
|
<kbd className="small">↵</kbd> to save • <kbd className="small">esc</kbd> to skip
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
defaultAssistantId,
|
|
3
|
+
getAllAssistantIdsMentioned,
|
|
4
|
+
type IWorkflow,
|
|
5
|
+
runWorkflow,
|
|
6
|
+
Workflows,
|
|
7
|
+
} from "@peers-app/peers-sdk";
|
|
3
8
|
import { Input } from "../../components/input";
|
|
4
9
|
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
5
10
|
import { SaveButton } from "../../components/save-button";
|
|
@@ -15,15 +20,18 @@ interface IProps {
|
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
export const WorkflowDetails = (props: IProps) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const workflow = usePromise(
|
|
24
|
+
async () => {
|
|
25
|
+
const workflow = await Workflows().get(props.workflowId);
|
|
26
|
+
if (!workflow) {
|
|
27
|
+
throw new Error("Workflow not found");
|
|
28
|
+
}
|
|
29
|
+
updateActiveTabTitle(workflow.name || "Workflow");
|
|
30
|
+
return Workflows().initDoc(workflow);
|
|
31
|
+
},
|
|
32
|
+
undefined,
|
|
33
|
+
[props.workflowId],
|
|
34
|
+
);
|
|
27
35
|
|
|
28
36
|
if (!workflow) {
|
|
29
37
|
return <LoadingIndicator />;
|
|
@@ -32,14 +40,15 @@ export const WorkflowDetails = (props: IProps) => {
|
|
|
32
40
|
async function saveChanges() {
|
|
33
41
|
if (!workflow) return;
|
|
34
42
|
workflow.updatedAt = new Date();
|
|
35
|
-
const assistantsMentioned = await getAllAssistantIdsMentioned(
|
|
43
|
+
const assistantsMentioned = await getAllAssistantIdsMentioned(
|
|
44
|
+
workflow.instructions[0].markdown ?? "",
|
|
45
|
+
);
|
|
36
46
|
workflow.defaultAssistantId = assistantsMentioned[0] || defaultAssistantId;
|
|
37
47
|
workflow.save();
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
return (
|
|
41
51
|
<div className="container-fluid p-3">
|
|
42
|
-
|
|
43
52
|
<div className="d-flex">
|
|
44
53
|
<div>
|
|
45
54
|
<h4>
|
|
@@ -50,26 +59,24 @@ export const WorkflowDetails = (props: IProps) => {
|
|
|
50
59
|
<h4>
|
|
51
60
|
<Input
|
|
52
61
|
key={workflow.workflowId}
|
|
53
|
-
className=
|
|
54
|
-
style={{ width:
|
|
62
|
+
className="border border-0"
|
|
63
|
+
style={{ width: "100%", outline: "none", backgroundColor: "transparent" }}
|
|
55
64
|
value={workflow.qs.name}
|
|
56
65
|
/>
|
|
57
66
|
</h4>
|
|
58
67
|
</div>
|
|
59
68
|
<div>
|
|
60
|
-
<button
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
<button
|
|
70
|
+
className="btn btn-success me-2"
|
|
71
|
+
onClick={() => {
|
|
72
|
+
saveChanges(); // TODO take this out, is just for testing
|
|
73
|
+
_runWorkflow(workflow.toJS());
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
64
76
|
Run All
|
|
65
77
|
</button>
|
|
66
78
|
|
|
67
|
-
<SaveButton
|
|
68
|
-
key={workflow.workflowId}
|
|
69
|
-
onClick={saveChanges}
|
|
70
|
-
doc={workflow}
|
|
71
|
-
/>
|
|
72
|
-
|
|
79
|
+
<SaveButton key={workflow.workflowId} onClick={saveChanges} doc={workflow} />
|
|
73
80
|
</div>
|
|
74
81
|
</div>
|
|
75
82
|
|
|
@@ -77,23 +84,26 @@ export const WorkflowDetails = (props: IProps) => {
|
|
|
77
84
|
key={workflow.workflowId}
|
|
78
85
|
tabs={[
|
|
79
86
|
{
|
|
80
|
-
name:
|
|
87
|
+
name: "Info",
|
|
88
|
+
content: (
|
|
81
89
|
<ScreenTabBody>
|
|
82
90
|
<WorkflowInfo workflow={workflow} />
|
|
83
91
|
</ScreenTabBody>
|
|
92
|
+
),
|
|
84
93
|
},
|
|
85
94
|
{
|
|
86
|
-
name:
|
|
95
|
+
name: "Instructions",
|
|
96
|
+
content: (
|
|
87
97
|
<ScreenTabBody>
|
|
88
98
|
<WorkflowInstructions workflow={workflow} />
|
|
89
99
|
</ScreenTabBody>
|
|
100
|
+
),
|
|
90
101
|
},
|
|
91
102
|
]}
|
|
92
103
|
/>
|
|
93
104
|
</div>
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
|
|
105
|
+
);
|
|
106
|
+
};
|
|
97
107
|
|
|
98
108
|
async function _runWorkflow(workflow: IWorkflow) {
|
|
99
109
|
// TODO maybe warn if there are pending changes
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { IDoc, IWorkflow } from "@peers-app/peers-sdk";
|
|
2
2
|
import { Input } from "../../components/input";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { IDoc, IWorkflow } from "@peers-app/peers-sdk";
|
|
5
3
|
import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
|
|
6
4
|
|
|
7
|
-
|
|
8
5
|
export const WorkflowInfo = (props: { workflow: IDoc<IWorkflow> }) => {
|
|
9
6
|
const { workflow } = props;
|
|
10
7
|
|
|
@@ -19,11 +16,7 @@ export const WorkflowInfo = (props: { workflow: IDoc<IWorkflow> }) => {
|
|
|
19
16
|
/>
|
|
20
17
|
|
|
21
18
|
<small>Description:</small>
|
|
22
|
-
<MarkdownEditorInline
|
|
23
|
-
value={workflow.qs.description}
|
|
24
|
-
/>
|
|
25
|
-
|
|
19
|
+
<MarkdownEditorInline value={workflow.qs.description} />
|
|
26
20
|
</div>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
type IDoc,
|
|
3
|
+
type IWorkflow,
|
|
4
|
+
type IWorkflowInstruction,
|
|
5
|
+
type Observable,
|
|
6
|
+
observable,
|
|
7
|
+
} from "@peers-app/peers-sdk";
|
|
8
|
+
import { useEffect, useState } from "react";
|
|
9
|
+
import type { IEditorEffects } from "../../components/markdown-editor/editor";
|
|
4
10
|
import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
|
|
5
11
|
import { useObservable } from "../../hooks";
|
|
6
12
|
|
|
@@ -13,15 +19,17 @@ export const WorkflowInstructions = (props: { workflow: IDoc<IWorkflow> }) => {
|
|
|
13
19
|
|
|
14
20
|
return (
|
|
15
21
|
<div>
|
|
16
|
-
{workflow.qs.instructions().map((
|
|
22
|
+
{workflow.qs.instructions().map((_instruction, i) => {
|
|
17
23
|
return (
|
|
18
24
|
<div
|
|
19
25
|
key={i}
|
|
20
26
|
className="mb-2"
|
|
21
|
-
style={
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
style={
|
|
28
|
+
{
|
|
29
|
+
// border: '1px solid #ccc',
|
|
30
|
+
// borderRadius: '5px',
|
|
31
|
+
}
|
|
32
|
+
}
|
|
25
33
|
>
|
|
26
34
|
<WorkflowInstruction
|
|
27
35
|
workflow={workflow}
|
|
@@ -30,12 +38,11 @@ export const WorkflowInstructions = (props: { workflow: IDoc<IWorkflow> }) => {
|
|
|
30
38
|
focusedInstructionIndex={focusedInstructionIndex}
|
|
31
39
|
/>
|
|
32
40
|
</div>
|
|
33
|
-
)
|
|
41
|
+
);
|
|
34
42
|
})}
|
|
35
43
|
</div>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
44
|
+
);
|
|
45
|
+
};
|
|
39
46
|
|
|
40
47
|
interface IWorkflowInstructionProps {
|
|
41
48
|
workflow: IDoc<IWorkflow>;
|
|
@@ -53,42 +60,41 @@ const WorkflowInstruction = (props: IWorkflowInstructionProps) => {
|
|
|
53
60
|
|
|
54
61
|
const thisInstruction = instructions()[thisInstructionIndex];
|
|
55
62
|
|
|
56
|
-
const [markdownObs] = useState(() => observable(thisInstruction.markdown ??
|
|
63
|
+
const [markdownObs] = useState(() => observable(thisInstruction.markdown ?? ""));
|
|
57
64
|
|
|
58
65
|
useEffect(() => {
|
|
59
|
-
const sub = focusedInstructionIndex.subscribe(focusedIndex => {
|
|
66
|
+
const sub = focusedInstructionIndex.subscribe((focusedIndex) => {
|
|
60
67
|
if (focusedIndex === thisInstructionIndex) {
|
|
61
68
|
mdEffects.focus?.();
|
|
62
69
|
}
|
|
63
70
|
});
|
|
64
71
|
return () => sub.dispose();
|
|
65
|
-
}, [thisInstructionIndex]);
|
|
72
|
+
}, [thisInstructionIndex, focusedInstructionIndex.subscribe, mdEffects.focus]);
|
|
66
73
|
|
|
67
74
|
useEffect(() => {
|
|
68
|
-
markdownObs(thisInstruction.markdown ??
|
|
69
|
-
const sub = markdownObs.subscribe(value => {
|
|
75
|
+
markdownObs(thisInstruction.markdown ?? "");
|
|
76
|
+
const sub = markdownObs.subscribe((value) => {
|
|
70
77
|
thisInstruction.markdown = value;
|
|
71
78
|
props.workflow.q(props.workflow.q() + 1);
|
|
72
79
|
});
|
|
73
80
|
return () => sub.dispose();
|
|
74
|
-
}, [thisInstruction,
|
|
75
|
-
|
|
81
|
+
}, [thisInstruction, markdownObs, props.workflow.q]);
|
|
76
82
|
|
|
77
83
|
let backspacedOnEmpty = false;
|
|
78
84
|
mdEffects.onKeyDown = (evt) => {
|
|
79
|
-
if (evt.key ===
|
|
85
|
+
if (evt.key === "Enter") {
|
|
80
86
|
if (markdownObs().match(/\n\s*\n$/)) {
|
|
81
87
|
// if the markdown ends with a new line, zero or more whitespace and then another newline, insert a new instruction below
|
|
82
88
|
evt.preventDefault();
|
|
83
89
|
const _instructions = instructions();
|
|
84
|
-
_instructions.splice(thisInstructionIndex + 1, 0, { markdown:
|
|
90
|
+
_instructions.splice(thisInstructionIndex + 1, 0, { markdown: "" });
|
|
85
91
|
instructions([..._instructions]);
|
|
86
92
|
markdownObs(markdownObs().trim());
|
|
87
93
|
focusedInstructionIndex(thisInstructionIndex + 1);
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
|
-
if (evt.key ===
|
|
91
|
-
if (markdownObs().trim() ===
|
|
96
|
+
if (evt.key === "Backspace") {
|
|
97
|
+
if (markdownObs().trim() === "") {
|
|
92
98
|
if (backspacedOnEmpty) {
|
|
93
99
|
evt.preventDefault();
|
|
94
100
|
const _instructions = instructions();
|
|
@@ -103,11 +109,12 @@ const WorkflowInstruction = (props: IWorkflowInstructionProps) => {
|
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
}
|
|
112
|
+
return false;
|
|
106
113
|
};
|
|
107
114
|
|
|
108
115
|
function runThisInstruction() {
|
|
109
116
|
// runInstructions([thisInstruction]);
|
|
110
|
-
confirm(
|
|
117
|
+
confirm("TODO: run this instruction not implemented yet");
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
return (
|
|
@@ -117,11 +124,11 @@ const WorkflowInstruction = (props: IWorkflowInstructionProps) => {
|
|
|
117
124
|
autoFocus={props.thisInstructionIndex === focusedInstructionIndex()}
|
|
118
125
|
topRightControls={[
|
|
119
126
|
{
|
|
120
|
-
iconClass:
|
|
127
|
+
iconClass: "bi bi-play",
|
|
121
128
|
title: `Run this instruction.`,
|
|
122
129
|
onClick: runThisInstruction,
|
|
123
|
-
}
|
|
130
|
+
},
|
|
124
131
|
]}
|
|
125
132
|
/>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
133
|
+
);
|
|
134
|
+
};
|