@kortix/ui 0.16.1 → 0.16.3
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 +133 -26
- 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 +131 -8
- package/dist/i18n/en.js +167 -44
- 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 +131 -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 +9 -3
- 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/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/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
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ProjectSessionGroup } from '@kortix/sdk';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
/** How the host renders a Drive folder or file in a tab (apps/web: the Drive explorer and file viewer). */
|
|
4
|
+
export interface SpaceDriveRenderers {
|
|
5
|
+
renderFolder?: (folder: {
|
|
6
|
+
path: string;
|
|
7
|
+
place: string;
|
|
8
|
+
ownFolder: string | null;
|
|
9
|
+
missing: ReactNode;
|
|
10
|
+
}) => ReactNode;
|
|
11
|
+
renderFile?: (file: {
|
|
12
|
+
path: string;
|
|
13
|
+
title: string;
|
|
14
|
+
missing: ReactNode;
|
|
15
|
+
}) => ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* One space (flag `session_groups`), laid out like a channel: a header (name,
|
|
19
|
+
* what it is for, who sees it, Share), a tab row (Home, Files, the space's own
|
|
20
|
+
* tabs, "+"), and the open tab under it. Home is where a session starts and
|
|
21
|
+
* the space's session history lists; Files is the space's folder
|
|
22
|
+
* (`/Spaces/<group_id>`, mounted in every session of the space at /drives/space).
|
|
23
|
+
*/
|
|
24
|
+
export declare function SpaceDetailPage({ projectId, groupId, ...renderers }: {
|
|
25
|
+
projectId: string;
|
|
26
|
+
groupId: string;
|
|
27
|
+
} & SpaceDriveRenderers): import("react").JSX.Element | null;
|
|
28
|
+
/** The name, with its menu: Edit details for everyone who sees the space, Delete for whoever may manage it. */
|
|
29
|
+
export declare function SpaceSettingsMenu({ projectId, space, onEdit, trigger, }: {
|
|
30
|
+
projectId: string;
|
|
31
|
+
space: ProjectSessionGroup;
|
|
32
|
+
onEdit: () => void;
|
|
33
|
+
/** The button that opens the menu; the gear by default. */
|
|
34
|
+
trigger?: ReactNode;
|
|
35
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useDeleteWorkspaceSessionGroup, useFeatureFlag, useSetWorkspaceSessionGroupTabs, useWorkspaceSessionGroups, useWorkspaceSessions, } from '@kortix/sdk/react';
|
|
4
|
+
import { MY_KORTIX_SANDBOX_SLUG, isMyKortixAgentName, sessionGroupDriveFolder } from '../../_vendor/kortix-shared.js';
|
|
5
|
+
import { FileTextIcon, FunnelSimpleIcon, GearSixIcon, ShareNetworkIcon, MagnifyingGlassIcon, PencilSimpleIcon, StackIcon, TrashIcon, UsersThreeIcon, } from '@phosphor-icons/react';
|
|
6
|
+
import { formatDistanceToNowStrict } from 'date-fns';
|
|
7
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
8
|
+
import { FeatureGateScreen } from '../../customize/shared/feature-gate-screen.js';
|
|
9
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
10
|
+
import { useDebounce } from '../../internal/hooks/use-debounced-value.js';
|
|
11
|
+
import { SidebarToggle } from '../../internal/layout/sidebar-toggle.js';
|
|
12
|
+
import { ProjectScope } from '../../internal/project-scope.js';
|
|
13
|
+
import { uiRoutes } from '../../lib/routes.js';
|
|
14
|
+
import { cn } from '../../lib/utils.js';
|
|
15
|
+
import { Button } from '../../primitives/button.js';
|
|
16
|
+
import { ConfirmDialog } from '../../primitives/confirm-dialog.js';
|
|
17
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from '../../primitives/dropdown-menu.js';
|
|
18
|
+
import { EmptyArt } from '../../primitives/empty-art.js';
|
|
19
|
+
import { EmptyState } from '../../primitives/empty-state.js';
|
|
20
|
+
import { ErrorState } from '../../primitives/error-state.js';
|
|
21
|
+
import Hint from '../../primitives/hint.js';
|
|
22
|
+
import { Skeleton } from '../../primitives/skeleton.js';
|
|
23
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../../primitives/tabs.js';
|
|
24
|
+
import { errorToast, successToast } from '../../primitives/toast.js';
|
|
25
|
+
import { ExpandableSearch } from '../../primitives/expandable-search.js';
|
|
26
|
+
import { selectAccessFilters, selectLabelFilters, selectOrderMode, selectOwnerFilters, selectSourceFilters, selectStatusFilters, useSessionFilterStore, } from '../../internal/stores/session-filter-store.js';
|
|
27
|
+
import { SessionFilterMenu } from '../sidebar/session-filter-menu.js';
|
|
28
|
+
import { filterProjectSessions } from '../sessions/project-sessions-helpers.js';
|
|
29
|
+
import { ProfileHoverCard, profileLabel } from '../../primitives/profile-hover-card.js';
|
|
30
|
+
import { UserAvatar } from '../../primitives/user-avatar.js';
|
|
31
|
+
import { UiLink as Link, useUiRouter, useUiSearchParams, useUiShallowNavigate, useUiPathname } from '../../providers/ui-provider.js';
|
|
32
|
+
import { useDriveFolder, useProjectDrive } from '../../files/drives/use-drives.js';
|
|
33
|
+
import { getSessionDisplayTitle, sessionLastActivityAt } from '../../session/actions/project-session-list-helpers.js';
|
|
34
|
+
import { sessionDisplayStatus } from '../../session/actions/session-label.js';
|
|
35
|
+
import { SessionStatusMark } from '../../session/list/session-status-mark.js';
|
|
36
|
+
import { ComposerChatInput } from '../../session/composer/composer-chat-input.js';
|
|
37
|
+
import { useProjectHomeSend } from '../layout/use-project-home-send.js';
|
|
38
|
+
import { AddTabMenu, StoredTabBody, StoredTabTrigger } from '../spaces/space-tabs.js';
|
|
39
|
+
import { SpaceIconButton } from './space-icon.js';
|
|
40
|
+
import { SpaceFormModal } from './space-form-modal.js';
|
|
41
|
+
import { spaceParticipants, useSpaceAudienceLabel } from './space-people.js';
|
|
42
|
+
import { SessionParticipantStack } from '../../session/participants/session-participants.js';
|
|
43
|
+
import { SpaceShareModal } from './space-share-modal.js';
|
|
44
|
+
/** Rows per page of the space's session history. */
|
|
45
|
+
const PAGE_SIZE = 30;
|
|
46
|
+
const SKELETON_WIDTHS = ['w-56', 'w-40', 'w-64', 'w-44'];
|
|
47
|
+
/** The two built-in tabs; stored tabs follow them. `?tab=` names the open one. */
|
|
48
|
+
const HOME_TAB = 'home';
|
|
49
|
+
const FILES_TAB = 'files';
|
|
50
|
+
/** People listed in the About rail before "N more". */
|
|
51
|
+
const PEOPLE_MAX = 6;
|
|
52
|
+
/** Files listed in the About rail before "N more". */
|
|
53
|
+
const FILES_MAX = 5;
|
|
54
|
+
/**
|
|
55
|
+
* One space (flag `session_groups`), laid out like a channel: a header (name,
|
|
56
|
+
* what it is for, who sees it, Share), a tab row (Home, Files, the space's own
|
|
57
|
+
* tabs, "+"), and the open tab under it. Home is where a session starts and
|
|
58
|
+
* the space's session history lists; Files is the space's folder
|
|
59
|
+
* (`/Spaces/<group_id>`, mounted in every session of the space at /drives/space).
|
|
60
|
+
*/
|
|
61
|
+
export function SpaceDetailPage({ projectId, groupId, ...renderers }) {
|
|
62
|
+
const t = useTranslations('sessionSpaces');
|
|
63
|
+
const flag = useFeatureFlag(projectId, 'session_groups');
|
|
64
|
+
const groups = useWorkspaceSessionGroups(flag.enabled ? projectId : null);
|
|
65
|
+
if (flag.isLoading)
|
|
66
|
+
return null;
|
|
67
|
+
if (!flag.enabled) {
|
|
68
|
+
return _jsx(FeatureGateScreen, { featureKey: "session_groups", featureName: t('title'), description: t('gateDescription') });
|
|
69
|
+
}
|
|
70
|
+
if (groups.isLoading)
|
|
71
|
+
return null;
|
|
72
|
+
if (groups.isError) {
|
|
73
|
+
return (_jsx(CenteredState, { children: _jsx(ErrorState, { size: "sm", title: t('loadFailed'), action: _jsx(Button, { variant: "outline", size: "sm", onClick: () => void groups.refetch(), children: t('tryAgain') }) }) }));
|
|
74
|
+
}
|
|
75
|
+
const space = groups.data?.find((group) => group.group_id === groupId) ?? null;
|
|
76
|
+
if (!space) {
|
|
77
|
+
const all = uiRoutes().sessionSpaces?.(projectId);
|
|
78
|
+
return (_jsx(CenteredState, { children: _jsx(EmptyState, { media: _jsx(EmptyArt, { icon: StackIcon }), title: t('notFoundTitle'), description: t('notFoundDescription'), action: all ? (_jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsx(Link, { href: all, children: t('allSpaces') }) })) : undefined }) }));
|
|
79
|
+
}
|
|
80
|
+
return (_jsx(ProjectScope, { projectId: projectId, children: _jsx(SpaceView, { projectId: projectId, space: space, ...renderers }) }));
|
|
81
|
+
}
|
|
82
|
+
/** A load failure or a missing space: the sidebar opener, then the state in the middle of the page. */
|
|
83
|
+
function CenteredState({ children }) {
|
|
84
|
+
return (_jsxs("div", { className: "bg-background flex min-h-0 flex-1 flex-col", children: [_jsx("div", { className: "flex h-12 shrink-0 items-center px-3", children: _jsx(SidebarToggle, {}) }), _jsx("div", { className: "flex min-h-0 flex-1 items-center justify-center px-4", children: children })] }));
|
|
85
|
+
}
|
|
86
|
+
function SpaceView({ projectId, space, renderFolder, renderFile }) {
|
|
87
|
+
const t = useTranslations('sessionSpaces');
|
|
88
|
+
const [editing, setEditing] = useState(false);
|
|
89
|
+
const [sharing, setSharing] = useState(false);
|
|
90
|
+
const canManage = space.can_manage === true;
|
|
91
|
+
const state = useSessionSpaceTabs(projectId, space);
|
|
92
|
+
const ownFolder = sessionGroupDriveFolder(space.group_id);
|
|
93
|
+
// The open tab lives in the URL (`?tab=`), so a link opens it and Back returns.
|
|
94
|
+
const searchParams = useUiSearchParams();
|
|
95
|
+
const pathname = useUiPathname();
|
|
96
|
+
const navigate = useUiShallowNavigate();
|
|
97
|
+
const asked = searchParams?.get('tab') ?? HOME_TAB;
|
|
98
|
+
const known = asked === HOME_TAB || asked === FILES_TAB || state.tabs.some((stored) => stored.id === asked);
|
|
99
|
+
const tab = known ? asked : HOME_TAB;
|
|
100
|
+
const setTab = useCallback((next) => navigate(next === HOME_TAB ? pathname : `${pathname}?tab=${encodeURIComponent(next)}`, { replace: true }), [navigate, pathname]);
|
|
101
|
+
return (
|
|
102
|
+
// Capped at the screen height: the app shell above sizes to its content (`min-h-svh`), so
|
|
103
|
+
// without the cap the whole document scrolled and took the header with it. `overflow-clip`,
|
|
104
|
+
// not `hidden`, so no focus() can scroll it either. Only the tab content scrolls.
|
|
105
|
+
_jsxs("div", { className: "bg-background flex h-svh max-h-svh min-h-0 flex-1 flex-col overflow-clip", children: [_jsxs(Tabs, { value: tab, onValueChange: setTab, className: "flex min-h-0 flex-1 flex-col gap-0 overflow-clip", children: [_jsxs("header", { className: "border-border bg-background sticky top-0 z-20 flex h-12 shrink-0 items-stretch gap-2 border-b px-3", children: [_jsx("div", { className: "flex shrink-0 items-center", children: _jsx(SidebarToggle, {}) }), _jsxs(TabsList, { type: "underline", size: "sm", className: cn('h-full min-w-0 flex-1 justify-start gap-5 overflow-x-auto border-b-0 px-1',
|
|
106
|
+
// The underline hugs the word: no side padding on a tab.
|
|
107
|
+
'**:data-[slot=tabs-trigger]:px-0'), children: [_jsx(TabsTrigger, { value: HOME_TAB, className: "w-fit flex-none", children: t('tabHome') }), _jsx(TabsTrigger, { value: FILES_TAB, className: "w-fit flex-none", children: t('tabFiles') }), state.tabs.map((stored, index) => (_jsx(StoredTabTrigger, { tab: stored, index: index, active: stored.id === tab, state: state }, stored.id))), _jsx(AddTabMenu, { projectId: projectId, ownFolder: ownFolder, ownFolderTab: false, state: state, onAdded: setTab,
|
|
108
|
+
// A quiet affordance, not a peer of the tabs: muted, a smaller plus, closer in.
|
|
109
|
+
triggerClassName: "text-muted-foreground hover:text-foreground -ml-1.5 [&_svg]:size-3.5" })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsx(AudienceShare, { space: space, onShare: canManage ? () => setSharing(true) : undefined }), _jsx(SpaceSettingsMenu, { projectId: projectId, space: space, onEdit: () => setEditing(true) })] })] }), _jsx(TabsContent, { value: HOME_TAB, className: "min-h-0 flex-1 overflow-y-auto", children: _jsx(SpaceHome, { projectId: projectId, space: space, onEdit: () => setEditing(true), onShare: canManage ? () => setSharing(true) : undefined, onOpenFiles: () => setTab(FILES_TAB) }) }), _jsx(TabsContent, { value: FILES_TAB, className: "flex min-h-0 flex-1 flex-col", children: ownFolder && renderFolder
|
|
110
|
+
? renderFolder({ path: ownFolder, place: space.name, ownFolder, missing: null })
|
|
111
|
+
: null }), state.tabs.map((stored) => (_jsx(TabsContent, { value: stored.id, className: "flex min-h-0 flex-1 flex-col overflow-y-auto", children: _jsx(StoredTabBody, { projectId: projectId, tab: stored, state: state, folder: renderFolder ? (path, missing) => renderFolder({ path, place: space.name, ownFolder, missing }) : undefined, file: renderFile ? (path, title, missing) => renderFile({ path, title, missing }) : undefined }) }, stored.id)))] }), _jsx(SpaceFormModal, { projectId: projectId, space: space, open: editing, onOpenChange: setEditing }), canManage ? _jsx(SpaceShareModal, { projectId: projectId, space: space, open: sharing, onOpenChange: setSharing }) : null] }));
|
|
112
|
+
}
|
|
113
|
+
/** The space's stored tabs and the write that replaces them; everyone who sees the space may edit them. */
|
|
114
|
+
function useSessionSpaceTabs(projectId, space) {
|
|
115
|
+
const t = useTranslations('spaces.view.tabEdit');
|
|
116
|
+
const mutation = useSetWorkspaceSessionGroupTabs(projectId);
|
|
117
|
+
const saved = space.tabs ?? [];
|
|
118
|
+
const tabs = mutation.isPending && mutation.variables?.groupId === space.group_id ? mutation.variables.tabs : saved;
|
|
119
|
+
const save = (next) => mutation.mutateAsync({ groupId: space.group_id, tabs: next }).catch((error) => {
|
|
120
|
+
errorToast(t('saveError'), { description: error instanceof Error ? error.message : undefined });
|
|
121
|
+
throw error;
|
|
122
|
+
});
|
|
123
|
+
return { tabs, canEdit: true, save };
|
|
124
|
+
}
|
|
125
|
+
/** The name, with its menu: Edit details for everyone who sees the space, Delete for whoever may manage it. */
|
|
126
|
+
export function SpaceSettingsMenu({ projectId, space, onEdit, trigger, }) {
|
|
127
|
+
const t = useTranslations('sessionSpaces');
|
|
128
|
+
const router = useUiRouter();
|
|
129
|
+
const remove = useDeleteWorkspaceSessionGroup(projectId);
|
|
130
|
+
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
131
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DropdownMenu, { children: [_jsx(Hint, { label: t('options'), children: _jsx(DropdownMenuTrigger, { asChild: true, children: trigger ?? (_jsx(Button, { variant: "secondary", size: "icon-base", className: "shrink-0", "aria-label": t('options'), children: _jsx(GearSixIcon, { className: "size-4" }) })) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-48", children: [_jsxs(DropdownMenuItem, { className: "cursor-pointer", onSelect: onEdit, children: [_jsx(PencilSimpleIcon, {}), t('editDetails')] }), space.can_manage === true ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { className: "cursor-pointer", variant: "destructive", onSelect: () => setConfirmOpen(true), children: [_jsx(TrashIcon, {}), t('delete')] })] })) : null] })] }), _jsx(ConfirmDialog, { open: confirmOpen, onOpenChange: setConfirmOpen, title: t('deleteTitle'), description: t('deleteDescription', { name: space.name }), confirmLabel: t('delete'), confirmVariant: "destructive", isPending: remove.isPending, onConfirm: () => {
|
|
132
|
+
remove.mutate(space.group_id, {
|
|
133
|
+
onSuccess: () => {
|
|
134
|
+
successToast(t('deleted'));
|
|
135
|
+
setConfirmOpen(false);
|
|
136
|
+
const all = uiRoutes().sessionSpaces?.(projectId);
|
|
137
|
+
router.push(all ?? uiRoutes().project(projectId));
|
|
138
|
+
},
|
|
139
|
+
onError: () => errorToast(t('deleteFailed')),
|
|
140
|
+
});
|
|
141
|
+
} })] }));
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Who sees the space, and Share, as one control at the right of the header:
|
|
145
|
+
* the people (or the lock, or the workspace glyph) then "Share". Whoever may
|
|
146
|
+
* not change the sharing sees the people alone, named on hover.
|
|
147
|
+
*/
|
|
148
|
+
function AudienceShare({ space, onShare }) {
|
|
149
|
+
const t = useTranslations('sessionSpaces');
|
|
150
|
+
const label = useSpaceAudienceLabel(space);
|
|
151
|
+
// The session header's stack: overlapping faces, the full list on hover. It draws for two or more people.
|
|
152
|
+
const participants = spaceParticipants(space);
|
|
153
|
+
return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(SessionParticipantStack, { participants: participants, label: label }), onShare ? (_jsxs(Button, { size: "sm", variant: "secondary", className: "gap-1.5", onClick: onShare, children: [_jsx(ShareNetworkIcon, { className: "size-4 shrink-0" }), t('share')] })) : null] }));
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Home: start a session in the space, then its history. Beside them on a wide
|
|
157
|
+
* screen, what the space is about: what it is for, who is in it, its newest files.
|
|
158
|
+
*/
|
|
159
|
+
function SpaceHome({ projectId, space, onEdit, onShare, onOpenFiles, }) {
|
|
160
|
+
return (_jsxs("div", { className: "mx-auto grid w-full max-w-5xl gap-10 px-4 pt-12 pb-20 md:px-8 md:pt-16 lg:grid-cols-[minmax(0,1fr)_16rem]", children: [_jsxs("div", { className: "min-w-0 space-y-8", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(SpaceIconButton, { projectId: projectId, space: space }), _jsx("h1", { className: "text-foreground min-w-0 truncate text-xl font-medium first-letter:uppercase", children: space.name })] }), space.description ? (
|
|
161
|
+
// The About rail shows it on wide screens; this line is for every width.
|
|
162
|
+
_jsx("button", { type: "button", onClick: onEdit, className: "text-muted-foreground hover:text-foreground duration-fast line-clamp-2 block text-left text-sm text-pretty transition-colors lg:hidden", children: space.description })) : null] }), _jsx(SpaceComposer, { projectId: projectId, space: space })] }), _jsx(SpaceHistory, { projectId: projectId, space: space })] }), _jsx(SpaceAbout, { projectId: projectId, space: space, onEdit: onEdit, onShare: onShare, onOpenFiles: onOpenFiles })] }));
|
|
163
|
+
}
|
|
164
|
+
/** The About rail: three short blocks, each a label over its facts, on wide screens only. */
|
|
165
|
+
function SpaceAbout({ projectId, space, onEdit, onShare, onOpenFiles, }) {
|
|
166
|
+
const t = useTranslations('sessionSpaces');
|
|
167
|
+
return (_jsxs("aside", { className: "hidden space-y-8 lg:block", "aria-label": t('about'), children: [_jsx(AboutBlock, { title: t('about'), action: _jsx(AboutAction, { onClick: onEdit, children: t('edit') }), children: space.description ? (_jsx("p", { className: "text-muted-foreground text-sm text-pretty whitespace-pre-line", children: space.description })) : (_jsx("button", { type: "button", onClick: onEdit, className: "text-muted-foreground hover:text-foreground duration-fast text-left text-sm transition-colors", children: t('noDescription') })) }), _jsx(AboutBlock, { title: t('people'), action: onShare ? _jsx(AboutAction, { onClick: onShare, children: t('share') }) : null, children: _jsx(SpacePeopleList, { space: space }) }), _jsx(SpaceRecentFiles, { projectId: projectId, space: space, onOpenFiles: onOpenFiles })] }));
|
|
168
|
+
}
|
|
169
|
+
function AboutBlock({ title, action, children }) {
|
|
170
|
+
return (_jsxs("section", { className: "space-y-2.5", children: [_jsxs("div", { className: "flex h-6 items-center justify-between gap-2", children: [_jsx("h3", { className: "text-muted-foreground text-xs font-medium", children: title }), action] }), children] }));
|
|
171
|
+
}
|
|
172
|
+
function AboutAction({ onClick, children }) {
|
|
173
|
+
return (_jsx(Button, { variant: "transparent", size: "sm", className: "text-muted-foreground hover:text-foreground h-6 px-0 text-xs", onClick: onClick, children: children }));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The hover card's lines for a person of the space, one fact per line: their
|
|
177
|
+
* part in it (the creator; or a member, with the day they were added) and
|
|
178
|
+
* their workspace role when it is more than member.
|
|
179
|
+
*/
|
|
180
|
+
function SpacePersonMeta({ person }) {
|
|
181
|
+
const t = useTranslations('sessionSpaces');
|
|
182
|
+
const added = person.added_at ? new Date(person.added_at) : null;
|
|
183
|
+
const addedLabel = added && !Number.isNaN(added.getTime()) ? added.toLocaleDateString(undefined, { day: 'numeric', month: 'short', year: 'numeric' }) : null;
|
|
184
|
+
let role = null;
|
|
185
|
+
if (person.workspace_role === 'owner')
|
|
186
|
+
role = t('workspaceOwner');
|
|
187
|
+
else if (person.workspace_role === 'admin')
|
|
188
|
+
role = t('workspaceAdmin');
|
|
189
|
+
return (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { children: person.is_creator ? t('createdSpace') : addedLabel ? t('addedOn', { date: addedLabel }) : t('spaceMember') }), role ? _jsx("p", { children: role }) : null] }));
|
|
190
|
+
}
|
|
191
|
+
/** Who is in the space, one row each: its creator and everyone it is shared with, or the whole workspace. */
|
|
192
|
+
function SpacePeopleList({ space }) {
|
|
193
|
+
const t = useTranslations('sessionSpaces');
|
|
194
|
+
const people = space.people ?? [];
|
|
195
|
+
return (_jsxs("ul", { className: "space-y-0.5", children: [people.slice(0, PEOPLE_MAX).map((person) => {
|
|
196
|
+
const profile = { userId: person.user_id, name: person.name, email: person.email, avatarUrl: person.avatar_url };
|
|
197
|
+
return (_jsx("li", { children: _jsx(ProfileHoverCard, { person: profile, detail: _jsx(SpacePersonMeta, { person: person }), children: _jsxs("div", { tabIndex: 0, className: "hover:bg-hover focus-visible:ring-ring duration-fast -mx-1.5 flex min-w-0 cursor-default items-center gap-2 rounded-md px-1.5 py-1 transition-colors outline-none focus-visible:ring-2", children: [_jsx(UserAvatar, { email: person.email ?? person.user_id, name: person.name ?? person.email, avatarUrl: person.avatar_url, colorKey: person.user_id, size: "xs" }), _jsx("span", { className: "text-foreground min-w-0 truncate text-sm", children: profileLabel(profile) })] }) }) }, person.user_id));
|
|
198
|
+
}), people.length > PEOPLE_MAX ? _jsx("li", { className: "text-muted-foreground px-0 pt-1 text-xs tabular-nums", children: t('morePeople', { count: people.length - PEOPLE_MAX }) }) : null, space.visibility === 'project' ? (_jsxs("li", { className: "text-muted-foreground flex items-center gap-2 py-1 text-sm", children: [_jsx(UsersThreeIcon, { className: "size-4 shrink-0" }), t('visibility')] })) : null] }));
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The Files block: the newest files in the space's folder, each opening the
|
|
202
|
+
* Files tab. No block at all while it loads or when the folder has no files:
|
|
203
|
+
* the Files tab is one click away, and an empty block is noise.
|
|
204
|
+
*/
|
|
205
|
+
function SpaceRecentFiles({ projectId, space, onOpenFiles }) {
|
|
206
|
+
const t = useTranslations('sessionSpaces');
|
|
207
|
+
const drive = useProjectDrive(projectId);
|
|
208
|
+
const path = sessionGroupDriveFolder(space.group_id);
|
|
209
|
+
const folder = useDriveFolder(path ? (drive.data?.driveId ?? null) : null, path ?? '/');
|
|
210
|
+
const files = (folder.data?.entries ?? []).filter((entry) => entry.type === 'file').sort((a, b) => b.mtime - a.mtime);
|
|
211
|
+
if (files.length === 0)
|
|
212
|
+
return null;
|
|
213
|
+
return (_jsx(AboutBlock, { title: t('tabFiles'), action: _jsx(AboutAction, { onClick: onOpenFiles, children: t('openFiles') }), children: _jsxs("ul", { className: "space-y-0.5", children: [files.slice(0, FILES_MAX).map((file) => (_jsx("li", { children: _jsxs("button", { type: "button", onClick: onOpenFiles, className: "hover:bg-hover duration-fast -mx-1.5 flex w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-1 text-left transition-colors", children: [_jsx(FileTextIcon, { className: "text-muted-foreground size-4 shrink-0" }), _jsx("span", { className: "text-foreground min-w-0 flex-1 truncate text-sm", children: file.name })] }) }, file.path))), files.length > FILES_MAX ? _jsx("li", { className: "text-muted-foreground px-0 pt-1 text-xs tabular-nums", children: t('moreFiles', { count: files.length - FILES_MAX }) }) : null] }) }));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The project home's composer and send, filed in this space: the session it
|
|
217
|
+
* creates opens like any other. My Kortix runs on its own sandbox, as on the
|
|
218
|
+
* home (`project-home.tsx`). The draft is kept per space.
|
|
219
|
+
*/
|
|
220
|
+
function SpaceComposer({ projectId, space }) {
|
|
221
|
+
const t = useTranslations('sessionSpaces');
|
|
222
|
+
const { send, sending, draftHandoffScope } = useProjectHomeSend(projectId, { groupId: space.group_id });
|
|
223
|
+
const [selectedAgent, setSelectedAgent] = useState(null);
|
|
224
|
+
const metaSelected = isMyKortixAgentName(selectedAgent);
|
|
225
|
+
const draftScope = useMemo(() => ({ kind: 'space', spaceId: space.group_id }), [space.group_id]);
|
|
226
|
+
const handleSend = useCallback((text, files, options, attachments) => send(text, files, { ...options, ...(metaSelected ? { sandbox_slug: MY_KORTIX_SANDBOX_SLUG } : {}) }, attachments), [metaSelected, send]);
|
|
227
|
+
return (_jsx(ComposerChatInput, { onSend: handleSend, projectId: projectId, draftScope: draftScope, draftHandoffScope: draftHandoffScope, isSending: sending, disabled: sending, clearOnSend: false, autoFocus: true, underbarPlacement: "inline", slashMenuPlacement: "below",
|
|
228
|
+
// The page column holds it: no centred max width, no inset of its own (as a channel's composer).
|
|
229
|
+
parentClassName: "max-w-none px-0", placeholder: t('composerPlaceholder', { name: space.name }), hint: t('composerPlaceholder', { name: space.name }), onAgentSelectionChange: setSelectedAgent }));
|
|
230
|
+
}
|
|
231
|
+
/** The space's top-level sessions, newest activity first, searchable; each row opens the session. */
|
|
232
|
+
function SpaceHistory({ projectId, space }) {
|
|
233
|
+
const t = useTranslations('sessionSpaces');
|
|
234
|
+
const tFilter = useTranslations('sidebar.filter');
|
|
235
|
+
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
236
|
+
const [search, setSearch] = useState('');
|
|
237
|
+
const q = useDebounce(search.trim(), 250);
|
|
238
|
+
// This list's own filter state (`space`): narrowing a space does not narrow the sidebar.
|
|
239
|
+
const orderMode = useSessionFilterStore(selectOrderMode(projectId, SPACE_SURFACE));
|
|
240
|
+
const statusFilters = useSessionFilterStore(selectStatusFilters(projectId, SPACE_SURFACE));
|
|
241
|
+
const sourceFilters = useSessionFilterStore(selectSourceFilters(projectId, SPACE_SURFACE));
|
|
242
|
+
const ownerFilters = useSessionFilterStore(selectOwnerFilters(projectId, SPACE_SURFACE));
|
|
243
|
+
const accessFilters = useSessionFilterStore(selectAccessFilters(projectId, SPACE_SURFACE));
|
|
244
|
+
const labelFilters = useSessionFilterStore(selectLabelFilters(projectId, SPACE_SURFACE));
|
|
245
|
+
const query = useWorkspaceSessions(projectId, {
|
|
246
|
+
group: space.group_id,
|
|
247
|
+
parent: 'root',
|
|
248
|
+
limit: PAGE_SIZE,
|
|
249
|
+
...(q ? { q } : {}),
|
|
250
|
+
...(labelFilters.length > 0 ? { labels: labelFilters } : {}),
|
|
251
|
+
});
|
|
252
|
+
const inSpace = query.sessions.filter((session) => session.group_id === space.group_id);
|
|
253
|
+
const rows = orderSessions(filterProjectSessions(inSpace, statusFilters, sourceFilters, tI18nComplete, { owners: ownerFilters, access: accessFilters }), orderMode);
|
|
254
|
+
const filtering = statusFilters.length + sourceFilters.length + ownerFilters.length + accessFilters.length + labelFilters.length > 0;
|
|
255
|
+
// A space with no sessions shows just the composer: no heading, no search, no empty state.
|
|
256
|
+
// A search with no match keeps the section, so the filter stays visible.
|
|
257
|
+
const settled = !query.isLoading && !query.isScanning && !query.isError;
|
|
258
|
+
if (settled && inSpace.length === 0 && !search.trim() && !q && labelFilters.length === 0)
|
|
259
|
+
return null;
|
|
260
|
+
return (_jsxs("section", { className: "space-y-3", "aria-label": t('sessionsHeading'), children: [_jsxs("div", { className: "bg-background sticky top-0 z-10 flex h-10 items-center gap-3", children: [_jsx("h2", { className: "text-foreground text-sm font-medium", children: t('sessionsHeading') }), _jsxs("div", { className: "ml-auto flex items-center justify-end gap-1", children: [_jsx(ExpandableSearch, { value: search, onValueChange: setSearch, label: t('searchSessions'), size: "sm" }), _jsxs(DropdownMenu, { children: [_jsx(Hint, { label: tFilter('filters'), children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "icon-base", "aria-label": tFilter('filters'), className: "text-muted-foreground hover:text-foreground relative shrink-0", children: [_jsx(FunnelSimpleIcon, { className: "size-4" }), filtering ? _jsx("span", { "aria-hidden": true, className: "bg-foreground absolute top-1.5 right-1.5 size-1.5 rounded-full" }) : null] }) }) }), _jsx(SessionFilterMenu, { projectId: projectId, sessions: inSpace, surface: SPACE_SURFACE, side: "bottom", align: "end" })] })] })] }), query.isLoading || query.isScanning ? (_jsx("ul", { className: "-mx-2 space-y-1", "aria-hidden": true, children: SKELETON_WIDTHS.map((width) => (_jsxs("li", { className: "flex items-center gap-3 px-2 py-2.5", children: [_jsx(Skeleton, { className: "size-4 shrink-0 rounded-full py-0" }), _jsx(Skeleton, { className: `h-3.5 py-0 ${width}` }), _jsx(Skeleton, { className: "ml-auto h-3 w-10 shrink-0 py-0" })] }, width))) })) : query.isError && rows.length === 0 ? (_jsx(ErrorState, { size: "sm", title: t('sessionsLoadFailed'), action: _jsx(Button, { variant: "outline", size: "sm", onClick: () => void query.refetch(), children: t('tryAgain') }) })) : rows.length === 0 ? (_jsx(EmptyState, { size: "sm", media: _jsx(EmptyArt, { icon: MagnifyingGlassIcon }), title: t('noSessionsMatch'), description: t('noResultsDescription') })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "space-y-5", children: (orderMode === 'activity' ? byDay(rows) : [{ key: null, sessions: rows }]).map((day) => (_jsxs("section", { className: "space-y-1", children: [day.key ? _jsx("h3", { className: "text-muted-foreground text-xs font-medium", children: t(day.key) }) : null, _jsx("ul", { className: "-mx-2", children: day.sessions.map((session) => (_jsx("li", { children: _jsx(SessionHistoryRow, { projectId: projectId, session: session }) }, session.session_id))) })] }, day.key ?? 'all'))) }), query.hasNextPage ? (_jsx(Button, { variant: "outline", size: "sm", "aria-busy": query.isFetchingNextPage || undefined, disabled: query.isFetchingNextPage, onClick: () => void query.fetchNextPage(), children: t('loadMore') })) : null] }))] }));
|
|
261
|
+
}
|
|
262
|
+
const SPACE_SURFACE = 'space';
|
|
263
|
+
/** The list in the order the filter menu picked: last activity (the server's order), newest first, or by title. */
|
|
264
|
+
function orderSessions(sessions, mode) {
|
|
265
|
+
if (mode === 'created')
|
|
266
|
+
return [...sessions].sort((a, b) => Date.parse(b.created_at ?? '') - Date.parse(a.created_at ?? ''));
|
|
267
|
+
if (mode === 'name')
|
|
268
|
+
return [...sessions].sort((a, b) => getSessionDisplayTitle(a).localeCompare(getSessionDisplayTitle(b)));
|
|
269
|
+
return sessions;
|
|
270
|
+
}
|
|
271
|
+
/** The day buckets of the history, newest first: Today, Yesterday, This week, Earlier. Empty buckets are left out. */
|
|
272
|
+
function byDay(sessions) {
|
|
273
|
+
const startOfToday = new Date();
|
|
274
|
+
startOfToday.setHours(0, 0, 0, 0);
|
|
275
|
+
const day = 24 * 60 * 60 * 1000;
|
|
276
|
+
const buckets = { today: [], yesterday: [], thisWeek: [], earlier: [] };
|
|
277
|
+
for (const session of sessions) {
|
|
278
|
+
const at = new Date(sessionLastActivityAt(session)).getTime();
|
|
279
|
+
if (at >= startOfToday.getTime())
|
|
280
|
+
buckets.today.push(session);
|
|
281
|
+
else if (at >= startOfToday.getTime() - day)
|
|
282
|
+
buckets.yesterday.push(session);
|
|
283
|
+
else if (at >= startOfToday.getTime() - 6 * day)
|
|
284
|
+
buckets.thisWeek.push(session);
|
|
285
|
+
else
|
|
286
|
+
buckets.earlier.push(session);
|
|
287
|
+
}
|
|
288
|
+
return ['today', 'yesterday', 'thisWeek', 'earlier'].filter((key) => buckets[key].length > 0).map((key) => ({ key, sessions: buckets[key] }));
|
|
289
|
+
}
|
|
290
|
+
/** One session of the history: its status, its title, who started it (an avatar, named on hover), when it last moved. */
|
|
291
|
+
function SessionHistoryRow({ projectId, session }) {
|
|
292
|
+
const when = useMemo(() => {
|
|
293
|
+
try {
|
|
294
|
+
return formatDistanceToNowStrict(new Date(sessionLastActivityAt(session)), { addSuffix: true });
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
return '';
|
|
298
|
+
}
|
|
299
|
+
}, [session]);
|
|
300
|
+
const starter = session.owner_name?.trim() || session.initiator?.label || session.owner_email || null;
|
|
301
|
+
return (_jsxs(Link, { href: uiRoutes().session(projectId, session.session_id), prefetch: false, className: "hover:bg-hover duration-fast flex items-center gap-3 rounded-md px-2 py-2 transition-colors", children: [_jsx("span", { className: "flex size-4 shrink-0 items-center justify-center", children: _jsx(SessionStatusMark, { status: sessionDisplayStatus(session) }) }), _jsx("span", { className: "text-foreground min-w-0 flex-1 truncate text-sm", children: getSessionDisplayTitle(session) }), starter ? (_jsx(ProfileHoverCard, { side: "top", align: "end", person: {
|
|
302
|
+
userId: session.created_by ?? session.session_id,
|
|
303
|
+
name: session.owner_name ?? session.initiator?.label ?? null,
|
|
304
|
+
email: session.owner_email ?? null,
|
|
305
|
+
avatarUrl: session.owner_avatar_url ?? null,
|
|
306
|
+
}, children: _jsx("span", { className: "shrink-0", children: _jsx(UserAvatar, { email: session.owner_email ?? starter, name: starter, avatarUrl: session.owner_avatar_url, colorKey: session.created_by ?? session.session_id, size: "xs" }) }) })) : null, _jsx("span", { className: "text-muted-foreground shrink-0 text-right text-xs whitespace-nowrap tabular-nums", children: when })] }));
|
|
307
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ProjectSessionGroup } from '@kortix/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Create a space, or edit one (`space` set): its name and what it is for.
|
|
4
|
+
* Every session of the space reads the description at turn start
|
|
5
|
+
* (apps/api session-where.ts). A taken name shows in the dialog; any other
|
|
6
|
+
* failure is a toast and the dialog stays open with what was typed.
|
|
7
|
+
*/
|
|
8
|
+
export declare function SpaceFormModal({ projectId, space, open, onOpenChange, onSaved, }: {
|
|
9
|
+
projectId: string;
|
|
10
|
+
/** Null: create a new space. */
|
|
11
|
+
space: ProjectSessionGroup | null;
|
|
12
|
+
open: boolean;
|
|
13
|
+
onOpenChange: (open: boolean) => void;
|
|
14
|
+
/** After a create or a save, with the space as the API returned it. */
|
|
15
|
+
onSaved?: (space: ProjectSessionGroup) => void;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ApiError } from '@kortix/sdk';
|
|
4
|
+
import { useCreateWorkspaceSessionGroup, useUpdateWorkspaceSessionGroup } from '@kortix/sdk/react';
|
|
5
|
+
import { useId, useState } from 'react';
|
|
6
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
7
|
+
import { Button } from '../../primitives/button.js';
|
|
8
|
+
import { Field, FieldGroup, FieldLabel } from '../../primitives/field.js';
|
|
9
|
+
import { Input } from '../../primitives/input.js';
|
|
10
|
+
import { Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalTitle } from '../../primitives/modal.js';
|
|
11
|
+
import { Textarea } from '../../primitives/textarea.js';
|
|
12
|
+
import { errorToast, successToast } from '../../primitives/toast.js';
|
|
13
|
+
import { ProjectIconField } from '../projects/modal/project-icon-field.js';
|
|
14
|
+
import { spaceIconValue } from './space-icon.js';
|
|
15
|
+
/** The API's limits (`SESSION_GROUP_NAME_MAX`, `SESSION_GROUP_DESCRIPTION_MAX`). */
|
|
16
|
+
const NAME_MAX = 80;
|
|
17
|
+
const DESCRIPTION_MAX = 2000;
|
|
18
|
+
/**
|
|
19
|
+
* Create a space, or edit one (`space` set): its name and what it is for.
|
|
20
|
+
* Every session of the space reads the description at turn start
|
|
21
|
+
* (apps/api session-where.ts). A taken name shows in the dialog; any other
|
|
22
|
+
* failure is a toast and the dialog stays open with what was typed.
|
|
23
|
+
*/
|
|
24
|
+
export function SpaceFormModal({ projectId, space, open, onOpenChange, onSaved, }) {
|
|
25
|
+
const t = useTranslations('sessionSpaces');
|
|
26
|
+
const create = useCreateWorkspaceSessionGroup(projectId);
|
|
27
|
+
const update = useUpdateWorkspaceSessionGroup(projectId);
|
|
28
|
+
const nameId = useId();
|
|
29
|
+
const descriptionId = useId();
|
|
30
|
+
const [name, setName] = useState('');
|
|
31
|
+
const [description, setDescription] = useState('');
|
|
32
|
+
/** The icon picked in this dialog; null follows the name's suggestion (create) or keeps the stored one (edit). */
|
|
33
|
+
const [icon, setIcon] = useState(null);
|
|
34
|
+
const [problem, setProblem] = useState(null);
|
|
35
|
+
// Reset the fields each time the dialog opens, for the space it opens on.
|
|
36
|
+
const [syncedFor, setSyncedFor] = useState([false, null]);
|
|
37
|
+
if (syncedFor[0] !== open || syncedFor[1] !== (space?.group_id ?? null)) {
|
|
38
|
+
setSyncedFor([open, space?.group_id ?? null]);
|
|
39
|
+
if (open) {
|
|
40
|
+
setName(space?.name ?? '');
|
|
41
|
+
setDescription(space?.description ?? '');
|
|
42
|
+
setIcon(space?.icon ?? null);
|
|
43
|
+
setProblem(null);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const pending = create.isPending || update.isPending;
|
|
47
|
+
const trimmedName = name.trim();
|
|
48
|
+
const trimmedDescription = description.trim();
|
|
49
|
+
const iconChanged = JSON.stringify(icon ?? null) !== JSON.stringify(space?.icon ?? null);
|
|
50
|
+
const unchanged = space !== null && trimmedName === space.name && trimmedDescription === (space.description ?? '') && !iconChanged;
|
|
51
|
+
const submit = async () => {
|
|
52
|
+
if (!trimmedName || unchanged || pending)
|
|
53
|
+
return;
|
|
54
|
+
setProblem(null);
|
|
55
|
+
try {
|
|
56
|
+
const saved = space
|
|
57
|
+
? await update.mutateAsync({
|
|
58
|
+
groupId: space.group_id,
|
|
59
|
+
input: { name: trimmedName, description: trimmedDescription || null, ...(iconChanged ? { icon } : {}) },
|
|
60
|
+
})
|
|
61
|
+
: await create.mutateAsync({ name: trimmedName, description: trimmedDescription || null, ...(icon ? { icon } : {}) });
|
|
62
|
+
successToast(space ? t('saved') : t('created'));
|
|
63
|
+
onOpenChange(false);
|
|
64
|
+
onSaved?.(saved);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const code = error instanceof ApiError ? error.code : undefined;
|
|
68
|
+
if (code === 'group_name_taken')
|
|
69
|
+
setProblem(t('nameTaken'));
|
|
70
|
+
else if (code === 'group_limit')
|
|
71
|
+
setProblem(t('limit'));
|
|
72
|
+
else if (code === 'invalid_icon')
|
|
73
|
+
errorToast(t('iconSaveFailed'));
|
|
74
|
+
else
|
|
75
|
+
errorToast(space ? t('saveFailed') : t('createFailed'));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return (_jsx(Modal, { open: open, onOpenChange: (next) => !pending && onOpenChange(next), children: _jsxs(ModalContent, { className: "lg:max-w-lg", children: [_jsx(ModalHeader, { children: _jsx(ModalTitle, { children: space ? t('editTitle') : t('createTitle') }) }), _jsx(ModalBody, { children: _jsx("form", { id: `${nameId}-form`, onSubmit: (event) => {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
void submit();
|
|
81
|
+
}, children: _jsxs(FieldGroup, { children: [_jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: nameId, children: t('nameLabel') }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ProjectIconField, { value: spaceIconValue({ name: trimmedName || space?.name || '', icon }), onChange: (emoji) => setIcon({ emoji }), onGlyphChange: (glyph) => setIcon({ glyph }), onClear: icon ? () => setIcon(null) : undefined, disabled: pending }), _jsx(Input, { id: nameId, autoFocus: true, value: name, maxLength: NAME_MAX, placeholder: t('namePlaceholder'), "aria-invalid": problem ? true : undefined, onChange: (event) => {
|
|
82
|
+
setName(event.target.value);
|
|
83
|
+
setProblem(null);
|
|
84
|
+
} })] }), problem ? (_jsx("p", { className: "text-destructive text-xs", role: "alert", children: problem })) : null] }), _jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: descriptionId, children: t('descriptionLabel') }), _jsx(Textarea, { id: descriptionId, value: description, maxLength: DESCRIPTION_MAX, minHeight: 96, maxHeight: 280, placeholder: t('descriptionPlaceholder'), onChange: (event) => setDescription(event.target.value), onKeyDown: (event) => {
|
|
85
|
+
if (event.nativeEvent.isComposing)
|
|
86
|
+
return;
|
|
87
|
+
if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
void submit();
|
|
90
|
+
}
|
|
91
|
+
} })] })] }) }) }), _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') }), _jsx(Button, { type: "submit", form: `${nameId}-form`, size: "sm", className: "w-full sm:w-auto", "aria-busy": pending || undefined, disabled: !trimmedName || unchanged || pending, children: space ? t('save') : t('create') })] })] }) }));
|
|
92
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ProjectSessionGroup } from '@kortix/sdk';
|
|
2
|
+
import { type EntityAvatarSize } from '../../primitives/entity-avatar.js';
|
|
3
|
+
import { type ProjectIconValue } from '../projects/modal/project-icon-field.js';
|
|
4
|
+
type SpaceIconSource = Pick<ProjectSessionGroup, 'name' | 'icon'>;
|
|
5
|
+
/**
|
|
6
|
+
* The icon a space shows: the one picked or given at create, else the one its
|
|
7
|
+
* name suggests (`suggestSpaceIcon`, the same function the API runs on
|
|
8
|
+
* create). Never null, so every space has a face.
|
|
9
|
+
*/
|
|
10
|
+
export declare function spaceIconValue(space: SpaceIconSource): Exclude<ProjectIconValue, null>;
|
|
11
|
+
/**
|
|
12
|
+
* A space's icon with no tile: the glyph in its colour, or the emoji, sized by
|
|
13
|
+
* `className` (default `size-4`). For dense rows such as the sidebar, where a
|
|
14
|
+
* filled tile reads heavier than the name beside it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function SpaceIconBare({ space, className }: {
|
|
17
|
+
space: SpaceIconSource;
|
|
18
|
+
className?: string;
|
|
19
|
+
}): import("react").JSX.Element | null;
|
|
20
|
+
/** A space's icon as a tile: the spaces list, the picker. */
|
|
21
|
+
export declare function SpaceIcon({ space, size, className, }: {
|
|
22
|
+
space: SpaceIconSource;
|
|
23
|
+
size?: EntityAvatarSize;
|
|
24
|
+
className?: string;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* The space page's icon: the workspace icon picker (Icons and Emojis). A pick
|
|
28
|
+
* saves at once and the tile repaints from the pending value, so it never
|
|
29
|
+
* flashes the old icon. The trash button puts back the icon the name suggests.
|
|
30
|
+
*/
|
|
31
|
+
export declare function SpaceIconButton({ projectId, space, className, }: {
|
|
32
|
+
projectId: string;
|
|
33
|
+
space: ProjectSessionGroup;
|
|
34
|
+
className?: string;
|
|
35
|
+
}): import("react").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useUpdateWorkspaceSessionGroup } from '@kortix/sdk/react';
|
|
4
|
+
import { suggestSpaceIcon } from '../../_vendor/kortix-shared.js';
|
|
5
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
6
|
+
import { cn } from '../../internal/lib/utils.js';
|
|
7
|
+
import { EntityAvatar } from '../../primitives/entity-avatar.js';
|
|
8
|
+
import { glyphFace } from '../../primitives/glyph-face.js';
|
|
9
|
+
import { glyphForeground, glyphStyle } from '../../primitives/glyph-tint.js';
|
|
10
|
+
import { errorToast } from '../../primitives/toast.js';
|
|
11
|
+
import { ProjectIconField } from '../projects/modal/project-icon-field.js';
|
|
12
|
+
/**
|
|
13
|
+
* The icon a space shows: the one picked or given at create, else the one its
|
|
14
|
+
* name suggests (`suggestSpaceIcon`, the same function the API runs on
|
|
15
|
+
* create). Never null, so every space has a face.
|
|
16
|
+
*/
|
|
17
|
+
export function spaceIconValue(space) {
|
|
18
|
+
return space.icon ?? suggestSpaceIcon(space.name);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A space's icon with no tile: the glyph in its colour, or the emoji, sized by
|
|
22
|
+
* `className` (default `size-4`). For dense rows such as the sidebar, where a
|
|
23
|
+
* filled tile reads heavier than the name beside it.
|
|
24
|
+
*/
|
|
25
|
+
export function SpaceIconBare({ space, className }) {
|
|
26
|
+
const icon = spaceIconValue(space);
|
|
27
|
+
if ('emoji' in icon) {
|
|
28
|
+
return (_jsx("span", { "aria-hidden": true, className: cn('inline-flex size-4 shrink-0 items-center justify-center text-sm leading-none', className), children: icon.emoji }));
|
|
29
|
+
}
|
|
30
|
+
const Glyph = glyphFace(icon.glyph.name) ?? glyphFace(suggestSpaceIcon(space.name).glyph.name);
|
|
31
|
+
if (!Glyph)
|
|
32
|
+
return null;
|
|
33
|
+
return (_jsx(Glyph, { "aria-hidden": true, weight: "fill", style: glyphStyle(icon.glyph.color), className: cn('size-4 shrink-0', glyphForeground(icon.glyph.color), className) }));
|
|
34
|
+
}
|
|
35
|
+
/** A space's icon as a tile: the spaces list, the picker. */
|
|
36
|
+
export function SpaceIcon({ space, size = 'sm', className, }) {
|
|
37
|
+
const icon = spaceIconValue(space);
|
|
38
|
+
return (_jsx(EntityAvatar, { label: space.name, emoji: 'emoji' in icon ? icon.emoji : null, glyph: 'glyph' in icon ? icon.glyph : null, size: size, className: cn('border-0', className) }));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The space page's icon: the workspace icon picker (Icons and Emojis). A pick
|
|
42
|
+
* saves at once and the tile repaints from the pending value, so it never
|
|
43
|
+
* flashes the old icon. The trash button puts back the icon the name suggests.
|
|
44
|
+
*/
|
|
45
|
+
export function SpaceIconButton({ projectId, space, className, }) {
|
|
46
|
+
const t = useTranslations('sessionSpaces');
|
|
47
|
+
const update = useUpdateWorkspaceSessionGroup(projectId);
|
|
48
|
+
const pending = update.isPending && update.variables?.groupId === space.group_id ? update.variables.input : null;
|
|
49
|
+
const stored = pending && pending.icon !== undefined ? pending.icon : space.icon;
|
|
50
|
+
const save = (icon) => update.mutate({ groupId: space.group_id, input: { icon } }, { onError: () => errorToast(t('iconSaveFailed')) });
|
|
51
|
+
return (_jsx(ProjectIconField, { value: spaceIconValue({ name: space.name, icon: stored }), onChange: (emoji) => save({ emoji }), onGlyphChange: (glyph) => save({ glyph }), onClear: stored ? () => save(null) : undefined, triggerClassName: className }));
|
|
52
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ProjectSessionGroup } from '@kortix/sdk';
|
|
2
|
+
/** Who sees a space: everyone in the workspace, its creator alone, or its creator and the people it is shared with. */
|
|
3
|
+
export type SpaceAudience = {
|
|
4
|
+
kind: 'everyone';
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'private';
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'people';
|
|
9
|
+
ids: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare function spaceAudience(space: ProjectSessionGroup): SpaceAudience;
|
|
12
|
+
/** The audience in words: "Everyone in this workspace", "Only you", "Shared with 3 people". */
|
|
13
|
+
export declare function useSpaceAudienceLabel(space: ProjectSessionGroup): string;
|
|
14
|
+
/** One person of the workspace as the avatars draw them. */
|
|
15
|
+
export interface WorkspacePerson {
|
|
16
|
+
email: string;
|
|
17
|
+
/** Their profile's display name; null when they set none. */
|
|
18
|
+
name: string | null;
|
|
19
|
+
avatarUrl: string | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The space's own people (creator, then members) with their profiles, as the
|
|
23
|
+
* API returns them on the space: every viewer of the space can read these,
|
|
24
|
+
* unlike the workspace access list, which only managers can.
|
|
25
|
+
*/
|
|
26
|
+
export declare function spacePeople(space: ProjectSessionGroup): Map<string, WorkspacePerson>;
|
|
27
|
+
/** The workspace's people by id, for avatars: email, name and picture. A viewer who may not read the list gets an empty map. */
|
|
28
|
+
export declare function useWorkspacePeople(projectId: string, enabled: boolean): Map<string, WorkspacePerson>;
|
|
29
|
+
/**
|
|
30
|
+
* Who sees the space, drawn small: up to `max` avatars and "+N", the people
|
|
31
|
+
* glyph for the whole workspace, a lock for its creator alone. A viewer who
|
|
32
|
+
* may not read the people list sees the count beside the people glyph, never
|
|
33
|
+
* a "?" avatar.
|
|
34
|
+
*/
|
|
35
|
+
export declare function SpaceAudienceMark({ space, max, className }: {
|
|
36
|
+
space: ProjectSessionGroup;
|
|
37
|
+
max?: number;
|
|
38
|
+
className?: string;
|
|
39
|
+
}): import("react").JSX.Element;
|
|
40
|
+
/** A space's people in the shape of the session header's avatar stack (`SessionParticipantStack`), creator first. */
|
|
41
|
+
export declare function spaceParticipants(space: ProjectSessionGroup): {
|
|
42
|
+
participants: {
|
|
43
|
+
user_id: string;
|
|
44
|
+
name: string | null;
|
|
45
|
+
email: string | null;
|
|
46
|
+
avatar_url: string | null;
|
|
47
|
+
is_viewer: boolean;
|
|
48
|
+
}[];
|
|
49
|
+
total: number;
|
|
50
|
+
multi_user: boolean;
|
|
51
|
+
};
|