@kortix/ui 0.15.11 → 0.16.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/dist/_vendor/kortix-shared.js +478 -179
- package/dist/_vendor/shared/my-kortix-agent.d.ts +5 -3
- package/dist/_vendor/shared/session/attachment-tile.d.ts +8 -0
- package/dist/_vendor/shared/workspace-settings.d.ts +3 -0
- package/dist/access/access/copy-row.d.ts +7 -1
- package/dist/access/access/copy-row.js +2 -2
- package/dist/animated-copy-icon.js +2 -1
- package/dist/browser/sandbox-browser-chrome.d.ts +2 -1
- package/dist/browser/sandbox-browser-chrome.js +1 -1
- package/dist/customize/agents/agent-cover-card.d.ts +1 -1
- package/dist/customize/agents/agent-cover-card.js +10 -2
- package/dist/customize/agents/agent-filter.js +3 -1
- package/dist/customize/agents/agent-overview.d.ts +10 -0
- package/dist/customize/agents/agent-overview.js +5 -4
- package/dist/customize/agents/agent-page-chrome.d.ts +5 -6
- package/dist/customize/agents/agent-page-chrome.js +16 -13
- package/dist/customize/agents/agent-page.js +6 -28
- package/dist/customize/agents/agent-tabs.d.ts +1 -0
- package/dist/customize/agents/agent-tabs.js +1 -0
- package/dist/customize/agents/agents-page.js +3 -3
- package/dist/customize/agents/create-agent-modal.d.ts +9 -0
- package/dist/customize/agents/create-agent-modal.js +21 -3
- package/dist/customize/agents/use-default-agent.js +2 -2
- package/dist/customize/connectors/connector-identity.d.ts +11 -2
- package/dist/customize/connectors/connector-identity.js +16 -4
- package/dist/customize/connectors/connectors-page.js +10 -6
- package/dist/customize/connectors/detail/app-page.js +2 -2
- package/dist/customize/connectors/install/install-dialog.d.ts +2 -0
- package/dist/customize/connectors/install/install-dialog.js +6 -1
- package/dist/customize/connectors/use-agent-access.d.ts +1 -0
- package/dist/customize/evals/eval-compare-view.d.ts +10 -0
- package/dist/customize/evals/eval-compare-view.js +68 -0
- package/dist/customize/evals/eval-dataset-view.d.ts +20 -0
- package/dist/customize/evals/eval-dataset-view.js +81 -0
- package/dist/customize/evals/eval-datasets-page.d.ts +25 -0
- package/dist/customize/evals/eval-datasets-page.js +91 -0
- package/dist/customize/evals/eval-job-view.d.ts +12 -0
- package/dist/customize/evals/eval-job-view.js +360 -0
- package/dist/customize/evals/eval-jobs-page.d.ts +4 -0
- package/dist/customize/evals/eval-jobs-page.js +69 -0
- package/dist/customize/evals/eval-meta.d.ts +97 -0
- package/dist/customize/evals/eval-meta.js +228 -0
- package/dist/customize/evals/eval-task-view.d.ts +13 -0
- package/dist/customize/evals/eval-task-view.js +123 -0
- package/dist/customize/evals/eval-tasks-page.d.ts +8 -0
- package/dist/customize/evals/eval-tasks-page.js +56 -0
- package/dist/customize/evals/eval-ui.d.ts +97 -0
- package/dist/customize/evals/eval-ui.js +153 -0
- package/dist/customize/evals/evals-page.d.ts +10 -0
- package/dist/customize/evals/evals-page.js +56 -0
- package/dist/customize/evals/run-eval-modal.d.ts +28 -0
- package/dist/customize/evals/run-eval-modal.js +167 -0
- package/dist/customize/project-settings/project-admin-sections.d.ts +3 -2
- package/dist/customize/project-settings/project-admin-sections.js +6 -1
- package/dist/customize/providers/provider-connect.d.ts +13 -0
- package/dist/customize/providers/provider-connect.js +29 -5
- package/dist/customize/providers/provider-sheet.js +5 -4
- package/dist/customize/sections/view/gateway/gateway-overview.d.ts +5 -0
- package/dist/customize/sections/view/gateway/gateway-overview.js +32 -6
- package/dist/customize/sections/view/gateway/routing-parts.d.ts +6 -0
- package/dist/customize/sections/view/gateway/routing-parts.js +21 -13
- package/dist/customize/sections/view/git-view.d.ts +19 -1
- package/dist/customize/sections/view/git-view.js +7 -3
- package/dist/customize/sections/view/manifest-issue-list.d.ts +16 -0
- package/dist/customize/sections/view/manifest-issue-list.js +41 -0
- package/dist/customize/sections/view/manifest-issues-row.d.ts +24 -0
- package/dist/customize/sections/view/manifest-issues-row.js +39 -0
- package/dist/customize/sections/view/sandbox-provider-coverage.d.ts +7 -1
- package/dist/customize/sections/view/sandbox-provider-coverage.js +7 -5
- package/dist/customize/sections/view/secrets-view.d.ts +13 -0
- package/dist/customize/sections/view/secrets-view.js +10 -6
- package/dist/customize/sections/view/subscription-usage.d.ts +2 -7
- package/dist/customize/sections/view/subscription-usage.js +4 -8
- package/dist/customize/settings/settings-tab-header.js +12 -3
- package/dist/customize/settings/tabs/experimental-tab.d.ts +16 -5
- package/dist/customize/settings/tabs/experimental-tab.js +36 -11
- package/dist/customize/settings/tabs/general-tab.js +1 -1
- package/dist/customize/settings/tabs/sandbox-tab.d.ts +10 -0
- package/dist/customize/settings/tabs/sandbox-tab.js +27 -4
- package/dist/customize/settings/tabs/snapshots-tab.d.ts +31 -0
- package/dist/customize/settings/tabs/snapshots-tab.js +61 -5
- package/dist/customize/settings/tabs/workspace-keys.js +6 -3
- package/dist/customize/shared/capability-page-shell.js +9 -1
- package/dist/customize/shared/catalog/catalog-card.d.ts +1 -1
- package/dist/customize/shared/catalog/catalog-card.js +15 -5
- package/dist/customize/shared/customize-tab-bar.js +1 -1
- package/dist/customize/shared/new-entity-menu.d.ts +1 -1
- package/dist/customize/shared/new-entity-menu.js +38 -1
- package/dist/customize/triggers/runtime-triggers.d.ts +4 -0
- package/dist/customize/triggers/runtime-triggers.js +21 -2
- package/dist/customize/triggers/schedule/post-to-field.js +2 -2
- package/dist/customize/triggers/schedule-view.js +2 -1
- package/dist/files/project/components/drive-explorer.js +33 -70
- package/dist/files/project/components/drive-grid-view.d.ts +2 -31
- package/dist/files/project/components/drive-grid-view.js +12 -22
- package/dist/files/project/components/drive-list-view.d.ts +3 -30
- package/dist/files/project/components/drive-list-view.js +8 -18
- package/dist/files/project/components/drive-selection-bar.d.ts +4 -5
- package/dist/files/project/components/drive-selection-bar.js +13 -20
- package/dist/files/project/components/explorer-listing.d.ts +48 -0
- package/dist/files/project/components/explorer-listing.js +64 -0
- package/dist/files/project/components/file-explorer-page.js +7 -204
- package/dist/files/project/components/file-thumbnail.js +3 -1
- package/dist/files/project/components/manifest-issue-mark.d.ts +9 -0
- package/dist/files/project/components/manifest-issue-mark.js +26 -0
- package/dist/files/project/hooks/use-change-requests.d.ts +10 -0
- package/dist/files/project/hooks/use-change-requests.js +17 -0
- package/dist/files/project/manifest-annotations.d.ts +16 -0
- package/dist/files/project/manifest-annotations.js +19 -0
- package/dist/files/project/store/version-store.d.ts +1 -1
- package/dist/files/project/upload-batch.d.ts +20 -0
- package/dist/files/project/upload-batch.js +20 -0
- package/dist/files/runtime/hooks/use-binary-blob.js +3 -2
- package/dist/files/runtime/hooks/use-file-content.js +3 -2
- package/dist/files/runtime/hooks/use-file-list.js +1 -2
- package/dist/files/runtime/hooks/use-file-mutations.js +69 -6
- package/dist/files/runtime/hooks/use-file-refresh.d.ts +4 -0
- package/dist/files/runtime/hooks/use-file-refresh.js +6 -0
- package/dist/files/tree/components/file-tree-item.js +1 -4
- package/dist/files/viewer/file-annotations.d.ts +18 -0
- package/dist/files/viewer/file-annotations.js +21 -0
- package/dist/files/viewer/file-content-renderer.js +1 -1
- package/dist/files/viewer/file-viewer.js +2 -1
- package/dist/files/viewer/index.d.ts +1 -0
- package/dist/files/viewer/index.js +1 -0
- package/dist/files/viewer/use-file-content-state.js +8 -1
- package/dist/i18n/en.d.ts +495 -46
- package/dist/i18n/en.js +536 -87
- package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +0 -4
- package/dist/icons/caret-right-solid.d.ts +11 -0
- package/dist/icons/caret-right-solid.js +15 -0
- package/dist/internal/auth/auth-art.d.ts +12 -0
- package/dist/internal/auth/auth-art.js +118 -0
- package/dist/internal/auth/auth-card-shell.d.ts +14 -10
- package/dist/internal/auth/auth-card-shell.js +20 -31
- package/dist/internal/auth/auth-consent.d.ts +3 -1
- package/dist/internal/auth/auth-consent.js +2 -2
- package/dist/internal/auth/auth-primitives.d.ts +26 -1
- package/dist/internal/auth/auth-primitives.js +37 -8
- package/dist/internal/connector-logo/connector-logo.d.ts +2 -1
- package/dist/internal/connector-logo/connector-logo.js +11 -2
- package/dist/internal/files/file-read-retry.d.ts +18 -2
- package/dist/internal/files/file-read-retry.js +42 -4
- package/dist/internal/hooks/projects/use-new-project-session.js +5 -10
- package/dist/internal/hooks/use-auto-scroll-physics.d.ts +1 -1
- package/dist/internal/hooks/use-auto-scroll-physics.js +2 -10
- package/dist/internal/hooks/use-reduced-motion.d.ts +4 -0
- package/dist/internal/hooks/use-reduced-motion.js +12 -0
- package/dist/internal/hooks/use-save-shortcut.d.ts +8 -0
- package/dist/internal/hooks/use-save-shortcut.js +28 -0
- package/dist/internal/layout/connect-mcp-modal.d.ts +1 -1
- package/dist/internal/layout/connect-mcp-modal.js +9 -4
- package/dist/internal/layout/panel-chrome.d.ts +28 -0
- package/dist/internal/layout/panel-chrome.js +27 -0
- package/dist/internal/layout/project-page-header.js +5 -1
- package/dist/internal/lib/browser-noise/rules/webview.js +16 -0
- package/dist/internal/lib/manifest-health.d.ts +25 -1
- package/dist/internal/lib/manifest-health.js +56 -0
- package/dist/internal/lib/project-preamble.js +1 -1
- package/dist/internal/lib/web-notifications.d.ts +1 -1
- package/dist/internal/lib/web-notifications.js +3 -0
- package/dist/internal/notifications/notification-inbox.js +2 -1
- package/dist/internal/notifications/notification-rows.d.ts +1 -1
- package/dist/internal/notifications/notification-rows.js +15 -1
- package/dist/internal/selection/selection-bar.d.ts +2 -8
- package/dist/internal/selection/selection-bar.js +15 -38
- package/dist/internal/stores/active-space-store.d.ts +1 -1
- package/dist/internal/stores/browser-recents-store.d.ts +1 -1
- package/dist/internal/stores/current-account-store.d.ts +1 -1
- package/dist/internal/stores/first-chat-store.d.ts +1 -1
- package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
- package/dist/internal/stores/session-browser-store.d.ts +1 -1
- package/dist/internal/stores/session-expanded-store.d.ts +1 -1
- package/dist/internal/stores/session-filter-store.d.ts +1 -1
- package/dist/internal/stores/session-history-view-store.d.ts +1 -1
- package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
- package/dist/internal/stores/sound-store.d.ts +1 -1
- package/dist/internal/stores/tab-store.d.ts +1 -1
- package/dist/internal/stores/user-preferences-store.d.ts +9 -1
- package/dist/internal/stores/user-preferences-store.js +2 -0
- package/dist/internal/stores/web-notification-store.d.ts +1 -1
- package/dist/lib/base-ui-compat.js +28 -1
- package/dist/lib/dotmatrix-hooks.d.ts +1 -0
- package/dist/lib/dotmatrix-hooks.js +3 -13
- package/dist/lib/reduced-motion.d.ts +10 -0
- package/dist/lib/reduced-motion.js +104 -0
- package/dist/lib/routes.d.ts +9 -0
- package/dist/lib/routes.js +7 -4
- package/dist/markdown/artifact-link.d.ts +11 -0
- package/dist/markdown/artifact-link.js +62 -0
- package/dist/markdown/code/index.d.ts +1 -1
- package/dist/markdown/code/index.js +1 -1
- package/dist/markdown/code/inline-code.d.ts +1 -1
- package/dist/markdown/code/inline-code.js +1 -1
- package/dist/markdown/genui/components/map-canvas.js +2 -1
- package/dist/markdown/index.d.ts +3 -1
- package/dist/markdown/index.js +2 -1
- package/dist/markdown/{code/inline-chip.js → inline-chip.js} +2 -2
- package/dist/markdown/inline-code-text.d.ts +34 -0
- package/dist/markdown/inline-code-text.js +68 -0
- package/dist/markdown/setup-links/approval-decision.js +3 -3
- package/dist/markdown/soft-breaks.d.ts +21 -0
- package/dist/markdown/soft-breaks.js +33 -0
- package/dist/markdown/unified-markdown.d.ts +9 -1
- package/dist/markdown/unified-markdown.js +31 -9
- package/dist/primitives/action-bar.d.ts +50 -0
- package/dist/primitives/action-bar.js +87 -0
- package/dist/primitives/calendar.js +4 -2
- package/dist/primitives/inline-meta.js +2 -2
- package/dist/primitives/kortix-loader.js +2 -1
- package/dist/primitives/modal.d.ts +1 -1
- package/dist/primitives/paper-wallpaper-shaders.d.ts +1 -0
- package/dist/primitives/paper-wallpaper-shaders.js +6 -0
- package/dist/primitives/resizable.d.ts +1 -1
- package/dist/primitives/resize-seam.d.ts +3 -2
- package/dist/primitives/resize-seam.js +4 -3
- package/dist/primitives/settings-section-header.d.ts +30 -1
- package/dist/primitives/settings-section-header.js +37 -0
- package/dist/primitives/sliding-tab-indicator.js +2 -1
- package/dist/primitives/switch.js +15 -8
- package/dist/primitives/text-shimmer.js +6 -0
- package/dist/primitives/toast-clearance.d.ts +52 -0
- package/dist/primitives/toast-clearance.js +116 -0
- package/dist/primitives/toast.d.ts +3 -1
- package/dist/primitives/toast.js +2 -0
- package/dist/primitives/typed-title.js +1 -1
- package/dist/primitives/wallpaper-shaders.js +1 -1
- package/dist/session/actions/project-session-list-helpers.d.ts +16 -0
- package/dist/session/actions/project-session-list-helpers.js +18 -0
- package/dist/session/agents/agent-model.d.ts +1 -0
- package/dist/session/agents/agent-model.js +2 -1
- package/dist/session/agents/agent-strip.js +10 -4
- package/dist/session/agents/workflow-run-controls.d.ts +27 -4
- package/dist/session/agents/workflow-run-controls.js +63 -10
- package/dist/session/composer/ComposerCard.js +3 -0
- package/dist/session/composer/agent-selector.js +6 -4
- package/dist/session/composer/animated-placeholder.js +2 -1
- package/dist/session/composer/attachment-tile.d.ts +2 -2
- package/dist/session/composer/attachment-tile.js +25 -3
- package/dist/session/composer/composer-agent-access.d.ts +10 -1
- package/dist/session/composer/composer-agent-access.js +18 -4
- package/dist/session/composer/composer-chat-input.js +7 -2
- package/dist/session/composer/composer.d.ts +2 -2
- package/dist/session/composer/composer.js +7 -6
- package/dist/session/composer/hooks/use-file-search.d.ts +12 -2
- package/dist/session/composer/hooks/use-file-search.js +71 -7
- package/dist/session/composer/menus/menu-items.js +6 -2
- package/dist/session/composer/menus/menu-shell.d.ts +3 -1
- package/dist/session/composer/menus/menu-shell.js +2 -2
- package/dist/session/composer/menus/slash-menu.d.ts +7 -0
- package/dist/session/composer/menus/slash-menu.js +48 -1
- package/dist/session/composer/use-instant-session-send.js +7 -1
- package/dist/session/header/session-reminders-indicator.js +3 -2
- package/dist/session/header/session-site-header.js +24 -6
- package/dist/session/media/sandbox-url-detector.js +1 -1
- package/dist/session/models/model-connection-gate.js +2 -1
- package/dist/session/models/model-selector.js +1 -1
- package/dist/session/models/subscription-switcher.d.ts +7 -0
- package/dist/session/models/subscription-switcher.js +52 -10
- package/dist/session/models/subscription-windows.d.ts +2 -0
- package/dist/session/models/subscription-windows.js +2 -0
- package/dist/session/outcomes/session-outcomes-provider.js +14 -7
- package/dist/session/panel/action-panel.js +8 -19
- package/dist/session/panel/easy/app-preview.d.ts +4 -1
- package/dist/session/panel/easy/app-preview.js +95 -33
- package/dist/session/panel/easy/apps-card.js +6 -11
- package/dist/session/panel/easy/change-requests-card.js +1 -1
- package/dist/session/panel/easy/changes-card.d.ts +14 -0
- package/dist/session/panel/easy/changes-card.js +60 -0
- package/dist/session/panel/easy/context-card.d.ts +5 -1
- package/dist/session/panel/easy/context-card.js +13 -28
- package/dist/session/panel/easy/context-meter.d.ts +18 -0
- package/dist/session/panel/easy/context-meter.js +73 -0
- package/dist/session/panel/easy/detail-view.d.ts +1 -1
- package/dist/session/panel/easy/detail-view.js +24 -21
- package/dist/session/panel/easy/easy-panel.js +7 -5
- package/dist/session/panel/easy/file-preview.js +3 -1
- package/dist/session/panel/easy/frame-history.d.ts +91 -0
- package/dist/session/panel/easy/frame-history.js +198 -0
- package/dist/session/panel/easy/outputs-card.d.ts +10 -0
- package/dist/session/panel/easy/outputs-card.js +28 -31
- package/dist/session/panel/easy/panel-card.d.ts +1 -3
- package/dist/session/panel/easy/panel-card.js +24 -8
- package/dist/session/panel/easy/plan-card.js +2 -2
- package/dist/session/panel/easy/step-icon.d.ts +4 -1
- package/dist/session/panel/easy/step-icon.js +2 -2
- package/dist/session/panel/session-action-panel-column.d.ts +5 -0
- package/dist/session/panel/session-action-panel-column.js +198 -101
- package/dist/session/panel/session-desktop.js +5 -1
- package/dist/session/panel/session-diff-viewer.d.ts +3 -1
- package/dist/session/panel/session-diff-viewer.js +7 -4
- package/dist/session/panel/session-panel-provider.js +29 -5
- package/dist/session/panel/shared/derive-panels.js +64 -4
- package/dist/session/status/session-busy-indicator.js +2 -1
- package/dist/session/status/session-error-banner.js +1 -1
- package/dist/session/thread/chat-minimap.js +2 -1
- package/dist/session/thread/session-body.js +4 -1
- package/dist/session/thread/session-chat.js +18 -3
- package/dist/session/thread/session-turn-meta-rows.d.ts +13 -5
- package/dist/session/thread/session-turn-meta-rows.js +33 -5
- package/dist/session/thread/transcript.d.ts +1 -2
- package/dist/session/thread/transcript.js +26 -24
- package/dist/session/thread/typing-indicator.d.ts +2 -2
- package/dist/session/thread/typing-indicator.js +10 -3
- package/dist/session/tool/tools/session-spawn-tool.js +3 -3
- package/dist/session/tool/tools/workflow-run-card.d.ts +11 -1
- package/dist/session/tool/tools/workflow-run-card.js +31 -7
- package/dist/session/tool/tools/workflow-run-cost.d.ts +29 -0
- package/dist/session/tool/tools/workflow-run-cost.js +75 -0
- package/dist/session/tool/tools/workflow-tool.d.ts +1 -1
- package/dist/session/tool/tools/workflow-tool.js +40 -15
- package/dist/session/turn/peer-message-row.js +1 -1
- package/dist/session/turn/queued-prompt-bubbles.d.ts +3 -2
- package/dist/session/turn/queued-prompt-bubbles.js +1 -1
- package/dist/session/turn/throttled-markdown.js +1 -1
- package/dist/styles/theme.css +68 -0
- package/dist/styles.css +1 -1
- package/dist/terminal/pty-terminal.js +1 -1
- package/dist/terminal/session-terminal-connect-bar.js +2 -1
- package/dist/test-utils/intl.d.ts +495 -46
- package/dist/workspace/admin/project-admin-dashboard.js +21 -7
- package/dist/workspace/admin/settings-search-landing.js +2 -1
- package/dist/workspace/calendar/calendar-dates.d.ts +31 -0
- package/dist/workspace/calendar/calendar-dates.js +64 -0
- package/dist/workspace/calendar/calendar-new-item.d.ts +11 -0
- package/dist/workspace/calendar/calendar-new-item.js +47 -0
- package/dist/workspace/calendar/calendar-page.d.ts +3 -0
- package/dist/workspace/calendar/calendar-page.js +177 -0
- package/dist/workspace/calendar/calendar-panel.d.ts +13 -0
- package/dist/workspace/calendar/calendar-panel.js +103 -0
- package/dist/workspace/calendar/calendar-people.d.ts +52 -0
- package/dist/workspace/calendar/calendar-people.js +117 -0
- package/dist/workspace/calendar/calendar-scheduled.d.ts +29 -0
- package/dist/workspace/calendar/calendar-scheduled.js +118 -0
- package/dist/workspace/calendar/calendar-views.d.ts +32 -0
- package/dist/workspace/calendar/calendar-views.js +124 -0
- package/dist/workspace/calendar/calendar-when.d.ts +14 -0
- package/dist/workspace/calendar/calendar-when.js +81 -0
- package/dist/workspace/calendar/mention-textarea.d.ts +19 -0
- package/dist/workspace/calendar/mention-textarea.js +84 -0
- package/dist/workspace/home/access-requests-bell.js +2 -1
- package/dist/workspace/inbox/workspace-inbox.d.ts +1 -1
- package/dist/workspace/inbox/workspace-inbox.js +1 -1
- package/dist/workspace/layout/project-files-view.js +2 -1
- package/dist/workspace/memory/memory-page-list.js +1 -1
- package/dist/workspace/new/workspace-handoff.js +2 -1
- package/dist/workspace/projects/modal/project-icon-field.js +2 -1
- package/dist/workspace/session-workspace.js +13 -12
- package/dist/workspace/setup/setup-steps.d.ts +43 -0
- package/dist/workspace/setup/setup-steps.js +38 -0
- package/dist/workspace/setup/workspace-setup-page.d.ts +10 -0
- package/dist/workspace/setup/workspace-setup-page.js +124 -0
- package/dist/workspace/sidebar/footer/project-artifacts-nav.js +5 -1
- package/dist/workspace/sidebar/footer/project-calendar-nav.d.ts +8 -0
- package/dist/workspace/sidebar/footer/project-calendar-nav.js +31 -0
- package/dist/workspace/sidebar/footer/project-chrome-nav.d.ts +14 -6
- package/dist/workspace/sidebar/footer/project-chrome-nav.js +37 -25
- package/dist/workspace/sidebar/footer/project-computer-nav.d.ts +17 -9
- package/dist/workspace/sidebar/footer/project-computer-nav.js +36 -26
- package/dist/workspace/sidebar/footer/project-download-app-nav.d.ts +7 -7
- package/dist/workspace/sidebar/footer/project-download-app-nav.js +25 -13
- package/dist/workspace/sidebar/footer/project-inbox-nav.d.ts +8 -0
- package/dist/workspace/sidebar/footer/project-inbox-nav.js +29 -0
- package/dist/workspace/sidebar/footer/project-manifest-issues-alert.d.ts +3 -13
- package/dist/workspace/sidebar/footer/project-manifest-issues-alert.js +6 -48
- package/dist/workspace/sidebar/footer/project-mcp-nav.d.ts +7 -7
- package/dist/workspace/sidebar/footer/project-mcp-nav.js +31 -13
- package/dist/workspace/sidebar/footer/project-phone-app-nav.d.ts +10 -0
- package/dist/workspace/sidebar/footer/project-phone-app-nav.js +61 -0
- package/dist/workspace/sidebar/footer/project-promo-cards.d.ts +21 -0
- package/dist/workspace/sidebar/footer/project-promo-cards.js +33 -0
- package/dist/workspace/sidebar/footer/promo-card.d.ts +41 -0
- package/dist/workspace/sidebar/footer/promo-card.js +47 -0
- package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
- package/dist/workspace/sidebar/project-nav-items.js +12 -4
- package/dist/workspace/sidebar/project-session-list.js +58 -26
- package/dist/workspace/sidebar/project-sidebar.js +2 -5
- package/dist/workspace/sidebar/project-spaces-nav.js +2 -1
- package/dist/workspace/sidebar/session-brief-hover-card.d.ts +24 -0
- package/dist/workspace/sidebar/session-brief-hover-card.js +4 -3
- package/dist/workspace/sidebar/session-group-sections.d.ts +26 -7
- package/dist/workspace/sidebar/session-group-sections.js +121 -41
- package/dist/workspace/sidebar/sidebar-drill.js +6 -0
- package/dist/workspace/sidebar/sidebar-more-group.js +3 -2
- package/dist/workspace/sidebar/use-workspace-list.d.ts +7 -0
- package/dist/workspace/sidebar/use-workspace-list.js +11 -1
- package/dist/workspace/sidebar/workspace-settings-sidebar-nav.d.ts +14 -0
- package/dist/workspace/sidebar/workspace-settings-sidebar-nav.js +46 -2
- package/dist/workspace/space/space-tab-panels.js +1 -1
- package/dist/workspace/spaces/space-timeline.js +2 -2
- package/package.json +67 -10
- package/skills/kortix-ui/SKILL.md +2 -2
- package/skills/kortix-ui/references/modules.md +5 -3
- package/dist/session/thread/turn-share.d.ts +0 -16
- package/dist/session/thread/turn-share.js +0 -161
- package/dist/workspace/sidebar/footer/promo-nav-row.d.ts +0 -11
- package/dist/workspace/sidebar/footer/promo-nav-row.js +0 -7
- /package/dist/markdown/{code/inline-chip.d.ts → inline-chip.d.ts} +0 -0
|
@@ -41,7 +41,7 @@ import { Button } from '../../primitives/button.js';
|
|
|
41
41
|
import { EmptyState } from '../../primitives/empty-state.js';
|
|
42
42
|
import { ErrorState } from '../../primitives/error-state.js';
|
|
43
43
|
import { FadedScrollArea } from '../../primitives/faded-scroll-area.js';
|
|
44
|
-
import {
|
|
44
|
+
import { SETTINGS_PAGE_COLUMN_CLASS, SettingsPageHeader, SettingsPageTitleProvider, } from '../../primitives/settings-section-header.js';
|
|
45
45
|
import { Skeleton } from '../../primitives/skeleton.js';
|
|
46
46
|
import { Tabs, TabsList, TabsTrigger } from '../../primitives/tabs.js';
|
|
47
47
|
import { UiLink as Link, useUiRouter, useUiSearchParams } from '../../providers/ui-provider.js';
|
|
@@ -93,6 +93,10 @@ const RESOURCE_PAGES = {
|
|
|
93
93
|
skills: lazyPage(() => import('../../customize/skills/skills-page.js'), (m) => m.SkillsPage),
|
|
94
94
|
drives: lazyPage(() => import('../../customize/agents/agent-drives-section.js'), (m) => m.AgentDrivesSection),
|
|
95
95
|
triggers: lazyPage(() => import('../../customize/triggers/triggers-page.js'), (m) => m.TriggersPage),
|
|
96
|
+
evals: lazyPage(() => import('../../customize/evals/evals-page.js'), (m) => m.EvalsPage),
|
|
97
|
+
'eval-datasets': lazyPage(() => import('../../customize/evals/eval-datasets-page.js'), (m) => m.EvalDatasetsPage),
|
|
98
|
+
'eval-tasks': lazyPage(() => import('../../customize/evals/eval-tasks-page.js'), (m) => m.EvalTasksPage),
|
|
99
|
+
'eval-jobs': lazyPage(() => import('../../customize/evals/eval-jobs-page.js'), (m) => m.EvalJobsPage),
|
|
96
100
|
models: lazyPage(() => import('../../customize/models/models-page.js'), (m) => m.ModelsPage),
|
|
97
101
|
secrets: lazyPage(() => import('../../customize/secrets/secrets-page.js'), (m) => m.SecretsPage),
|
|
98
102
|
repo: lazyPage(() => import('../layout/project-files-view.js'), (m) => m.ProjectFilesView),
|
|
@@ -122,7 +126,7 @@ const SETTINGS_PAGES = {
|
|
|
122
126
|
const { GitView } = m;
|
|
123
127
|
return function GitSection({ projectId }) {
|
|
124
128
|
const tI18nComplete = useI18nTranslations('hardcodedUi.i18nComplete');
|
|
125
|
-
return (_jsxs("div", { className: "mx-auto w-full max-w-2xl space-y-8", children: [_jsx(
|
|
129
|
+
return (_jsxs("div", { className: "mx-auto w-full max-w-2xl space-y-8", children: [_jsx(SettingsPageHeader, { title: tI18nComplete.raw('text95ddc9c4dfd3'), description: tI18nComplete.raw('texte0d7209f4c07') }), _jsx(GitView, { projectId: projectId })] }));
|
|
126
130
|
};
|
|
127
131
|
}),
|
|
128
132
|
sandbox: lazyPage(() => Promise.all([
|
|
@@ -165,6 +169,7 @@ export function ProjectAdminDashboard({ projectId, section, content, hostSection
|
|
|
165
169
|
const canAdmin = pageCans[PROJECT_ACTIONS.PROJECT_SETTINGS_WRITE];
|
|
166
170
|
const projectRowsOpen = canAdmin?.allowed === true;
|
|
167
171
|
const drives = useFeatureFlag(projectId, 'drives');
|
|
172
|
+
const evals = useFeatureFlag(projectId, 'evals');
|
|
168
173
|
// The account rows: the account hub's own rule, for a member of the
|
|
169
174
|
// workspace's account. A project shared into an account the caller does not
|
|
170
175
|
// belong to has no account panes for them.
|
|
@@ -188,6 +193,7 @@ export function ProjectAdminDashboard({ projectId, section, content, hostSection
|
|
|
188
193
|
resources.settled &&
|
|
189
194
|
settingsAnswered &&
|
|
190
195
|
!drives.isLoading &&
|
|
196
|
+
!evals.isLoading &&
|
|
191
197
|
// Members needs the account id: wait for the project so it never pops in.
|
|
192
198
|
project.isFetched &&
|
|
193
199
|
accountsQuery.isFetched &&
|
|
@@ -195,6 +201,7 @@ export function ProjectAdminDashboard({ projectId, section, content, hostSection
|
|
|
195
201
|
// `resources.tabs` is a fresh array each render; its contents are the key.
|
|
196
202
|
const allowedTabs = resources.tabs.join(',');
|
|
197
203
|
const drivesOn = drives.enabled;
|
|
204
|
+
const evalsOn = evals.enabled;
|
|
198
205
|
const visibleSections = hub.sectionVisible;
|
|
199
206
|
const groups = useMemo(() => {
|
|
200
207
|
const allowed = new Set(allowedTabs.split(','));
|
|
@@ -225,6 +232,8 @@ export function ProjectAdminDashboard({ projectId, section, content, hostSection
|
|
|
225
232
|
return null;
|
|
226
233
|
if (resource.flag === 'drives' && !drivesOn)
|
|
227
234
|
return null;
|
|
235
|
+
if (resource.flag === 'evals' && !evalsOn)
|
|
236
|
+
return null;
|
|
228
237
|
return {
|
|
229
238
|
key,
|
|
230
239
|
label: label(key),
|
|
@@ -271,6 +280,7 @@ export function ProjectAdminDashboard({ projectId, section, content, hostSection
|
|
|
271
280
|
projectRowsOpen,
|
|
272
281
|
hostSections,
|
|
273
282
|
drivesOn,
|
|
283
|
+
evalsOn,
|
|
274
284
|
settingsCans,
|
|
275
285
|
settingsProbeFailed,
|
|
276
286
|
tI18nComplete,
|
|
@@ -409,11 +419,15 @@ export function ProjectAdminDashboard({ projectId, section, content, hostSection
|
|
|
409
419
|
// The frame's title bar names the panel; this row is the rail only.
|
|
410
420
|
_jsx("nav", { "aria-label": title, className: "border-border/60 bg-background flex shrink-0 flex-col border-b", children: _jsx(FadedScrollArea, { ref: stripRef, orientation: "horizontal", fadeColor: "from-background", className: "min-w-0 flex-1 py-2", children: settled ? (_jsx("div", { className: "flex w-fit items-center gap-2", children: _jsx(Tabs, { value: active, className: "w-fit", children: _jsx(TabsList, { orientation: "horizontal", className: "w-fit", children: groups.flatMap((group) => group.rows).map((row) => (_jsx(RailTrigger, { projectId: projectId, row: row, horizontal: true }, row.key))) }) }) })) : (_jsx(Skeleton, { className: "mx-3 h-7 w-64 rounded-md" })) }) })) : (_jsxs("aside", { className: "flex min-h-0 flex-col border-r bg-inherit", children: [_jsx("nav", { "aria-label": title, className: "flex min-h-0 flex-1 [scrollbar-width:none] flex-col gap-4 overflow-y-auto px-2 pt-4 pb-2 [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden", children: settled ? (_jsx(Tabs, { value: active, orientation: "vertical", className: "gap-4", children: groups
|
|
411
421
|
.filter((group) => group.id !== RAIL_FOOTER_GROUP)
|
|
412
|
-
.map((group) => (_jsx(RailGroup, { label: tSettings(`groups.${group.id}`), children: group.rows.map((row) => (_jsx(RailTrigger, { projectId: projectId, row: row }, row.key))) }, group.id))) })) : (_jsx(RailSkeleton, {})) }), settled && footerRows.length > 0 ? (_jsx("div", { className: "border-border/60 shrink-0 border-t px-2 py-2", children: _jsx(Tabs, { value: active, orientation: "vertical", children: _jsx(RailGroup, { children: footerRows.map((row) => (_jsx(RailTrigger, { projectId: projectId, row: row }, row.key))) }) }) })) : null] })), _jsx("main", { ref: mainRef, className: "bg-background flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden", children: settled && active && activeRow && (ProjectPage || AccountPage) ? (
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
422
|
+
.map((group) => (_jsx(RailGroup, { label: tSettings(`groups.${group.id}`), children: group.rows.map((row) => (_jsx(RailTrigger, { projectId: projectId, row: row }, row.key))) }, group.id))) })) : (_jsx(RailSkeleton, {})) }), settled && footerRows.length > 0 ? (_jsx("div", { className: "border-border/60 shrink-0 border-t px-2 py-2", children: _jsx(Tabs, { value: active, orientation: "vertical", children: _jsx(RailGroup, { children: footerRows.map((row) => (_jsx(RailTrigger, { projectId: projectId, row: row }, row.key))) }) }) })) : null] })), _jsx("main", { ref: mainRef, className: "bg-background flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden", children: settled && active && activeRow && (ProjectPage || AccountPage) ? (
|
|
423
|
+
// Every page header in the pane reads its title from the rail row,
|
|
424
|
+
// so the page is named exactly like the row that opened it. A page
|
|
425
|
+
// below a section (a connector) names itself.
|
|
426
|
+
_jsx(SettingsPageTitleProvider, { value: content ? null : activeRow.label, children: _jsx(Suspense, { fallback: _jsx(CapabilitiesSkeleton, {}), children: isProjectAdminResource(active) && ProjectPage ? (_jsxs("div", { className: cn('flex min-h-0 flex-1 flex-col overflow-hidden', active === 'apps' && HOST_PANE_CLASS), children: [active === 'repo' && !content ? (_jsx("div", { className: cn(SETTINGS_PAGE_COLUMN_CLASS, 'shrink-0 pb-6'), children: _jsx(SettingsPageHeader, { title: activeRow.label }) })) : null, content ?? _jsx(ProjectPage, { projectId: projectId })] })) : (
|
|
427
|
+
// Bounded, not scrolling: the account panes' split sheet
|
|
428
|
+
// (Invite, New key) splits this column, and the page and the
|
|
429
|
+
// sheet each scroll inside their own half.
|
|
430
|
+
_jsx("div", { className: "min-h-0 flex-1", children: _jsx(AccountHubSheetProvider, { children: activeRow.project && ProjectPage ? (_jsx("div", { className: SETTINGS_PAGE_COLUMN_CLASS, children: _jsx("div", { className: "flex w-full max-w-2xl flex-col space-y-6", children: active === 'general' ? (_jsx(ProjectPage, { projectId: projectId, slot: companionPane })) : (_jsxs(_Fragment, { children: [_jsx(ProjectPage, { projectId: projectId }), companionPane] })) }) })) : AccountPage && accountTab && accountId ? (_jsx(EmbeddedAccountHubProvider, { value: { accountId, tab: accountTab }, children: _jsx(AccountPage, { projectId: projectId, accountId: accountId, tab: accountTab, companion: false, title: isWorkspaceAccountSection(active) ? undefined : activeRow.label }) })) : null }) })) }, active) })) : (_jsx(CapabilitiesSkeleton, {})) })] }) }));
|
|
417
431
|
}
|
|
418
432
|
/* ------------------------------------------------------------------ rail */
|
|
419
433
|
/** One row: a real link inside the trigger, since the section is URL state. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { useWorkspaceSettingsRailStore } from '../../internal/stores/workspace-settings-rail-store.js';
|
|
4
|
+
import { prefersReducedMotion } from '../../internal/hooks/use-reduced-motion.js';
|
|
4
5
|
/** How long the page may take to render the card before the landing gives up. */
|
|
5
6
|
const FIND_TIMEOUT_MS = 4000;
|
|
6
7
|
/** A row taller than this is a whole card: the mark stays on the row. */
|
|
@@ -27,7 +28,7 @@ export function useSettingsSearchLanding(projectId, section, rootRef) {
|
|
|
27
28
|
if (!target)
|
|
28
29
|
return false;
|
|
29
30
|
const row = rowOf(target, root);
|
|
30
|
-
const reduce =
|
|
31
|
+
const reduce = prefersReducedMotion();
|
|
31
32
|
// Instant: a long smooth scroll is motion the person did not ask for.
|
|
32
33
|
row.scrollIntoView({ block: 'center', behavior: 'instant' });
|
|
33
34
|
mark(row, reduce);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CalendarItem } from '@kortix/sdk';
|
|
2
|
+
/** The local calendar day of a date: `YYYY-MM-DD`. */
|
|
3
|
+
export declare const dayKey: (d: Date) => string;
|
|
4
|
+
export declare const parseDayKey: (key: string) => Date;
|
|
5
|
+
export declare const addDays: (d: Date, n: number) => Date;
|
|
6
|
+
/** Monday 00:00 local of the week that holds `d`. */
|
|
7
|
+
export declare const weekStart: (d: Date) => Date;
|
|
8
|
+
export declare const weekDays: (start: Date) => Date[];
|
|
9
|
+
/** The weeks, Monday first, that cover the month of `d`. */
|
|
10
|
+
export declare function monthWeeks(d: Date): Date[][];
|
|
11
|
+
/** The window a view reads: `[from, to)` in local midnights. */
|
|
12
|
+
export declare function viewRange(mode: 'week' | 'month', anchor: Date): {
|
|
13
|
+
from: Date;
|
|
14
|
+
to: Date;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The local day an item sits on, or null with no date. An all-day item keeps
|
|
18
|
+
* its calendar date in every time zone: the API stores it as UTC midnight.
|
|
19
|
+
*/
|
|
20
|
+
export declare function itemDayKey(item: Pick<CalendarItem, 'starts_at' | 'all_day'>): string | null;
|
|
21
|
+
/**
|
|
22
|
+
* `starts_at` and `all_day` for an item moved to another day: a timed item
|
|
23
|
+
* keeps its local time of day, an all-day item stays all day, and an item
|
|
24
|
+
* with no date lands at 09:00 local.
|
|
25
|
+
*/
|
|
26
|
+
export declare function moveToDay(item: Pick<CalendarItem, 'starts_at' | 'all_day'>, day: string): {
|
|
27
|
+
starts_at: string;
|
|
28
|
+
all_day: boolean;
|
|
29
|
+
};
|
|
30
|
+
/** An open item whose time (or, all day, whose day) has passed. */
|
|
31
|
+
export declare function isOverdue(item: Pick<CalendarItem, 'starts_at' | 'all_day' | 'status'>, now: Date): boolean;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
2
|
+
/** The local calendar day of a date: `YYYY-MM-DD`. */
|
|
3
|
+
export const dayKey = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
4
|
+
export const parseDayKey = (key) => {
|
|
5
|
+
const [y, m, d] = key.split('-').map(Number);
|
|
6
|
+
return new Date(y, m - 1, d);
|
|
7
|
+
};
|
|
8
|
+
export const addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
|
|
9
|
+
/** Monday 00:00 local of the week that holds `d`. */
|
|
10
|
+
export const weekStart = (d) => addDays(d, -((d.getDay() + 6) % 7));
|
|
11
|
+
export const weekDays = (start) => Array.from({ length: 7 }, (_, i) => addDays(start, i));
|
|
12
|
+
/** The weeks, Monday first, that cover the month of `d`. */
|
|
13
|
+
export function monthWeeks(d) {
|
|
14
|
+
const first = new Date(d.getFullYear(), d.getMonth(), 1);
|
|
15
|
+
const last = new Date(d.getFullYear(), d.getMonth() + 1, 0);
|
|
16
|
+
const weeks = [];
|
|
17
|
+
for (let s = weekStart(first); s <= last; s = addDays(s, 7))
|
|
18
|
+
weeks.push(weekDays(s));
|
|
19
|
+
return weeks;
|
|
20
|
+
}
|
|
21
|
+
/** The window a view reads: `[from, to)` in local midnights. */
|
|
22
|
+
export function viewRange(mode, anchor) {
|
|
23
|
+
if (mode === 'week') {
|
|
24
|
+
const from = weekStart(anchor);
|
|
25
|
+
return { from, to: addDays(from, 7) };
|
|
26
|
+
}
|
|
27
|
+
const weeks = monthWeeks(anchor);
|
|
28
|
+
return { from: weeks[0][0], to: addDays(weeks[weeks.length - 1][6], 1) };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The local day an item sits on, or null with no date. An all-day item keeps
|
|
32
|
+
* its calendar date in every time zone: the API stores it as UTC midnight.
|
|
33
|
+
*/
|
|
34
|
+
export function itemDayKey(item) {
|
|
35
|
+
if (!item.starts_at)
|
|
36
|
+
return null;
|
|
37
|
+
return item.all_day ? item.starts_at.slice(0, 10) : dayKey(new Date(item.starts_at));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* `starts_at` and `all_day` for an item moved to another day: a timed item
|
|
41
|
+
* keeps its local time of day, an all-day item stays all day, and an item
|
|
42
|
+
* with no date lands at 09:00 local.
|
|
43
|
+
*/
|
|
44
|
+
export function moveToDay(item, day) {
|
|
45
|
+
if (item.all_day)
|
|
46
|
+
return { starts_at: `${day}T00:00:00.000Z`, all_day: true };
|
|
47
|
+
const target = parseDayKey(day);
|
|
48
|
+
if (item.starts_at) {
|
|
49
|
+
const from = new Date(item.starts_at);
|
|
50
|
+
target.setHours(from.getHours(), from.getMinutes(), 0, 0);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
target.setHours(9, 0, 0, 0);
|
|
54
|
+
}
|
|
55
|
+
return { starts_at: target.toISOString(), all_day: false };
|
|
56
|
+
}
|
|
57
|
+
/** An open item whose time (or, all day, whose day) has passed. */
|
|
58
|
+
export function isOverdue(item, now) {
|
|
59
|
+
if (item.status !== 'open' || !item.starts_at)
|
|
60
|
+
return false;
|
|
61
|
+
if (item.all_day)
|
|
62
|
+
return item.starts_at.slice(0, 10) < dayKey(now);
|
|
63
|
+
return new Date(item.starts_at).getTime() < now.getTime();
|
|
64
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CalendarItem } from '@kortix/sdk';
|
|
2
|
+
import { type CalendarDirectory } from './calendar-people.js';
|
|
3
|
+
export declare function NewItemModal({ projectId, open, day, directory, onOpenChange, onCreated, }: {
|
|
4
|
+
projectId: string;
|
|
5
|
+
open: boolean;
|
|
6
|
+
/** Preset all-day date (`YYYY-MM-DD`), or null for no date. */
|
|
7
|
+
day: string | null;
|
|
8
|
+
directory: CalendarDirectory;
|
|
9
|
+
onOpenChange: (open: boolean) => void;
|
|
10
|
+
onCreated: (item: CalendarItem) => void;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useWorkspaceCalendarActions } from '@kortix/sdk/react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
6
|
+
import { Button } from '../../primitives/button.js';
|
|
7
|
+
import { Input } from '../../primitives/input.js';
|
|
8
|
+
import { Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalTitle } from '../../primitives/modal.js';
|
|
9
|
+
import { errorToast } from '../../primitives/toast.js';
|
|
10
|
+
import { PeoplePicker } from './calendar-people.js';
|
|
11
|
+
import { NO_DATE, WhenPicker } from './calendar-when.js';
|
|
12
|
+
import { MentionTextarea } from './mention-textarea.js';
|
|
13
|
+
export function NewItemModal({ projectId, open, day, directory, onOpenChange, onCreated, }) {
|
|
14
|
+
const t = useTranslations('calendar');
|
|
15
|
+
const actions = useWorkspaceCalendarActions(projectId);
|
|
16
|
+
// The page remounts this modal for every opening (`key`), so each one starts empty on `day`.
|
|
17
|
+
const [title, setTitle] = useState('');
|
|
18
|
+
const [notes, setNotes] = useState('');
|
|
19
|
+
const [when, setWhen] = useState(() => (day ? { starts_at: `${day}T00:00:00.000Z`, ends_at: null, all_day: true } : NO_DATE));
|
|
20
|
+
const [people, setPeople] = useState([]);
|
|
21
|
+
const create = () => {
|
|
22
|
+
const name = title.trim();
|
|
23
|
+
if (!name || actions.create.isPending)
|
|
24
|
+
return;
|
|
25
|
+
actions.create.mutate({
|
|
26
|
+
title: name,
|
|
27
|
+
notes,
|
|
28
|
+
...when,
|
|
29
|
+
people: people.map((p) => (p.kind === 'person' ? { user_id: p.user_id } : { agent: p.agent })),
|
|
30
|
+
}, {
|
|
31
|
+
onSuccess: (item) => {
|
|
32
|
+
onOpenChange(false);
|
|
33
|
+
onCreated(item);
|
|
34
|
+
},
|
|
35
|
+
onError: (error) => errorToast(error instanceof Error ? error.message : t('saveFailed')),
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
return (_jsx(Modal, { open: open, onOpenChange: onOpenChange, children: _jsx(ModalContent, { className: "sm:max-w-lg", children: _jsxs("form", { className: "contents", onSubmit: (event) => {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
create();
|
|
41
|
+
}, onKeyDown: (event) => {
|
|
42
|
+
if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
create();
|
|
45
|
+
}
|
|
46
|
+
}, children: [_jsx(ModalHeader, { className: "pb-4", children: _jsx(ModalTitle, { children: t('newItem') }) }), _jsxs(ModalBody, { className: "space-y-3", children: [_jsx(Input, { autoFocus: true, size: "lg", maxLength: 200, "aria-label": t('titleLabel'), value: title, placeholder: t('titlePlaceholder'), onChange: (event) => setTitle(event.target.value) }), _jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [_jsx(WhenPicker, { value: when, onChange: setWhen }), _jsx(PeoplePicker, { value: people, directory: directory, onChange: setPeople })] }), _jsx(MentionTextarea, { value: notes, onChange: setNotes, directory: directory, ariaLabel: t('notes'), placeholder: t('notesPlaceholder'), minHeight: 64, onSubmit: create })] }), _jsxs(ModalFooter, { className: "pb-5", children: [_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => onOpenChange(false), children: t('cancel') }), _jsx(Button, { type: "submit", size: "sm", disabled: !title.trim() || actions.create.isPending, "aria-busy": actions.create.isPending, children: t('create') })] })] }) }) }));
|
|
47
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useUnifiedTriggers, useWorkspaceCalendarActions, useWorkspaceCalendarItem, useWorkspaceCalendarItems } from '@kortix/sdk/react';
|
|
4
|
+
import { agentDisplayName } from '../../_vendor/kortix-shared.js';
|
|
5
|
+
import { CaretDownIcon, CaretLeftIcon, CaretRightIcon, PlusIcon, UsersThreeIcon } from '@phosphor-icons/react';
|
|
6
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
7
|
+
import { useLocale, useTranslations } from '../../i18n/index.js';
|
|
8
|
+
import { ProjectPageHeader } from '../../internal/layout/project-page-header.js';
|
|
9
|
+
import { cn } from '../../lib/utils.js';
|
|
10
|
+
import { Button } from '../../primitives/button.js';
|
|
11
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, } from '../../primitives/dropdown-menu.js';
|
|
12
|
+
import { ErrorState } from '../../primitives/error-state.js';
|
|
13
|
+
import { Hint } from '../../primitives/hint.js';
|
|
14
|
+
import { Skeleton } from '../../primitives/skeleton.js';
|
|
15
|
+
import { SplitSheet, SplitSheetContent, SplitSheetMain } from '../../primitives/split-sheet.js';
|
|
16
|
+
import { Tabs, TabsList, TabsTrigger } from '../../primitives/tabs.js';
|
|
17
|
+
import { errorToast } from '../../primitives/toast.js';
|
|
18
|
+
import { useUiPathname, useUiSearchParams, useUiShallowNavigate, useUiViewerId } from '../../providers/ui-provider.js';
|
|
19
|
+
import { addDays, itemDayKey, moveToDay, parseDayKey, viewRange, weekStart } from './calendar-dates.js';
|
|
20
|
+
import { NewItemModal } from './calendar-new-item.js';
|
|
21
|
+
import { FirePanel, ItemPanel } from './calendar-panel.js';
|
|
22
|
+
import { ParticipantMark, personName, useCalendarDirectory } from './calendar-people.js';
|
|
23
|
+
import { scheduledFires } from './calendar-scheduled.js';
|
|
24
|
+
import { MonthView, UNDATED, WeekView } from './calendar-views.js';
|
|
25
|
+
const ITEM_ID = /^[0-9a-f-]{36}$/i;
|
|
26
|
+
/** The current minute, so "today" and "overdue" move without a reload. */
|
|
27
|
+
function useNow() {
|
|
28
|
+
const [now, setNow] = useState(() => new Date());
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const timer = window.setInterval(() => setNow(new Date()), 60_000);
|
|
31
|
+
return () => window.clearInterval(timer);
|
|
32
|
+
}, []);
|
|
33
|
+
return now;
|
|
34
|
+
}
|
|
35
|
+
export function CalendarPage({ projectId }) {
|
|
36
|
+
const t = useTranslations('calendar');
|
|
37
|
+
const locale = useLocale();
|
|
38
|
+
const now = useNow();
|
|
39
|
+
const viewerId = useUiViewerId();
|
|
40
|
+
const pathname = useUiPathname();
|
|
41
|
+
const search = useUiSearchParams();
|
|
42
|
+
const navigate = useUiShallowNavigate();
|
|
43
|
+
const directory = useCalendarDirectory(projectId);
|
|
44
|
+
const actions = useWorkspaceCalendarActions(projectId);
|
|
45
|
+
const [mode, setMode] = useState('week');
|
|
46
|
+
const [anchor, setAnchor] = useState(() => weekStart(new Date()));
|
|
47
|
+
const [filter, setFilter] = useState('all');
|
|
48
|
+
const [fireId, setFireId] = useState(null);
|
|
49
|
+
const [creating, setCreating] = useState({ open: false, day: null, n: 0 });
|
|
50
|
+
/** Items moved by a drag, shown on their new day until the list reads them back. */
|
|
51
|
+
const [moved, setMoved] = useState({});
|
|
52
|
+
const itemParam = search.get('item');
|
|
53
|
+
const itemId = itemParam && ITEM_ID.test(itemParam) ? itemParam : null;
|
|
54
|
+
const selection = itemId ? { kind: 'item', id: itemId } : fireId ? { kind: 'fire', id: fireId } : null;
|
|
55
|
+
const range = useMemo(() => viewRange(mode, anchor), [mode, anchor]);
|
|
56
|
+
const items = useWorkspaceCalendarItems(projectId, {
|
|
57
|
+
from: range.from.toISOString(),
|
|
58
|
+
to: range.to.toISOString(),
|
|
59
|
+
with: filter === 'all' ? undefined : filter,
|
|
60
|
+
});
|
|
61
|
+
// Scheduled triggers and Loops always show: everyone, or the picked agent's own.
|
|
62
|
+
const triggers = useUnifiedTriggers(projectId);
|
|
63
|
+
const shownItems = useMemo(() => (items.data ?? []).map((item) => (moved[item.item_id] ? { ...item, ...moved[item.item_id] } : item)), [items.data, moved]);
|
|
64
|
+
const fires = useMemo(() => {
|
|
65
|
+
if (filter === 'me' || filter.startsWith('user:'))
|
|
66
|
+
return [];
|
|
67
|
+
const all = scheduledFires(triggers.data, range, now);
|
|
68
|
+
return filter.startsWith('agent:') ? all.filter((fire) => fire.trigger.agent === filter.slice(6)) : all;
|
|
69
|
+
}, [filter, triggers.data, range, now]);
|
|
70
|
+
const openFire = fireId ? fires.find((fire) => fire.id === fireId) ?? null : null;
|
|
71
|
+
const setItemParam = (id) => {
|
|
72
|
+
const params = new URLSearchParams(search.toString());
|
|
73
|
+
if (id)
|
|
74
|
+
params.set('item', id);
|
|
75
|
+
else
|
|
76
|
+
params.delete('item');
|
|
77
|
+
params.delete('notification');
|
|
78
|
+
const query = params.toString();
|
|
79
|
+
navigate(`${pathname}${query ? `?${query}` : ''}`, { replace: true });
|
|
80
|
+
};
|
|
81
|
+
const openItem = (id) => {
|
|
82
|
+
setFireId(null);
|
|
83
|
+
setItemParam(id);
|
|
84
|
+
};
|
|
85
|
+
const openFireEntry = (id) => {
|
|
86
|
+
if (itemId)
|
|
87
|
+
setItemParam(null);
|
|
88
|
+
setFireId(id);
|
|
89
|
+
};
|
|
90
|
+
const close = () => {
|
|
91
|
+
setFireId(null);
|
|
92
|
+
if (itemId)
|
|
93
|
+
setItemParam(null);
|
|
94
|
+
};
|
|
95
|
+
const move = (item, day) => {
|
|
96
|
+
const input = day === UNDATED ? { starts_at: null, all_day: false } : moveToDay(item, day);
|
|
97
|
+
setMoved((current) => ({ ...current, [item.item_id]: input }));
|
|
98
|
+
actions.update.mutate({ itemId: item.item_id, input }, {
|
|
99
|
+
onError: (error) => errorToast(error instanceof Error ? error.message : t('saveFailed')),
|
|
100
|
+
onSettled: () => setMoved((current) => {
|
|
101
|
+
const { [item.item_id]: _, ...rest } = current;
|
|
102
|
+
return rest;
|
|
103
|
+
}),
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
const step = (direction) => setAnchor(mode === 'week' ? addDays(anchor, 7 * direction) : new Date(anchor.getFullYear(), anchor.getMonth() + direction, 1));
|
|
107
|
+
const goToday = () => setAnchor(mode === 'week' ? weekStart(new Date()) : new Date());
|
|
108
|
+
const switchMode = (next) => {
|
|
109
|
+
if (next === mode)
|
|
110
|
+
return;
|
|
111
|
+
setAnchor(next === 'week' ? weekStart(anchor) : addDays(anchor, 3));
|
|
112
|
+
setMode(next);
|
|
113
|
+
};
|
|
114
|
+
const label = mode === 'week'
|
|
115
|
+
? new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'short', year: 'numeric' }).formatRange(range.from, addDays(range.to, -1))
|
|
116
|
+
: new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' }).format(anchor);
|
|
117
|
+
const filterLabel = (() => {
|
|
118
|
+
if (filter === 'all')
|
|
119
|
+
return t('filter.everyone');
|
|
120
|
+
if (filter === 'me')
|
|
121
|
+
return t('filter.me');
|
|
122
|
+
if (filter.startsWith('agent:'))
|
|
123
|
+
return agentDisplayName(filter.slice(6));
|
|
124
|
+
return personName(directory.person(filter.slice(5)), t('formerMember'));
|
|
125
|
+
})();
|
|
126
|
+
// A deep link to an item in another week shows that week once the item loads.
|
|
127
|
+
useLinkedItemWeek(projectId, itemId, items.data, (day) => {
|
|
128
|
+
setMode('week');
|
|
129
|
+
setAnchor(weekStart(parseDayKey(day)));
|
|
130
|
+
});
|
|
131
|
+
return (_jsxs("div", { className: "flex h-svh flex-col overflow-hidden", children: [_jsx(ProjectPageHeader, { title: t('title'), children: _jsxs(Button, { size: "sm", variant: "outline", className: "gap-1.5", onClick: () => setCreating((c) => ({ open: true, day: null, n: c.n + 1 })), children: [_jsx(PlusIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }), t('newItem')] }) }), _jsxs(SplitSheet, { size: "lg", open: selection !== null && (selection.kind === 'item' || openFire !== null), onOpenChange: (open) => !open && close(), className: "min-h-0 flex-1", children: [_jsxs(SplitSheetMain, { className: "flex min-h-0 flex-col", children: [_jsxs("div", { className: "flex shrink-0 flex-wrap items-center gap-2 px-4 py-3 md:px-6", children: [_jsx("h2", { className: "text-foreground mr-1 text-base font-medium tabular-nums", children: label }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Hint, { label: mode === 'week' ? t('previousWeek') : t('previousMonth'), children: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": mode === 'week' ? t('previousWeek') : t('previousMonth'), onClick: () => step(-1), children: _jsx(CaretLeftIcon, { className: "size-4" }) }) }), _jsx(Button, { variant: "outline", size: "xs", onClick: goToday, children: t('today') }), _jsx(Hint, { label: mode === 'week' ? t('nextWeek') : t('nextMonth'), children: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": mode === 'week' ? t('nextWeek') : t('nextMonth'), onClick: () => step(1), children: _jsx(CaretRightIcon, { className: "size-4" }) }) })] }), _jsxs("div", { className: "ml-auto flex flex-wrap items-center gap-1", children: [_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "xs", className: "gap-1.5", children: [_jsx(FilterGlyph, { filter: filter, viewerId: viewerId, directory: directory }), filterLabel, _jsx(CaretDownIcon, { className: "size-3", "aria-hidden": true })] }) }), _jsx(DropdownMenuContent, { align: "end", className: "max-h-80 w-56 overflow-y-auto", children: _jsxs(DropdownMenuRadioGroup, { value: filter, onValueChange: (value) => setFilter(String(value)), children: [_jsxs(DropdownMenuRadioItem, { value: "all", children: [_jsx(FilterGlyph, { filter: "all", viewerId: viewerId, directory: directory }), t('filter.everyone')] }), viewerId ? (_jsxs(DropdownMenuRadioItem, { value: "me", children: [_jsx(FilterGlyph, { filter: "me", viewerId: viewerId, directory: directory }), t('filter.me')] })) : null, directory.people.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: t('people') }), directory.people
|
|
132
|
+
.filter((person) => person.user_id !== viewerId)
|
|
133
|
+
.map((person) => (_jsxs(DropdownMenuRadioItem, { value: `user:${person.user_id}`, children: [_jsx(FilterGlyph, { filter: `user:${person.user_id}`, viewerId: viewerId, directory: directory }), _jsx("span", { className: "truncate", children: personName(person, person.handle) })] }, person.user_id)))] })) : null, directory.agents.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: t('agents') }), directory.agents.map((agent) => (_jsxs(DropdownMenuRadioItem, { value: `agent:${agent}`, children: [_jsx(FilterGlyph, { filter: `agent:${agent}`, viewerId: viewerId, directory: directory }), _jsx("span", { className: "truncate", children: agentDisplayName(agent) })] }, agent)))] })) : null] }) })] }), _jsx(Tabs, { value: mode, onValueChange: (value) => switchMode(value), children: _jsxs(TabsList, { size: "xs", "aria-label": t('view'), children: [_jsx(TabsTrigger, { value: "week", children: t('week') }), _jsx(TabsTrigger, { value: "month", children: t('month') })] }) })] })] }), _jsx("div", { className: cn('min-h-0 flex-1 overflow-y-auto', mode === 'month' && 'border-border border-t'), children: items.isPending && !items.data ? (_jsx("div", { className: "flex flex-col gap-3 px-4 py-3 md:px-6", children: Array.from({ length: 5 }, (_, i) => (_jsx(Skeleton, { className: "h-20 w-full rounded-md" }, i))) })) : items.isError && !items.data ? (_jsx("div", { className: "px-4 py-6 md:px-6", children: _jsx(ErrorState, { size: "sm", title: t('loadFailed'), action: _jsx(Button, { variant: "outline", size: "sm", onClick: () => void items.refetch(), children: t('tryAgain') }) }) })) : mode === 'week' ? (_jsx(WeekView, { start: range.from, items: shownItems, fires: fires, directory: directory, selection: selection, now: now, onOpenItem: openItem, onOpenFire: openFireEntry, onMove: move, onAdd: (day) => setCreating((c) => ({ open: true, day, n: c.n + 1 })) })) : (_jsx(MonthView, { anchor: anchor, items: shownItems.filter((item) => itemDayKey(item) !== null), fires: fires, directory: directory, selection: selection, now: now, onOpenItem: openItem, onOpenFire: openFireEntry, onMove: move, onAdd: (day) => setCreating((c) => ({ open: true, day, n: c.n + 1 })), onShowDay: (day) => {
|
|
134
|
+
setMode('week');
|
|
135
|
+
setAnchor(weekStart(day));
|
|
136
|
+
} })) })] }), _jsx(SplitSheetContent, { className: "flex min-h-0 flex-col", children: selection?.kind === 'item' ? (_jsx(ItemPanel, { projectId: projectId, itemId: selection.id, directory: directory, onClose: close }, selection.id)) : openFire ? (_jsx(FirePanel, { projectId: projectId, fire: openFire, directory: directory }, openFire.id)) : null })] }), _jsx(NewItemModal, { projectId: projectId, open: creating.open, day: creating.day, directory: directory, onOpenChange: (open) => setCreating((current) => ({ ...current, open })), onCreated: (item) => {
|
|
137
|
+
const day = itemDayKey(item);
|
|
138
|
+
if (day) {
|
|
139
|
+
const { from, to } = viewRange(mode, anchor);
|
|
140
|
+
const at = parseDayKey(day);
|
|
141
|
+
if (at < from || at >= to)
|
|
142
|
+
setAnchor(mode === 'week' ? weekStart(at) : at);
|
|
143
|
+
}
|
|
144
|
+
openItem(item.item_id);
|
|
145
|
+
} }, creating.n)] }));
|
|
146
|
+
}
|
|
147
|
+
/** The face of a filter row: three people for everyone, else that person's avatar or that agent's mark. */
|
|
148
|
+
function FilterGlyph({ filter, viewerId, directory }) {
|
|
149
|
+
const who = filter.startsWith('agent:')
|
|
150
|
+
? { kind: 'agent', agent: filter.slice(6) }
|
|
151
|
+
: filter.startsWith('user:')
|
|
152
|
+
? { kind: 'person', user_id: filter.slice(5) }
|
|
153
|
+
: filter === 'me' && viewerId
|
|
154
|
+
? { kind: 'person', user_id: viewerId }
|
|
155
|
+
: null;
|
|
156
|
+
if (!who) {
|
|
157
|
+
// The avatars' box (`UserAvatar` xs), so every row's label starts at one edge.
|
|
158
|
+
return (_jsx("span", { className: "flex size-5 shrink-0 items-center justify-center", "aria-hidden": true, children: _jsx(UsersThreeIcon, { className: "size-4" }) }));
|
|
159
|
+
}
|
|
160
|
+
return _jsx(ParticipantMark, { who: who, directory: directory });
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* A deep link (`?item=` from a notification) to an item outside the shown
|
|
164
|
+
* window moves the view to the item's week, once per item. It reads the same
|
|
165
|
+
* cache entry as the panel.
|
|
166
|
+
*/
|
|
167
|
+
function useLinkedItemWeek(projectId, itemId, shown, show) {
|
|
168
|
+
const [handled, setHandled] = useState(null);
|
|
169
|
+
const detail = useWorkspaceCalendarItem(projectId, itemId).data?.item;
|
|
170
|
+
// Adjusting state while rendering: runs once per item, no effect.
|
|
171
|
+
if (itemId && handled !== itemId && detail?.item_id === itemId && shown) {
|
|
172
|
+
setHandled(itemId);
|
|
173
|
+
const day = itemDayKey(detail);
|
|
174
|
+
if (day && !shown.some((item) => item.item_id === itemId))
|
|
175
|
+
show(day);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type CalendarDirectory } from './calendar-people.js';
|
|
2
|
+
import { type ScheduledFire } from './calendar-scheduled.js';
|
|
3
|
+
export declare function ItemPanel({ projectId, itemId, directory, onClose, }: {
|
|
4
|
+
projectId: string;
|
|
5
|
+
itemId: string;
|
|
6
|
+
directory: CalendarDirectory;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export declare function FirePanel({ projectId, fire, directory }: {
|
|
10
|
+
projectId: string;
|
|
11
|
+
fire: ScheduledFire;
|
|
12
|
+
directory: CalendarDirectory;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
// The side panel: one calendar item (when, people, notes, comments) or one
|
|
4
|
+
// scheduled trigger or Loop (read only, with a link to Triggers).
|
|
5
|
+
import { ApiError } from '@kortix/sdk';
|
|
6
|
+
import { useWorkspaceCalendarActions, useWorkspaceCalendarItem } from '@kortix/sdk/react';
|
|
7
|
+
import { agentDisplayName } from '../../_vendor/kortix-shared.js';
|
|
8
|
+
import { ArrowSquareOutIcon, CheckCircleIcon, CircleIcon, DotsThreeIcon, TrashIcon } from '@phosphor-icons/react';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { describeCadence, describeEvery, describeOneOff } from '../../customize/triggers/schedule/schedule-copy.js';
|
|
11
|
+
import { useLocale, useTranslations } from '../../i18n/index.js';
|
|
12
|
+
import { adminPath, uiRoutes } from '../../lib/routes.js';
|
|
13
|
+
import { cn } from '../../lib/utils.js';
|
|
14
|
+
import { Button } from '../../primitives/button.js';
|
|
15
|
+
import { ConfirmDialog } from '../../primitives/confirm-dialog.js';
|
|
16
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '../../primitives/dropdown-menu.js';
|
|
17
|
+
import { ErrorState } from '../../primitives/error-state.js';
|
|
18
|
+
import { Skeleton } from '../../primitives/skeleton.js';
|
|
19
|
+
import { SplitSheetBody, SplitSheetHeader, SplitSheetTitle } from '../../primitives/split-sheet.js';
|
|
20
|
+
import { errorToast } from '../../primitives/toast.js';
|
|
21
|
+
import { UiLink } from '../../providers/ui-provider.js';
|
|
22
|
+
import { MentionText, PeoplePicker, Who } from './calendar-people.js';
|
|
23
|
+
import { WhenPicker } from './calendar-when.js';
|
|
24
|
+
import { everySeconds } from './calendar-scheduled.js';
|
|
25
|
+
import { MentionTextarea } from './mention-textarea.js';
|
|
26
|
+
function Row({ label, children }) {
|
|
27
|
+
return (_jsxs("div", { className: "grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-3", children: [_jsx("dt", { className: "text-muted-foreground text-xs", children: label }), _jsx("dd", { className: "min-w-0 text-sm", children: children })] }));
|
|
28
|
+
}
|
|
29
|
+
function useStamp() {
|
|
30
|
+
const locale = useLocale();
|
|
31
|
+
const format = new Intl.DateTimeFormat(locale, { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' });
|
|
32
|
+
return (iso) => format.format(new Date(iso));
|
|
33
|
+
}
|
|
34
|
+
export function ItemPanel({ projectId, itemId, directory, onClose, }) {
|
|
35
|
+
const t = useTranslations('calendar');
|
|
36
|
+
const stamp = useStamp();
|
|
37
|
+
const query = useWorkspaceCalendarItem(projectId, itemId);
|
|
38
|
+
const actions = useWorkspaceCalendarActions(projectId);
|
|
39
|
+
const [title, setTitle] = useState('');
|
|
40
|
+
const [notes, setNotes] = useState('');
|
|
41
|
+
const [comment, setComment] = useState('');
|
|
42
|
+
const [confirming, setConfirming] = useState(false);
|
|
43
|
+
const item = query.data?.item;
|
|
44
|
+
// The stored title and notes replace the drafts when they change on the server.
|
|
45
|
+
const stored = item ? `${item.title}\u0000${item.notes}` : null;
|
|
46
|
+
const [seen, setSeen] = useState(null);
|
|
47
|
+
if (item && stored !== seen) {
|
|
48
|
+
setSeen(stored);
|
|
49
|
+
setTitle(item.title);
|
|
50
|
+
setNotes(item.notes);
|
|
51
|
+
}
|
|
52
|
+
const save = (input) => actions.update.mutate({ itemId, input }, { onError: (error) => errorToast(error instanceof Error ? error.message : t('saveFailed')) });
|
|
53
|
+
if (query.isPending) {
|
|
54
|
+
return (_jsxs(SplitSheetBody, { className: "flex flex-col gap-3", children: [_jsx(Skeleton, { className: "h-7 w-2/3 rounded-md" }), _jsx(Skeleton, { className: "h-24 w-full rounded-md" })] }));
|
|
55
|
+
}
|
|
56
|
+
if (!item) {
|
|
57
|
+
const gone = query.error instanceof ApiError && query.error.status === 404;
|
|
58
|
+
return (_jsxs(_Fragment, { children: [_jsx(SplitSheetHeader, { closeLabel: t('close'), children: _jsx(SplitSheetTitle, { children: gone ? t('goneTitle') : t('itemLoadFailed') }) }), _jsx(SplitSheetBody, { children: gone ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('goneBody') })) : (_jsx(ErrorState, { size: "sm", title: t('itemLoadFailed'), action: _jsx(Button, { variant: "outline", size: "sm", onClick: () => void query.refetch(), children: t('tryAgain') }) })) })] }));
|
|
59
|
+
}
|
|
60
|
+
const done = item.status === 'done';
|
|
61
|
+
const comments = query.data?.comments ?? [];
|
|
62
|
+
const send = () => {
|
|
63
|
+
const body = comment.trim();
|
|
64
|
+
if (!body || actions.comment.isPending)
|
|
65
|
+
return;
|
|
66
|
+
actions.comment.mutate({ itemId, body }, {
|
|
67
|
+
onSuccess: () => setComment(''),
|
|
68
|
+
onError: (error) => errorToast(error instanceof Error ? error.message : t('commentFailed')),
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const author = item.created_by;
|
|
72
|
+
return (_jsxs(_Fragment, { children: [_jsxs(SplitSheetHeader, { closeLabel: t('close'), className: "items-center", children: [_jsx(SplitSheetTitle, { className: "sr-only", children: item.title }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsxs(Button, { variant: done ? 'outline' : 'default', size: "xs", className: "gap-1.5", "aria-busy": actions.update.isPending, disabled: actions.update.isPending, onClick: () => save({ status: done ? 'open' : 'done' }), children: [done ? _jsx(CircleIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }) : _jsx(CheckCircleIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }), done ? t('reopen') : t('markDone')] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": t('moreActions'), children: _jsx(DotsThreeIcon, { className: "size-4" }) }) }), _jsx(DropdownMenuContent, { align: "end", children: _jsxs(DropdownMenuItem, { variant: "destructive", onSelect: () => setConfirming(true), children: [_jsx(TrashIcon, { "aria-hidden": true }), t('delete')] }) })] })] })] }), _jsxs(SplitSheetBody, { className: "flex flex-col gap-6", children: [_jsx("textarea", { value: title, rows: 1, "aria-label": t('titleLabel'), maxLength: 200, onChange: (event) => setTitle(event.target.value.replace(/\n/g, ' ')), onBlur: () => {
|
|
73
|
+
const next = title.trim();
|
|
74
|
+
if (!next)
|
|
75
|
+
setTitle(item.title);
|
|
76
|
+
else if (next !== item.title)
|
|
77
|
+
save({ title: next });
|
|
78
|
+
}, onKeyDown: (event) => event.key === 'Enter' && (event.preventDefault(), event.currentTarget.blur()), className: cn('text-foreground focus-visible:ring-ring -mx-1 w-full resize-none rounded-sm bg-transparent px-1 text-lg font-medium outline-none [field-sizing:content] focus-visible:ring-2', done && 'text-muted-foreground line-through') }), _jsxs("dl", { className: "flex flex-col gap-1", children: [_jsx(Row, { label: t('when'), children: _jsx(WhenPicker, { value: { starts_at: item.starts_at, ends_at: item.ends_at, all_day: item.all_day }, onChange: (value) => save(value) }) }), _jsx(Row, { label: t('people'), children: _jsx(PeoplePicker, { value: item.people, directory: directory, onChange: (people) => save({ people: people.map((p) => (p.kind === 'person' ? { user_id: p.user_id } : { agent: p.agent })) }) }) }), _jsx(Row, { label: t('created'), children: _jsxs("span", { className: "text-muted-foreground inline-flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs", children: [_jsx("span", { className: "text-foreground text-sm", children: _jsx(Who, { who: author, directory: directory, unknown: t('formerMember') }) }), _jsx("span", { className: "tabular-nums", children: stamp(item.created_at) }), author.kind === 'agent' && author.session_id && uiRoutes().session ? (_jsxs(UiLink, { href: uiRoutes().session(projectId, author.session_id), className: "text-muted-foreground hover:text-foreground inline-flex items-center gap-0.5 underline-offset-4 hover:underline", children: [t('openSession'), _jsx(ArrowSquareOutIcon, { className: "size-3", "aria-hidden": true })] })) : null] }) })] }), _jsxs("section", { className: "flex flex-col gap-2", "aria-label": t('notes'), children: [_jsx("h3", { className: "text-muted-foreground text-xs", children: t('notes') }), _jsx(MentionTextarea, { value: notes, onChange: setNotes, directory: directory, ariaLabel: t('notes'), placeholder: t('notesPlaceholder'), minHeight: 72, onBlur: () => notes !== item.notes && save({ notes }) })] }), _jsxs("section", { className: "flex flex-col gap-3", "aria-label": t('commentsTitle'), children: [_jsx("h3", { className: "text-muted-foreground text-xs", children: t('commentsTitle') }), comments.length > 0 ? (_jsx("ul", { className: "flex flex-col gap-4", children: comments.map((entry) => (_jsxs("li", { className: "flex flex-col gap-1", children: [_jsxs("span", { className: "text-muted-foreground flex items-center gap-1.5 text-xs", children: [_jsx("span", { className: "text-foreground text-sm font-medium", children: _jsx(Who, { who: entry.author, directory: directory, unknown: t('formerMember') }) }), _jsx("span", { className: "tabular-nums", children: stamp(entry.created_at) })] }), _jsx("p", { className: "text-foreground text-sm whitespace-pre-wrap wrap-anywhere", children: _jsx(MentionText, { text: entry.body, directory: directory }) })] }, entry.comment_id))) })) : null, _jsx(MentionTextarea, { value: comment, onChange: setComment, directory: directory, ariaLabel: t('commentLabel'), placeholder: t('commentPlaceholder'), minHeight: 52, onSubmit: send }), _jsx("div", { className: "flex justify-end", children: _jsx(Button, { size: "sm", onClick: send, disabled: !comment.trim() || actions.comment.isPending, "aria-busy": actions.comment.isPending, children: t('comment') }) })] })] }), _jsx(ConfirmDialog, { open: confirming, onOpenChange: setConfirming, title: t('deleteTitle'), description: t('deleteBody', { title: item.title }), confirmLabel: t('delete'), confirmVariant: "destructive", isPending: actions.remove.isPending, onConfirm: () => actions.remove.mutate(itemId, {
|
|
79
|
+
onSuccess: () => {
|
|
80
|
+
setConfirming(false);
|
|
81
|
+
onClose();
|
|
82
|
+
},
|
|
83
|
+
onError: (error) => errorToast(error instanceof Error ? error.message : t('deleteFailed')),
|
|
84
|
+
}) })] }));
|
|
85
|
+
}
|
|
86
|
+
/** "Every day at 09:00", "Every 4 hours", "Once on …": the sentence the Triggers page shows. */
|
|
87
|
+
function scheduleSentence(source) {
|
|
88
|
+
if (source.at)
|
|
89
|
+
return describeOneOff(source.at);
|
|
90
|
+
const every = everySeconds(source.every);
|
|
91
|
+
if (every)
|
|
92
|
+
return describeEvery(every);
|
|
93
|
+
if (source.cron)
|
|
94
|
+
return describeCadence(source.cron.trim().split(/\s+/).length === 5 ? `0 ${source.cron}` : source.cron);
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
export function FirePanel({ projectId, fire, directory }) {
|
|
98
|
+
const t = useTranslations('calendar');
|
|
99
|
+
const stamp = useStamp();
|
|
100
|
+
const { trigger } = fire;
|
|
101
|
+
const loop = trigger.target.kind === 'session';
|
|
102
|
+
return (_jsxs(_Fragment, { children: [_jsx(SplitSheetHeader, { closeLabel: t('close'), children: _jsx(SplitSheetTitle, { className: "text-base font-medium", children: trigger.name || trigger.id }) }), _jsxs(SplitSheetBody, { className: "flex flex-col gap-6", children: [_jsxs("dl", { className: "flex flex-col gap-1", children: [_jsx(Row, { label: t('kind'), children: loop ? t('loop') : t('trigger') }), _jsx(Row, { label: t('target'), children: trigger.target.kind === 'session' ? (_jsx(UiLink, { href: uiRoutes().session(projectId, trigger.target.session_id), className: "hover:underline underline-offset-4", children: trigger.target.session_name || t('session') })) : trigger.target.kind === 'app' ? (trigger.target.app) : (_jsx(Who, { who: { kind: 'agent', agent: trigger.agent }, directory: directory, unknown: agentDisplayName(trigger.agent) })) }), _jsx(Row, { label: t('schedule'), children: _jsxs("span", { className: "flex flex-col", children: [_jsx("span", { children: scheduleSentence(trigger.source) }), trigger.source.cron ? (_jsxs("span", { className: "text-muted-foreground font-mono text-xs", children: [trigger.source.cron, " ", trigger.source.timezone ? `· ${trigger.source.timezone}` : ''] })) : null] }) }), _jsx(Row, { label: fire.past ? t('lastRun') : t('thisDay'), children: _jsxs("span", { className: "tabular-nums", children: [stamp(fire.at), fire.count > 1 ? ` · ${t('runs', { count: fire.count, capped: fire.capped ? 'yes' : 'no' })}` : '', fire.past ? ` · ${fire.failed ? t('failed') : t('succeeded')}` : ''] }) }), trigger.next_fire_at ? (_jsx(Row, { label: t('nextRun'), children: _jsx("span", { className: "tabular-nums", children: stamp(trigger.next_fire_at) }) })) : null] }), trigger.prompt ? (_jsxs("section", { className: "flex flex-col gap-2", "aria-label": t('prompt'), children: [_jsx("h3", { className: "text-muted-foreground text-xs", children: t('prompt') }), _jsx("p", { className: "text-foreground line-clamp-12 text-sm whitespace-pre-wrap wrap-anywhere", children: trigger.prompt })] })) : null, _jsx("div", { children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", className: "gap-1.5", children: _jsxs(UiLink, { href: adminPath(projectId, 'triggers'), children: [t('openTriggers'), _jsx(ArrowSquareOutIcon, { className: "size-3.5 shrink-0", "aria-hidden": true })] }) }) })] })] }));
|
|
103
|
+
}
|