@peers-app/peers-ui 0.27.2 → 0.27.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +3 -1
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/sync-recovery.js +103 -1
- package/dist/screens/variables/variable-details.js +2 -1
- package/dist/tabs-layout/network-status-indicator.js +26 -12
- package/dist/tabs-layout/use-network-status.d.ts +6 -1
- package/dist/tabs-layout/use-network-status.js +27 -4
- package/package.json +9 -3
- package/.claude/settings.local.json +0 -34
- package/.github/README.md +0 -52
- package/.github/workflows/delete-all-artifacts.yml +0 -49
- package/.github/workflows/publish.yml +0 -51
- package/babel.config.js +0 -7
- package/biome.json +0 -198
- package/dist/app-updates/app-updates-consumer.test.d.ts +0 -1
- package/dist/app-updates/app-updates-consumer.test.js +0 -56
- package/dist/app-updates/app-updates-settings.test.d.ts +0 -1
- package/dist/app-updates/app-updates-settings.test.js +0 -93
- package/dist/app-updates/remote-app-update-panel.test.d.ts +0 -1
- package/dist/app-updates/remote-app-update-panel.test.js +0 -165
- package/dist/components/access-level-field.test.d.ts +0 -1
- package/dist/components/access-level-field.test.js +0 -28
- package/dist/components/message-logs/tool-access-approval-card.test.d.ts +0 -1
- package/dist/components/message-logs/tool-access-approval-card.test.js +0 -102
- package/dist/components/responsive-section-nav.test.d.ts +0 -1
- package/dist/components/responsive-section-nav.test.js +0 -45
- package/dist/globals-hash.test.d.ts +0 -1
- package/dist/globals-hash.test.js +0 -16
- package/dist/hooks/use-observable-state.test.d.ts +0 -1
- package/dist/hooks/use-observable-state.test.js +0 -64
- package/dist/hooks/use-observable.test.d.ts +0 -1
- package/dist/hooks/use-observable.test.js +0 -191
- package/dist/hooks/use-rows.test.d.ts +0 -1
- package/dist/hooks/use-rows.test.js +0 -175
- package/dist/hooks/use-tool.test.d.ts +0 -1
- package/dist/hooks/use-tool.test.js +0 -190
- package/dist/host-shell/host-shell-consumer.test.d.ts +0 -1
- package/dist/host-shell/host-shell-consumer.test.js +0 -28
- package/dist/root-layout/root-layout-host.test.d.ts +0 -1
- package/dist/root-layout/root-layout-host.test.js +0 -86
- package/dist/screens/account/account-screen.test.d.ts +0 -1
- package/dist/screens/account/account-screen.test.js +0 -51
- package/dist/screens/assistants/assistant-config.test.d.ts +0 -1
- package/dist/screens/assistants/assistant-config.test.js +0 -57
- package/dist/screens/contacts/contact-list.test.d.ts +0 -1
- package/dist/screens/contacts/contact-list.test.js +0 -48
- package/dist/screens/device-pairing/device-pairing.test.d.ts +0 -1
- package/dist/screens/device-pairing/device-pairing.test.js +0 -119
- package/dist/screens/devices/devices-list.test.d.ts +0 -1
- package/dist/screens/devices/devices-list.test.js +0 -53
- package/dist/screens/groups/group-list.test.d.ts +0 -1
- package/dist/screens/groups/group-list.test.js +0 -38
- package/dist/screens/identity/identity-routes.test.d.ts +0 -1
- package/dist/screens/identity/identity-routes.test.js +0 -51
- package/dist/screens/identity/identity-screen.test.d.ts +0 -1
- package/dist/screens/identity/identity-screen.test.js +0 -103
- package/dist/screens/invites/accept-invite.test.d.ts +0 -1
- package/dist/screens/invites/accept-invite.test.js +0 -103
- package/dist/screens/invites/activity-view.test.d.ts +0 -1
- package/dist/screens/invites/activity-view.test.js +0 -108
- package/dist/screens/invites/invite-classify.test.d.ts +0 -1
- package/dist/screens/invites/invite-classify.test.js +0 -115
- package/dist/screens/network-viewer/network-viewer-ipc.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer-ipc.test.js +0 -61
- package/dist/screens/network-viewer/network-viewer.section.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer.section.test.js +0 -63
- package/dist/screens/network-viewer/sync-recovery.test.d.ts +0 -1
- package/dist/screens/network-viewer/sync-recovery.test.js +0 -104
- package/dist/screens/packages/package-helpers.test.d.ts +0 -1
- package/dist/screens/packages/package-helpers.test.js +0 -53
- package/dist/screens/packages/package-runtime-status.test.d.ts +0 -1
- package/dist/screens/packages/package-runtime-status.test.js +0 -50
- package/dist/screens/packages/packages-ipc.test.d.ts +0 -1
- package/dist/screens/packages/packages-ipc.test.js +0 -43
- package/dist/screens/settings/settings-page.test.d.ts +0 -1
- package/dist/screens/settings/settings-page.test.js +0 -19
- package/dist/screens/tools/tool-access-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-access-ipc.test.js +0 -40
- package/dist/screens/tools/tool-catalog-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-catalog-ipc.test.js +0 -52
- package/dist/tabs-layout/network-status-indicator.test.d.ts +0 -1
- package/dist/tabs-layout/network-status-indicator.test.js +0 -665
- package/dist/tabs-layout/tabs-state.test.d.ts +0 -1
- package/dist/tabs-layout/tabs-state.test.js +0 -110
- package/dist/tabs-layout/use-network-status.test.d.ts +0 -1
- package/dist/tabs-layout/use-network-status.test.js +0 -45
- package/dist/ui-router/ui-loader.test.d.ts +0 -1
- package/dist/ui-router/ui-loader.test.js +0 -91
- package/jest.config.js +0 -25
- package/release-guard.js +0 -10
- package/src/app-updates/app-update-controls.tsx +0 -73
- package/src/app-updates/app-updates-consumer.test.ts +0 -83
- package/src/app-updates/app-updates-consumer.ts +0 -121
- package/src/app-updates/app-updates-settings.test.tsx +0 -109
- package/src/app-updates/app-updates-settings.tsx +0 -136
- package/src/app-updates/remote-app-update-panel.test.tsx +0 -205
- package/src/app-updates/remote-app-update-panel.tsx +0 -210
- package/src/app-updates/use-app-update-status.ts +0 -16
- package/src/command-palette/command-palette-ui.tsx +0 -564
- package/src/command-palette/command-palette.ts +0 -242
- package/src/components/access-level-field.test.tsx +0 -32
- package/src/components/access-level-field.tsx +0 -68
- package/src/components/checkbox.tsx +0 -25
- package/src/components/group-switcher.tsx +0 -526
- package/src/components/input-date.tsx +0 -29
- package/src/components/input-number.tsx +0 -83
- package/src/components/input.tsx +0 -25
- package/src/components/inverse-lazy-list.tsx +0 -107
- package/src/components/io-schema-values.tsx +0 -103
- package/src/components/io-schema.tsx +0 -259
- package/src/components/lazy-list.tsx +0 -115
- package/src/components/list-screen.tsx +0 -126
- package/src/components/loading-indicator.tsx +0 -7
- package/src/components/markdown-editor/autolink-plugin.tsx +0 -29
- package/src/components/markdown-editor/editor-inline.tsx +0 -9
- package/src/components/markdown-editor/editor.tsx +0 -158
- package/src/components/markdown-editor/markdown-plugin.tsx +0 -202
- package/src/components/markdown-editor/mention-node.ts +0 -204
- package/src/components/markdown-editor/mentions-plugin.tsx +0 -354
- package/src/components/markdown-editor/move-line-plugin.tsx +0 -186
- package/src/components/markdown-editor/select-line-boundary-plugin.tsx +0 -95
- package/src/components/markdown-editor/theme.ts +0 -46
- package/src/components/markdown-editor/toolbar.tsx +0 -269
- package/src/components/markdown-with-mentions.tsx +0 -198
- package/src/components/message-logs/message-logs.tsx +0 -523
- package/src/components/message-logs/tool-access-approval-card.test.tsx +0 -127
- package/src/components/message-logs/tool-access-approval-card.tsx +0 -178
- package/src/components/messages/avatar.tsx +0 -171
- package/src/components/messages/channel-message-list.tsx +0 -189
- package/src/components/messages/channel-view.tsx +0 -92
- package/src/components/messages/message-compose.tsx +0 -192
- package/src/components/messages/message-display.tsx +0 -231
- package/src/components/messages/thread-message-list.tsx +0 -135
- package/src/components/qr-scanner.tsx +0 -180
- package/src/components/responsive-section-nav.test.tsx +0 -88
- package/src/components/responsive-section-nav.tsx +0 -92
- package/src/components/router.tsx +0 -175
- package/src/components/save-button.tsx +0 -134
- package/src/components/sortable-list.tsx +0 -130
- package/src/components/tabs.tsx +0 -76
- package/src/components/tooltip.tsx +0 -43
- package/src/components/trust-level-badge.tsx +0 -44
- package/src/components/trust-level-dropdown.tsx +0 -136
- package/src/components/typeahead.tsx +0 -357
- package/src/globals-hash.test.ts +0 -19
- package/src/globals.tsx +0 -226
- package/src/hooks/index.ts +0 -8
- package/src/hooks/use-host-contract.ts +0 -75
- package/src/hooks/use-observable-state.test.tsx +0 -101
- package/src/hooks/use-observable-state.ts +0 -29
- package/src/hooks/use-observable.test.tsx +0 -258
- package/src/hooks/use-observable.ts +0 -67
- package/src/hooks/use-on-screen.ts +0 -24
- package/src/hooks/use-promise.ts +0 -34
- package/src/hooks/use-rows.test.tsx +0 -196
- package/src/hooks/use-rows.ts +0 -120
- package/src/hooks/use-subscription.ts +0 -24
- package/src/hooks/use-tool.test.tsx +0 -225
- package/src/hooks/use-tool.ts +0 -116
- package/src/host-shell/host-shell-consumer.test.ts +0 -32
- package/src/host-shell/host-shell-consumer.ts +0 -53
- package/src/index.tsx +0 -42
- package/src/mention-configs.ts +0 -185
- package/src/operator-console/operator-console-state.ts +0 -119
- package/src/operator-console/operator-console.tsx +0 -233
- package/src/peers-services-registration.ts +0 -6
- package/src/root-layout/global-overlays.ts +0 -50
- package/src/root-layout/layout-picker.tsx +0 -47
- package/src/root-layout/layouts/full-screen-layout.tsx +0 -144
- package/src/root-layout/layouts/tabs-with-console-layout.tsx +0 -260
- package/src/root-layout/root-layout-host.test.tsx +0 -108
- package/src/root-layout/root-layout-host.tsx +0 -147
- package/src/root-layout/root-layout-registry.ts +0 -51
- package/src/root-layout/root-layout-state.ts +0 -55
- package/src/root-layout/root-layout.ts +0 -32
- package/src/screens/account/account-screen.test.tsx +0 -65
- package/src/screens/account/account-screen.tsx +0 -942
- package/src/screens/assistants/assistant-config.test.tsx +0 -54
- package/src/screens/assistants/assistant-config.tsx +0 -121
- package/src/screens/assistants/assistant-details.tsx +0 -89
- package/src/screens/assistants/assistant-info.tsx +0 -66
- package/src/screens/assistants/assistant-list.tsx +0 -145
- package/src/screens/assistants/assistant-tools.tsx +0 -82
- package/src/screens/console-logs/console-logs-list.tsx +0 -374
- package/src/screens/console-logs/log-display.tsx +0 -137
- package/src/screens/console-logs/log-filters.tsx +0 -64
- package/src/screens/console-logs/mobile-log-card.tsx +0 -161
- package/src/screens/console-logs/resizable-table-header.tsx +0 -110
- package/src/screens/contacts/contact-details.tsx +0 -123
- package/src/screens/contacts/contact-list.test.tsx +0 -59
- package/src/screens/contacts/contact-list.tsx +0 -286
- package/src/screens/contacts/index.ts +0 -2
- package/src/screens/data-explorer/data-explorer.tsx +0 -633
- package/src/screens/data-explorer/index.ts +0 -6
- package/src/screens/data-explorer/query-executor.tsx +0 -520
- package/src/screens/device-pairing/device-pairing.test.tsx +0 -143
- package/src/screens/device-pairing/device-pairing.tsx +0 -461
- package/src/screens/device-pairing/identity-ipc.ts +0 -25
- package/src/screens/device-pairing/index.ts +0 -2
- package/src/screens/device-pairing/use-device-pairing-state.ts +0 -15
- package/src/screens/devices/devices-list.test.tsx +0 -68
- package/src/screens/devices/devices-list.tsx +0 -365
- package/src/screens/devices/index.ts +0 -1
- package/src/screens/groups/group-details.tsx +0 -160
- package/src/screens/groups/group-invite-panel.tsx +0 -311
- package/src/screens/groups/group-list.test.tsx +0 -44
- package/src/screens/groups/group-list.tsx +0 -317
- package/src/screens/groups/group-members.tsx +0 -343
- package/src/screens/groups/index.ts +0 -3
- package/src/screens/identity/identity-routes.test.ts +0 -70
- package/src/screens/identity/identity-routes.ts +0 -301
- package/src/screens/identity/identity-screen.test.tsx +0 -138
- package/src/screens/identity/identity-screen.tsx +0 -282
- package/src/screens/identity/index.ts +0 -2
- package/src/screens/identity/invite-contact-panel.tsx +0 -45
- package/src/screens/identity/profile-invite.tsx +0 -93
- package/src/screens/invites/accept-invite.test.tsx +0 -115
- package/src/screens/invites/accept-invite.tsx +0 -318
- package/src/screens/invites/activity-view.test.tsx +0 -127
- package/src/screens/invites/activity-view.tsx +0 -162
- package/src/screens/invites/index.ts +0 -6
- package/src/screens/invites/invite-capture.ts +0 -104
- package/src/screens/invites/invite-classify.test.ts +0 -129
- package/src/screens/invites/invite-share.tsx +0 -104
- package/src/screens/invites/invites-ipc.ts +0 -25
- package/src/screens/invites/pending-invites-list.tsx +0 -256
- package/src/screens/network-viewer/connection-troubleshooter.tsx +0 -395
- package/src/screens/network-viewer/cpu-usage-graph.tsx +0 -294
- package/src/screens/network-viewer/device-details-modal.tsx +0 -339
- package/src/screens/network-viewer/group-details-modal.tsx +0 -421
- package/src/screens/network-viewer/index.ts +0 -8
- package/src/screens/network-viewer/network-viewer-ipc.test.ts +0 -72
- package/src/screens/network-viewer/network-viewer-ipc.ts +0 -39
- package/src/screens/network-viewer/network-viewer-section.ts +0 -12
- package/src/screens/network-viewer/network-viewer.section.test.tsx +0 -68
- package/src/screens/network-viewer/network-viewer.tsx +0 -708
- package/src/screens/network-viewer/remote-logs-panel.tsx +0 -190
- package/src/screens/network-viewer/sync-recovery.test.tsx +0 -114
- package/src/screens/network-viewer/sync-recovery.tsx +0 -461
- package/src/screens/network-viewer/usage-graph.tsx +0 -455
- package/src/screens/packages/local-folder-grants-panel.tsx +0 -290
- package/src/screens/packages/local-folders-ipc.ts +0 -28
- package/src/screens/packages/package-details.tsx +0 -166
- package/src/screens/packages/package-helpers.test.ts +0 -57
- package/src/screens/packages/package-helpers.ts +0 -137
- package/src/screens/packages/package-info.tsx +0 -354
- package/src/screens/packages/package-list.tsx +0 -519
- package/src/screens/packages/package-network-panel.tsx +0 -82
- package/src/screens/packages/package-new-local.tsx +0 -100
- package/src/screens/packages/package-runtime-status.test.tsx +0 -58
- package/src/screens/packages/package-runtime-status.tsx +0 -68
- package/src/screens/packages/package-versions.tsx +0 -298
- package/src/screens/packages/packages-ipc.test.ts +0 -47
- package/src/screens/packages/packages-ipc.ts +0 -125
- package/src/screens/peer-types/peer-type-details.tsx +0 -172
- package/src/screens/peer-types/peer-type-list.tsx +0 -64
- package/src/screens/search/global-search.tsx +0 -406
- package/src/screens/settings/color-mode-dropdown.tsx +0 -82
- package/src/screens/settings/settings-page.test.tsx +0 -24
- package/src/screens/settings/settings-page.tsx +0 -426
- package/src/screens/setup-user.tsx +0 -355
- package/src/screens/tools/tool-access-ipc.test.ts +0 -55
- package/src/screens/tools/tool-access-ipc.ts +0 -27
- package/src/screens/tools/tool-catalog-ipc.test.ts +0 -52
- package/src/screens/tools/tool-catalog-ipc.ts +0 -51
- package/src/screens/tools/tool-details.tsx +0 -52
- package/src/screens/tools/tool-info.tsx +0 -45
- package/src/screens/tools/tool-list.tsx +0 -106
- package/src/screens/tools/tool-schema.tsx +0 -44
- package/src/screens/tools/tool-test-details.tsx +0 -89
- package/src/screens/tools/tool-test-list.tsx +0 -73
- package/src/screens/variables/variable-details.tsx +0 -289
- package/src/screens/variables/variable-list.tsx +0 -110
- package/src/screens/welcome-modal.tsx +0 -294
- package/src/screens/workflows/workflow-details.tsx +0 -115
- package/src/screens/workflows/workflow-info.tsx +0 -22
- package/src/screens/workflows/workflow-instructions.tsx +0 -134
- package/src/screens/workflows/workflow-list.tsx +0 -117
- package/src/setupTests.ts +0 -38
- package/src/system-apps/assistants.app.ts +0 -7
- package/src/system-apps/console-logs.app.ts +0 -7
- package/src/system-apps/data-explorer.app.ts +0 -8
- package/src/system-apps/identity.app.ts +0 -9
- package/src/system-apps/index.ts +0 -77
- package/src/system-apps/mobile-settings.app.ts +0 -7
- package/src/system-apps/network-viewer.app.ts +0 -8
- package/src/system-apps/packages.app.ts +0 -7
- package/src/system-apps/search.app.ts +0 -8
- package/src/system-apps/settings.app.ts +0 -7
- package/src/system-apps/threads.app.ts +0 -7
- package/src/system-apps/tools.app.ts +0 -7
- package/src/system-apps/types.app.ts +0 -7
- package/src/system-apps/variables.app.ts +0 -7
- package/src/system-apps/workflows.app.ts +0 -7
- package/src/tabs-layout/network-status-indicator.test.tsx +0 -799
- package/src/tabs-layout/network-status-indicator.tsx +0 -756
- package/src/tabs-layout/tabs-layout.tsx +0 -857
- package/src/tabs-layout/tabs-state.test.ts +0 -152
- package/src/tabs-layout/tabs-state.ts +0 -587
- package/src/tabs-layout/use-network-status.test.tsx +0 -58
- package/src/tabs-layout/use-network-status.ts +0 -68
- package/src/ui-defaults/index.ts +0 -2
- package/src/ui-defaults/list-screen.tsx +0 -94
- package/src/ui-defaults/markdown-field.tsx +0 -87
- package/src/ui-router/routes-loader.ts +0 -193
- package/src/ui-router/ui-loader.test.tsx +0 -108
- package/src/ui-router/ui-loader.tsx +0 -606
- package/src/utils.ts +0 -95
- package/tsconfig.json +0 -18
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { type ICursorIterable, type ITool, newid, observable, Tools } from "@peers-app/peers-sdk";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { Input } from "../../components/input";
|
|
4
|
-
import { LazyList } from "../../components/lazy-list";
|
|
5
|
-
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
6
|
-
import { MarkdownWithMentions } from "../../components/markdown-with-mentions";
|
|
7
|
-
import { isDesktop } from "../../globals";
|
|
8
|
-
import { useObservable } from "../../hooks";
|
|
9
|
-
|
|
10
|
-
/** Browse permanent tool catalog rows. */
|
|
11
|
-
export function ToolList() {
|
|
12
|
-
const [searchTextObs] = useState(() => observable(""));
|
|
13
|
-
const [searchText] = useObservable(searchTextObs);
|
|
14
|
-
|
|
15
|
-
const [cursorObs] = useState(() => observable<ICursorIterable<ITool> | undefined>());
|
|
16
|
-
const [cursorId] = useState(() => observable(newid()));
|
|
17
|
-
|
|
18
|
-
async function newCursor() {
|
|
19
|
-
let cursor: ICursorIterable<ITool>;
|
|
20
|
-
const _searchText = searchText.trim();
|
|
21
|
-
if (_searchText) {
|
|
22
|
-
cursor = await Tools().cursor(
|
|
23
|
-
{ name: { $matchWords: _searchText } },
|
|
24
|
-
{ sortBy: ["-toolId"] },
|
|
25
|
-
);
|
|
26
|
-
} else {
|
|
27
|
-
cursor = await Tools().cursor(undefined, { sortBy: ["-toolId"] });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
cursorObs(cursor);
|
|
31
|
-
cursorId(newid());
|
|
32
|
-
return cursor;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const sub = searchTextObs.subscribe(() => {
|
|
37
|
-
cursorObs(undefined);
|
|
38
|
-
cursorId(newid());
|
|
39
|
-
});
|
|
40
|
-
return () => sub.dispose();
|
|
41
|
-
}, [cursorId, cursorObs, searchTextObs.subscribe]);
|
|
42
|
-
|
|
43
|
-
async function loadMore(existingTools: ITool[]): Promise<ITool[]> {
|
|
44
|
-
const moreMatches: ITool[] = [];
|
|
45
|
-
const cursor = cursorObs() || (await newCursor());
|
|
46
|
-
for await (const tool of cursor) {
|
|
47
|
-
if (existingTools.find((w) => w.toolId === tool.toolId)) continue;
|
|
48
|
-
moreMatches.push(tool);
|
|
49
|
-
if (searchText.length && moreMatches.length > 5) break;
|
|
50
|
-
if (moreMatches.length >= 50) break;
|
|
51
|
-
}
|
|
52
|
-
if (moreMatches.length === 0) {
|
|
53
|
-
cursorObs(undefined);
|
|
54
|
-
}
|
|
55
|
-
return moreMatches;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<div className="container-fluid">
|
|
60
|
-
<Input
|
|
61
|
-
value={searchTextObs}
|
|
62
|
-
className="form-control mt-3"
|
|
63
|
-
style={{ marginBottom: "10px" }}
|
|
64
|
-
placeholder="Search tools"
|
|
65
|
-
autoFocus={!!isDesktop()}
|
|
66
|
-
/>
|
|
67
|
-
|
|
68
|
-
<div className="peers-list-container">
|
|
69
|
-
<LazyList
|
|
70
|
-
key={cursorId()}
|
|
71
|
-
loadMore={loadMore}
|
|
72
|
-
scrollThreshold={0.6}
|
|
73
|
-
renderItems={(tools) => {
|
|
74
|
-
return tools.map((tool) => {
|
|
75
|
-
let markdownContent = `${tool.usageDescription}\n\n---\n\n${tool.detailedDescription ?? ""}`;
|
|
76
|
-
const maxLen = 500;
|
|
77
|
-
if (markdownContent.length > maxLen) {
|
|
78
|
-
markdownContent = `${markdownContent.substring(0, maxLen)}...`;
|
|
79
|
-
}
|
|
80
|
-
markdownContent = markdownContent.replace(/\n\n---\n\n$/, "");
|
|
81
|
-
return (
|
|
82
|
-
<div key={tool.toolId} className="container-fluid pb-4">
|
|
83
|
-
<i className="bi bi-tools"></i>
|
|
84
|
-
<a href={`#tools/${tool.toolId}`}>{tool.name}</a>
|
|
85
|
-
<div style={{ paddingLeft: "20px" }}>
|
|
86
|
-
<MarkdownWithMentions content={markdownContent} />
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
}}
|
|
92
|
-
loadingIndicator={
|
|
93
|
-
<div className="d-flex justify-content-center" style={{ height: 200 }}>
|
|
94
|
-
<LoadingIndicator />
|
|
95
|
-
</div>
|
|
96
|
-
}
|
|
97
|
-
endOfList={
|
|
98
|
-
<div className="d-flex justify-content-center" style={{ height: 200 }}>
|
|
99
|
-
{/* <span className="h3">End of List</span> */}
|
|
100
|
-
</div>
|
|
101
|
-
}
|
|
102
|
-
/>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { IOSchema, ITool, IToolCatalogEntry } from "@peers-app/peers-sdk";
|
|
2
|
-
|
|
3
|
-
function FieldTable({ label, schema }: { label: string; schema?: IOSchema }) {
|
|
4
|
-
return (
|
|
5
|
-
<section className="mb-4">
|
|
6
|
-
<h6>{label}</h6>
|
|
7
|
-
{!schema?.fields.length ? (
|
|
8
|
-
<p>No fields</p>
|
|
9
|
-
) : (
|
|
10
|
-
<table className="table table-sm">
|
|
11
|
-
<thead>
|
|
12
|
-
<tr>
|
|
13
|
-
<th>Name</th>
|
|
14
|
-
<th>Type</th>
|
|
15
|
-
<th>Required</th>
|
|
16
|
-
<th>Description</th>
|
|
17
|
-
</tr>
|
|
18
|
-
</thead>
|
|
19
|
-
<tbody>
|
|
20
|
-
{schema.fields.map((field) => (
|
|
21
|
-
<tr key={field.name}>
|
|
22
|
-
<td>{field.name}</td>
|
|
23
|
-
<td>
|
|
24
|
-
{field.type}
|
|
25
|
-
{field.isArray ? "[]" : ""}
|
|
26
|
-
</td>
|
|
27
|
-
<td>{field.optional ? "No" : "Yes"}</td>
|
|
28
|
-
<td>{field.description}</td>
|
|
29
|
-
</tr>
|
|
30
|
-
))}
|
|
31
|
-
</tbody>
|
|
32
|
-
</table>
|
|
33
|
-
)}
|
|
34
|
-
</section>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
/** Read-only contract field tables, plus persisted assistant runner configuration. */
|
|
38
|
-
export const ToolSchema = ({ tool, entry }: { tool: ITool; entry?: IToolCatalogEntry }) => (
|
|
39
|
-
<div>
|
|
40
|
-
{tool.isAssistantRunner && <FieldTable label="Config Schema" schema={tool.configSchema} />}
|
|
41
|
-
<FieldTable label="Input Schema" schema={entry?.inputSchema ?? tool.inputSchema} />
|
|
42
|
-
<FieldTable label="Output Schema" schema={entry?.outputSchema ?? tool.outputSchema} />
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { type ITool, Tools, ToolTests } from "@peers-app/peers-sdk";
|
|
2
|
-
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
3
|
-
import { MarkdownEditor } from "../../components/markdown-editor/editor";
|
|
4
|
-
import { SaveButton } from "../../components/save-button";
|
|
5
|
-
import { useObservableState, usePromise } from "../../hooks";
|
|
6
|
-
import { updateActiveTabTitle } from "../../tabs-layout/tabs-state";
|
|
7
|
-
|
|
8
|
-
export const ToolTestDetails = (props: { toolTestId: string }) => {
|
|
9
|
-
const { toolTestId } = props;
|
|
10
|
-
|
|
11
|
-
const tool = useObservableState<ITool | undefined>(undefined);
|
|
12
|
-
|
|
13
|
-
const toolTest = usePromise(async () => {
|
|
14
|
-
const toolTestData = await ToolTests().get(toolTestId);
|
|
15
|
-
if (!toolTestData) return null;
|
|
16
|
-
const _tool = await Tools().get(toolTestData.toolId);
|
|
17
|
-
tool(_tool);
|
|
18
|
-
const doc = ToolTests().initDoc(toolTestData);
|
|
19
|
-
updateActiveTabTitle(_tool?.name ? `${_tool.name} Test` : "Tool Test");
|
|
20
|
-
return doc;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
if (toolTest === null) {
|
|
24
|
-
return <div>ToolTest not found</div>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (!toolTest) {
|
|
28
|
-
return <LoadingIndicator />;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div className="container-fluid mt-2">
|
|
33
|
-
<div>
|
|
34
|
-
<a href={`#tools/${toolTest.toolId}`}>Tool: {tool()?.name}</a>
|
|
35
|
-
<div className="float-end">
|
|
36
|
-
<SaveButton doc={toolTest} />
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<div style={{ height: "calc(100vh - 55px)", overflowY: "auto", width: "100%" }}>
|
|
41
|
-
<small>Test description:</small>
|
|
42
|
-
<div
|
|
43
|
-
style={{
|
|
44
|
-
border: "1px solid #ccc",
|
|
45
|
-
borderRadius: "5px",
|
|
46
|
-
}}
|
|
47
|
-
>
|
|
48
|
-
<MarkdownEditor value={toolTest.qs.description} hideToolbar={true} />
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
{/* <small>Input:</small>
|
|
52
|
-
<div
|
|
53
|
-
style={{
|
|
54
|
-
border: '1px solid #ccc',
|
|
55
|
-
borderRadius: '5px',
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
<MarkdownEditor
|
|
59
|
-
value={toolTest.qs.input}
|
|
60
|
-
hideToolbar={true}
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<small>Output:</small>
|
|
65
|
-
<div
|
|
66
|
-
style={{
|
|
67
|
-
border: '1px solid #ccc',
|
|
68
|
-
borderRadius: '5px',
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
<MarkdownEditor
|
|
72
|
-
value={toolTest.qs.output}
|
|
73
|
-
hideToolbar={true}
|
|
74
|
-
/>
|
|
75
|
-
</div> */}
|
|
76
|
-
|
|
77
|
-
<small>Code:</small>
|
|
78
|
-
<div
|
|
79
|
-
style={{
|
|
80
|
-
border: "1px solid #ccc",
|
|
81
|
-
borderRadius: "5px",
|
|
82
|
-
}}
|
|
83
|
-
>
|
|
84
|
-
<MarkdownEditor value={toolTest.qs.code} hideToolbar={true} />
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { type IToolTest, newid, ToolTests } from "@peers-app/peers-sdk";
|
|
2
|
-
import type React from "react";
|
|
3
|
-
import { useEffect } from "react";
|
|
4
|
-
import { Input } from "../../components/input";
|
|
5
|
-
import { mainContentPath } from "../../globals";
|
|
6
|
-
import { useObservableState } from "../../hooks";
|
|
7
|
-
|
|
8
|
-
export const ToolTestList = (props: { toolId: string }) => {
|
|
9
|
-
const { toolId } = props;
|
|
10
|
-
|
|
11
|
-
const testsObs = useObservableState<IToolTest[]>([]);
|
|
12
|
-
const searchText = useObservableState<string>("");
|
|
13
|
-
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
ToolTests()
|
|
16
|
-
.list({ toolId })
|
|
17
|
-
.then((tests) => {
|
|
18
|
-
testsObs(tests);
|
|
19
|
-
});
|
|
20
|
-
}, [toolId, testsObs]);
|
|
21
|
-
|
|
22
|
-
const tests = testsObs().filter((test) =>
|
|
23
|
-
test.description.toLowerCase().includes(searchText().toLowerCase()),
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
async function createTest(evt: React.KeyboardEvent<HTMLInputElement>) {
|
|
27
|
-
if (evt.key !== "Enter") return;
|
|
28
|
-
evt.preventDefault();
|
|
29
|
-
// TODO maybe use LLM call to do this?
|
|
30
|
-
const test = await ToolTests().insert({
|
|
31
|
-
toolTestId: newid(),
|
|
32
|
-
toolId,
|
|
33
|
-
description: searchText(),
|
|
34
|
-
code: "",
|
|
35
|
-
input: {},
|
|
36
|
-
output: {},
|
|
37
|
-
});
|
|
38
|
-
testsObs([...tests, test]);
|
|
39
|
-
searchText("");
|
|
40
|
-
mainContentPath(`tools/tests/${test.toolTestId}`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div>
|
|
45
|
-
<Input
|
|
46
|
-
className="form-control mb-2"
|
|
47
|
-
value={searchText}
|
|
48
|
-
onKeyDown={createTest}
|
|
49
|
-
placeholder="Search or create new test"
|
|
50
|
-
/>
|
|
51
|
-
|
|
52
|
-
{testsObs().length === 0 && (
|
|
53
|
-
<div className="text-center">
|
|
54
|
-
<p>No test for this tool yet</p>
|
|
55
|
-
</div>
|
|
56
|
-
)}
|
|
57
|
-
|
|
58
|
-
{testsObs().length !== 0 && tests.length === 0 && (
|
|
59
|
-
<div className="text-center">
|
|
60
|
-
<p>No matching tests found</p>
|
|
61
|
-
</div>
|
|
62
|
-
)}
|
|
63
|
-
|
|
64
|
-
{tests.map((test, iTest) => {
|
|
65
|
-
return (
|
|
66
|
-
<p key={iTest} onDoubleClick={(_e) => mainContentPath(`tools/tests/${test.toolTestId}`)}>
|
|
67
|
-
{test.description.split("\n")[0]}
|
|
68
|
-
</p>
|
|
69
|
-
);
|
|
70
|
-
})}
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
camelCaseToSpaces,
|
|
3
|
-
getIconClassName,
|
|
4
|
-
getUserContext,
|
|
5
|
-
type IDoc,
|
|
6
|
-
type IPersistentVar,
|
|
7
|
-
type Observable,
|
|
8
|
-
observable,
|
|
9
|
-
PersistentVars,
|
|
10
|
-
} from "@peers-app/peers-sdk";
|
|
11
|
-
import { useEffect, useState } from "react";
|
|
12
|
-
import { Checkbox } from "../../components/checkbox";
|
|
13
|
-
import { Input } from "../../components/input";
|
|
14
|
-
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
15
|
-
import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
|
|
16
|
-
import { SaveButton } from "../../components/save-button";
|
|
17
|
-
import { ScreenTabBody, Tabs } from "../../components/tabs";
|
|
18
|
-
import { useObservable, usePromise, useSubscription } from "../../hooks";
|
|
19
|
-
import { hostShellTools } from "../../host-shell/host-shell-consumer";
|
|
20
|
-
import { updateActiveTabTitle } from "../../tabs-layout/tabs-state";
|
|
21
|
-
|
|
22
|
-
interface IProps {
|
|
23
|
-
persistentVarId: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Details screen for one persistent variable: name, value (copyable), and settings. */
|
|
27
|
-
export const VariableDetails = (props: IProps) => {
|
|
28
|
-
const persistentVariable = usePromise(
|
|
29
|
-
async () => {
|
|
30
|
-
const persistentVariable = await PersistentVars().get(props.persistentVarId);
|
|
31
|
-
if (!persistentVariable) {
|
|
32
|
-
throw new Error("Variable not found");
|
|
33
|
-
}
|
|
34
|
-
updateActiveTabTitle(persistentVariable.name || "Variable");
|
|
35
|
-
return PersistentVars().initDoc(persistentVariable);
|
|
36
|
-
},
|
|
37
|
-
undefined,
|
|
38
|
-
[props.persistentVarId],
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (!persistentVariable) return;
|
|
43
|
-
const sub = persistentVariable.qs.name.subscribe(() => {
|
|
44
|
-
persistentVariable.name = persistentVariable.qs
|
|
45
|
-
.name()
|
|
46
|
-
.replaceAll(/\s/g, "_")
|
|
47
|
-
.replaceAll(/[^a-zA-Z0-9_-]/g, "");
|
|
48
|
-
});
|
|
49
|
-
return () => {
|
|
50
|
-
sub.dispose();
|
|
51
|
-
};
|
|
52
|
-
}, [persistentVariable]);
|
|
53
|
-
|
|
54
|
-
if (!persistentVariable) {
|
|
55
|
-
return <LoadingIndicator />;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<div className="container-fluid p-3">
|
|
60
|
-
<div className="d-flex">
|
|
61
|
-
<div>
|
|
62
|
-
<h4>
|
|
63
|
-
<i className={`${getIconClassName(PersistentVars())} me-2"`}></i>
|
|
64
|
-
</h4>
|
|
65
|
-
</div>
|
|
66
|
-
<div className="flex-grow-1">
|
|
67
|
-
<h4>
|
|
68
|
-
<Input
|
|
69
|
-
key={persistentVariable.persistentVarId}
|
|
70
|
-
className="border border-0"
|
|
71
|
-
style={{ width: "100%", outline: "none", backgroundColor: "transparent" }}
|
|
72
|
-
value={persistentVariable.qs.name}
|
|
73
|
-
/>
|
|
74
|
-
</h4>
|
|
75
|
-
</div>
|
|
76
|
-
<div>
|
|
77
|
-
<SaveButton key={persistentVariable.persistentVarId} doc={persistentVariable} />
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
<Tabs
|
|
82
|
-
key={persistentVariable.persistentVarId}
|
|
83
|
-
tabs={[
|
|
84
|
-
{
|
|
85
|
-
name: "Info",
|
|
86
|
-
content: (
|
|
87
|
-
<ScreenTabBody>
|
|
88
|
-
<VariableInfo persistentVariable={persistentVariable} />
|
|
89
|
-
</ScreenTabBody>
|
|
90
|
-
),
|
|
91
|
-
},
|
|
92
|
-
]}
|
|
93
|
-
/>
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const VariableInfo = (props: { persistentVariable: IDoc<IPersistentVar> }) => {
|
|
99
|
-
const { persistentVariable: pvar } = props;
|
|
100
|
-
|
|
101
|
-
pvar.description = pvar.description || "";
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<div>
|
|
105
|
-
<small>Name:</small>
|
|
106
|
-
<Input
|
|
107
|
-
value={pvar.qs.name}
|
|
108
|
-
className="form-control mb-3 p-0 ps-2"
|
|
109
|
-
placeholder="Variable name"
|
|
110
|
-
title="Variable name"
|
|
111
|
-
/>
|
|
112
|
-
|
|
113
|
-
<div className="d-flex flex-row">
|
|
114
|
-
<VariableScope pvar={pvar} />
|
|
115
|
-
<div className="ms-2">
|
|
116
|
-
<label className="form-label small mt-2 me-2">Is Secret:</label>
|
|
117
|
-
<Checkbox className="form-check-input mt-2" checked={pvar.qs.isSecret} />
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
<br />
|
|
122
|
-
<VariableValue pvar={pvar} />
|
|
123
|
-
|
|
124
|
-
<small className="mt-2">Description:</small>
|
|
125
|
-
<MarkdownEditorInline value={pvar.qs.description as Observable<string>} />
|
|
126
|
-
</div>
|
|
127
|
-
);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const VariableScope = (props: { pvar: IDoc<IPersistentVar> }) => {
|
|
131
|
-
const { pvar } = props;
|
|
132
|
-
|
|
133
|
-
const [scope, setScope] = useObservable(pvar.qs.scope);
|
|
134
|
-
|
|
135
|
-
return (
|
|
136
|
-
<div className="dropdown">
|
|
137
|
-
<button
|
|
138
|
-
className="btn btn-secondary dropdown-toggle"
|
|
139
|
-
type="button"
|
|
140
|
-
id="colorModeDropdown"
|
|
141
|
-
data-bs-toggle="dropdown"
|
|
142
|
-
aria-expanded="false"
|
|
143
|
-
>
|
|
144
|
-
Scope: {camelCaseToSpaces(scope)}
|
|
145
|
-
</button>
|
|
146
|
-
<ul className="dropdown-menu" aria-labelledby="colorModeDropdown">
|
|
147
|
-
<li>
|
|
148
|
-
<button className="dropdown-item" onClick={() => setScope("device")}>
|
|
149
|
-
Device {scope === "device" && "✓"}
|
|
150
|
-
</button>
|
|
151
|
-
</li>
|
|
152
|
-
<li>
|
|
153
|
-
<button className="dropdown-item" onClick={() => setScope("user")}>
|
|
154
|
-
User {scope === "user" && "✓"}
|
|
155
|
-
</button>
|
|
156
|
-
</li>
|
|
157
|
-
{/* <li><button className="dropdown-item" onClick={() => setScope('group')}>Group {scope === 'group' && '✓'}</button></li> */}
|
|
158
|
-
</ul>
|
|
159
|
-
</div>
|
|
160
|
-
);
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const VariableValue = (props: { pvar: IDoc<IPersistentVar> }) => {
|
|
164
|
-
const { pvar } = props;
|
|
165
|
-
|
|
166
|
-
const [isSecret] = useObservable(pvar.qs.isSecret);
|
|
167
|
-
const scalarValue = observable(pvar.value.value);
|
|
168
|
-
// WARNING: the editable string path assumes the value is a string
|
|
169
|
-
useSubscription(pvar.qs.value, (value) => {
|
|
170
|
-
scalarValue(value?.value);
|
|
171
|
-
});
|
|
172
|
-
useSubscription(scalarValue, (value) => {
|
|
173
|
-
pvar.value = { value };
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
const valueLabel = (
|
|
177
|
-
<div className="d-flex align-items-center justify-content-between">
|
|
178
|
-
<small>Value:</small>
|
|
179
|
-
<CopyValueButton pvar={pvar} />
|
|
180
|
-
</div>
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
if (isSecret) {
|
|
184
|
-
return (
|
|
185
|
-
<>
|
|
186
|
-
{valueLabel}
|
|
187
|
-
<Input
|
|
188
|
-
value={scalarValue}
|
|
189
|
-
type="password"
|
|
190
|
-
className="form-control mb-3 p-0 ps-2"
|
|
191
|
-
placeholder="Variable value"
|
|
192
|
-
title="Variable value"
|
|
193
|
-
/>
|
|
194
|
-
</>
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// The markdown editor only handles strings. System/package pvars may hold booleans,
|
|
199
|
-
// numbers, or objects, so render those read-only (still copyable via the button).
|
|
200
|
-
// Read directly (no subscription) to avoid a render/write-back loop with scalarValue.
|
|
201
|
-
const scalar = pvar.value?.value;
|
|
202
|
-
if (typeof scalar !== "string") {
|
|
203
|
-
const isObject = scalar !== null && typeof scalar === "object";
|
|
204
|
-
const display =
|
|
205
|
-
scalar === undefined || scalar === null
|
|
206
|
-
? ""
|
|
207
|
-
: isObject
|
|
208
|
-
? JSON.stringify(scalar, null, 2)
|
|
209
|
-
: String(scalar);
|
|
210
|
-
return (
|
|
211
|
-
<>
|
|
212
|
-
{valueLabel}
|
|
213
|
-
{isObject ? (
|
|
214
|
-
<pre
|
|
215
|
-
className="form-control mb-1 p-2"
|
|
216
|
-
style={{ whiteSpace: "pre-wrap", wordBreak: "break-word", maxHeight: 300 }}
|
|
217
|
-
>
|
|
218
|
-
{display}
|
|
219
|
-
</pre>
|
|
220
|
-
) : (
|
|
221
|
-
<input
|
|
222
|
-
className="form-control mb-1 p-0 ps-2"
|
|
223
|
-
value={display}
|
|
224
|
-
readOnly
|
|
225
|
-
title="Variable value"
|
|
226
|
-
/>
|
|
227
|
-
)}
|
|
228
|
-
<div className="form-text text-muted mb-3">
|
|
229
|
-
This {typeof scalar} value is read-only here — use Copy Value to copy it.
|
|
230
|
-
</div>
|
|
231
|
-
</>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return (
|
|
236
|
-
<>
|
|
237
|
-
{valueLabel}
|
|
238
|
-
<MarkdownEditorInline value={scalarValue} hideToolbar />
|
|
239
|
-
<br />
|
|
240
|
-
</>
|
|
241
|
-
);
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Button that copies a persistent variable's value to the clipboard. Decryption (for
|
|
246
|
-
* secret values) and the clipboard write happen entirely on the host, through System Host
|
|
247
|
-
* Shell `copyVariableToClipboard`, so the plaintext is never exposed to the UI. Shows
|
|
248
|
-
* transient success/error feedback on the icon.
|
|
249
|
-
*/
|
|
250
|
-
const CopyValueButton = (props: { pvar: IDoc<IPersistentVar> }) => {
|
|
251
|
-
const { pvar } = props;
|
|
252
|
-
const [status, setStatus] = useState<"idle" | "copied" | "error">("idle");
|
|
253
|
-
|
|
254
|
-
async function onCopy() {
|
|
255
|
-
try {
|
|
256
|
-
const userContext = await getUserContext();
|
|
257
|
-
const groupId = userContext.currentlyActiveGroupId();
|
|
258
|
-
const tools = await hostShellTools();
|
|
259
|
-
const result = await tools.copyVariableToClipboard({
|
|
260
|
-
persistentVarId: pvar.persistentVarId,
|
|
261
|
-
groupId,
|
|
262
|
-
});
|
|
263
|
-
setStatus(result.copied ? "copied" : "error");
|
|
264
|
-
} catch (err) {
|
|
265
|
-
console.error("Failed to copy variable value", err);
|
|
266
|
-
setStatus("error");
|
|
267
|
-
}
|
|
268
|
-
setTimeout(() => setStatus("idle"), 1500);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
const iconClass =
|
|
272
|
-
status === "copied"
|
|
273
|
-
? "bi-check-lg text-success"
|
|
274
|
-
: status === "error"
|
|
275
|
-
? "bi-exclamation-triangle text-danger"
|
|
276
|
-
: "bi-clipboard";
|
|
277
|
-
|
|
278
|
-
return (
|
|
279
|
-
<button
|
|
280
|
-
type="button"
|
|
281
|
-
className="btn btn-sm btn-outline-secondary"
|
|
282
|
-
onClick={onCopy}
|
|
283
|
-
title="Copy value to clipboard"
|
|
284
|
-
>
|
|
285
|
-
<i className={iconClass}></i>
|
|
286
|
-
<span className="ms-1">Copy Value</span>
|
|
287
|
-
</button>
|
|
288
|
-
);
|
|
289
|
-
};
|