@kortix/ui 0.15.6 → 0.15.8
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/README.md +7 -7
- package/dist/_vendor/kortix-shared.js +36 -1
- package/dist/_vendor/shared/my-kortix-agent.d.ts +7 -0
- package/dist/_vendor/shared/pixel-mark.d.ts +18 -0
- package/dist/customize/connectors/catalog/connector-categories.d.ts +2 -2
- package/dist/customize/connectors/catalog/connector-categories.js +2 -2
- package/dist/customize/connectors/detail/connector-modal.js +1 -1
- package/dist/customize/providers/provider-accordion.js +3 -2
- package/dist/customize/providers/provider-connect.d.ts +7 -0
- package/dist/customize/providers/provider-connect.js +21 -2
- package/dist/customize/providers/provider-sheet.js +3 -2
- package/dist/customize/sections/gateway-view.d.ts +2 -2
- package/dist/customize/sections/gateway-view.js +30 -15
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.d.ts +3 -1
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +2 -2
- package/dist/customize/sections/view/account-secret-resources-panel.js +8 -5
- package/dist/customize/sections/view/agent-editor-basics-fields.js +1 -1
- package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
- package/dist/customize/sections/view/git-view.js +1 -1
- package/dist/customize/sections/view/permission-editor.js +1 -1
- package/dist/customize/sections/view/review-center-connected.js +15 -3
- package/dist/customize/sections/view/subscription-usage.d.ts +269 -17
- package/dist/customize/sections/view/subscription-usage.js +197 -54
- package/dist/customize/shared/entity/entity-modal.js +8 -10
- package/dist/files/project/components/drive-toolbar.d.ts +1 -1
- package/dist/files/project/components/drive-toolbar.js +1 -1
- package/dist/files/project/store/version-store.d.ts +1 -1
- package/dist/files/renderers/shared/scroll-area-compat.d.ts +6 -6
- package/dist/files/renderers/shared/scroll-area-compat.js +7 -9
- package/dist/files/renderers/shared/select-compat.js +3 -7
- package/dist/files/viewer/file-preview-modal.d.ts +10 -11
- package/dist/files/viewer/file-preview-modal.js +17 -18
- package/dist/i18n/en.d.ts +40 -47
- package/dist/i18n/en.js +47 -54
- package/dist/i18n/ui-catalog/app-registry-translation-keys.generated.js +5 -0
- package/dist/index.js +1 -1
- package/dist/internal/account-hub/account-hub-location.js +2 -2
- package/dist/internal/account-hub/use-account-members.d.ts +28 -1
- package/dist/internal/account-hub/use-account-members.js +27 -10
- package/dist/internal/auth/auth-primitives.d.ts +27 -0
- package/dist/internal/auth/auth-primitives.js +21 -0
- package/dist/internal/billing/index.d.ts +1 -0
- package/dist/internal/billing/index.js +2 -0
- package/dist/internal/billing/use-free-grant-unspent.d.ts +10 -0
- package/dist/internal/billing/use-free-grant-unspent.js +20 -0
- package/dist/internal/components/agent-mark.d.ts +1 -8
- package/dist/internal/components/agent-mark.js +2 -19
- package/dist/internal/lib/billing/billing-gate-state.d.ts +20 -0
- package/dist/internal/lib/billing/billing-gate-state.js +22 -0
- package/dist/internal/lib/error-handler.js +0 -2
- package/dist/internal/lib/navigation/modified-click.js +2 -2
- package/dist/internal/lib/pixel-mark.d.ts +3 -20
- package/dist/internal/lib/pixel-mark.js +3 -34
- package/dist/internal/notifications/notification-inbox.js +1 -1
- package/dist/internal/stores/active-space-store.d.ts +1 -1
- package/dist/internal/stores/browser-recents-store.d.ts +1 -1
- package/dist/internal/stores/current-account-store.d.ts +1 -1
- package/dist/internal/stores/first-chat-store.d.ts +1 -1
- package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
- package/dist/internal/stores/session-browser-store.d.ts +1 -1
- package/dist/internal/stores/session-expanded-store.d.ts +1 -1
- package/dist/internal/stores/session-filter-store.d.ts +1 -1
- package/dist/internal/stores/session-history-view-store.d.ts +1 -1
- package/dist/internal/stores/session-hover-store.d.ts +1 -1
- package/dist/internal/stores/session-hover-store.js +1 -1
- package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
- package/dist/internal/stores/sound-store.d.ts +1 -1
- package/dist/internal/stores/tab-store.d.ts +1 -1
- package/dist/internal/stores/upgrade-dialog-store.d.ts +0 -2
- package/dist/internal/stores/upgrade-dialog-store.js +0 -2
- package/dist/internal/stores/user-preferences-store.d.ts +1 -1
- package/dist/internal/stores/web-notification-store.d.ts +1 -1
- package/dist/lib/base-ui-compat.d.ts +149 -0
- package/dist/lib/base-ui-compat.js +339 -0
- package/dist/lib/portal-container.d.ts +3 -7
- package/dist/lib/portal-container.js +5 -3
- package/dist/lib/z-stack.d.ts +4 -4
- package/dist/lib/z-stack.js +5 -5
- package/dist/markdown/setup-links/approval-decision.d.ts +1 -1
- package/dist/markdown/setup-links/approval-decision.js +1 -1
- package/dist/primitives/accordion.d.ts +36 -5
- package/dist/primitives/accordion.js +41 -8
- package/dist/primitives/alert-dialog.d.ts +33 -11
- package/dist/primitives/alert-dialog.js +41 -19
- package/dist/primitives/avatar.d.ts +5 -2
- package/dist/primitives/avatar.js +3 -3
- package/dist/primitives/badge.js +1 -1
- package/dist/primitives/breadcrumb.js +1 -1
- package/dist/primitives/button-group.js +3 -3
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox.d.ts +14 -5
- package/dist/primitives/checkbox.js +24 -9
- package/dist/primitives/collapsible.d.ts +16 -4
- package/dist/primitives/collapsible.js +18 -7
- package/dist/primitives/command-core.d.ts +121 -0
- package/dist/primitives/command-core.js +642 -0
- package/dist/primitives/command.d.ts +38 -4
- package/dist/primitives/command.js +22 -13
- package/dist/primitives/context-menu.d.ts +61 -31
- package/dist/primitives/context-menu.js +40 -53
- package/dist/primitives/dialog.d.ts +48 -10
- package/dist/primitives/dialog.js +48 -19
- package/dist/primitives/disclosure.d.ts +1 -1
- package/dist/primitives/disclosure.js +2 -2
- package/dist/primitives/drawer.d.ts +28 -9
- package/dist/primitives/drawer.js +42 -18
- package/dist/primitives/dropdown-menu.d.ts +55 -33
- package/dist/primitives/dropdown-menu.js +46 -82
- package/dist/primitives/faded-scroll-area.js +2 -1
- package/dist/primitives/hint.js +3 -3
- package/dist/primitives/hover-card.d.ts +17 -5
- package/dist/primitives/hover-card.js +45 -8
- package/dist/primitives/item.js +2 -2
- package/dist/primitives/label.d.ts +5 -2
- package/dist/primitives/label.js +10 -3
- package/dist/primitives/menu-base.d.ts +150 -0
- package/dist/primitives/menu-base.js +171 -0
- package/dist/primitives/menu-recipe.d.ts +1 -1
- package/dist/primitives/menu-recipe.js +2 -7
- package/dist/primitives/modal.d.ts +19 -52
- package/dist/primitives/modal.js +24 -28
- package/dist/primitives/navigation-menu.d.ts +36 -11
- package/dist/primitives/navigation-menu.js +31 -12
- package/dist/primitives/popover.d.ts +31 -6
- package/dist/primitives/popover.js +79 -12
- package/dist/primitives/preview-image.d.ts +18 -7
- package/dist/primitives/preview-image.js +14 -11
- package/dist/primitives/progress.d.ts +4 -2
- package/dist/primitives/progress.js +4 -3
- package/dist/primitives/project-icon-picker.js +2 -2
- package/dist/primitives/radio-group.d.ts +28 -5
- package/dist/primitives/radio-group.js +18 -10
- package/dist/primitives/scroll-area.d.ts +2 -2
- package/dist/primitives/scroll-area.js +8 -3
- package/dist/primitives/select.d.ts +55 -12
- package/dist/primitives/select.js +93 -36
- package/dist/primitives/separator.d.ts +6 -2
- package/dist/primitives/separator.js +10 -2
- package/dist/primitives/sheet.d.ts +17 -10
- package/dist/primitives/sheet.js +19 -22
- package/dist/primitives/sidebar-menu-primitives.js +8 -8
- package/dist/primitives/slider-native.d.ts +2 -2
- package/dist/primitives/slider-native.js +11 -9
- package/dist/primitives/slider.d.ts +24 -6
- package/dist/primitives/slider.js +26 -24
- package/dist/primitives/slot.d.ts +6 -0
- package/dist/primitives/slot.js +7 -0
- package/dist/primitives/split-sheet.js +1 -1
- package/dist/primitives/stepper.js +1 -1
- package/dist/primitives/switch.d.ts +16 -3
- package/dist/primitives/switch.js +7 -6
- package/dist/primitives/tabs.d.ts +36 -20
- package/dist/primitives/tabs.js +131 -102
- package/dist/primitives/toggle.d.ts +16 -3
- package/dist/primitives/toggle.js +8 -3
- package/dist/primitives/tooltip.d.ts +24 -5
- package/dist/primitives/tooltip.js +32 -10
- package/dist/primitives/type-to-confirm-dialog.d.ts +1 -1
- package/dist/primitives/type-to-confirm-dialog.js +1 -1
- package/dist/session/composer/animated-placeholder.js +1 -1
- package/dist/session/composer/chat-input/chat-input-control.js +3 -3
- package/dist/session/composer/editor/composer-editor.js +1 -1
- package/dist/session/composer/menus/menu-shell.d.ts +1 -1
- package/dist/session/composer/menus/menu-shell.js +1 -1
- package/dist/session/composer/menus/mount.js +1 -1
- package/dist/session/composer/reasoning-effort-selector.js +1 -1
- package/dist/session/header/session-site-header.js +2 -2
- package/dist/session/header/subagent-hover-card.js +2 -2
- package/dist/session/media/image-preview.js +1 -1
- package/dist/session/models/model-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +18 -12
- package/dist/session/models/subscription-switcher.d.ts +37 -0
- package/dist/session/models/subscription-switcher.js +97 -0
- package/dist/session/models/subscription-windows.d.ts +40 -0
- package/dist/session/models/subscription-windows.js +86 -0
- package/dist/session/overrides/session-overrides-control.js +3 -3
- package/dist/session/panel/diff-dialog.js +1 -1
- package/dist/session/panel/easy/detail-view.js +3 -3
- package/dist/session/panel/mobile-tool-drawer.js +2 -2
- package/dist/session/panel/panel-fallback.js +1 -1
- package/dist/session/panel/session-files-explorer.d.ts +1 -1
- package/dist/session/panel/session-files-explorer.js +1 -1
- package/dist/session/prompts/ask-deck.d.ts +14 -2
- package/dist/session/prompts/ask-deck.js +6 -2
- package/dist/session/thread/session-chat.js +2 -2
- package/dist/session/thread/session-context-message-explorer.js +1 -1
- package/dist/session/thread/turn-share.js +3 -4
- package/dist/session/tool/shared/show-helpers.js +1 -1
- package/dist/session/turn/message-time-label.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +40 -47
- package/dist/workspace/admin/settings-search.js +4 -12
- package/dist/workspace/inbox/workspace-inbox.js +11 -2
- package/dist/workspace/layout/new-session-create.d.ts +4 -2
- package/dist/workspace/layout/new-session-create.js +11 -0
- package/dist/workspace/projects/modal/project-icon-field.js +9 -23
- package/dist/workspace/review/approval-modal.d.ts +6 -6
- package/dist/workspace/review/approval-modal.js +10 -14
- package/dist/workspace/review/review-center.d.ts +9 -2
- package/dist/workspace/review/review-center.js +258 -126
- package/dist/workspace/review/review-detail.d.ts +20 -10
- package/dist/workspace/review/review-detail.js +39 -44
- package/dist/workspace/review/review-meta.d.ts +27 -6
- package/dist/workspace/review/review-meta.js +46 -34
- package/dist/workspace/sessions/session-row.js +1 -1
- package/dist/workspace/sidebar/footer/project-download-app-nav.d.ts +10 -0
- package/dist/workspace/sidebar/footer/project-download-app-nav.js +53 -0
- package/dist/workspace/sidebar/footer/promo-nav-row.d.ts +2 -1
- package/dist/workspace/sidebar/footer/promo-nav-row.js +1 -1
- package/dist/workspace/sidebar/project-session-list.js +2 -2
- package/dist/workspace/sidebar/project-sidebar.d.ts +6 -1
- package/dist/workspace/sidebar/project-sidebar.js +3 -2
- package/dist/workspace/sidebar/session-brief-hover-card.d.ts +1 -1
- package/dist/workspace/sidebar/session-brief-hover-card.js +3 -3
- package/dist/workspace/sidebar/session-title.d.ts +2 -2
- package/dist/workspace/sidebar/session-title.js +2 -2
- package/dist/workspace/sidebar/workspace-menu-model.d.ts +19 -13
- package/dist/workspace/sidebar/workspace-menu-model.js +7 -8
- package/dist/workspace/sidebar/workspace-menu-section.js +1 -1
- package/dist/workspace/spaces/space-links.js +1 -1
- package/dist/workspace/spaces/space-threads-tab.js +1 -1
- package/package.json +16 -35
- package/skills/kortix-ui/SKILL.md +1 -1
- package/skills/kortix-ui/references/custom-dashboard.md +1 -1
- package/dist/customize/sections/view/subscription-usage-tab.d.ts +0 -25
- package/dist/customize/sections/view/subscription-usage-tab.js +0 -121
|
@@ -17,7 +17,7 @@ import { Checkbox } from '../../primitives/checkbox.js';
|
|
|
17
17
|
import { ConfirmDialog } from '../../primitives/confirm-dialog.js';
|
|
18
18
|
import { CountBadge } from '../../primitives/count-badge.js';
|
|
19
19
|
import { Button } from '../../primitives/button.js';
|
|
20
|
-
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem,
|
|
20
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from '../../primitives/dropdown-menu.js';
|
|
21
21
|
import Hint from '../../primitives/hint.js';
|
|
22
22
|
import { InputGroupSearch, InputGroupSearchIcon, InputGroupSearchInput, } from '../../primitives/input-group.js';
|
|
23
23
|
import { Kbd } from '../../primitives/kbd.js';
|
|
@@ -27,6 +27,7 @@ import { Skeleton } from '../../primitives/skeleton.js';
|
|
|
27
27
|
import { DiffStat } from '../../primitives/status.js';
|
|
28
28
|
import { Tabs, TabsList, TabsTrigger } from '../../primitives/tabs.js';
|
|
29
29
|
import { errorToast, infoToast, successToast, toastIcon, undoToast, } from '../../primitives/toast.js';
|
|
30
|
+
import { EmptyArt } from '../../primitives/empty-art.js';
|
|
30
31
|
import { EmptyState } from '../../primitives/empty-state.js';
|
|
31
32
|
import { ErrorState } from '../../primitives/error-state.js';
|
|
32
33
|
import { localizeUiCatalog } from '../../i18n/ui-catalog/localize-ui-catalog.js';
|
|
@@ -35,18 +36,18 @@ import { cn } from '../../internal/lib/utils.js';
|
|
|
35
36
|
import { hasOpenFloatingLayer } from '../../lib/z-stack.js';
|
|
36
37
|
import { SelectionBar } from '../../internal/selection/selection-bar.js';
|
|
37
38
|
import { selectRange, toggleId } from '../../internal/selection/selection.js';
|
|
38
|
-
import {
|
|
39
|
+
import { ChatsIcon as Chats, CheckCircleIcon as CheckCircleSolid, CheckSquareIcon, ClockCountdownIcon as ClockCountdown, DotsThreeIcon as DotsThree, FunnelSimpleIcon as FunnelSimple, MagnifyingGlassIcon as Search, ShapesIcon as Shapes, ShieldCheckIcon as ShieldCheck, TrayIcon as Tray, WarningIcon, XIcon as X, } from '@phosphor-icons/react';
|
|
39
40
|
import { useUiPathname, useUiRouter, useUiSearchParams } from '../../providers/ui-provider.js';
|
|
40
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
41
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
41
42
|
import { statusToVerdict } from './map.js';
|
|
42
43
|
import { getLocalizedMockItems } from './mock-data.js';
|
|
43
44
|
import { BULK_MAX, BULK_VERDICT, bulkResultMessage, bulkSelectable, bulkSkipMessage, bulkSupports, formatExpiresIn, formatItemAge, isQuickDecidableApproval, resolveBulkOutcome, } from './review-actions.js';
|
|
44
45
|
import { reviewArgsSummary } from '../../session/prompts/session-approval-review.js';
|
|
45
46
|
import { approvalIdentity } from '../../markdown/setup-links/approval-decision.js';
|
|
46
47
|
import { ConnectorAppMark } from '../../markdown/setup-links/connector-handshake.js';
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
48
|
+
import { ApprovalDecisionPane, reviewApprovalAsker, reviewApprovalDenyOnly, reviewApprovalDetails, } from './approval-modal.js';
|
|
49
|
+
import { ClosePaneButton, ReviewDetail } from './review-detail.js';
|
|
50
|
+
import { ROW_MERGED_GLYPH, ROW_STATUS_GLYPH, ROW_TILE, ROW_TILE_NEUTRAL, reviewKindLabel, reviewStatusLabel, } from './review-meta.js';
|
|
50
51
|
import { bulkSetStatus, decideApprovalAction, filterItems, groupBySession, isPromiseLike, REVIEW_VERDICT_ANNOUNCED, sessionOptions, setStatus, } from './review-reducer.js';
|
|
51
52
|
import { segmentForStatus, } from './types.js';
|
|
52
53
|
/**
|
|
@@ -59,9 +60,9 @@ function TimeAgo({ iso }) {
|
|
|
59
60
|
useEffect(() => setMounted(true), []);
|
|
60
61
|
return _jsx("span", { className: "tabular-nums", children: mounted ? formatItemAge(iso) : '' });
|
|
61
62
|
}
|
|
62
|
-
/** "Expires in 3h" on a pending approval. Under one hour a
|
|
63
|
-
* warning accent leads it; the text stays muted (an accent paints a
|
|
64
|
-
* never text). Client-only, like `TimeAgo`. Nothing once no time is left. */
|
|
63
|
+
/** "Expires in 3h" on a pending approval. Under one hour a countdown glyph in
|
|
64
|
+
* the warning accent leads it; the text stays muted (an accent paints a
|
|
65
|
+
* glyph, never text). Client-only, like `TimeAgo`. Nothing once no time is left. */
|
|
65
66
|
function ExpiresIn({ iso }) {
|
|
66
67
|
const tHardcodedUi = useTranslations('hardcodedUi');
|
|
67
68
|
const [mounted, setMounted] = useState(false);
|
|
@@ -69,7 +70,7 @@ function ExpiresIn({ iso }) {
|
|
|
69
70
|
const left = mounted ? formatExpiresIn(iso) : null;
|
|
70
71
|
if (!left)
|
|
71
72
|
return null;
|
|
72
|
-
return (_jsxs(_Fragment, { children: [_jsx(Dot, {}), left.soon ? (_jsx(
|
|
73
|
+
return (_jsxs(_Fragment, { children: [_jsx(Dot, {}), left.soon ? (_jsx(ClockCountdown, { "aria-hidden": true, className: "text-kortix-orange size-3.5 shrink-0" })) : null, _jsx("span", { className: "shrink-0 tabular-nums", children: tHardcodedUi('approvalPage.expiresIn', { time: left.time }) })] }));
|
|
73
74
|
}
|
|
74
75
|
const SEGMENTS = [
|
|
75
76
|
{ value: 'needs_you', label: 'Needs you' },
|
|
@@ -94,57 +95,67 @@ const SHORTCUTS = [
|
|
|
94
95
|
{ keys: ['/'], label: 'Search' },
|
|
95
96
|
{ keys: ['?'], label: 'This help' },
|
|
96
97
|
];
|
|
97
|
-
/** Flat rows, no chrome
|
|
98
|
-
const LIST_CLASS = 'space-y-
|
|
99
|
-
/** One small glyph after the title says where the item landed; the row
|
|
100
|
-
* carries no status badge. `needs_you` has no glyph — its action button is
|
|
101
|
-
* the state. */
|
|
102
|
-
const STATUS_GLYPH = {
|
|
103
|
-
approved: { icon: Check, className: 'text-kortix-green' },
|
|
104
|
-
done: { icon: Check, className: 'text-kortix-green' },
|
|
105
|
-
waiting: { icon: Clock, className: 'text-muted-foreground' },
|
|
106
|
-
changes_requested: { icon: ArrowUUpLeft, className: 'text-kortix-orange' },
|
|
107
|
-
rejected: { icon: X, className: 'text-kortix-red' },
|
|
108
|
-
dismissed: { icon: X, className: 'text-muted-foreground' },
|
|
109
|
-
expired: { icon: Clock, className: 'text-muted-foreground' },
|
|
110
|
-
};
|
|
98
|
+
/** Flat rows, no chrome: the row itself lifts on hover, focus and selection. */
|
|
99
|
+
const LIST_CLASS = 'space-y-px';
|
|
111
100
|
function Dot() {
|
|
112
|
-
return (_jsx("span", { "aria-hidden": true, className: "text-muted-foreground", children: "\
|
|
101
|
+
return (_jsx("span", { "aria-hidden": true, className: "text-muted-foreground", children: "\u00B7" }));
|
|
113
102
|
}
|
|
114
|
-
|
|
103
|
+
/**
|
|
104
|
+
* The 32 px leading tile: a connector call shows its app's mark; every other
|
|
105
|
+
* kind its own glyph, tinted while it needs you and neutral once it does not.
|
|
106
|
+
* A small corner badge adds what the tile cannot say: a connector call is an
|
|
107
|
+
* approval, a change has merge conflicts.
|
|
108
|
+
*/
|
|
109
|
+
function RowTile({ item, className }) {
|
|
110
|
+
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
111
|
+
const pending = item.status === 'needs_you';
|
|
112
|
+
const connector = item.kind === 'approval' ? reviewApprovalDetails(item) : null;
|
|
113
|
+
const who = connector ? approvalIdentity(connector) : null;
|
|
114
|
+
const tile = ROW_TILE[item.kind];
|
|
115
|
+
const conflicted = item.kind === 'change' && (item.detail.conflicts?.length ?? 0) > 0;
|
|
116
|
+
const badge = who
|
|
117
|
+
? { icon: ShieldCheck, className: pending ? 'text-kortix-orange' : 'text-muted-foreground' }
|
|
118
|
+
: conflicted
|
|
119
|
+
? { icon: WarningIcon, className: 'text-kortix-orange' }
|
|
120
|
+
: null;
|
|
121
|
+
return (_jsxs("span", { className: cn('relative flex size-8 shrink-0', className), "aria-label": reviewKindLabel(item.kind, tI18nComplete), role: "img", children: [who ? (_jsx(ConnectorAppMark, { name: who.connector ?? item.title, slug: who.slug, iconUrl: who.iconUrl, size: "md" })) : (_jsx("span", { className: cn('flex size-8 items-center justify-center rounded-md', pending ? tile.tint : ROW_TILE_NEUTRAL), children: _jsx(tile.icon, { className: "size-4" }) })), badge ? (_jsx("span", { className: "bg-background absolute -right-1 -bottom-1 flex size-4 items-center justify-center rounded-full", children: _jsx(badge.icon, { weight: "fill", className: cn('size-3', badge.className) }) })) : null] }));
|
|
122
|
+
}
|
|
123
|
+
function ItemRow({ item, idx, focused, active, fresh, sessionLabel, onOpen, onAskChanges, onDismiss, onOpenSession, selection, }) {
|
|
115
124
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
116
125
|
const tBulk = useTranslations('hardcodedUi.reviewBulk');
|
|
117
|
-
const
|
|
126
|
+
const tReview = useTranslations('hardcodedUi.approvalPage');
|
|
118
127
|
const segment = segmentForStatus(item.status);
|
|
119
128
|
const pending = segment === 'needs_you';
|
|
120
129
|
const number = item.kind === 'change' ? item.detail.number : undefined;
|
|
121
130
|
const diff = item.kind === 'change' ? item.detail.advanced : undefined;
|
|
122
|
-
const glyph =
|
|
123
|
-
|
|
131
|
+
const glyph = item.kind === 'change' && item.status === 'approved'
|
|
132
|
+
? ROW_MERGED_GLYPH
|
|
133
|
+
: ROW_STATUS_GLYPH[item.status];
|
|
134
|
+
const statusLabel = reviewStatusLabel(item.status, tI18nComplete);
|
|
135
|
+
// Second line: who, then where. The session stands in for the repo; when
|
|
124
136
|
// the group already names it, the row's own summary fills the slot.
|
|
125
137
|
const where = sessionLabel ?? item.summary;
|
|
126
|
-
// Nothing to review: the
|
|
138
|
+
// Nothing to review: the pane offers only Deny, so the row says so in
|
|
127
139
|
// place of "awaiting approval". Nothing is denied automatically.
|
|
128
140
|
const denyOnly = pending && reviewApprovalDenyOnly(item);
|
|
129
|
-
const tReview = useTranslations('hardcodedUi.approvalPage');
|
|
130
141
|
const selecting = selection?.selecting ?? false;
|
|
131
142
|
const selectable = !!selection && !selection.disabled;
|
|
132
|
-
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const leading = !selectable || !selection ? (kindIcon) : (_jsx("span", { className: "flex size-5 shrink-0 items-center justify-center", children: selecting ? (_jsx(Checkbox, { checked: selection.checked, tabIndex: -1, "aria-hidden": true, className: "pointer-events-none" })) : (_jsxs(_Fragment, { children: [kindIcon, _jsx(Checkbox, { checked: false, "aria-label": tBulk('selectRow', { title: item.title }), onClick: (e) => {
|
|
139
|
-
// The row's own state decides; Radix skips its toggle.
|
|
143
|
+
const highRisk = segment !== 'done' && item.risk === 'high';
|
|
144
|
+
// One fixed 32 px slot: the tile, swapped for the checkbox on row hover and
|
|
145
|
+
// for the whole of select mode. Nothing shifts.
|
|
146
|
+
const tile = (_jsx(RowTile, { item: item, className: cn(selectable && !selecting && 'group-focus-within:hidden group-hover:hidden') }));
|
|
147
|
+
const leading = !selectable || !selection ? (tile) : (_jsx("span", { className: "flex size-8 shrink-0 items-center justify-center", children: selecting ? (_jsx(Checkbox, { checked: selection.checked, tabIndex: -1, "aria-hidden": true, className: "pointer-events-none" })) : (_jsxs(_Fragment, { children: [tile, _jsx(Checkbox, { checked: false, "aria-label": tBulk('selectRow', { title: item.title }), onClick: (e) => {
|
|
148
|
+
// The row's own state decides; the checkbox skips its toggle.
|
|
140
149
|
e.preventDefault();
|
|
141
150
|
selection.onToggle(e.shiftKey);
|
|
142
151
|
}, className: "hidden group-focus-within:flex group-hover:flex" })] })) }));
|
|
143
|
-
const body = (_jsxs(_Fragment, { children: [_jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "
|
|
152
|
+
const body = (_jsxs(_Fragment, { children: [_jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [fresh ? (_jsx("span", { "aria-label": tI18nComplete.raw('text18fdd549b2ed'), role: "img", className: "bg-kortix-blue size-1.5 shrink-0 rounded-full" })) : null, _jsx("span", { className: cn('truncate text-sm', pending || fresh ? 'text-foreground font-medium' : 'text-muted-foreground'), children: item.title }), number != null && (_jsxs("span", { className: "text-muted-foreground shrink-0 text-sm tabular-nums", children: ["#", number] }))] }), _jsx("span", { className: "text-muted-foreground mt-0.5 flex min-w-0 items-center gap-1.5 text-xs", children: denyOnly ? (_jsxs("span", { className: "flex min-w-0 items-center gap-1", children: [_jsx(WarningIcon, { "aria-hidden": true, className: "text-kortix-orange size-3.5 shrink-0" }), _jsx("span", { className: "truncate", children: tReview('canOnlyBeDenied') })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "max-w-[45%] shrink-0 truncate", children: item.agent }), item.kind === 'approval' && segment !== 'done' && item.expiresAt ? (_jsx(ExpiresIn, { iso: item.expiresAt })) : diff && (diff.additions > 0 || diff.deletions > 0) ? (_jsxs(_Fragment, { children: [_jsx(Dot, {}), _jsx(DiffStat, { additions: diff.additions, deletions: diff.deletions, className: "shrink-0 text-xs" })] })) : where ? (_jsxs(_Fragment, { children: [_jsx(Dot, {}), _jsx("span", { className: "truncate", children: where })] })) : null] })) })] }));
|
|
153
|
+
// Right column: where it stands on top, how old it is below.
|
|
154
|
+
const trailing = (_jsxs("span", { className: "flex shrink-0 flex-col items-end gap-1 pt-0.5", children: [_jsx(Hint, { label: statusLabel, children: _jsx("span", { role: "img", "aria-label": statusLabel, className: "flex shrink-0", children: _jsx(glyph.icon, { className: cn('size-4 shrink-0', glyph.className) }) }) }), _jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-xs", children: [highRisk ? (_jsx(Hint, { label: tBulk('riskHigh'), children: _jsx(WarningIcon, { weight: "fill", "aria-label": tBulk('riskHigh'), className: "text-kortix-orange size-3.5 shrink-0" }) })) : null, _jsx(TimeAgo, { iso: item.createdAt })] })] }));
|
|
144
155
|
// The menu's Select hands focus to the row (select mode drops the menu), not
|
|
145
156
|
// back to the trigger that is about to unmount.
|
|
146
157
|
const enteringSelect = useRef(false);
|
|
147
|
-
const
|
|
158
|
+
const rowClass = 'relative flex items-start gap-3 rounded-md px-2.5 py-2.5';
|
|
148
159
|
// Select mode: the whole row is the option (trigger-list.tsx), with no
|
|
149
160
|
// open button and no menu inside it to steal the click.
|
|
150
161
|
if (selecting && selection) {
|
|
@@ -153,20 +164,20 @@ function ItemRow({ item, idx, focused, fresh, sessionLabel, onOpen, onAskChanges
|
|
|
153
164
|
e.preventDefault();
|
|
154
165
|
selection.onToggle(e.shiftKey);
|
|
155
166
|
}
|
|
156
|
-
}, className: cn('
|
|
167
|
+
}, className: cn(rowClass, 'outline-none select-none focus-visible:ring-ring focus-visible:ring-2', focused || selection.checked ? 'bg-active' : selectable && 'hover:bg-hover', selectable && 'cursor-pointer'), children: [leading, _jsx("span", { className: "min-w-0 flex-1", children: body }), trailing] }));
|
|
157
168
|
}
|
|
158
|
-
return (_jsxs("li", { "data-idx": idx, className: cn('group
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
169
|
+
return (_jsxs("li", { "data-idx": idx, "aria-current": active || undefined, className: cn('group', rowClass, active ? 'bg-active' : focused ? 'bg-hover' : 'hover:bg-hover'), children: [leading, _jsx("button", { type: "button", "data-row-open": true, onClick: onOpen, className: "focus-visible:ring-ring min-w-0 flex-1 rounded-sm text-left focus-visible:ring-2 focus-visible:outline-none", children: body }), _jsxs("span", { className: "relative flex shrink-0", children: [_jsx("span", { className: "group-focus-within:invisible group-hover:invisible", children: trailing }), _jsx("span", { className: "invisible absolute top-0 right-0 group-focus-within:visible group-hover:visible", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": tI18nComplete('textcbd7bbfcd257', { value0: item.title }), className: "text-muted-foreground", children: _jsx(DotsThree, { className: "size-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-52", onCloseAutoFocus: (e) => {
|
|
170
|
+
if (enteringSelect.current)
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
enteringSelect.current = false;
|
|
173
|
+
}, children: [_jsxs(DropdownMenuItem, { onClick: onOpen, children: [tI18nComplete.raw('texted077f3d8125'), _jsx(DropdownMenuShortcut, { children: "\u21B5" })] }), onOpenSession && (_jsx(DropdownMenuItem, { onClick: onOpenSession, children: tI18nComplete.raw('textb205bb47f81a') })), pending && (onAskChanges || onDismiss) && _jsx(DropdownMenuSeparator, {}), pending && onAskChanges && (_jsxs(DropdownMenuItem, { onClick: onAskChanges, children: [tI18nComplete.raw('text705364916412'), _jsx(DropdownMenuShortcut, { children: "e" })] })), pending && onDismiss && (_jsxs(DropdownMenuItem, { variant: "destructive", onClick: onDismiss, children: [tI18nComplete.raw('text48845bff334a'), _jsx(DropdownMenuShortcut, { children: "d" })] })), selectable && selection ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onSelect: () => {
|
|
174
|
+
enteringSelect.current = true;
|
|
175
|
+
selection.onToggle(false);
|
|
176
|
+
}, children: [_jsx(CheckSquareIcon, {}), tI18nComplete.raw('text2a78025de6aa'), _jsx(DropdownMenuShortcut, { children: "x" })] })] })) : null] })] }) })] })] }));
|
|
166
177
|
}
|
|
167
178
|
/** One plain bar per row, row height, while the inbox loads. */
|
|
168
179
|
function ListSkeleton({ rows = 4 }) {
|
|
169
|
-
return (_jsx("div", { className: "space-y-1", children: Array.from({ length: rows }).map((_, i) => (_jsx(Skeleton, { className: "h-
|
|
180
|
+
return (_jsx("div", { className: "space-y-1 p-1.5", children: Array.from({ length: rows }).map((_, i) => (_jsx(Skeleton, { className: "h-14 w-full rounded-md" }, i))) }));
|
|
170
181
|
}
|
|
171
182
|
function KeyboardHelp({ open, onClose }) {
|
|
172
183
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
@@ -197,6 +208,26 @@ const RISK_BADGE = {
|
|
|
197
208
|
medium: { variant: 'warning', key: 'riskMedium' },
|
|
198
209
|
high: { variant: 'destructive', key: 'riskHigh' },
|
|
199
210
|
};
|
|
211
|
+
/** `@3xl` in px: the inbox width from which list and detail sit side by side. */
|
|
212
|
+
const TWO_PANE_PX = 768;
|
|
213
|
+
/** Whether `ref`'s element is at least `min` px wide, kept current on resize.
|
|
214
|
+
* True until measured: the server render and a desktop first paint agree. */
|
|
215
|
+
function useContainerWide(ref, min) {
|
|
216
|
+
const [wide, setWide] = useState(true);
|
|
217
|
+
// Before paint: a narrow inbox mounts the asks deck above the list on its
|
|
218
|
+
// first frame, not one frame late.
|
|
219
|
+
useLayoutEffect(() => {
|
|
220
|
+
const el = ref.current;
|
|
221
|
+
if (!el || typeof ResizeObserver === 'undefined')
|
|
222
|
+
return;
|
|
223
|
+
const measure = () => setWide(el.getBoundingClientRect().width >= min);
|
|
224
|
+
measure();
|
|
225
|
+
const observer = new ResizeObserver(measure);
|
|
226
|
+
observer.observe(el);
|
|
227
|
+
return () => observer.disconnect();
|
|
228
|
+
}, [ref, min]);
|
|
229
|
+
return wide;
|
|
230
|
+
}
|
|
200
231
|
export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChange, loadMore, onAct, onBulkAct, onOpenSession, onRecoverChange, recoveringCrId, onRefresh, isLoading, isFetching, isFetched, isError, sessionLabels, verdictAllowed = EVERY_VERDICT, needsYouDeck, } = {}) {
|
|
201
232
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
202
233
|
const tBulk = useTranslations('hardcodedUi.reviewBulk');
|
|
@@ -211,6 +242,12 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
211
242
|
const setSegment = onSegmentChange ?? setLocalSegment;
|
|
212
243
|
const [kindFilter, setKindFilter] = useState('all');
|
|
213
244
|
const [query, setQuery] = useState('');
|
|
245
|
+
const [searchOpen, setSearchOpen] = useState(false);
|
|
246
|
+
const tPane = useTranslations('hardcodedUi.reviewPane');
|
|
247
|
+
// Two panes from `@3xl` (48rem) of the inbox's own width. CSS lays the panes
|
|
248
|
+
// out; this flag only decides where the asks deck mounts, once.
|
|
249
|
+
const rootRef = useRef(null);
|
|
250
|
+
const wide = useContainerWide(rootRef, TWO_PANE_PX);
|
|
214
251
|
// Per-session view: filter to one session, and/or group the list by session so
|
|
215
252
|
// a session's reviews + approvals sit together. Both operate on `sessionId`.
|
|
216
253
|
const [sessionFilter, setSessionFilter] = useState('all');
|
|
@@ -254,7 +291,7 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
254
291
|
const sourceItems = initialItems ?? items;
|
|
255
292
|
const selectedId = useMemo(() => (idParam && sourceItems.some((i) => i.id === idParam) ? idParam : null), [sourceItems, idParam]);
|
|
256
293
|
const listLoaded = !connected || isFetched === true;
|
|
257
|
-
const setSelectedId = useCallback((id) => {
|
|
294
|
+
const setSelectedId = useCallback((id, how) => {
|
|
258
295
|
const params = new URLSearchParams(search?.toString() ?? '');
|
|
259
296
|
if (id)
|
|
260
297
|
params.set('id', id);
|
|
@@ -262,15 +299,26 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
262
299
|
params.delete('id');
|
|
263
300
|
const suffix = params.toString();
|
|
264
301
|
const href = suffix ? `${pathname}?${suffix}` : pathname;
|
|
265
|
-
// Opening pushes so the browser's Back returns to the
|
|
266
|
-
//
|
|
267
|
-
|
|
302
|
+
// Opening from nothing pushes, so the browser's Back returns to the
|
|
303
|
+
// empty pane. Moving between items (j/k, the next row after a verdict)
|
|
304
|
+
// and closing replace: Back never walks the list item by item.
|
|
305
|
+
if ((how ?? (id && !idParam ? 'push' : 'replace')) === 'push') {
|
|
268
306
|
router.push(href, { scroll: false });
|
|
269
|
-
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
270
309
|
router.replace(href, { scroll: false });
|
|
271
|
-
|
|
310
|
+
}
|
|
311
|
+
}, [idParam, pathname, router, search]);
|
|
272
312
|
const labelFor = useMemo(() => (id) => sessionLabels?.[id], [sessionLabels]);
|
|
273
313
|
const visible = useMemo(() => filterItems(items, segment, kindFilter, query, sessionFilter), [items, segment, kindFilter, query, sessionFilter]);
|
|
314
|
+
/** After a verdict the item leaves its list: open the row that took its
|
|
315
|
+
* place (the next one, else the one above).
|
|
316
|
+
* Reads the list as it was before the verdict. */
|
|
317
|
+
const advanceFrom = (id) => {
|
|
318
|
+
const at = visible.findIndex((i) => i.id === id);
|
|
319
|
+
const next = at >= 0 ? (visible[at + 1] ?? visible[at - 1]) : undefined;
|
|
320
|
+
setSelectedId(next?.id ?? null, 'replace');
|
|
321
|
+
};
|
|
274
322
|
const kindCounts = useMemo(() => {
|
|
275
323
|
// Respect the active session filter so the kind-tab badges never contradict
|
|
276
324
|
// the visible list when scoped to one session.
|
|
@@ -632,31 +680,67 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
632
680
|
}
|
|
633
681
|
return;
|
|
634
682
|
}
|
|
635
|
-
// Help
|
|
636
|
-
|
|
683
|
+
// Help or the bulk confirm owns the keyboard. An open item does not:
|
|
684
|
+
// j/k walk the list beside it.
|
|
685
|
+
if (helpOpen || confirm.open)
|
|
637
686
|
return;
|
|
638
687
|
if (typing)
|
|
639
688
|
return; // don't hijack search typing
|
|
689
|
+
if (hasOpenFloatingLayer())
|
|
690
|
+
return; // a menu or dialog owns its keys
|
|
640
691
|
if (e.key === '/') {
|
|
641
692
|
e.preventDefault();
|
|
642
|
-
|
|
693
|
+
setSearchOpen(true);
|
|
694
|
+
requestAnimationFrame(() => document.getElementById('review-search')?.focus());
|
|
643
695
|
return;
|
|
644
696
|
}
|
|
645
697
|
if (e.key === '1' || e.key === '2' || e.key === '3') {
|
|
646
698
|
setSegment(segments[Number(e.key) - 1].value);
|
|
647
699
|
return;
|
|
648
700
|
}
|
|
701
|
+
// a/e/d decide the open item whenever one is open, even when a filter
|
|
702
|
+
// hides its row or empties the list: the verdict goes to what the pane
|
|
703
|
+
// shows. Select mode gives them no verb.
|
|
704
|
+
const openItem = selectedId
|
|
705
|
+
? (items.find((i) => i.id === selectedId) ?? sourceItems.find((i) => i.id === selectedId))
|
|
706
|
+
: undefined;
|
|
707
|
+
if (openItem && !selectMode && (e.key === 'a' || e.key === 'e' || e.key === 'd')) {
|
|
708
|
+
if (e.key === 'a')
|
|
709
|
+
quickPrimary(openItem);
|
|
710
|
+
else if (e.key === 'e')
|
|
711
|
+
quickAskChanges(openItem);
|
|
712
|
+
else
|
|
713
|
+
dismissIds([openItem.id]);
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
649
716
|
if (visible.length === 0)
|
|
650
717
|
return;
|
|
651
|
-
|
|
718
|
+
// j/k/x move from the open item's row when one is open, else from the
|
|
719
|
+
// cursor's row. Select mode moves the cursor, not the open item: there
|
|
720
|
+
// it wins.
|
|
721
|
+
const cur = (selectedId && !selectMode ? visible.find((i) => i.id === selectedId) : undefined) ??
|
|
722
|
+
visible[Math.min(focusedIdx, visible.length - 1)];
|
|
652
723
|
setKbNav(true);
|
|
653
|
-
if (e.key === 'j' || e.key === 'ArrowDown') {
|
|
724
|
+
if (e.key === 'j' || e.key === 'ArrowDown' || e.key === 'k' || e.key === 'ArrowUp') {
|
|
654
725
|
e.preventDefault();
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
726
|
+
const down = e.key === 'j' || e.key === 'ArrowDown';
|
|
727
|
+
// From the open item's row when one is open (rows of a deep link
|
|
728
|
+
// can arrive after it), else from the keyboard cursor.
|
|
729
|
+
const openAt = cur ? visible.indexOf(cur) : -1;
|
|
730
|
+
const from = openAt >= 0 ? openAt : Math.min(focusedIdx, visible.length - 1);
|
|
731
|
+
const to = down ? Math.min(visible.length - 1, from + 1) : Math.max(0, from - 1);
|
|
732
|
+
setFocusedIdx(to);
|
|
733
|
+
// DOM focus follows the cursor out of the list (a click left it on a
|
|
734
|
+
// row), so a later Enter clicks the row the user sees.
|
|
735
|
+
const active = document.activeElement;
|
|
736
|
+
if (active && listRef.current?.contains(active)) {
|
|
737
|
+
listRef.current
|
|
738
|
+
.querySelector(`[data-idx="${to}"] [data-row-open]`)
|
|
739
|
+
?.focus({ preventScroll: true });
|
|
740
|
+
}
|
|
741
|
+
// With an item open, the pane follows the cursor.
|
|
742
|
+
if (selectedId && !selectMode && visible[to])
|
|
743
|
+
setSelectedId(visible[to].id, 'replace');
|
|
660
744
|
}
|
|
661
745
|
else if (e.key === 'x') {
|
|
662
746
|
if (cur && selectableIds.includes(cur.id))
|
|
@@ -667,6 +751,12 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
667
751
|
return;
|
|
668
752
|
}
|
|
669
753
|
else if (e.key === 'Enter' || e.key === 'o') {
|
|
754
|
+
// Enter on a focused button or link (Approve, an answer, a session
|
|
755
|
+
// link) is that control's click, not "open the focused row".
|
|
756
|
+
if (e.defaultPrevented ||
|
|
757
|
+
(e.key === 'Enter' && el instanceof HTMLElement && el.closest('button, a, [role="button"]'))) {
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
670
760
|
e.preventDefault();
|
|
671
761
|
if (cur)
|
|
672
762
|
setSelectedId(cur.id);
|
|
@@ -694,7 +784,7 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
694
784
|
sourceItems.find((i) => i.id === selectedId) ??
|
|
695
785
|
null)
|
|
696
786
|
: null;
|
|
697
|
-
const renderRow = (item, idx, inGroup) => (_jsx(ItemRow, { item: item, idx: idx, focused: kbNav && idx === focusedIdx, fresh: freshIds.has(item.id), sessionLabel: !inGroup && item.sessionId ? labelFor(item.sessionId) : undefined, onOpen: () => setSelectedId(item.id), onAskChanges: verdictAllowed(item, 'changes') ? () => quickAskChanges(item) : undefined, onDismiss: verdictAllowed(item, 'dismiss') ? () => dismissIds([item.id]) : undefined, onOpenSession: item.sessionId && onOpenSession ? () => onOpenSession(item.sessionId) : undefined, selection: selectMode || selectableIds.includes(item.id)
|
|
787
|
+
const renderRow = (item, idx, inGroup) => (_jsx(ItemRow, { item: item, idx: idx, focused: kbNav && idx === focusedIdx, active: item.id === selectedId, fresh: freshIds.has(item.id), sessionLabel: !inGroup && item.sessionId ? labelFor(item.sessionId) : undefined, onOpen: () => setSelectedId(item.id), onAskChanges: verdictAllowed(item, 'changes') ? () => quickAskChanges(item) : undefined, onDismiss: verdictAllowed(item, 'dismiss') ? () => dismissIds([item.id]) : undefined, onOpenSession: item.sessionId && onOpenSession ? () => onOpenSession(item.sessionId) : undefined, selection: selectMode || selectableIds.includes(item.id)
|
|
698
788
|
? {
|
|
699
789
|
checked: selectedIds.has(item.id),
|
|
700
790
|
selecting: !!selectMode,
|
|
@@ -722,7 +812,6 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
722
812
|
: loadMore.isError
|
|
723
813
|
? tSidebar('retry')
|
|
724
814
|
: tSidebar('loadMore') }) })) : null;
|
|
725
|
-
const shortcutsButton = (_jsxs("button", { type: "button", onClick: () => setHelpOpen(true), className: "text-muted-foreground hover:text-foreground duration-fast hidden items-center gap-1.5 text-xs transition-colors sm:flex", children: [_jsx(Kbd, { children: "?" }), tI18nComplete.raw('text46e978d0c193')] }));
|
|
726
815
|
const bulkActions = [
|
|
727
816
|
{
|
|
728
817
|
id: 'approve',
|
|
@@ -777,63 +866,106 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
777
866
|
confirm: tBulk('dismissConfirm', { count: confirmCount }),
|
|
778
867
|
description: withList(tBulk('dismissDescription')),
|
|
779
868
|
};
|
|
780
|
-
// A
|
|
781
|
-
//
|
|
782
|
-
if (idParam && !selected && !listLoaded && !isError) {
|
|
783
|
-
return (_jsx("div", { className: "flex h-full min-h-0 flex-col", children: _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: _jsx("div", { className: "w-full p-4", children: _jsx(ListSkeleton, {}) }) }) }));
|
|
784
|
-
}
|
|
785
|
-
// A Connector call opens the standalone approve page's panel in a modal over
|
|
786
|
-
// the inbox, so it reads and decides the same way on both surfaces.
|
|
869
|
+
// A Connector call renders the standalone approve page's panel in the
|
|
870
|
+
// detail pane, so it reads and decides the same way on both surfaces.
|
|
787
871
|
const approval = selected ? reviewApprovalDetails(selected) : null;
|
|
788
872
|
const approvalCall = approval && selected?.kind === 'approval' ? selected.detail.actions?.[0] : undefined;
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
const
|
|
800
|
-
|
|
801
|
-
//
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
873
|
+
// Filters set beyond the defaults, as removable chips under the list header.
|
|
874
|
+
const activeKind = kindFilter === 'all' ? null : kindFilters.find((f) => f.value === kindFilter);
|
|
875
|
+
const activeSession = sessionFilter === 'all' ? null : sessionOpts.find((s) => s.sessionId === sessionFilter);
|
|
876
|
+
const filtered = !!activeKind || !!activeSession || grouped;
|
|
877
|
+
const showSearch = searchOpen || query.length > 0;
|
|
878
|
+
const clearFilters = () => {
|
|
879
|
+
setKindFilter('all');
|
|
880
|
+
setSessionFilter('all');
|
|
881
|
+
setGrouped(false);
|
|
882
|
+
};
|
|
883
|
+
const back = () => setSelectedId(null);
|
|
884
|
+
const listBody = isError && items.length === 0 ? (_jsx(ErrorState, { size: "sm", title: tI18nComplete.raw('text23686ff6ba91'), description: tI18nComplete.raw('text481859b689b0'), action: _jsxs(Button, { variant: "outline", size: "sm", onClick: onRefresh, disabled: isFetching, children: [isFetching ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, tI18nComplete.raw('text942087cc2d41')] }) })) : isLoading && items.length === 0 ? (_jsx(ListSkeleton, {})) : visible.length === 0 && loadMore ? (
|
|
885
|
+
// Nothing on the pages read so far matches, and more pages exist:
|
|
886
|
+
// offer them, never the empty state (KRTX-1727).
|
|
887
|
+
_jsx("div", { className: "pt-6", children: loadMoreButton })) : visible.length === 0 && segment === 'needs_you' && needsYouDeck && !query && !wide ? (
|
|
888
|
+
// Narrow inbox: the deck above owns the Needs you empty state; an empty
|
|
889
|
+
// list under open asks must not say "all caught up". Once the deck
|
|
890
|
+
// draws nothing (`peer-empty`), it does.
|
|
891
|
+
_jsx("div", { className: "hidden peer-empty:block", children: _jsx(EmptyState, { icon: CheckCircleSolid, size: "sm", title: tI18nComplete.raw('text2f485b9971df'), description: tI18nComplete.raw('text67735374cc20') }) })) : visible.length === 0 ? (_jsx(EmptyState, { icon: CheckCircleSolid, size: "sm", title: query
|
|
892
|
+
? tI18nComplete.raw('text2df01a03ff43')
|
|
893
|
+
: segment === 'needs_you' && needsYouDeck
|
|
894
|
+
? // The asks deck beside the list still waits on you: not "all
|
|
895
|
+
// caught up", only no review items.
|
|
896
|
+
tI18nComplete.raw('textf4c7f41c12d6')
|
|
897
|
+
: segment === 'needs_you'
|
|
898
|
+
? tI18nComplete.raw('text2f485b9971df')
|
|
899
|
+
: tI18nComplete.raw('textf4c7f41c12d6'), description: query
|
|
900
|
+
? tI18nComplete.raw('text2e6d79de50dc')
|
|
901
|
+
: segment === 'needs_you'
|
|
902
|
+
? tI18nComplete.raw('text67735374cc20')
|
|
903
|
+
: segment === 'waiting'
|
|
904
|
+
? tI18nComplete.raw('text2c192433a710')
|
|
905
|
+
: tI18nComplete.raw('text6a00736dae3c') })) : grouped ? (_jsx("div", { ...listProps, className: "space-y-4", children: groups.map((g) => (_jsxs("section", { className: "space-y-1", children: [_jsxs("div", { className: "flex h-7 items-center gap-2 px-2.5", children: [_jsx("h2", { className: "text-muted-foreground truncate text-xs font-medium", children: g.label }), _jsx(CountBadge, { count: g.items.length }), g.sessionId && onOpenSession && (_jsx("button", { type: "button", className: "text-muted-foreground hover:text-foreground duration-fast ml-auto shrink-0 text-xs transition-colors", onClick: () => onOpenSession(g.sessionId), children: tI18nComplete.raw('textb205bb47f81a') }))] }), _jsx("ul", { ...listboxProps, className: LIST_CLASS, children: g.items.map((item) => renderRow(item, visibleIndexById.get(item.id) ?? 0, true)) })] }, g.sessionId ?? '__none__'))) })) : (_jsx("ul", { ...listProps, ...listboxProps, className: LIST_CLASS, children: visible.map((item, idx) => renderRow(item, idx, false)) }));
|
|
906
|
+
/** Nothing open: a quiet prompt to pick a row. */
|
|
907
|
+
const paneEmpty = (_jsx("div", { className: "flex min-h-full flex-1 items-center justify-center px-6 py-8", children: _jsx(EmptyState, { media: _jsx(EmptyArt, { icon: Tray }), size: "sm", title: tPane('emptyTitle'), description: tPane('emptyDescription') }) }));
|
|
908
|
+
// The detail pane: the open item, else (Needs you, wide) what the agents
|
|
909
|
+
// ask of you, else a quiet prompt to pick a row.
|
|
910
|
+
const detail = selected ? (approval ? (_jsxs("div", { className: "flex min-h-full flex-col", children: [_jsx("div", { className: "flex h-11 shrink-0 items-center px-4 @3xl/inbox:justify-end", children: _jsx(ClosePaneButton, { onClick: back }) }), _jsx("div", { className: "flex flex-1 items-start justify-center px-6 py-8", children: _jsx(ApprovalDecisionPane, { details: approval, previewAuthorized: approvalCall?.previewAuthorized !== false, resolvers: approvalCall?.resolvers, ...reviewApprovalAsker(selected, sessionLabels), busyDecision: pendingId === selected.id ? pendingDecision : null, onDecision:
|
|
911
|
+
// Only the viewer the API lets decide this call gets the decision.
|
|
912
|
+
connected && verdictAllowed(selected, 'approve')
|
|
913
|
+
? (decision, note) => {
|
|
914
|
+
actions.resolve(selected.id, decision === 'approve' ? 'approved' : 'rejected', decision === 'approve'
|
|
915
|
+
? tI18nComplete.raw('text0674d4a026cb')
|
|
916
|
+
: tI18nComplete.raw('text4341be8eb7f0'), note);
|
|
917
|
+
advanceFrom(selected.id);
|
|
918
|
+
}
|
|
919
|
+
: undefined, onOpenSession: selected.sessionId && onOpenSession
|
|
920
|
+
? () => onOpenSession(selected.sessionId)
|
|
921
|
+
: undefined }, selected.id) })] })) : (_jsx(ReviewDetail, { item: selected, actions: actions, onBack: back, onResolved: () => advanceFrom(selected.id) }, selected.id))) : idParam && !listLoaded && !isError ? (
|
|
922
|
+
// A `?id=` we cannot resolve yet: hold a skeleton until the list has
|
|
923
|
+
// fetched once, so a refresh never flashes the empty pane on the way.
|
|
924
|
+
_jsxs("div", { className: "space-y-4 px-6 py-6", children: [_jsx(Skeleton, { className: "h-6 w-2/3" }), _jsx(Skeleton, { className: "h-4 w-1/3" }), _jsx(Skeleton, { className: "h-40 w-full" })] })) : (paneEmpty);
|
|
925
|
+
// Wide inbox, Needs you: the asks deck holds the empty pane.
|
|
926
|
+
const deckInPane = wide && segment === 'needs_you' && !!needsYouDeck;
|
|
927
|
+
return (
|
|
928
|
+
// Two panes in a named container: the inbox's own width picks the layout,
|
|
929
|
+
// not the viewport, since this view also mounts in the narrow settings
|
|
930
|
+
// panel. Below `@3xl` one pane shows at a time: the list, or the open item.
|
|
931
|
+
_jsxs("div", { ref: rootRef, className: "@container/inbox relative flex h-full min-h-0", children: [_jsxs("div", { className: cn('border-border min-h-0 w-full min-w-0 flex-col @3xl/inbox:flex @3xl/inbox:w-sm @3xl/inbox:shrink-0 @6xl/inbox:w-md @3xl/inbox:border-r', selected ? 'hidden' : 'flex'), children: [_jsxs("div", { className: "border-border flex h-11 shrink-0 items-center gap-1 border-b px-2.5", children: [_jsx(Tabs, { value: segment, onValueChange: (v) => {
|
|
932
|
+
setSegment(v);
|
|
933
|
+
markSeen();
|
|
934
|
+
}, className: "min-w-0", children: _jsx(TabsList, { variant: "secondary", size: "sm", children: segments.map((s) => (_jsx(TabsTrigger, { value: s.value, className: "w-fit flex-none px-2.5", children: s.label }, s.value))) }) }), _jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-0.5", children: [_jsx(Hint, { label: _jsxs("span", { className: "flex items-center gap-1.5", children: [tI18nComplete.raw('text49c266baaaa7'), _jsx(Kbd, { children: "/" })] }), children: _jsx(Button, { type: "button", variant: showSearch ? 'secondary' : 'ghost', size: "icon-sm", "aria-label": tI18nComplete.raw('text49c266baaaa7'), "aria-expanded": showSearch, className: cn(!showSearch && 'text-muted-foreground'), onClick: () => {
|
|
935
|
+
if (showSearch && !query) {
|
|
936
|
+
setSearchOpen(false);
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
setSearchOpen(true);
|
|
940
|
+
requestAnimationFrame(() => document.getElementById('review-search')?.focus());
|
|
941
|
+
}, children: _jsx(Search, { className: "size-4" }) }) }), _jsxs(DropdownMenu, { children: [_jsx(Hint, { label: tI18nComplete.raw('text638e249f4a15'), children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: filtered ? 'secondary' : 'ghost', size: "icon-sm", "aria-label": tI18nComplete.raw('text638e249f4a15'), className: cn(!filtered && 'text-muted-foreground'), children: _jsx(FunnelSimple, { className: "size-4" }) }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [_jsxs(DropdownMenuSub, { children: [_jsxs(DropdownMenuSubTrigger, { children: [_jsx(Shapes, {}), tI18nComplete.raw('textbaaddf70fb5d')] }), _jsx(DropdownMenuSubContent, { className: "w-52", children: _jsx(DropdownMenuRadioGroup, { value: kindFilter, onValueChange: (v) => setKindFilter(v), children: kindFilters.map((f) => {
|
|
942
|
+
const Glyph = f.value === 'all' ? Shapes : ROW_TILE[f.value].icon;
|
|
943
|
+
return (_jsxs(DropdownMenuRadioItem, { value: f.value, side: "left", children: [_jsx(Glyph, { className: "text-muted-foreground size-4 shrink-0" }), f.label, (kindCounts[f.value] ?? 0) > 0 && (_jsx(CountBadge, { count: kindCounts[f.value] ?? 0, className: "ml-auto" }))] }, f.value));
|
|
944
|
+
}) }) })] }), sessionOpts.length > 0 && (_jsxs(DropdownMenuSub, { children: [_jsxs(DropdownMenuSubTrigger, { children: [_jsx(Chats, {}), tI18nComplete.raw('text6959b4159575')] }), _jsx(DropdownMenuSubContent, { className: "max-h-72 w-64 overflow-y-auto", children: _jsxs(DropdownMenuRadioGroup, { value: sessionFilter, onValueChange: setSessionFilter, children: [_jsxs(DropdownMenuRadioItem, { value: "all", side: "left", children: [tI18nComplete.raw('text78648d4d6649'), _jsx(CountBadge, { count: filterItems(items, segment, kindFilter, query, 'all').length, className: "ml-auto" })] }), sessionOpts.map((s) => (_jsxs(DropdownMenuRadioItem, { value: s.sessionId, side: "left", children: [_jsx("span", { className: "truncate", children: s.label }), _jsx(CountBadge, { count: filterItems(items, segment, kindFilter, query, s.sessionId).length, className: "ml-auto" })] }, s.sessionId)))] }) })] })), sessionOpts.length > 0 && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuCheckboxItem, { checked: grouped, onCheckedChange: setGrouped, className: "pl-8", children: tI18nComplete.raw('text137f98df3b9b') })] })), filtered ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: clearFilters, children: tI18nComplete.raw('text7179ea0035fc') })] })) : null] })] })] })] }), showSearch || filtered ? (_jsxs("div", { className: "border-border flex shrink-0 flex-col gap-2 border-b px-2.5 py-2", children: [showSearch ? (_jsxs(InputGroupSearch, { className: "w-full", children: [_jsx(InputGroupSearchIcon, { children: _jsx(Search, {}) }), _jsx(InputGroupSearchInput, { id: "review-search", value: query, onChange: (e) => {
|
|
945
|
+
setQuery(e.target.value);
|
|
946
|
+
setFocusedIdx(0);
|
|
947
|
+
}, onBlur: () => {
|
|
948
|
+
if (!query)
|
|
949
|
+
setSearchOpen(false);
|
|
950
|
+
}, placeholder: tI18nComplete.raw('text49c266baaaa7'), variant: "popover", size: "sm" })] })) : null, filtered ? (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [activeKind ? (_jsx(FilterChip, { label: activeKind.label, onRemove: () => setKindFilter('all') })) : null, activeSession ? (_jsx(FilterChip, { label: activeSession.label, onRemove: () => setSessionFilter('all') })) : null, grouped ? (_jsx(FilterChip, { label: tI18nComplete.raw('text137f98df3b9b'), onRemove: () => setGrouped(false) })) : null] })) : null] })) : null, _jsxs("div", { className: cn('min-h-0 flex-1 overflow-y-auto p-1.5', selectMode && segment === 'needs_you' && 'pb-20'), children: [segment === 'needs_you' && needsYouDeck && !wide ? (
|
|
951
|
+
// `peer`: when the deck draws nothing (its Undo window after the
|
|
952
|
+
// last card), the list's empty state below shows instead.
|
|
953
|
+
_jsx("div", { className: "peer px-1 pt-1 pb-3 empty:hidden", children: needsYouDeck({ paused: !!selected }) })) : null, listBody, visible.length > 0 && loadMore ? _jsx("div", { className: "pt-2", children: loadMoreButton }) : null] }), selectMode && segment === 'needs_you' ? (
|
|
954
|
+
// Pinned to the bottom of the inbox, not to the end of the list
|
|
955
|
+
// (`sticky` stops where a short list ends, schedule-view.tsx), and
|
|
956
|
+
// across the whole inbox: the list column is too narrow for its verbs.
|
|
957
|
+
_jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-4 z-10 flex justify-center px-4", children: _jsx("div", { className: "pointer-events-auto w-full max-w-xl", children: _jsx(SelectionBar, { selectedCount: selectedItems.length, allSelected: selectableIds.length > 0 &&
|
|
958
|
+
selectedItems.length >= Math.min(BULK_MAX, selectableIds.length), canSelectAll: selectableIds.length > 0, onSelectAll: () => setSelectedIds(new Set(selectableIds.slice(0, BULK_MAX))), onClear: () => setSelectedIds(new Set()), onExit: exitSelectMode, actions: bulkActions, progress: bulkProgress, animateIn: selectMode !== 'key', note: selectedItems.length >= BULK_MAX && selectableIds.length > BULK_MAX
|
|
959
|
+
? tBulk('limitNote', { count: BULK_MAX })
|
|
960
|
+
: undefined }) }) })) : null] }), _jsxs("div", { className: cn('min-h-0 min-w-0 flex-1 flex-col @3xl/inbox:flex', selected ? 'flex' : 'hidden'), children: [deckInPane && needsYouDeck ? (
|
|
961
|
+
// Not keyed by the open item and kept mounted while one is open
|
|
962
|
+
// (`paused`, hidden): a staged answer keeps its Undo window.
|
|
963
|
+
_jsxs("div", { className: cn('min-h-0 flex-1 flex-col overflow-y-auto', selected ? 'hidden' : 'flex'), children: [_jsx("div", { className: "peer mx-auto flex min-h-full w-full max-w-2xl flex-col justify-center px-6 py-8 empty:hidden", children: needsYouDeck({ paused: !!selected }) }), _jsx("div", { className: "hidden min-h-full flex-1 peer-empty:flex", children: paneEmpty })] })) : null, selected || !deckInPane ? (
|
|
964
|
+
// Keyed by the open item: each one opens scrolled to its top.
|
|
965
|
+
_jsx("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto", children: detail }, selected?.id ?? 'none')) : null] }), _jsx(ConfirmDialog, { open: confirm.open, onOpenChange: (open) => setConfirm((c) => ({ ...c, open })), title: confirmCopy.title, description: confirmCopy.description, confirmLabel: confirmCopy.confirm, confirmVariant: confirm.verb === 'approve' ? 'default' : 'destructive', onConfirm: () => void runBulk(confirm.verb) }), _jsx(KeyboardHelp, { open: helpOpen, onClose: () => setHelpOpen(false) })] }));
|
|
966
|
+
}
|
|
967
|
+
/** One filter in effect, under the list header: its name and a remove button. */
|
|
968
|
+
function FilterChip({ label, onRemove }) {
|
|
969
|
+
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
970
|
+
return (_jsxs(Badge, { variant: "secondary", size: "sm", className: "max-w-full gap-1 pr-1", children: [_jsx("span", { className: "truncate", children: label }), _jsx("button", { type: "button", onClick: onRemove, "aria-label": `${tI18nComplete.raw('text83b12c2216ef')} ${label}`, className: "text-muted-foreground hover:text-foreground duration-fast rounded-xs transition-colors", children: _jsx(X, { className: "size-3" }) })] }));
|
|
839
971
|
}
|