@kortix/ui 0.16.0 → 0.16.2
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 +157 -51
- package/dist/_vendor/shared/index.d.ts +1 -0
- package/dist/_vendor/shared/space-icon.d.ts +30 -0
- package/dist/_vendor/shared/space-slug.d.ts +12 -0
- package/dist/access/access/access-dialog.js +2 -2
- package/dist/access/share-dialog.d.ts +77 -0
- package/dist/access/share-dialog.js +160 -0
- package/dist/access/sharing-picker.d.ts +8 -1
- package/dist/access/sharing-picker.js +2 -2
- package/dist/changes/change-list.js +3 -3
- package/dist/customize/connectors/catalog/catalog-paging.d.ts +1 -1
- package/dist/customize/connectors/catalog/catalog-paging.js +1 -1
- package/dist/customize/providers/provider-sheet.js +17 -7
- package/dist/customize/sections/component/manifest-copy-block.js +1 -1
- package/dist/customize/sections/component/section-wrapper.d.ts +1 -8
- package/dist/customize/sections/component/section-wrapper.js +3 -3
- package/dist/customize/sections/llm-provider/model-capability-icons.js +1 -1
- package/dist/customize/sections/view/gateway/generation-controls.js +1 -1
- package/dist/customize/sections/view/git-view.js +1 -1
- package/dist/customize/settings/settings-tabs.js +0 -5
- package/dist/customize/settings/tabs/general-tab.js +2 -2
- package/dist/customize/shared/capability-page-shell.d.ts +2 -2
- package/dist/customize/shared/capability-page-shell.js +7 -5
- package/dist/customize/shared/capability-scroll-root.js +1 -2
- package/dist/customize/shared/catalog/catalog-card.js +1 -1
- package/dist/files/project/components/change-requests-panel.js +2 -2
- package/dist/files/project/components/checkpoint-detail-dialog.js +4 -4
- package/dist/files/project/components/checkpoints-panel.js +2 -2
- package/dist/files/project/components/drive-explorer.js +2 -2
- package/dist/files/project/components/file-breadcrumbs.js +1 -1
- package/dist/files/project/components/file-history-popover.js +2 -2
- package/dist/files/project/components/file-thumbnail.js +1 -1
- package/dist/files/project/components/open-change-request-dialog.js +1 -1
- package/dist/files/renderers/mermaid/mermaid-diagram.js +2 -2
- package/dist/files/renderers/show-content-renderer.js +6 -6
- package/dist/files/renderers/sqlite-renderer.js +8 -8
- package/dist/files/renderers/zip/zip-renderer.js +2 -2
- package/dist/files/viewer/file-content-renderer.js +5 -5
- package/dist/files/viewer/json-tree-view.js +3 -3
- package/dist/i18n/en.d.ts +133 -8
- package/dist/i18n/en.js +170 -45
- package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +0 -3
- package/dist/internal/billing/use-cost-explorer.d.ts +9 -2
- package/dist/internal/billing/use-cost-explorer.js +22 -0
- package/dist/internal/billing/use-session-costs.d.ts +7 -2
- package/dist/internal/billing/use-session-costs.js +6 -0
- package/dist/internal/chrome/use-chrome-offered.d.ts +3 -3
- package/dist/internal/chrome/use-chrome-offered.js +3 -3
- package/dist/internal/components/nav-rail.d.ts +1 -20
- package/dist/internal/components/nav-rail.js +1 -15
- package/dist/internal/layout/project-page-header.d.ts +13 -9
- package/dist/internal/layout/project-page-header.js +14 -10
- package/dist/internal/lib/browser-noise/evidence.d.ts +2 -0
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +16 -1
- package/dist/internal/lib/error-handler.js +0 -9
- package/dist/internal/lib/interface-theme-defaults.js +2 -2
- package/dist/internal/lib/project-actions.d.ts +4 -5
- package/dist/internal/lib/project-actions.js +3 -5
- package/dist/internal/lib/project-preamble.d.ts +42 -4
- package/dist/internal/lib/project-preamble.js +49 -5
- package/dist/internal/lib/web-notifications.js +17 -29
- package/dist/internal/outcomes/outcome-vocabulary.js +1 -1
- package/dist/internal/stores/session-filter-store.d.ts +1 -1
- package/dist/internal/stores/user-preferences-store.d.ts +2 -2
- package/dist/internal/stores/workspace-settings-rail-store.d.ts +0 -8
- package/dist/internal/stores/workspace-settings-rail-store.js +0 -2
- package/dist/lib/routes.d.ts +7 -0
- package/dist/lib/routes.js +6 -1
- package/dist/markdown/doc-editor/doc-extensions.js +2 -0
- package/dist/markdown/doc-editor/doc-paste.d.ts +13 -0
- package/dist/markdown/doc-editor/doc-paste.js +67 -0
- package/dist/markdown/markdown-frontmatter.js +3 -3
- package/dist/markdown/markdown-policy.d.ts +1 -1
- package/dist/markdown/ordered-list.js +1 -1
- package/dist/primitives/context-menu.d.ts +1 -0
- package/dist/primitives/definition-list.js +1 -1
- package/dist/primitives/dropdown-menu.d.ts +1 -0
- package/dist/primitives/emoji-picker.js +1 -1
- package/dist/primitives/expandable-search.d.ts +57 -0
- package/dist/primitives/expandable-search.js +58 -0
- package/dist/primitives/favicon-avatar.js +1 -1
- package/dist/primitives/file-tree.d.ts +1 -1
- package/dist/primitives/file-tree.js +1 -1
- package/dist/primitives/glyph-picker.js +2 -2
- package/dist/primitives/input-group.js +1 -1
- package/dist/primitives/menu-base.d.ts +10 -0
- package/dist/primitives/menu-base.js +7 -2
- package/dist/primitives/phone-input.js +1 -1
- package/dist/primitives/profile-hover-card.d.ts +28 -0
- package/dist/primitives/profile-hover-card.js +22 -0
- package/dist/primitives/settings-section-header.d.ts +5 -5
- package/dist/primitives/settings-section-header.js +5 -5
- package/dist/primitives/sort-menu.d.ts +23 -0
- package/dist/primitives/sort-menu.js +54 -0
- package/dist/primitives/tabs.js +1 -1
- package/dist/primitives/toast-clearance.d.ts +12 -28
- package/dist/primitives/toast-clearance.js +23 -45
- package/dist/primitives/user-avatar.js +2 -3
- package/dist/session/agents/subagent-dialog-content.js +28 -70
- package/dist/session/composer/ComposerCard.d.ts +4 -1
- package/dist/session/composer/ComposerCard.js +51 -7
- package/dist/session/composer/composer-chat-input.js +3 -1
- package/dist/session/composer/composer-toolbar.d.ts +3 -1
- package/dist/session/composer/composer-toolbar.js +6 -2
- package/dist/session/composer/composer-underbar.d.ts +3 -1
- package/dist/session/composer/composer-underbar.js +2 -2
- package/dist/session/composer/composer.d.ts +12 -0
- package/dist/session/composer/composer.js +112 -6
- package/dist/session/composer/draft/composer-draft.d.ts +1 -0
- package/dist/session/composer/draft/composer-draft.js +10 -2
- package/dist/session/composer/draft/draft-uploads.js +13 -2
- package/dist/session/composer/draft/use-composer-draft.d.ts +2 -0
- package/dist/session/composer/draft/use-composer-draft.js +41 -6
- package/dist/session/composer/drive-mentions.d.ts +34 -0
- package/dist/session/composer/drive-mentions.js +98 -0
- package/dist/session/composer/editor/composer-editor.d.ts +3 -0
- package/dist/session/composer/editor/composer-editor.js +3 -1
- package/dist/session/composer/editor/serialize.js +3 -4
- package/dist/session/composer/menus/mention-controller.d.ts +3 -0
- package/dist/session/composer/menus/mention-controller.js +5 -0
- package/dist/session/composer/menus/mention-menu.d.ts +20 -3
- package/dist/session/composer/menus/mention-menu.js +33 -6
- package/dist/session/composer/menus/menu-items.d.ts +16 -1
- package/dist/session/composer/menus/menu-items.js +21 -1
- package/dist/session/composer/submit-latch.d.ts +3 -1
- package/dist/session/composer/submit-latch.js +5 -1
- package/dist/session/composer/types.d.ts +9 -2
- package/dist/session/header/session-changes-indicator.js +1 -1
- package/dist/session/header/session-site-header.js +2 -2
- package/dist/session/media/sandbox-url-detector.js +3 -3
- package/dist/session/models/model-connection-gate.d.ts +5 -0
- package/dist/session/models/model-connection-gate.js +12 -3
- package/dist/session/models/model-connection-layout.d.ts +7 -0
- package/dist/session/models/model-connection-layout.js +7 -0
- package/dist/session/models/provider-failure-recovery.js +1 -1
- package/dist/session/models/subscription-offer.d.ts +6 -5
- package/dist/session/models/subscription-offer.js +6 -6
- package/dist/session/panel/advanced/advanced-panel.js +1 -1
- package/dist/session/panel/session-detail-panel.js +1 -1
- package/dist/session/panel/session-diff-viewer.js +1 -1
- package/dist/session/panel/session-files-explorer.js +1 -1
- package/dist/session/panel/session-files-panel.js +3 -3
- package/dist/session/panel/shared/action-navigator.js +1 -1
- package/dist/session/status/provisioning-failure.d.ts +4 -4
- package/dist/session/status/provisioning-failure.js +4 -4
- package/dist/session/status/session-busy-indicator.js +1 -1
- package/dist/session/status/session-error-banner.js +6 -1
- package/dist/session/thread/mention-chip.d.ts +1 -1
- package/dist/session/thread/mention-segments.d.ts +4 -2
- package/dist/session/thread/mention-segments.js +28 -1
- package/dist/session/thread/message-parsing.d.ts +11 -0
- package/dist/session/thread/message-parsing.js +22 -3
- package/dist/session/thread/optimistic-turn.d.ts +4 -2
- package/dist/session/thread/optimistic-turn.js +13 -11
- package/dist/session/thread/session-chat.js +6 -1
- package/dist/session/thread/session-context-message-explorer.js +1 -1
- package/dist/session/thread/session-older-autoload.d.ts +2 -3
- package/dist/session/thread/session-older-autoload.js +2 -3
- package/dist/session/thread/transcript.js +8 -10
- package/dist/session/tool/shared/error-and-connector.js +1 -1
- package/dist/session/tool/shared/file-list.js +2 -2
- package/dist/session/tool/shared/infrastructure-parts.js +1 -1
- package/dist/session/tool/shared/infrastructure-preview.js +1 -1
- package/dist/session/tool/shared/infrastructure-row-header.js +3 -3
- package/dist/session/tool/shared/infrastructure-rows.js +2 -2
- package/dist/session/tool/shared/output-block.js +4 -4
- package/dist/session/tool/shared/session-helpers.js +3 -3
- package/dist/session/tool/shared/structured-output.js +3 -3
- package/dist/session/tool/shared/todo-helpers.js +1 -1
- package/dist/session/tool/tool-error.js +2 -2
- package/dist/session/tool/tools/agent-spawn-tool.js +3 -3
- package/dist/session/tool/tools/agent-status-tool.js +1 -1
- package/dist/session/tool/tools/apply-patch-tool.js +1 -1
- package/dist/session/tool/tools/connector-get-tool.js +1 -1
- package/dist/session/tool/tools/connector-list-tool.js +1 -1
- package/dist/session/tool/tools/connector-tools.js +1 -1
- package/dist/session/tool/tools/edit-tool.js +1 -1
- package/dist/session/tool/tools/get-mem-tool.js +1 -1
- package/dist/session/tool/tools/glob-tool.js +1 -1
- package/dist/session/tool/tools/image-search-tool.js +1 -1
- package/dist/session/tool/tools/memory-search-tool.js +1 -1
- package/dist/session/tool/tools/memory-tool.js +4 -4
- package/dist/session/tool/tools/presentation-gen-tool.js +2 -2
- package/dist/session/tool/tools/project-delete-tool.js +1 -1
- package/dist/session/tool/tools/project-list-tool.js +1 -1
- package/dist/session/tool/tools/pty-read-tool.js +1 -1
- package/dist/session/tool/tools/pty-spawn-tool.js +1 -1
- package/dist/session/tool/tools/pty-write-tool.js +1 -1
- package/dist/session/tool/tools/read-tool.js +1 -1
- package/dist/session/tool/tools/removed-connector-tool.js +1 -1
- package/dist/session/tool/tools/scrape-webpage-tool.js +1 -1
- package/dist/session/tool/tools/session-get-tool.js +3 -3
- package/dist/session/tool/tools/session-list-background-tool.js +1 -1
- package/dist/session/tool/tools/session-read-tool.js +1 -1
- package/dist/session/tool/tools/session-search-tool.js +1 -1
- package/dist/session/tool/tools/session-spawn-tool.js +1 -1
- package/dist/session/tool/tools/skill-tool.js +1 -1
- package/dist/session/tool/tools/todo-write-tool.js +1 -1
- package/dist/session/tool/tools/web-fetch-tool.js +1 -1
- package/dist/session/tool/tools/write-tool.js +1 -1
- package/dist/session/turn/activity-file-chips.js +7 -3
- package/dist/session/turn/activity-step.js +1 -1
- package/dist/session/turn/burst-summary-trigger.js +3 -3
- package/dist/session/turn/chain-step-trigger.js +1 -1
- package/dist/session/turn/plan-card.js +1 -1
- package/dist/session/turn/thought-chain-step.js +1 -1
- package/dist/session/turn/turn-work-accordion.js +1 -1
- package/dist/session/turn/user-message.js +13 -6
- package/dist/session/voice/use-call-card-position.d.ts +30 -0
- package/dist/session/voice/use-call-card-position.js +126 -0
- package/dist/session/voice/voice-call-card.js +10 -3
- package/dist/styles/theme.css +12 -0
- package/dist/styles/tokens.css +12 -6
- package/dist/styles.css +1 -1
- package/dist/terminal/session-terminal-panel.js +1 -1
- package/dist/test-utils/intl.d.ts +133 -8
- package/dist/workspace/admin/project-admin-dashboard.js +7 -24
- package/dist/workspace/calendar/calendar-page.js +1 -1
- package/dist/workspace/home/first-chat.d.ts +4 -3
- package/dist/workspace/home/first-chat.js +6 -6
- package/dist/workspace/home/welcome-body.js +2 -2
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/layout/project-home.js +11 -4
- package/dist/workspace/layout/use-project-home-send.d.ts +3 -1
- package/dist/workspace/layout/use-project-home-send.js +6 -2
- package/dist/workspace/memory/company-memory-page.js +2 -4
- package/dist/workspace/new/github-source.js +0 -1
- package/dist/workspace/new/new-workspace-form.d.ts +0 -1
- package/dist/workspace/new/new-workspace-form.js +0 -3
- package/dist/workspace/new/use-create-workspace.d.ts +1 -1
- package/dist/workspace/new/use-create-workspace.js +1 -2
- package/dist/workspace/session-spaces/space-detail-page.d.ts +35 -0
- package/dist/workspace/session-spaces/space-detail-page.js +307 -0
- package/dist/workspace/session-spaces/space-form-modal.d.ts +16 -0
- package/dist/workspace/session-spaces/space-form-modal.js +92 -0
- package/dist/workspace/session-spaces/space-icon.d.ts +36 -0
- package/dist/workspace/session-spaces/space-icon.js +52 -0
- package/dist/workspace/session-spaces/space-people.d.ts +51 -0
- package/dist/workspace/session-spaces/space-people.js +91 -0
- package/dist/workspace/session-spaces/space-picker.d.ts +11 -0
- package/dist/workspace/session-spaces/space-picker.js +42 -0
- package/dist/workspace/session-spaces/space-share-modal.d.ts +14 -0
- package/dist/workspace/session-spaces/space-share-modal.js +93 -0
- package/dist/workspace/session-spaces/spaces-page.d.ts +8 -0
- package/dist/workspace/session-spaces/spaces-page.js +125 -0
- package/dist/workspace/sessions/session-owner-filters.d.ts +2 -0
- package/dist/workspace/sessions/session-owner-filters.js +2 -0
- package/dist/workspace/setup/setup-banner.d.ts +4 -0
- package/dist/workspace/setup/setup-banner.js +57 -0
- package/dist/workspace/setup/setup-steps.d.ts +14 -0
- package/dist/workspace/setup/setup-steps.js +15 -0
- package/dist/workspace/setup/use-setup-steps.d.ts +18 -0
- package/dist/workspace/setup/use-setup-steps.js +57 -0
- package/dist/workspace/setup/workspace-setup-page.js +8 -41
- package/dist/workspace/sidebar/footer/project-artifacts-nav.js +1 -1
- package/dist/workspace/sidebar/footer/project-promo-cards.d.ts +7 -2
- package/dist/workspace/sidebar/footer/project-promo-cards.js +4 -3
- package/dist/workspace/sidebar/footer/project-sandbox-alert.js +1 -1
- package/dist/workspace/sidebar/footer/promo-card.d.ts +10 -1
- package/dist/workspace/sidebar/footer/promo-card.js +31 -2
- package/dist/workspace/sidebar/footer/sandbox-health.js +1 -1
- package/dist/workspace/sidebar/modal/session-people-picker.d.ts +13 -0
- package/dist/workspace/sidebar/modal/session-people-picker.js +72 -0
- package/dist/workspace/sidebar/modal/share-session-modal.js +2 -1
- package/dist/workspace/sidebar/project-nav-items.d.ts +1 -3
- package/dist/workspace/sidebar/project-nav-items.js +3 -8
- package/dist/workspace/sidebar/project-session-list.js +19 -12
- package/dist/workspace/sidebar/project-sidebar.js +13 -13
- package/dist/workspace/sidebar/project-spaces-nav.js +1 -2
- package/dist/workspace/sidebar/session-filter-menu.js +19 -13
- package/dist/workspace/sidebar/session-group-sections.d.ts +12 -12
- package/dist/workspace/sidebar/session-group-sections.js +56 -75
- package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
- package/dist/workspace/sidebar/workspace-settings-sidebar-nav.js +2 -2
- package/dist/workspace/spaces/space-tabs.d.ts +26 -6
- package/dist/workspace/spaces/space-tabs.js +19 -8
- package/package.json +27 -31
- package/skills/kortix-ui/references/modules.md +2 -2
- package/dist/workspace/new/clone-param.d.ts +0 -11
- package/dist/workspace/new/clone-param.js +0 -15
- package/dist/workspace/new/provision-new-workspace.d.ts +0 -14
- package/dist/workspace/new/provision-new-workspace.js +0 -14
- package/dist/workspace/sidebar/footer/project-inbox-nav.d.ts +0 -8
- package/dist/workspace/sidebar/footer/project-inbox-nav.js +0 -29
|
@@ -9,7 +9,6 @@ import { useTranslations } from '../../i18n/index.js';
|
|
|
9
9
|
import { HoverPrefetchLink } from '../../internal/components/hover-prefetch-link.js';
|
|
10
10
|
import { useIsMobile } from '../../internal/hooks/index.js';
|
|
11
11
|
import { reviewHref } from '../../internal/lib/capability-tab-routes.js';
|
|
12
|
-
import { ProjectInboxNavItem } from './footer/project-inbox-nav.js';
|
|
13
12
|
import { uiRoutes } from '../../lib/routes.js';
|
|
14
13
|
import { Button } from '../../primitives/button.js';
|
|
15
14
|
import { CountBadge } from '../../primitives/count-badge.js';
|
|
@@ -61,7 +60,7 @@ export function ProjectSpacesNav({ projectId }) {
|
|
|
61
60
|
const review = reviewHref(projectId);
|
|
62
61
|
const openAsks = useReviewNeedsYouCount(projectId);
|
|
63
62
|
const hrefOf = (space) => space.kind === 'dm' ? uiRoutes().dm(projectId, space.dm_agent_name ?? '') : uiRoutes().channel(projectId, space.slug ?? '');
|
|
64
|
-
return (_jsxs(FadedScrollArea, { fadeColor: "from-background", className: "h-full min-h-0", children: [_jsxs(SidebarMenu, { className: "gap-px", onKeyDown: moveFocus, children: [
|
|
63
|
+
return (_jsxs(FadedScrollArea, { fadeColor: "from-background", className: "h-full min-h-0", children: [_jsxs(SidebarMenu, { className: "gap-px", onKeyDown: moveFocus, children: [review ? (
|
|
65
64
|
// Spacing, not a rule, sets Review apart from the spaces.
|
|
66
65
|
_jsx(SidebarMenuItem, { className: "mb-2", children: _jsx(SidebarMenuButton, { asChild: true, isActive: isAt(pathname, review), className: "text-sidebar-foreground", children: _jsxs(HoverPrefetchLink, { href: review, children: [_jsx(CheckIcon, {}), _jsx("span", { className: "min-w-0 flex-1 truncate", children: t('spaces.review') }), openAsks > 0 ? _jsx(CountBadge, { count: openAsks, tone: "waiting" }) : null] }) }) })) : null, _jsx(SpaceRow, { projectId: projectId, space: personal, href: chatHref, active: isAt(pathname, chatHref) || isAt(pathname, uiRoutes().dm(projectId, MY_KORTIX_AGENT_NAME)), name: personalName, personal: true, isPrivate: true, names: names }), spaces.isError && !spaces.data ? (_jsxs("li", { className: "space-y-1.5 px-2 py-2", children: [_jsx("p", { className: "text-destructive/80 text-xs", children: t('spaces.loadError') }), _jsx(Button, { variant: "outline", size: "xs", onClick: () => spaces.refetch(), children: t('retry') })] })) : null, others.map((space) => {
|
|
67
66
|
const href = hrefOf(space);
|
|
@@ -13,7 +13,8 @@ import { SOURCE_ICONS } from './session-source-icons.js';
|
|
|
13
13
|
import { localizeUiCatalog } from '../../i18n/ui-catalog/localize-ui-catalog.js';
|
|
14
14
|
import { REMAINING_UI_TRANSLATION_KEYS } from '../../i18n/ui-catalog/remaining-ui-translation-keys.generated.js';
|
|
15
15
|
import { selectAccessFilters, selectGroupMode, selectHiddenSections, selectLabelFilters, selectOrderMode, selectOwnerFilters, selectSourceFilters, selectStatusFilters, useSessionFilterStore, } from '../../internal/stores/session-filter-store.js';
|
|
16
|
-
import { GlobeIcon, LockSimpleIcon, TagIcon, UsersIcon as UsersSolid } from '@phosphor-icons/react';
|
|
16
|
+
import { ArchiveIcon, ArrowSquareInIcon, ArrowsDownUpIcon, ArrowsInLineVerticalIcon, CircleDashedIcon, EyeIcon, GlobeIcon, ListBulletsIcon, LockSimpleIcon, SquaresFourIcon, TagIcon, TrashIcon, UserCircleIcon, UsersIcon as UsersSolid, } from '@phosphor-icons/react';
|
|
17
|
+
import { SessionStatusMark } from '../../session/list/session-status-mark.js';
|
|
17
18
|
import { CountBadge } from '../../primitives/count-badge.js';
|
|
18
19
|
import { groupSessions, localizedSessionGroupModes, localizedSessionOrderModes, } from './session-grouping.js';
|
|
19
20
|
/**
|
|
@@ -132,7 +133,9 @@ export function SessionFilterMenu({ projectId, sessions, align = 'start', side =
|
|
|
132
133
|
// Owner and Access are the page's facets: the page lists every session the
|
|
133
134
|
// viewer may open (for an account admin with session oversight, everyone's),
|
|
134
135
|
// while the sidebar is the viewer's own working set.
|
|
135
|
-
const pageFacets = surface
|
|
136
|
+
const pageFacets = surface !== 'sidebar';
|
|
137
|
+
// A space's list is one flat history: it is ordered and filtered, never grouped.
|
|
138
|
+
const grouped = surface !== 'space';
|
|
136
139
|
const ownerLabels = { you: t('ownerValue.you'), unknown: t('ownerValue.unknown') };
|
|
137
140
|
const setGroupMode = useSessionFilterStore((s) => s.setGroupMode);
|
|
138
141
|
const setOrderMode = useSessionFilterStore((s) => s.setOrderMode);
|
|
@@ -197,7 +200,8 @@ export function SessionFilterMenu({ projectId, sessions, align = 'start', side =
|
|
|
197
200
|
const pageFacetVisibility = pageFacets
|
|
198
201
|
? resolvePageFacetVisibility(sessions, activeOwners, activeAccess)
|
|
199
202
|
: { owner: false, access: false };
|
|
200
|
-
|
|
203
|
+
// A space always offers its members, even when one person started every session.
|
|
204
|
+
const showOwnerFacet = surface === 'space' ? ownerOptions.length > 0 : pageFacetVisibility.owner;
|
|
201
205
|
const showAccessFacet = pageFacetVisibility.access;
|
|
202
206
|
// Server-side facet: `sessions` already carry every selected label, so the
|
|
203
207
|
// options are the labels that co-occur with the current selection.
|
|
@@ -223,33 +227,35 @@ export function SessionFilterMenu({ projectId, sessions, align = 'start', side =
|
|
|
223
227
|
const hiddenSectionSet = new Set(hiddenSections);
|
|
224
228
|
const statusFilterSet = new Set(statusFilters);
|
|
225
229
|
const sourceFilterSet = new Set(sourceFilters);
|
|
226
|
-
return (_jsxs(DropdownMenuContent, { align: align, side: side, className: "w-56 p-1", children: [_jsx(FilterSubmenu, { trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('grouping') }), _jsx("span", { className: "text-muted-foreground truncate text-xs", children: groupLabel })] }), className: "w-40 p-1", children: _jsx(DropdownMenuRadioGroup, { value: groupMode, onValueChange: (value) => setGroupMode(projectId, value, surface), children: localizedGroupModes.map((mode) => (_jsx(FilterRadioItem, { value: mode.value, children: groupLabels[mode.value] }, mode.value))) }) }), _jsx(FilterSubmenu, { trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('ordering') }), _jsx("span", { className: "text-muted-foreground truncate text-xs", children: orderLabel })] }), className: "w-40 p-1", children: _jsx(DropdownMenuRadioGroup, { value: orderMode, onValueChange: (value) => setOrderMode(projectId, value, surface), children: localizedOrderModes.map((mode) => (_jsx(FilterRadioItem, { value: mode.value, children: orderLabels[mode.value] }, mode.value))) }) }), showOptions.length > 0 && (_jsx(FilterSubmenu, { trigger: _jsx(_Fragment, { children: _jsx("span", { className: "min-w-0 flex-1 truncate", children: t('show') }) }), className: "w-48 p-1", children: showOptions.map((option) => (_jsx(FilterCheckboxItem, { checked: !hiddenSectionSet.has(option.id), onCheckedChange: () => toggleSectionHidden(projectId, option.id, surface), children: sectionLabels[option.id] ?? option.label }, option.id))) })), showFiltersSection && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs("div", { className: "flex items-center justify-between gap-2 pr-1", children: [_jsx(DropdownMenuLabel, { className: "flex-1", children: t('filters') }), _jsx(DropdownMenuItem, { disabled: !hasActiveFacets, className: "text-muted-foreground w-auto shrink-0 cursor-pointer justify-end px-2 text-xs font-medium", onSelect: (event) => {
|
|
230
|
+
return (_jsxs(DropdownMenuContent, { align: align, side: side, className: "w-56 p-1", children: [grouped && (_jsx(FilterSubmenu, { icon: _jsx(SquaresFourIcon, {}), trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('grouping') }), _jsx("span", { className: "text-muted-foreground truncate text-xs", children: groupLabel })] }), className: "w-40 p-1", children: _jsx(DropdownMenuRadioGroup, { value: groupMode, onValueChange: (value) => setGroupMode(projectId, value, surface), children: localizedGroupModes.map((mode) => (_jsx(FilterRadioItem, { value: mode.value, children: groupLabels[mode.value] }, mode.value))) }) })), _jsx(FilterSubmenu, { icon: _jsx(ArrowsDownUpIcon, {}), trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('ordering') }), _jsx("span", { className: "text-muted-foreground truncate text-xs", children: orderLabel })] }), className: "w-40 p-1", children: _jsx(DropdownMenuRadioGroup, { value: orderMode, onValueChange: (value) => setOrderMode(projectId, value, surface), children: localizedOrderModes.map((mode) => (_jsx(FilterRadioItem, { value: mode.value, children: orderLabels[mode.value] }, mode.value))) }) }), grouped && showOptions.length > 0 && (_jsx(FilterSubmenu, { icon: _jsx(EyeIcon, {}), trigger: _jsx(_Fragment, { children: _jsx("span", { className: "min-w-0 flex-1 truncate", children: t('show') }) }), className: "w-48 p-1", children: showOptions.map((option) => (_jsx(FilterCheckboxItem, { checked: !hiddenSectionSet.has(option.id), onCheckedChange: () => toggleSectionHidden(projectId, option.id, surface), children: sectionLabels[option.id] ?? option.label }, option.id))) })), showFiltersSection && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs("div", { className: "flex items-center justify-between gap-2 pr-1", children: [_jsx(DropdownMenuLabel, { className: "flex-1", children: t('filters') }), _jsx(DropdownMenuItem, { disabled: !hasActiveFacets, className: "text-muted-foreground w-auto shrink-0 cursor-pointer justify-end px-2 text-xs font-medium", onSelect: (event) => {
|
|
227
231
|
// Reset stays legible without collapsing the menu the user is
|
|
228
232
|
// mid-adjustment in — same "stay open" contract as every
|
|
229
233
|
// checkbox row below.
|
|
230
234
|
event.preventDefault();
|
|
231
235
|
resetFilters(projectId, surface);
|
|
232
|
-
}, children: t('reset') })] }), statusOptions.length > 0 && (_jsx(FilterSubmenu, { trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('status') }), statusFilters.length > 0 && _jsx(FacetActiveDot, {})] }), className: "w-48 p-1", children: statusOptions.map((option) => (_jsxs(FilterCheckboxItem, { checked: statusFilterSet.has(option.value), onCheckedChange: () => toggleStatusFilter(projectId, option.value, surface), children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: statusLabels[option.value] }), _jsx(CountBadge, { count: option.count, className: "ml-auto" })] }, option.value))) })), sourceOptions.length > 0 && (_jsx(FilterSubmenu, { trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('source') }), sourceFilters.length > 0 && _jsx(FacetActiveDot, {})] }), className: "w-48 p-1", children: sourceOptions.map((option) => {
|
|
236
|
+
}, children: t('reset') })] }), statusOptions.length > 0 && (_jsx(FilterSubmenu, { icon: _jsx(CircleDashedIcon, {}), trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('status') }), statusFilters.length > 0 && _jsx(FacetActiveDot, {})] }), className: "w-48 p-1", children: statusOptions.map((option) => (_jsxs(FilterCheckboxItem, { checked: statusFilterSet.has(option.value), onCheckedChange: () => toggleStatusFilter(projectId, option.value, surface), children: [_jsx("span", { className: "flex size-4 shrink-0 items-center justify-center", children: _jsx(SessionStatusMark, { status: option.value }) }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: statusLabels[option.value] }), _jsx(CountBadge, { count: option.count, className: "ml-auto" })] }, option.value))) })), sourceOptions.length > 0 && (_jsx(FilterSubmenu, { icon: _jsx(ArrowSquareInIcon, {}), trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('source') }), sourceFilters.length > 0 && _jsx(FacetActiveDot, {})] }), className: "w-48 p-1", children: sourceOptions.map((option) => {
|
|
233
237
|
const OptionIcon = SOURCE_FILTER_ICONS[option.value];
|
|
234
238
|
return (_jsxs(FilterCheckboxItem, { checked: sourceFilterSet.has(option.value), onCheckedChange: () => toggleSourceFilter(projectId, option.value, surface), children: [_jsx(OptionIcon, { className: "size-4" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: sourceLabels[option.value] }), _jsx(CountBadge, { count: option.count, className: "ml-auto" })] }, option.value));
|
|
235
|
-
}) })), labelOptions.length > 0 && (_jsx(FilterSubmenu, { trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('labels') }), labelFilters.length > 0 && _jsx(FacetActiveDot, {})] }), className: "max-h-80 w-56 overflow-y-auto p-1", children: labelOptions.map((option) => (_jsxs(FilterCheckboxItem, { checked: labelFilterSet.has(option.value), onCheckedChange: () => toggleLabelFilter(projectId, option.value, surface), children: [_jsx(TagIcon, { className: "size-4" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: option.value }), _jsx(CountBadge, { count: option.count, className: "ml-auto" })] }, option.value))) })), showOwnerFacet && (_jsx(FilterSubmenu, { trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('owner') }), activeOwners.length > 0 && _jsx(FacetActiveDot, {})] }), className: "max-h-80 w-56 overflow-y-auto p-1", children: ownerOptions.map((option) => {
|
|
236
|
-
|
|
239
|
+
}) })), labelOptions.length > 0 && (_jsx(FilterSubmenu, { icon: _jsx(TagIcon, {}), trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('labels') }), labelFilters.length > 0 && _jsx(FacetActiveDot, {})] }), className: "max-h-80 w-56 overflow-y-auto p-1", children: labelOptions.map((option) => (_jsxs(FilterCheckboxItem, { checked: labelFilterSet.has(option.value), onCheckedChange: () => toggleLabelFilter(projectId, option.value, surface), children: [_jsx(TagIcon, { className: "size-4" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: option.value }), _jsx(CountBadge, { count: option.count, className: "ml-auto" })] }, option.value))) })), showOwnerFacet && (_jsx(FilterSubmenu, { icon: _jsx(UserCircleIcon, {}), trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: surface === 'space' ? t('members') : t('owner') }), activeOwners.length > 0 && _jsx(FacetActiveDot, {})] }), className: "max-h-80 w-56 overflow-y-auto p-1", children: ownerOptions.map((option) => {
|
|
240
|
+
// A space names everyone, the viewer included: its menu reads as a list of members.
|
|
241
|
+
const label = option.isViewer && surface !== 'space'
|
|
237
242
|
? t('ownerValue.you')
|
|
238
243
|
: option.value === UNKNOWN_OWNER_KEY
|
|
239
244
|
? t('ownerValue.unknown')
|
|
240
245
|
: (option.name ?? option.email ?? option.value);
|
|
241
|
-
return (_jsxs(FilterCheckboxItem, { checked: ownerFilterSet.has(option.value), onCheckedChange: () => toggleOwnerFilter(projectId, option.value, surface), children: [_jsx(UserAvatar, { size: "xs", name: option.name ?? undefined, email: option.email ?? '' }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: label }), _jsx(CountBadge, { count: option.count, className: "ml-auto" })] }, option.value));
|
|
242
|
-
}) })), showAccessFacet && (_jsx(FilterSubmenu, { trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('access') }), activeAccess.length > 0 && _jsx(FacetActiveDot, {})] }), className: "w-52 p-1", children: accessOptions.map((option) => {
|
|
246
|
+
return (_jsxs(FilterCheckboxItem, { checked: ownerFilterSet.has(option.value), onCheckedChange: () => toggleOwnerFilter(projectId, option.value, surface), children: [_jsx(UserAvatar, { size: "xs", name: option.name ?? undefined, email: option.email ?? '', avatarUrl: option.avatarUrl, colorKey: option.value }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: label }), _jsx(CountBadge, { count: option.count, className: "ml-auto" })] }, option.value));
|
|
247
|
+
}) })), showAccessFacet && (_jsx(FilterSubmenu, { icon: _jsx(LockSimpleIcon, {}), trigger: _jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: t('access') }), activeAccess.length > 0 && _jsx(FacetActiveDot, {})] }), className: "w-52 p-1", children: accessOptions.map((option) => {
|
|
243
248
|
const OptionIcon = SESSION_ACCESS_ICONS[option.value];
|
|
244
249
|
return (_jsxs(FilterCheckboxItem, { checked: accessFilterSet.has(option.value), onCheckedChange: () => toggleAccessFilter(projectId, option.value, surface), children: [_jsx(OptionIcon, { className: "size-4" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: accessLabels[option.value] }), _jsx(CountBadge, { count: option.count, className: "ml-auto" })] }, option.value));
|
|
245
|
-
}) }))
|
|
250
|
+
}) }))] })), grouped && _jsx(DropdownMenuSeparator, {}), grouped && (_jsxs(DropdownMenuItem, { className: "cursor-pointer", onSelect: () => collapseAllSections(projectId, resolveRenderedSectionIds(sessions, groupMode, orderMode, hiddenSections, tI18nComplete, reviewCountBySession, ownerLabels), surface), children: [_jsx(ArrowsInLineVerticalIcon, {}), t('collapseAll')] })), !pageFacets && sessionsHref && archivedHref && deletedHref && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { asChild: true, className: "cursor-pointer", children: _jsxs(Link, { href: sessionsHref, children: [_jsx(ListBulletsIcon, {}), tI18nComplete.raw('text78648d4d6649')] }) }), _jsx(DropdownMenuItem, { asChild: true, className: "cursor-pointer", children: _jsxs(Link, { href: archivedHref, children: [_jsx(ArchiveIcon, {}), tPinArchive('showArchived')] }) }), _jsx(DropdownMenuItem, { asChild: true, className: "cursor-pointer", children: _jsxs(Link, { href: deletedHref, children: [_jsx(TrashIcon, {}), tDeleted('view')] }) })] }))] }));
|
|
246
251
|
}
|
|
247
|
-
function FilterSubmenu({ trigger, className, children, }) {
|
|
248
|
-
return (_jsxs(DropdownMenuSub, { children: [
|
|
252
|
+
function FilterSubmenu({ icon, trigger, className, children, }) {
|
|
253
|
+
return (_jsxs(DropdownMenuSub, { children: [_jsxs(DropdownMenuSubTrigger, { children: [icon, trigger] }), _jsx(DropdownMenuSubContent, { className: className, children: children })] }));
|
|
249
254
|
}
|
|
250
255
|
function FilterRadioItem(props) {
|
|
251
256
|
return _jsx(DropdownMenuRadioItem, { ...props, onSelect: (event) => event.preventDefault() });
|
|
252
257
|
}
|
|
258
|
+
/** A multi-select row: a checkbox, since several can be on at once. */
|
|
253
259
|
function FilterCheckboxItem(props) {
|
|
254
|
-
return _jsx(DropdownMenuCheckboxItem, { ...props, onSelect: (event) => event.preventDefault() });
|
|
260
|
+
return _jsx(DropdownMenuCheckboxItem, { indicator: "checkbox", ...props, onSelect: (event) => event.preventDefault() });
|
|
255
261
|
}
|
|
@@ -15,7 +15,10 @@ import { type DragEvent, type ReactNode } from 'react';
|
|
|
15
15
|
export declare function markNewGroupFocus(): void;
|
|
16
16
|
/** `onCloseAutoFocus` of a menu with a "New group" item. */
|
|
17
17
|
export declare function keepFocusForNewGroup(event: Event): void;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* The sections-state id of one space. Spaces start collapsed: the id in the
|
|
20
|
+
* set means the space is open (unlike Pinned and Sessions, where it means closed).
|
|
21
|
+
*/
|
|
19
22
|
export declare function sessionGroupSectionId(groupId: string): string;
|
|
20
23
|
/** `onDragStart` of a session row: the row's link drag also carries the session id. */
|
|
21
24
|
export declare function startSessionDrag(event: DragEvent, sessionId: string): void;
|
|
@@ -27,17 +30,6 @@ export declare function useSessionGroupActions(projectId: string, groups: readon
|
|
|
27
30
|
}) => Promise<void>;
|
|
28
31
|
reorder: (groupIds: string[] | null) => Promise<void>;
|
|
29
32
|
};
|
|
30
|
-
/**
|
|
31
|
-
* Rename a group (a new group is named in place, `NewSessionGroupRow`). A
|
|
32
|
-
* taken name shows in the dialog; the dialog closes with a toast once the
|
|
33
|
-
* list holds the change.
|
|
34
|
-
*/
|
|
35
|
-
export declare function SessionGroupNameModal({ projectId, group, open, onOpenChange, }: {
|
|
36
|
-
projectId: string;
|
|
37
|
-
group: ProjectSessionGroup | null;
|
|
38
|
-
open: boolean;
|
|
39
|
-
onOpenChange: (open: boolean) => void;
|
|
40
|
-
}): import("react").JSX.Element;
|
|
41
33
|
/** `base`, or `base 2`, `base 3`…: the first name no group of the project has (names are unique per project). */
|
|
42
34
|
export declare function nextSessionGroupName(groups: readonly ProjectSessionGroup[], base: string): string;
|
|
43
35
|
/**
|
|
@@ -51,6 +43,14 @@ export declare function NewSessionGroupRow({ projectId, defaultName, onDone, }:
|
|
|
51
43
|
defaultName: string;
|
|
52
44
|
onDone: (group: ProjectSessionGroup | null) => void;
|
|
53
45
|
}): import("react").JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* The Spaces heading over the spaces: its label opens the Spaces page, its "+"
|
|
48
|
+
* (on hover) names a new space in place, like the Sessions header's controls.
|
|
49
|
+
*/
|
|
50
|
+
export declare function SpacesHeading({ projectId, onNew }: {
|
|
51
|
+
projectId: string;
|
|
52
|
+
onNew: () => void;
|
|
53
|
+
}): import("react").JSX.Element;
|
|
54
54
|
interface SessionGroupSectionsProps {
|
|
55
55
|
projectId: string;
|
|
56
56
|
groups: readonly ProjectSessionGroup[];
|
|
@@ -12,9 +12,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
12
12
|
* down. Dragging a row onto the rest of the list takes it out of its group.
|
|
13
13
|
*/
|
|
14
14
|
import { ApiError } from '@kortix/sdk';
|
|
15
|
-
import { findCachedProjectSession, useCreateProjectSessionGroup, useDeleteProjectSessionGroup, useProjectSessions,
|
|
15
|
+
import { findCachedProjectSession, useCreateProjectSessionGroup, useDeleteProjectSessionGroup, useProjectSessions, useReorderProjectSessionGroups, useSetProjectSessionGroup, } from '@kortix/sdk/react';
|
|
16
16
|
import { useQueryClient } from '@tanstack/react-query';
|
|
17
|
-
import { ArrowDownIcon, ArrowUpIcon, ArrowsInLineVerticalIcon, DotsThreeIcon, PencilSimpleIcon, PlusIcon, TrashIcon, } from '@phosphor-icons/react';
|
|
17
|
+
import { ArrowDownIcon, ArrowUpIcon, ArrowsInLineVerticalIcon, DotsThreeIcon, PencilSimpleIcon, PlusIcon, StackIcon, TrashIcon, } from '@phosphor-icons/react';
|
|
18
18
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
19
19
|
import { useTranslations } from '../../i18n/index.js';
|
|
20
20
|
import { cn } from '../../internal/lib/utils.js';
|
|
@@ -22,13 +22,14 @@ import { Button } from '../../primitives/button.js';
|
|
|
22
22
|
import { ConfirmDialog } from '../../primitives/confirm-dialog.js';
|
|
23
23
|
import { Disclosure, DisclosureContent, DisclosureTrigger } from '../../primitives/disclosure.js';
|
|
24
24
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from '../../primitives/dropdown-menu.js';
|
|
25
|
-
import
|
|
26
|
-
import Loading from '../../primitives/loading.js';
|
|
27
|
-
import { Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalTitle, } from '../../primitives/modal.js';
|
|
25
|
+
import Hint from '../../primitives/hint.js';
|
|
28
26
|
import { errorToast, successToast } from '../../primitives/toast.js';
|
|
29
27
|
import { moveGroupBy, moveGroupTo } from './session-group-order.js';
|
|
28
|
+
import { SpaceIconBare } from '../session-spaces/space-icon.js';
|
|
30
29
|
import { SESSION_MENU_TRIGGER_CLASS, SESSION_ROW_HEIGHT_CLASS, SIDEBAR_PAGE_SIZE, ShowMoreButton, } from '../../session/list/session-list-chrome.js';
|
|
31
30
|
import { CaretRightSolidIcon } from '../../icons/caret-right-solid.js';
|
|
31
|
+
import { uiRoutes } from '../../lib/routes.js';
|
|
32
|
+
import { UiLink, useUiPathname, useUiRouter } from '../../providers/ui-provider.js';
|
|
32
33
|
/** A dragged session row carries its id under this type. */
|
|
33
34
|
const SESSION_DRAG_TYPE = 'application/x-kortix-session';
|
|
34
35
|
/** A dragged group header carries its id under this type. */
|
|
@@ -61,7 +62,10 @@ export function keepFocusForNewGroup(event) {
|
|
|
61
62
|
}
|
|
62
63
|
/** Keeps a click or key inside a group's menu or dialog (portals bubble through React) off the header's toggle. */
|
|
63
64
|
const stopAtMenu = (event) => event.stopPropagation();
|
|
64
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* The sections-state id of one space. Spaces start collapsed: the id in the
|
|
67
|
+
* set means the space is open (unlike Pinned and Sessions, where it means closed).
|
|
68
|
+
*/
|
|
65
69
|
export function sessionGroupSectionId(groupId) {
|
|
66
70
|
return `group:${groupId}`;
|
|
67
71
|
}
|
|
@@ -150,53 +154,6 @@ export function useSessionGroupActions(projectId, groups) {
|
|
|
150
154
|
};
|
|
151
155
|
}, [file, reorder, groups, t, queryClient, projectId]);
|
|
152
156
|
}
|
|
153
|
-
/**
|
|
154
|
-
* Rename a group (a new group is named in place, `NewSessionGroupRow`). A
|
|
155
|
-
* taken name shows in the dialog; the dialog closes with a toast once the
|
|
156
|
-
* list holds the change.
|
|
157
|
-
*/
|
|
158
|
-
export function SessionGroupNameModal({ projectId, group, open, onOpenChange, }) {
|
|
159
|
-
const t = useTranslations('sidebar.sessionGroups');
|
|
160
|
-
const rename = useRenameProjectSessionGroup(projectId);
|
|
161
|
-
const [value, setValue] = useState('');
|
|
162
|
-
const [problem, setProblem] = useState(null);
|
|
163
|
-
const [syncedFor, setSyncedFor] = useState([open, group?.group_id ?? null]);
|
|
164
|
-
if (syncedFor[0] !== open || syncedFor[1] !== (group?.group_id ?? null)) {
|
|
165
|
-
setSyncedFor([open, group?.group_id ?? null]);
|
|
166
|
-
if (open) {
|
|
167
|
-
setValue(group?.name ?? '');
|
|
168
|
-
setProblem(null);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
const pending = rename.isPending;
|
|
172
|
-
const name = value.trim();
|
|
173
|
-
const unchanged = group !== null && name === group.name;
|
|
174
|
-
const submit = async () => {
|
|
175
|
-
if (!group || !name || unchanged || pending)
|
|
176
|
-
return;
|
|
177
|
-
setProblem(null);
|
|
178
|
-
try {
|
|
179
|
-
await rename.mutateAsync({ groupId: group.group_id, name });
|
|
180
|
-
successToast(t('renamed'));
|
|
181
|
-
onOpenChange(false);
|
|
182
|
-
}
|
|
183
|
-
catch (error) {
|
|
184
|
-
const code = error instanceof ApiError ? error.code : undefined;
|
|
185
|
-
setProblem(code === 'group_name_taken' ? t('nameTaken') : t('renameFailed'));
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
return (_jsx(Modal, { open: open, onOpenChange: (next) => !pending && onOpenChange(next), children: _jsxs(ModalContent, { className: "lg:max-w-md", children: [_jsx(ModalHeader, { children: _jsx(ModalTitle, { children: t('rename') }) }), _jsxs(ModalBody, { className: "space-y-2", children: [_jsx(Input, { autoFocus: true, value: value, maxLength: GROUP_NAME_MAX, placeholder: t('namePlaceholder'), "aria-label": t('namePlaceholder'), "aria-invalid": problem ? true : undefined, onChange: (event) => {
|
|
189
|
-
setValue(event.target.value);
|
|
190
|
-
setProblem(null);
|
|
191
|
-
}, onKeyDown: (event) => {
|
|
192
|
-
if (event.nativeEvent.isComposing)
|
|
193
|
-
return;
|
|
194
|
-
if (event.key === 'Enter') {
|
|
195
|
-
event.preventDefault();
|
|
196
|
-
void submit();
|
|
197
|
-
}
|
|
198
|
-
} }), problem ? (_jsx("p", { className: "text-destructive text-xs", role: "alert", children: problem })) : null] }), _jsxs(ModalFooter, { className: "sm:justify-between", children: [_jsx(Button, { variant: "outline-ghost", size: "sm", className: "w-full sm:w-auto", onClick: () => onOpenChange(false), disabled: pending, children: t('cancel') }), _jsxs(Button, { size: "sm", className: "w-full sm:w-auto", onClick: () => void submit(), disabled: !name || unchanged || pending, children: [pending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, t('save')] })] })] }) }));
|
|
199
|
-
}
|
|
200
157
|
/** `base`, or `base 2`, `base 3`…: the first name no group of the project has (names are unique per project). */
|
|
201
158
|
export function nextSessionGroupName(groups, base) {
|
|
202
159
|
const taken = new Set(groups.map((group) => group.name.toLowerCase()));
|
|
@@ -268,6 +225,19 @@ export function NewSessionGroupRow({ projectId, defaultName, onDone, }) {
|
|
|
268
225
|
}
|
|
269
226
|
}, className: "border-input bg-background text-sidebar-foreground placeholder:text-muted-foreground focus-visible:border-ring h-7 w-full min-w-0 rounded-md border px-1.5 text-sm font-medium outline-none" }) }), _jsx("p", { className: "text-muted-foreground flex h-8 items-center px-2 text-xs", children: _jsx("span", { className: "truncate", children: t('empty') }) })] }));
|
|
270
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* The Spaces heading over the spaces: its label opens the Spaces page, its "+"
|
|
230
|
+
* (on hover) names a new space in place, like the Sessions header's controls.
|
|
231
|
+
*/
|
|
232
|
+
export function SpacesHeading({ projectId, onNew }) {
|
|
233
|
+
const tGroups = useTranslations('sidebar.sessionGroups');
|
|
234
|
+
const href = uiRoutes().sessionSpaces?.(projectId) ?? null;
|
|
235
|
+
const label = 'text-muted-foreground group-hover/spaces-header:text-sidebar-foreground min-w-0 flex-1 truncate text-sm font-medium';
|
|
236
|
+
return (_jsxs("div", { className: cn('group/spaces-header hover:bg-sidebar-row flex items-center gap-1 rounded-md px-2 transition-colors', SESSION_ROW_HEIGHT_CLASS), children: [href ? (_jsx(Hint, { label: tGroups('allSpaces'), side: "right", children: _jsx(UiLink, { href: href, prefetch: false, className: cn(label, 'self-stretch leading-8 focus-visible:outline-none'), children: tGroups('heading') }) })) : (_jsx("span", { className: label, children: tGroups('heading') })), _jsx(Hint, { label: tGroups('newGroup'), side: "right", children: _jsx(Button, { variant: "ghost", size: "icon-xs", type: "button", "aria-label": tGroups('newGroup'), onClick: () => {
|
|
237
|
+
markNewGroupFocus();
|
|
238
|
+
onNew();
|
|
239
|
+
}, className: cn(SESSION_MENU_TRIGGER_CLASS, 'relative opacity-0 before:absolute before:-inset-1', 'group-hover/spaces-header:opacity-100 focus-visible:opacity-100'), children: _jsx(PlusIcon, { className: "size-4" }) }) })] }));
|
|
240
|
+
}
|
|
271
241
|
/** Every group of the project, in order. */
|
|
272
242
|
export function SessionGroupSections({ groups, ...rest }) {
|
|
273
243
|
const groupIds = groups.map((group) => group.group_id);
|
|
@@ -277,7 +247,11 @@ function SessionGroupSection({ projectId, group, groupIds, labels, collapsedSect
|
|
|
277
247
|
const t = useTranslations('sidebar');
|
|
278
248
|
const tGroups = useTranslations('sidebar.sessionGroups');
|
|
279
249
|
const sectionId = sessionGroupSectionId(group.group_id);
|
|
280
|
-
const open =
|
|
250
|
+
const open = collapsedSectionIds.has(sectionId);
|
|
251
|
+
const spaceHref = uiRoutes().sessionSpace?.(projectId, group.group_id) ?? null;
|
|
252
|
+
// The space whose page is open reads as the current row, as a nav row does.
|
|
253
|
+
const pathname = useUiPathname();
|
|
254
|
+
const current = !!spaceHref && !!pathname && pathname.endsWith(spaceHref);
|
|
281
255
|
// Any starter and any depth, like Pinned: a session is in a group because
|
|
282
256
|
// someone put it there. Loaded only while the group is open.
|
|
283
257
|
const query = useProjectSessions(projectId, {
|
|
@@ -285,8 +259,9 @@ function SessionGroupSection({ projectId, group, groupIds, labels, collapsedSect
|
|
|
285
259
|
labels,
|
|
286
260
|
limit: SIDEBAR_PAGE_SIZE,
|
|
287
261
|
enabled: open,
|
|
288
|
-
// No focus refetch: a
|
|
289
|
-
//
|
|
262
|
+
// No focus refetch: a project with dozens of open groups would refetch
|
|
263
|
+
// every one of them. A session started in a space refetches these lists
|
|
264
|
+
// itself (`use-project-home-send.ts`).
|
|
290
265
|
refetchOnWindowFocus: false,
|
|
291
266
|
});
|
|
292
267
|
// A pinned row shows under Pinned only. The `group_id` check drops a row the
|
|
@@ -297,23 +272,21 @@ function SessionGroupSection({ projectId, group, groupIds, labels, collapsedSect
|
|
|
297
272
|
onDropSession: (sessionId) => void actions.move(sessionId, group.group_id),
|
|
298
273
|
onDropGroup: (groupId) => void actions.reorder(moveGroupTo(groupIds, groupId, index)),
|
|
299
274
|
});
|
|
300
|
-
return (_jsx("div", { ...drop.props, "data-session-group": group.group_id, children: _jsxs(Disclosure, { open: open, onOpenChange: () => onToggleSection(sectionId), className: "group/section space-y-1", transition: { duration: 0.15, ease: 'easeOut' }, children: [
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
// Always shown: the caret is what tells a group from a date header.
|
|
316
|
-
className: "duration-normal size-4 shrink-0 transition-transform ease-out group-data-[state=open]/section:rotate-90" }), _jsx(SessionGroupMenu, { group: group, onRename: () => onRename(group), onNewGroup: onNewGroup, onCollapseOthers: groupIds.length > 1 ? () => onCollapseOthers(group.group_id) : null, onMoveUp: moveGroupBy(groupIds, group.group_id, -1), onMoveDown: moveGroupBy(groupIds, group.group_id, 1), onReorder: (ids) => void actions.reorder(ids), projectId: projectId })] }) }), _jsxs(DisclosureContent, { contentClassName: "space-y-px", children: [rows.map(renderNode), query.data !== undefined && rows.length === 0 && !query.hasNextPage ? (
|
|
275
|
+
return (_jsx("div", { ...drop.props, "data-session-group": group.group_id, children: _jsxs(Disclosure, { open: open, onOpenChange: () => onToggleSection(sectionId), className: "group/section space-y-1", transition: { duration: 0.15, ease: 'easeOut' }, children: [_jsxs("div", { draggable: true, onDragStart: (event) => {
|
|
276
|
+
event.dataTransfer.setData(GROUP_DRAG_TYPE, group.group_id);
|
|
277
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
278
|
+
draggingGroupId = group.group_id;
|
|
279
|
+
}, onDragEnd: () => {
|
|
280
|
+
draggingGroupId = null;
|
|
281
|
+
}, className: cn(
|
|
282
|
+
// A space reads like a nav row (Inbox, Drive): a 16px glyph slot, then its name, which opens the space.
|
|
283
|
+
// The glyph turns into the caret on hover; the caret folds the space's sessions under it.
|
|
284
|
+
'group/section-header text-sidebar-foreground/80 hover:bg-sidebar-row hover:text-sidebar-foreground relative flex items-center gap-2 rounded-md px-2 text-sm', SESSION_ROW_HEIGHT_CLASS, current && 'bg-active text-sidebar-accent-foreground font-medium hover:bg-active', drop.over === 'session' && 'bg-sidebar-row text-sidebar-foreground',
|
|
285
|
+
// A group dropped here takes this place: a line marks the side it
|
|
286
|
+
// lands on (below this group when it comes from above).
|
|
287
|
+
drop.over === 'group' &&
|
|
288
|
+
'before:bg-foreground/40 before:absolute before:inset-x-2 before:h-0.5 before:rounded-full', drop.over === 'group' &&
|
|
289
|
+
(groupIds.indexOf(draggingGroupId ?? '') < index ? 'before:bottom-0' : 'before:top-0')), children: [_jsx(DisclosureTrigger, { children: _jsxs("button", { type: "button", "aria-label": `${open ? tGroups('hideSessions') : tGroups('showSessions')}: ${group.name}`, className: "text-muted-foreground hover:text-sidebar-foreground hit-area-1.5 flex size-4 shrink-0 items-center justify-center rounded-sm", children: [_jsx(SpaceIconBare, { space: group, className: "-mx-0.5 size-5 group-hover/section-header:hidden group-focus-within/section-header:hidden" }), _jsx(CaretRightSolidIcon, { "aria-hidden": true, className: "duration-normal hidden size-4 transition-transform ease-out group-hover/section-header:block group-focus-within/section-header:block group-data-[state=open]/section:rotate-90" })] }) }), spaceHref ? (_jsx(UiLink, { href: spaceHref, prefetch: false, "aria-current": current ? 'page' : undefined, className: "min-w-0 flex-1 truncate self-stretch leading-8 first-letter:uppercase focus-visible:outline-none", children: group.name })) : (_jsx("span", { className: "min-w-0 flex-1 truncate first-letter:uppercase", children: group.name })), _jsx(SessionGroupMenu, { group: group, onRename: () => onRename(group), onNewGroup: onNewGroup, onCollapseOthers: groupIds.length > 1 ? () => onCollapseOthers(group.group_id) : null, onMoveUp: moveGroupBy(groupIds, group.group_id, -1), onMoveDown: moveGroupBy(groupIds, group.group_id, 1), onReorder: (ids) => void actions.reorder(ids), projectId: projectId })] }), _jsxs(DisclosureContent, { contentClassName: "space-y-px pl-4", children: [rows.map(renderNode), query.data !== undefined && rows.length === 0 && !query.hasNextPage ? (
|
|
317
290
|
// Aligned to the name's x (px-2), one row tall.
|
|
318
291
|
_jsx("p", { className: "text-muted-foreground flex h-8 items-center px-2 text-xs", children: _jsx("span", { className: "truncate", children: tGroups('empty') }) })) : null, query.hasNextPage && (_jsx(ShowMoreButton, { loading: query.isFetchingNextPage, failed: query.isFetchNextPageError, label: t('loadMore'), onClick: () => query.fetchNextPage() }))] })] }) }));
|
|
319
292
|
}
|
|
@@ -325,6 +298,9 @@ function SessionGroupSection({ projectId, group, groupIds, labels, collapsedSect
|
|
|
325
298
|
*/
|
|
326
299
|
function SessionGroupMenu({ projectId, group, onRename, onNewGroup, onCollapseOthers, onMoveUp, onMoveDown, onReorder, }) {
|
|
327
300
|
const tGroups = useTranslations('sidebar.sessionGroups');
|
|
301
|
+
const router = useUiRouter();
|
|
302
|
+
const spaceHref = uiRoutes().sessionSpace?.(projectId, group.group_id) ?? null;
|
|
303
|
+
const pathname = useUiPathname();
|
|
328
304
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
329
305
|
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
330
306
|
const remove = useDeleteProjectSessionGroup(projectId);
|
|
@@ -333,14 +309,19 @@ function SessionGroupMenu({ projectId, group, onRename, onNewGroup, onCollapseOt
|
|
|
333
309
|
requestAnimationFrame(fn);
|
|
334
310
|
};
|
|
335
311
|
return (
|
|
336
|
-
// `contents`: the trigger stays a flex item of the header
|
|
337
|
-
_jsxs("span", { className: "contents", onClick: stopAtMenu, onKeyDown: stopAtMenu, children: [_jsxs(DropdownMenu, { open: menuOpen, onOpenChange: setMenuOpen, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-xs", type: "button", "aria-label": `${tGroups('groupOptions')}: ${group.name}`, className: cn(SESSION_MENU_TRIGGER_CLASS, 'relative
|
|
312
|
+
// `contents`: the trigger stays a flex item of the header, after the name.
|
|
313
|
+
_jsxs("span", { className: "contents", onClick: stopAtMenu, onKeyDown: stopAtMenu, children: [_jsxs(DropdownMenu, { open: menuOpen, onOpenChange: setMenuOpen, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-xs", type: "button", "aria-label": `${tGroups('groupOptions')}: ${group.name}`, className: cn(SESSION_MENU_TRIGGER_CLASS, 'relative opacity-0', 'before:absolute before:-inset-1', 'group-hover/section-header:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100'), children: _jsx(DotsThreeIcon, { className: "size-4" }) }) }), _jsxs(DropdownMenuContent, { align: "start", side: "right", className: "w-44", onCloseAutoFocus: keepFocusForNewGroup, children: [spaceHref ? (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { className: "cursor-pointer", onSelect: () => router.push(spaceHref), children: [_jsx(StackIcon, {}), tGroups('openSpace')] }), _jsx(DropdownMenuSeparator, {})] })) : null, _jsxs(DropdownMenuItem, { className: "cursor-pointer", onSelect: () => {
|
|
338
314
|
markNewGroupFocus();
|
|
339
315
|
afterClose(onNewGroup);
|
|
340
316
|
}, children: [_jsx(PlusIcon, {}), tGroups('newGroup')] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { className: "cursor-pointer", onSelect: () => afterClose(onRename), children: [_jsx(PencilSimpleIcon, {}), tGroups('rename')] }), _jsxs(DropdownMenuItem, { className: "cursor-pointer", disabled: !onMoveUp, onSelect: () => onMoveUp && onReorder(onMoveUp), children: [_jsx(ArrowUpIcon, {}), tGroups('moveUp')] }), _jsxs(DropdownMenuItem, { className: "cursor-pointer", disabled: !onMoveDown, onSelect: () => onMoveDown && onReorder(onMoveDown), children: [_jsx(ArrowDownIcon, {}), tGroups('moveDown')] }), onCollapseOthers ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { className: "cursor-pointer", onSelect: onCollapseOthers, children: [_jsx(ArrowsInLineVerticalIcon, {}), tGroups('collapseOthers')] })] })) : null, _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { className: "cursor-pointer", variant: "destructive", onSelect: () => afterClose(() => setConfirmOpen(true)), children: [_jsx(TrashIcon, {}), tGroups('delete')] })] })] }), _jsx(ConfirmDialog, { open: confirmOpen, onOpenChange: setConfirmOpen, title: tGroups('deleteTitle'), description: tGroups('deleteDescription', { name: group.name }), confirmLabel: tGroups('delete'), cancelLabel: tGroups('cancel'), confirmVariant: "destructive", isPending: remove.isPending, onConfirm: () => remove.mutate(group.group_id, {
|
|
341
317
|
onSuccess: () => {
|
|
342
318
|
setConfirmOpen(false);
|
|
343
319
|
successToast(tGroups('deleted'));
|
|
320
|
+
// Deleting the space you are looking at leaves its page for the spaces list,
|
|
321
|
+
// not a "This space does not exist" screen.
|
|
322
|
+
if (spaceHref && pathname?.endsWith(spaceHref)) {
|
|
323
|
+
router.push(uiRoutes().sessionSpaces?.(projectId) ?? uiRoutes().project(projectId));
|
|
324
|
+
}
|
|
344
325
|
},
|
|
345
326
|
onError: () => errorToast(tGroups('deleteFailed')),
|
|
346
327
|
}) })] }));
|
|
@@ -24,5 +24,5 @@ export function SidebarMoreGroup({ projectId, footer }) {
|
|
|
24
24
|
const expanded = useSessionExpandedStore(selectExpandedIds(projectId));
|
|
25
25
|
const toggleExpanded = useSessionExpandedStore((state) => state.toggleExpanded);
|
|
26
26
|
const open = expanded.includes(MORE_SECTION_ID);
|
|
27
|
-
return (_jsxs(Disclosure, { open: open, onOpenChange: () => toggleExpanded(projectId, MORE_SECTION_ID), className: cn('group/more flex min-h-0 flex-col', open ? 'max-h-1/2' : 'shrink-0'), transition: { duration: 0.15, ease: 'easeOut' }, children: [_jsx(SidebarMenu, { children: _jsx(SidebarMenuItem, { children: _jsx(DisclosureTrigger, { children: _jsxs(SidebarMenuButton, { className: "text-muted-foreground hover:text-sidebar-foreground", children: [_jsx(DotsThreeIcon, { weight: "bold" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: t('more') }), _jsx(CaretRightSolidIcon, { "aria-hidden": true, className: cn('size-4! shrink-0 transition-transform duration-(--duration-fast) ease-out motion-reduce:transition-none', open && 'rotate-90') })] }) }) }) }), _jsxs(DisclosureContent, { className: "flex min-h-0 flex-1 flex-col", contentClassName: "flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto pt-1", children: [_jsx(SidebarMenu, { children: _jsx(ProjectNavItems, { projectId: projectId
|
|
27
|
+
return (_jsxs(Disclosure, { open: open, onOpenChange: () => toggleExpanded(projectId, MORE_SECTION_ID), className: cn('group/more flex min-h-0 flex-col', open ? 'max-h-1/2' : 'shrink-0'), transition: { duration: 0.15, ease: 'easeOut' }, children: [_jsx(SidebarMenu, { children: _jsx(SidebarMenuItem, { children: _jsx(DisclosureTrigger, { children: _jsxs(SidebarMenuButton, { className: "text-muted-foreground hover:text-sidebar-foreground", children: [_jsx(DotsThreeIcon, { weight: "bold" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: t('more') }), _jsx(CaretRightSolidIcon, { "aria-hidden": true, className: cn('size-4! shrink-0 transition-transform duration-(--duration-fast) ease-out motion-reduce:transition-none', open && 'rotate-90') })] }) }) }) }), _jsxs(DisclosureContent, { className: "flex min-h-0 flex-1 flex-col", contentClassName: "flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto pt-1", children: [_jsx(SidebarMenu, { children: _jsx(ProjectNavItems, { projectId: projectId }) }), _jsx(ProjectSessionList, { projectId: projectId, secondary: true }), footer] })] }));
|
|
28
28
|
}
|
|
@@ -38,8 +38,8 @@ export function WorkspaceSettingsSidebarNav({ projectId, shown, onNavigate, }) {
|
|
|
38
38
|
const active = (listed ? fromUrl : undefined) ?? rail?.active;
|
|
39
39
|
// The page's settings landmark moved here with the rail.
|
|
40
40
|
return (_jsxs("nav", { "aria-label": tSettings('title'), className: "flex h-full min-h-0 flex-col space-y-2", children: [_jsx(SidebarGroup, { className: "py-0", children: _jsx(SidebarMenu, { children: _jsx(SidebarMenuItem, { children: _jsx(SidebarMenuButton, { asChild: true, className: "text-sidebar-foreground", children: _jsxs(Link, { href: backHref, prefetch: shown, onClick: onNavigate, children: [_jsx("span", { className: "shrink-0", children: _jsx(ArrowLeftIcon, { className: "cn-rtl-flip" }) }), _jsx("span", { children: tCommon('back') })] }) }) }) }) }), rail ? (_jsx(SettingsSearch, { projectId: projectId, rail: rail, active: active, shown: shown, onNavigate: onNavigate })) : (_jsx("div", { className: "min-h-0 flex-1", children: _jsx(RailSkeleton, {}) })), rail?.footer ? (
|
|
41
|
-
// Help sits under the groups, outside the scrolling list, behind
|
|
42
|
-
//
|
|
41
|
+
// Help sits under the groups, outside the scrolling list, behind a
|
|
42
|
+
// hairline: it must not read as a row of the last group.
|
|
43
43
|
_jsx("div", { className: "border-sidebar-border shrink-0 border-t", children: _jsx(RailGroup, { group: rail.footer, active: active, prefetch: shown, onNavigate: onNavigate }) })) : null] }));
|
|
44
44
|
}
|
|
45
45
|
const LIST_SCROLL_CLASS = 'min-h-0 flex-1 [scrollbar-width:none] overflow-y-auto [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden';
|
|
@@ -8,12 +8,13 @@ export declare const KIND_ICON: Record<ProjectSpaceTabKind, Icon>;
|
|
|
8
8
|
* runs, the tab row shows the list being saved. A person may edit a DM they
|
|
9
9
|
* own (every DM they see) or a channel they may edit (`can_edit`).
|
|
10
10
|
*/
|
|
11
|
-
export declare function useSpaceTabs(projectId: string, space: ProjectSpace):
|
|
11
|
+
export declare function useSpaceTabs(projectId: string, space: ProjectSpace): SpaceTabsState;
|
|
12
|
+
/** A place's tabs while they show, whether this person may change them, and the write that replaces them all. */
|
|
13
|
+
export interface SpaceTabsState {
|
|
12
14
|
tabs: ProjectSpaceTab[];
|
|
13
15
|
canEdit: boolean;
|
|
14
|
-
save: (next: ProjectSpaceTab[]) => Promise<
|
|
15
|
-
}
|
|
16
|
-
export type SpaceTabsState = ReturnType<typeof useSpaceTabs>;
|
|
16
|
+
save: (next: ProjectSpaceTab[]) => Promise<unknown>;
|
|
17
|
+
}
|
|
17
18
|
/**
|
|
18
19
|
* One stored tab in the tab row. A right click opens its menu; the open tab
|
|
19
20
|
* also shows a caret that opens the same menu: Rename, Move left, Move right,
|
|
@@ -30,13 +31,20 @@ export declare function StoredTabTrigger({ tab, index, active, state, }: {
|
|
|
30
31
|
* space's own folder), a folder (the space's own files, or a path), an
|
|
31
32
|
* artifact, an App or a link. The new tab opens.
|
|
32
33
|
*/
|
|
33
|
-
export declare function AddTabMenu({ projectId, space, state, onAdded, label, }: {
|
|
34
|
+
export declare function AddTabMenu({ projectId, space, ownFolder: ownFolderOverride, ownFolderTab, state, onAdded, label, triggerClassName, }: {
|
|
34
35
|
projectId: string;
|
|
35
|
-
|
|
36
|
+
/** A channel or DM: its own folder is the first folder offered. */
|
|
37
|
+
space?: ProjectSpace;
|
|
38
|
+
/** Another place's own folder (a Space's `/Spaces/<group_id>`), when there is no `space`. */
|
|
39
|
+
ownFolder?: string | null;
|
|
40
|
+
/** Offer the own folder as a tab ("This space's files"). False where the place already shows it as a built-in tab. */
|
|
41
|
+
ownFolderTab?: boolean;
|
|
36
42
|
state: SpaceTabsState;
|
|
37
43
|
onAdded: (id: string) => void;
|
|
38
44
|
/** A text trigger ("Add tab", the details panel) instead of the tab row's "+". */
|
|
39
45
|
label?: string;
|
|
46
|
+
/** Extra classes for the "+" trigger, for a host whose tab row has its own rhythm. */
|
|
47
|
+
triggerClassName?: string;
|
|
40
48
|
}): import("react").JSX.Element;
|
|
41
49
|
/** What a host's file view draws for a `file` tab. `place` is "#general" or the DM's agent. */
|
|
42
50
|
export interface SpaceFile {
|
|
@@ -72,3 +80,15 @@ export declare function StoredTabPanel({ projectId, space, tab, place, state, re
|
|
|
72
80
|
}) => ReactNode;
|
|
73
81
|
renderFile?: (file: SpaceFile) => ReactNode;
|
|
74
82
|
}): import("react").JSX.Element;
|
|
83
|
+
/**
|
|
84
|
+
* The body of a stored tab for any place that has tabs (a channel, a DM, a
|
|
85
|
+
* Space): `folder` and `file` render a Drive folder or file the host's way;
|
|
86
|
+
* the rest is the same everywhere.
|
|
87
|
+
*/
|
|
88
|
+
export declare function StoredTabBody({ projectId, tab, state, folder, file, }: {
|
|
89
|
+
projectId: string;
|
|
90
|
+
tab: ProjectSpaceTab;
|
|
91
|
+
state: SpaceTabsState;
|
|
92
|
+
folder?: (path: string, missing: ReactNode) => ReactNode;
|
|
93
|
+
file?: (path: string, title: string, missing: ReactNode) => ReactNode;
|
|
94
|
+
}): import("react").JSX.Element;
|
|
@@ -7,6 +7,7 @@ import { useState } from 'react';
|
|
|
7
7
|
import { framePolicy } from '../../files/viewer/preview-policy.js';
|
|
8
8
|
import { useProjectDrive } from '../../files/drives/use-drives.js';
|
|
9
9
|
import { useTranslations } from '../../i18n/index.js';
|
|
10
|
+
import { cn } from '../../lib/utils.js';
|
|
10
11
|
import { Button } from '../../primitives/button.js';
|
|
11
12
|
import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ContextMenuTrigger } from '../../primitives/context-menu.js';
|
|
12
13
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from '../../primitives/dropdown-menu.js';
|
|
@@ -73,7 +74,7 @@ export function StoredTabTrigger({ tab, index, active, state, }) {
|
|
|
73
74
|
* space's own folder), a folder (the space's own files, or a path), an
|
|
74
75
|
* artifact, an App or a link. The new tab opens.
|
|
75
76
|
*/
|
|
76
|
-
export function AddTabMenu({ projectId, space, state, onAdded, label, }) {
|
|
77
|
+
export function AddTabMenu({ projectId, space, ownFolder: ownFolderOverride, ownFolderTab = true, state, onAdded, label, triggerClassName, }) {
|
|
77
78
|
const t = useTranslations('spaces.view.tabEdit');
|
|
78
79
|
const artifactsOn = useFeatureFlag(projectId, 'artifacts').enabled;
|
|
79
80
|
const apps = useProjectApps(projectId);
|
|
@@ -82,10 +83,12 @@ export function AddTabMenu({ projectId, space, state, onAdded, label, }) {
|
|
|
82
83
|
const [ask, setAsk] = useState(null);
|
|
83
84
|
const { tabs, save } = state;
|
|
84
85
|
const full = tabs.length >= SPACE_TABS_MAX;
|
|
85
|
-
const name = space.kind === 'channel' ? space.slug : space.dm_agent_name;
|
|
86
|
-
const ownFolder =
|
|
87
|
-
?
|
|
88
|
-
|
|
86
|
+
const name = space ? (space.kind === 'channel' ? space.slug : space.dm_agent_name) : null;
|
|
87
|
+
const ownFolder = space
|
|
88
|
+
? name
|
|
89
|
+
? spaceDriveFolders(space.kind, name, drive.data?.personalFolder ?? null, space.visibility === 'private' ? space.space_id : null)?.files ?? null
|
|
90
|
+
: null
|
|
91
|
+
: (ownFolderOverride ?? null);
|
|
89
92
|
const add = async (kind, title, ref) => {
|
|
90
93
|
const tab = { id: newTabId(kind, tabs), title: tabTitle(title, t(`kind.${kind}`)), kind, ref };
|
|
91
94
|
await save(appendTab(tabs, tab));
|
|
@@ -93,7 +96,7 @@ export function AddTabMenu({ projectId, space, state, onAdded, label, }) {
|
|
|
93
96
|
};
|
|
94
97
|
const quick = (kind, title, ref) => () => void add(kind, title, ref).catch(() => undefined);
|
|
95
98
|
const open = (next) => requestAnimationFrame(() => setAsk(next));
|
|
96
|
-
return (_jsxs(_Fragment, { children: [_jsxs(DropdownMenu, { children: [_jsx(Hint, { label: full ? t('full', { max: SPACE_TABS_MAX }) : t('add'), side: "bottom", children: _jsx(DropdownMenuTrigger, { asChild: true, children: label ? (_jsxs(Button, { size: "sm", variant: "ghost", disabled: full, className: "text-muted-foreground hover:text-foreground gap-1.5 self-start", children: [_jsx(PlusIcon, { className: "size-3.5 shrink-0" }), label] })) : (_jsx(Button, { size: "icon-xs", variant: "ghost", "aria-label": t('add'), disabled: full, className:
|
|
99
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DropdownMenu, { children: [_jsx(Hint, { label: full ? t('full', { max: SPACE_TABS_MAX }) : t('add'), side: "bottom", children: _jsx(DropdownMenuTrigger, { asChild: true, children: label ? (_jsxs(Button, { size: "sm", variant: "ghost", disabled: full, className: "text-muted-foreground hover:text-foreground gap-1.5 self-start", children: [_jsx(PlusIcon, { className: "size-3.5 shrink-0" }), label] })) : (_jsx(Button, { size: "icon-xs", variant: "ghost", "aria-label": t('add'), disabled: full, className: cn('ml-1 shrink-0', triggerClassName), children: _jsx(PlusIcon, {}) })) }) }), _jsxs(DropdownMenuContent, { align: "start", className: "w-56", children: [_jsxs(DropdownMenuItem, { onSelect: () => open('file'), children: [_jsx(FileIcon, {}), t('fileItem')] }), _jsxs(DropdownMenuSub, { children: [_jsxs(DropdownMenuSubTrigger, { children: [_jsx(FolderSimpleIcon, {}), t('kind.folder')] }), _jsxs(DropdownMenuSubContent, { className: "w-56", children: [ownFolder && ownFolderTab ? (_jsx(DropdownMenuItem, { onSelect: quick('folder', t('spaceFiles'), ownFolder), children: t('spaceFiles') })) : null, _jsx(DropdownMenuItem, { onSelect: () => open('folder'), children: t('otherFolder') })] })] }), artifactsOn ? (_jsxs(DropdownMenuSub, { children: [_jsxs(DropdownMenuSubTrigger, { children: [_jsx(FileTextIcon, {}), t('kind.artifact')] }), _jsx(DropdownMenuSubContent, { className: "max-h-72 w-56 overflow-y-auto", children: (artifacts.data ?? []).length === 0 ? (_jsx(DropdownMenuItem, { disabled: true, children: t('noArtifacts') })) : ((artifacts.data ?? []).map((artifact) => (_jsx(DropdownMenuItem, { onSelect: quick('artifact', artifact.title, artifact.artifact_id), children: _jsx("span", { className: "truncate", children: artifact.title }) }, artifact.artifact_id)))) })] })) : null, _jsxs(DropdownMenuSub, { children: [_jsxs(DropdownMenuSubTrigger, { children: [_jsx(AppWindowIcon, {}), t('kind.app')] }), _jsx(DropdownMenuSubContent, { className: "max-h-72 w-56 overflow-y-auto", children: (apps.data ?? []).length === 0 ? (_jsx(DropdownMenuItem, { disabled: true, children: t('noApps') })) : ((apps.data ?? []).map((app) => (_jsx(DropdownMenuItem, { onSelect: quick('app', app.name, app.slug), children: _jsx("span", { className: "truncate", children: app.name }) }, app.app_id)))) })] }), _jsxs(DropdownMenuItem, { onSelect: () => open('link'), children: [_jsx(LinkSimpleIcon, {}), t('linkItem')] })] })] }), _jsx(TargetModal
|
|
97
100
|
// A new key per open: the path starts again from the space's folder.
|
|
98
101
|
, { kind: ask, initial: ask === 'file' ? filePathPrefix(ownFolder) : '', onClose: () => setAsk(null), onAdd: (kind, ref) => add(kind, kind === 'link' ? linkTitle(ref) : folderTitle(ref), ref) }, ask ?? 'closed')] }));
|
|
99
102
|
}
|
|
@@ -164,19 +167,27 @@ function RenameTabModal({ open, title, onClose, onSave, }) {
|
|
|
164
167
|
* empty state with "Remove tab" for a person who may edit.
|
|
165
168
|
*/
|
|
166
169
|
export function StoredTabPanel({ projectId, space, tab, place, state, renderFolder, renderFile, }) {
|
|
170
|
+
return (_jsx(StoredTabBody, { projectId: projectId, tab: tab, state: state, folder: renderFolder ? (path, missing) => renderFolder({ space, tab: 'files', place, path, missing }) : undefined, file: renderFile ? (path, title, missing) => renderFile({ space, place, path, title, missing }) : undefined }));
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The body of a stored tab for any place that has tabs (a channel, a DM, a
|
|
174
|
+
* Space): `folder` and `file` render a Drive folder or file the host's way;
|
|
175
|
+
* the rest is the same everywhere.
|
|
176
|
+
*/
|
|
177
|
+
export function StoredTabBody({ projectId, tab, state, folder, file, }) {
|
|
167
178
|
const t = useTranslations('spaces.view.tabEdit');
|
|
168
179
|
const removeAction = state.canEdit ? (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => void state.save(removeTab(state.tabs, tab.id)).catch(() => undefined), children: [_jsx(XIcon, {}), t('remove')] })) : undefined;
|
|
169
180
|
const missing = (_jsx(EmptyState, { className: "min-h-full", media: _jsx(EmptyArt, { icon: KIND_ICON[tab.kind] ?? FileIcon }), title: t('missing.title'), description: t('missing.description'), action: removeAction }));
|
|
170
181
|
const ref = tab.ref ?? '';
|
|
171
182
|
switch (tab.kind) {
|
|
172
183
|
case 'file':
|
|
173
|
-
return ref &&
|
|
184
|
+
return ref && file ? _jsx(_Fragment, { children: file(ref, tab.title, missing) }) : missing;
|
|
174
185
|
case 'artifact':
|
|
175
186
|
return _jsx(ArtifactTab, { projectId: projectId, artifactId: ref, missingAction: removeAction });
|
|
176
187
|
case 'app':
|
|
177
188
|
return _jsx(AppTab, { projectId: projectId, slug: ref, missingAction: removeAction });
|
|
178
189
|
case 'folder':
|
|
179
|
-
return ref &&
|
|
190
|
+
return ref && folder ? _jsx(_Fragment, { children: folder(ref, missing) }) : missing;
|
|
180
191
|
case 'link':
|
|
181
192
|
if (!isLinkUrl(ref))
|
|
182
193
|
return missing;
|