@agent-native/core 0.120.2 → 0.120.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +3 -3
- package/corpus/core/CHANGELOG.md +28 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/cli/context-xray-local.ts +1 -1
- package/corpus/core/src/cli/index.ts +63 -18
- package/corpus/core/src/cli/skills.ts +5 -0
- package/corpus/core/src/cli/telemetry.ts +118 -1
- package/corpus/core/src/client/AgentPanel.tsx +10 -0
- package/corpus/core/src/client/CommandMenu.tsx +13 -1
- package/corpus/core/src/client/agent-page/AgentTabsPage.tsx +39 -4
- package/corpus/core/src/client/analytics.ts +13 -0
- package/corpus/core/src/client/error-capture.ts +6 -1
- package/corpus/core/src/client/extensions/ExtensionsListPage.tsx +12 -5
- package/corpus/core/src/client/extensions/agent-native-extension-runtime.ts +1 -1
- package/corpus/core/src/client/navigation/index.ts +2 -0
- package/corpus/core/src/client/org/OrgSwitcher.tsx +14 -32
- package/corpus/core/src/client/settings/ExtensionsSettingsContent.tsx +1 -1
- package/corpus/core/src/extensions/theme.ts +1 -1
- package/corpus/core/src/localization/default-messages.ts +2 -0
- package/corpus/core/src/server/core-routes-plugin.ts +10 -1
- package/corpus/core/src/server/framework-request-handler.ts +17 -26
- package/corpus/core/src/styles/agent-native.css +13 -0
- package/corpus/core/src/templates/chat/app/components/layout/Layout.tsx +3 -0
- package/corpus/core/src/templates/chat/app/components/layout/Sidebar.tsx +78 -45
- package/corpus/core/src/templates/chat/app/global.css +1 -1
- package/corpus/core/src/templates/default/app/global.css +1 -1
- package/corpus/core/src/tracking/error-capture.ts +151 -0
- package/corpus/core/src/tracking/index.ts +5 -0
- package/corpus/templates/analytics/app/components/dashboard/CumulativeNetChart.tsx +1 -1
- package/corpus/templates/analytics/app/components/dashboard/DashboardHistoryPanel.tsx +1 -4
- package/corpus/templates/analytics/app/components/dashboard/DashboardPanelSkeleton.tsx +1 -1
- package/corpus/templates/analytics/app/components/dashboard/DataTable.tsx +1 -1
- package/corpus/templates/analytics/app/components/dashboard/DateRangePicker.tsx +2 -2
- package/corpus/templates/analytics/app/components/dashboard/MetricCard.tsx +1 -1
- package/corpus/templates/analytics/app/components/dashboard/RecentActivity.tsx +1 -1
- package/corpus/templates/analytics/app/components/dashboard/RevenueChart.tsx +1 -1
- package/corpus/templates/analytics/app/components/dashboard/RevenueComparisonChart.tsx +1 -1
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +41 -9
- package/corpus/templates/analytics/app/components/dashboard/StatsCard.tsx +1 -1
- package/corpus/templates/analytics/app/components/dashboard/TimeSeriesChart.tsx +1 -1
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +2 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +28 -14
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +152 -124
- package/corpus/templates/analytics/app/global.css +5 -5
- package/corpus/templates/analytics/app/lib/dashboard-report-capture.ts +42 -0
- package/corpus/templates/analytics/app/pages/adhoc/_shared/KpiChart.tsx +1 -1
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/ChartTypePicker.tsx +1 -1
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/DateRangePicker.tsx +1 -1
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/EventRow.tsx +1 -1
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/SqlPreview.tsx +2 -2
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/DashboardFilterBar.tsx +3 -3
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/EmailReportDialog.tsx +2 -2
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +1 -1
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +1 -1
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +162 -51
- package/corpus/templates/analytics/app/root.tsx +28 -0
- package/corpus/templates/analytics/changelog/2026-07-24-analytics-charts-now-explain-slow-loads-and-offer-a-direct-r.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-24-daily-dashboard-emails-now-load-signed-reports-more-reliably.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-24-manage-agent-is-clearly-marked-as-a-link-to-its-dedicated-pa.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +1 -1
- package/corpus/templates/analytics/server/db/schema.ts +5 -0
- package/corpus/templates/analytics/server/jobs/dashboard-report.ts +21 -0
- package/corpus/templates/analytics/server/lib/canonical-first-party-dashboard-repair.ts +11 -0
- package/corpus/templates/analytics/server/lib/dashboard-report-subscriptions.ts +54 -0
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +235 -26
- package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +4 -1
- package/corpus/templates/analytics/server/plugins/db.ts +9 -0
- package/corpus/templates/analytics/shared/dashboard-report-timeouts.ts +1 -1
- package/corpus/templates/assets/app/components/asset/AssetPreviewDialog.tsx +376 -0
- package/corpus/templates/assets/app/components/create/RecentDraftsSection.tsx +14 -4
- package/corpus/templates/assets/app/components/layout/Layout.tsx +5 -0
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +118 -74
- package/corpus/templates/assets/app/global.css +1 -1
- package/corpus/templates/assets/app/i18n-data.ts +10 -0
- package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +99 -10
- package/corpus/templates/assets/app/routes/library.tsx +21 -198
- package/corpus/templates/assets/changelog/2026-07-21-unified-asset-preview-click-any-asset-to-open-one-preview-wi.md +6 -0
- package/corpus/templates/assets/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/assets/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/brain/app/components/layout/Layout.tsx +3 -0
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +76 -43
- package/corpus/templates/brain/app/global.css +1 -1
- package/corpus/templates/brain/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +67 -52
- package/corpus/templates/calendar/app/global.css +1 -1
- package/corpus/templates/calendar/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/chat/app/components/layout/Layout.tsx +3 -0
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +78 -45
- package/corpus/templates/chat/app/global.css +1 -1
- package/corpus/templates/chat/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/chat/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/clips/app/components/library/library-layout.tsx +65 -31
- package/corpus/templates/clips/app/components/library/organization-switcher.tsx +2 -2
- package/corpus/templates/clips/app/components/player/video-player.tsx +16 -1
- package/corpus/templates/clips/app/global.css +1 -1
- package/corpus/templates/clips/app/hooks/use-view-tracking.ts +55 -12
- package/corpus/templates/clips/app/routes/embed.$shareId.tsx +6 -5
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +7 -7
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +6 -5
- package/corpus/templates/clips/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/clips/server/plugins/db.ts +113 -68
- package/corpus/templates/content/actions/update-document.ts +145 -91
- package/corpus/templates/content/app/components/editor/CommentComposer.tsx +4 -1
- package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +366 -164
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +51 -28
- package/corpus/templates/content/app/components/editor/database/sidebar.tsx +19 -8
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +66 -42
- package/corpus/templates/content/app/global.css +1 -1
- package/corpus/templates/content/app/i18n-data.ts +15 -0
- package/corpus/templates/content/changelog/2026-07-23-shared-pages-now-keep-durable-content-visible-and-comment-th.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-comment-drafts-now-stay-open-when-saving-fails-and-long-live.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/design/actions/update-file.ts +85 -18
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +65 -30
- package/corpus/templates/design/app/entry.client.tsx +14 -1
- package/corpus/templates/design/app/global.css +1 -1
- package/corpus/templates/design/app/lib/design-save-outbox.ts +39 -0
- package/corpus/templates/design/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/design/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/dispatch/app/global.css +1 -1
- package/corpus/templates/dispatch/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/forms/app/components/layout/Layout.tsx +3 -0
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +72 -37
- package/corpus/templates/forms/app/global.css +1 -1
- package/corpus/templates/forms/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-24-forms-sidebar-actions-now-keep-search-language-feedback-and-.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/macros/app/components/DailyProgress.tsx +5 -5
- package/corpus/templates/macros/app/components/ExerciseCard.tsx +2 -2
- package/corpus/templates/macros/app/components/MealCard.tsx +2 -2
- package/corpus/templates/macros/app/components/WeightCard.tsx +2 -2
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +56 -29
- package/corpus/templates/macros/app/components/ui/button.tsx +1 -2
- package/corpus/templates/macros/app/components/ui/card.tsx +1 -1
- package/corpus/templates/macros/app/global.css +1 -1
- package/corpus/templates/macros/app/routes/_index.tsx +1 -1
- package/corpus/templates/macros/app/routes/analytics.tsx +4 -7
- package/corpus/templates/macros/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/macros/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +125 -37
- package/corpus/templates/mail/app/global.css +1 -1
- package/corpus/templates/mail/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/plan/app/components/layout/Layout.tsx +3 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +90 -60
- package/corpus/templates/plan/app/global.css +1 -1
- package/corpus/templates/plan/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +69 -32
- package/corpus/templates/slides/app/global.css +1 -1
- package/corpus/templates/slides/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/tasks/app/global.css +1 -1
- package/corpus/templates/tasks/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/toolkit/CHANGELOG.md +14 -0
- package/corpus/toolkit/README.md +8 -1
- package/corpus/toolkit/agent-native.eject.json +1 -1
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/app-shell/index.ts +1 -0
- package/corpus/toolkit/src/app-shell/sidebar-footer-actions.tsx +48 -0
- package/corpus/toolkit/src/chat-history.css +52 -1
- package/corpus/toolkit/src/design-system/default-adapter.tsx +1 -1
- package/corpus/toolkit/src/editor/useCollabReconcile.ts +83 -15
- package/corpus/toolkit/src/ui/button.tsx +1 -2
- package/corpus/toolkit/src/ui/card.tsx +1 -1
- package/corpus/toolkit/src/ui/table.tsx +4 -11
- package/dist/cli/context-xray-local.js +1 -1
- package/dist/cli/context-xray-local.js.map +1 -1
- package/dist/cli/index.js +56 -17
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +5 -0
- package/dist/cli/skills.js.map +1 -1
- package/dist/cli/telemetry.d.ts +7 -0
- package/dist/cli/telemetry.d.ts.map +1 -1
- package/dist/cli/telemetry.js +91 -1
- package/dist/cli/telemetry.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +7 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +2 -2
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/CommandMenu.d.ts +2 -0
- package/dist/client/CommandMenu.d.ts.map +1 -1
- package/dist/client/CommandMenu.js +12 -1
- package/dist/client/CommandMenu.js.map +1 -1
- package/dist/client/agent-page/AgentTabsPage.d.ts +4 -0
- package/dist/client/agent-page/AgentTabsPage.d.ts.map +1 -1
- package/dist/client/agent-page/AgentTabsPage.js +8 -4
- package/dist/client/agent-page/AgentTabsPage.js.map +1 -1
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +7 -0
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/error-capture.d.ts.map +1 -1
- package/dist/client/error-capture.js +8 -1
- package/dist/client/error-capture.js.map +1 -1
- package/dist/client/extensions/ExtensionsListPage.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionsListPage.js +2 -2
- package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
- package/dist/client/extensions/agent-native-extension-runtime.js +1 -1
- package/dist/client/extensions/agent-native-extension-runtime.js.map +1 -1
- package/dist/client/navigation/index.d.ts +1 -1
- package/dist/client/navigation/index.d.ts.map +1 -1
- package/dist/client/navigation/index.js +1 -1
- package/dist/client/navigation/index.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +9 -13
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/settings/ExtensionsSettingsContent.js +1 -1
- package/dist/client/settings/ExtensionsSettingsContent.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/extensions/theme.js +1 -1
- package/dist/extensions/theme.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/localization/default-messages.d.ts +2 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +2 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/provider-api/actions/provider-api.d.ts +2 -2
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +8 -1
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +17 -27
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/styles/agent-native.css +13 -0
- package/dist/templates/chat/app/components/layout/Layout.tsx +3 -0
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +78 -45
- package/dist/templates/chat/app/global.css +1 -1
- package/dist/templates/chat/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/dist/templates/chat/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/dist/templates/default/app/global.css +1 -1
- package/dist/tracking/error-capture.d.ts +14 -0
- package/dist/tracking/error-capture.d.ts.map +1 -0
- package/dist/tracking/error-capture.js +113 -0
- package/dist/tracking/error-capture.js.map +1 -0
- package/dist/tracking/index.d.ts +1 -0
- package/dist/tracking/index.d.ts.map +1 -1
- package/dist/tracking/index.js +1 -0
- package/dist/tracking/index.js.map +1 -1
- package/package.json +2 -2
- package/src/cli/context-xray-local.ts +1 -1
- package/src/cli/index.ts +63 -18
- package/src/cli/skills.ts +5 -0
- package/src/cli/telemetry.ts +118 -1
- package/src/client/AgentPanel.tsx +10 -0
- package/src/client/CommandMenu.tsx +13 -1
- package/src/client/agent-page/AgentTabsPage.tsx +39 -4
- package/src/client/analytics.ts +13 -0
- package/src/client/error-capture.ts +6 -1
- package/src/client/extensions/ExtensionsListPage.tsx +12 -5
- package/src/client/extensions/agent-native-extension-runtime.ts +1 -1
- package/src/client/navigation/index.ts +2 -0
- package/src/client/org/OrgSwitcher.tsx +14 -32
- package/src/client/settings/ExtensionsSettingsContent.tsx +1 -1
- package/src/extensions/theme.ts +1 -1
- package/src/localization/default-messages.ts +2 -0
- package/src/server/core-routes-plugin.ts +10 -1
- package/src/server/framework-request-handler.ts +17 -26
- package/src/styles/agent-native.css +13 -0
- package/src/templates/chat/app/components/layout/Layout.tsx +3 -0
- package/src/templates/chat/app/components/layout/Sidebar.tsx +78 -45
- package/src/templates/chat/app/global.css +1 -1
- package/src/templates/chat/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/src/templates/chat/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/src/templates/default/app/global.css +1 -1
- package/src/tracking/error-capture.ts +151 -0
- package/src/tracking/index.ts +5 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { useActionMutation } from "@agent-native/core/client/hooks";
|
|
2
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
3
|
+
import {
|
|
4
|
+
IconChevronLeft,
|
|
5
|
+
IconChevronRight,
|
|
6
|
+
IconDownload,
|
|
7
|
+
IconInfoCircle,
|
|
8
|
+
IconX,
|
|
9
|
+
} from "@tabler/icons-react";
|
|
10
|
+
import { useEffect, useState, type ReactNode } from "react";
|
|
11
|
+
import { toast } from "sonner";
|
|
12
|
+
|
|
13
|
+
import { Badge } from "@/components/ui/badge";
|
|
14
|
+
import { Button } from "@/components/ui/button";
|
|
15
|
+
import {
|
|
16
|
+
Dialog,
|
|
17
|
+
DialogClose,
|
|
18
|
+
DialogContent,
|
|
19
|
+
DialogDescription,
|
|
20
|
+
DialogTitle,
|
|
21
|
+
} from "@/components/ui/dialog";
|
|
22
|
+
import { assetPreviewSources } from "@/lib/asset-preview-sources";
|
|
23
|
+
import { assetMediaUrl } from "@/lib/asset-urls";
|
|
24
|
+
|
|
25
|
+
export type PreviewAsset = {
|
|
26
|
+
id: string;
|
|
27
|
+
libraryId?: string | null;
|
|
28
|
+
role?: string | null;
|
|
29
|
+
status?: string | null;
|
|
30
|
+
title?: string | null;
|
|
31
|
+
description?: string | null;
|
|
32
|
+
altText?: string | null;
|
|
33
|
+
prompt?: string | null;
|
|
34
|
+
mediaType?: string | null;
|
|
35
|
+
mimeType?: string | null;
|
|
36
|
+
width?: number | null;
|
|
37
|
+
height?: number | null;
|
|
38
|
+
url?: string | null;
|
|
39
|
+
previewUrl?: string | null;
|
|
40
|
+
thumbnailUrl?: string | null;
|
|
41
|
+
downloadUrl?: string | null;
|
|
42
|
+
folderId?: string | null;
|
|
43
|
+
category?: string | null;
|
|
44
|
+
model?: string | null;
|
|
45
|
+
aspectRatio?: string | null;
|
|
46
|
+
durationSeconds?: number | null;
|
|
47
|
+
metadata?: Record<string, unknown> | null;
|
|
48
|
+
lineage?: { label?: string | null } | null;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The single side-panel asset preview used everywhere an asset is opened:
|
|
53
|
+
* large media on the left, details on the right, a top toolbar (download,
|
|
54
|
+
* details toggle, close), and previous/next navigation across `assets`.
|
|
55
|
+
*/
|
|
56
|
+
export function AssetPreviewDialog({
|
|
57
|
+
asset,
|
|
58
|
+
assets,
|
|
59
|
+
onAssetChange,
|
|
60
|
+
renderImage,
|
|
61
|
+
}: {
|
|
62
|
+
asset: PreviewAsset | null;
|
|
63
|
+
assets: PreviewAsset[];
|
|
64
|
+
onAssetChange: (asset: PreviewAsset | null) => void;
|
|
65
|
+
/** Optional media renderer (e.g. an embed/COEP-aware image loader). */
|
|
66
|
+
renderImage?: (asset: PreviewAsset) => ReactNode;
|
|
67
|
+
}) {
|
|
68
|
+
const t = useT();
|
|
69
|
+
const exportAsset = useActionMutation("export-asset");
|
|
70
|
+
const [showDetails, setShowDetails] = useState(true);
|
|
71
|
+
return (
|
|
72
|
+
<Dialog
|
|
73
|
+
open={Boolean(asset)}
|
|
74
|
+
onOpenChange={(open) => {
|
|
75
|
+
if (!open) onAssetChange(null);
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
{asset &&
|
|
79
|
+
(() => {
|
|
80
|
+
const previewIndex = assets.findIndex(
|
|
81
|
+
(candidate) => candidate.id === asset.id,
|
|
82
|
+
);
|
|
83
|
+
const hasPrev = previewIndex > 0;
|
|
84
|
+
const hasNext = previewIndex >= 0 && previewIndex < assets.length - 1;
|
|
85
|
+
const showPreviousAsset = () => {
|
|
86
|
+
if (hasPrev) onAssetChange(assets[previewIndex - 1]);
|
|
87
|
+
};
|
|
88
|
+
const showNextAsset = () => {
|
|
89
|
+
if (hasNext) onAssetChange(assets[previewIndex + 1]);
|
|
90
|
+
};
|
|
91
|
+
const isVideo =
|
|
92
|
+
asset.mediaType === "video" ||
|
|
93
|
+
Boolean(asset.mimeType?.startsWith("video/"));
|
|
94
|
+
const videoSrc = assetPreviewSources(asset)[0];
|
|
95
|
+
const downloadAsset = () => {
|
|
96
|
+
// Synthetic starter-preset assets aren't database rows, so
|
|
97
|
+
// export-asset can't resolve them; download the source directly.
|
|
98
|
+
if (isStarterPreviewAsset(asset)) {
|
|
99
|
+
const directUrl = assetPreviewSources(asset)[0];
|
|
100
|
+
if (directUrl) window.location.href = directUrl;
|
|
101
|
+
else toast.error(t("assetDetail.downloadFailed"));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
exportAsset.mutate(
|
|
105
|
+
{ assetId: asset.id },
|
|
106
|
+
{
|
|
107
|
+
onSuccess: (result: any) => {
|
|
108
|
+
const url =
|
|
109
|
+
assetMediaUrl(result?.downloadUrl) ?? result?.downloadUrl;
|
|
110
|
+
if (url) window.location.href = url;
|
|
111
|
+
else toast.error(t("assetDetail.downloadFailed"));
|
|
112
|
+
},
|
|
113
|
+
onError: () => toast.error(t("assetDetail.downloadFailed")),
|
|
114
|
+
},
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
return (
|
|
118
|
+
<DialogContent
|
|
119
|
+
hideClose
|
|
120
|
+
onKeyDown={(event) => {
|
|
121
|
+
if (event.key === "ArrowLeft") showPreviousAsset();
|
|
122
|
+
if (event.key === "ArrowRight") showNextAsset();
|
|
123
|
+
}}
|
|
124
|
+
className="assets-preview-dialog flex max-h-[92vh] w-[94vw] max-w-6xl flex-col gap-0 overflow-hidden p-0"
|
|
125
|
+
>
|
|
126
|
+
<DialogTitle className="sr-only">
|
|
127
|
+
{assetPreviewTitle(asset)}
|
|
128
|
+
</DialogTitle>
|
|
129
|
+
<DialogDescription className="sr-only">
|
|
130
|
+
{t("library.fullSizePreview", {
|
|
131
|
+
title: assetPreviewTitle(asset),
|
|
132
|
+
})}
|
|
133
|
+
</DialogDescription>
|
|
134
|
+
|
|
135
|
+
<div className="flex items-center justify-end gap-1 border-b border-border px-3 py-2">
|
|
136
|
+
<Button
|
|
137
|
+
variant="ghost"
|
|
138
|
+
size="sm"
|
|
139
|
+
className="gap-2"
|
|
140
|
+
disabled={exportAsset.isPending}
|
|
141
|
+
onClick={downloadAsset}
|
|
142
|
+
>
|
|
143
|
+
<IconDownload className="h-4 w-4" />
|
|
144
|
+
{t("assetDetail.download")}
|
|
145
|
+
</Button>
|
|
146
|
+
<Button
|
|
147
|
+
variant="ghost"
|
|
148
|
+
size="sm"
|
|
149
|
+
className="gap-2"
|
|
150
|
+
aria-pressed={showDetails}
|
|
151
|
+
onClick={() => setShowDetails((value) => !value)}
|
|
152
|
+
>
|
|
153
|
+
<IconInfoCircle className="h-4 w-4" />
|
|
154
|
+
{t("library.viewDetails")}
|
|
155
|
+
</Button>
|
|
156
|
+
<DialogClose
|
|
157
|
+
aria-label={t("library.closePreview")}
|
|
158
|
+
className="inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
159
|
+
>
|
|
160
|
+
<IconX className="h-5 w-5" />
|
|
161
|
+
</DialogClose>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<div className="flex min-h-0 flex-1 flex-col md:flex-row">
|
|
165
|
+
<div className="relative flex min-h-0 flex-1 items-center justify-center bg-muted/30 p-4">
|
|
166
|
+
{isVideo ? (
|
|
167
|
+
<video
|
|
168
|
+
src={videoSrc}
|
|
169
|
+
poster={asset.thumbnailUrl ?? undefined}
|
|
170
|
+
controls
|
|
171
|
+
autoPlay
|
|
172
|
+
playsInline
|
|
173
|
+
className="max-h-[72vh] max-w-full rounded-lg bg-black object-contain"
|
|
174
|
+
/>
|
|
175
|
+
) : renderImage ? (
|
|
176
|
+
renderImage(asset)
|
|
177
|
+
) : (
|
|
178
|
+
<AssetPreviewImage asset={asset} />
|
|
179
|
+
)}
|
|
180
|
+
</div>
|
|
181
|
+
{showDetails && (
|
|
182
|
+
<aside className="w-full shrink-0 overflow-y-auto border-t border-border p-5 md:w-80 md:border-l md:border-t-0">
|
|
183
|
+
<AssetPreviewDetails asset={asset} isVideo={isVideo} />
|
|
184
|
+
</aside>
|
|
185
|
+
)}
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
{(hasPrev || hasNext) && (
|
|
189
|
+
<div className="flex justify-center gap-2 border-t border-border py-3">
|
|
190
|
+
<button
|
|
191
|
+
type="button"
|
|
192
|
+
aria-label={t("library.previousImage")}
|
|
193
|
+
onClick={showPreviousAsset}
|
|
194
|
+
disabled={!hasPrev}
|
|
195
|
+
className="inline-flex h-9 w-9 items-center justify-center rounded-full border border-border bg-background text-foreground transition hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40"
|
|
196
|
+
>
|
|
197
|
+
<IconChevronLeft className="h-5 w-5" />
|
|
198
|
+
</button>
|
|
199
|
+
<button
|
|
200
|
+
type="button"
|
|
201
|
+
aria-label={t("library.nextImage")}
|
|
202
|
+
onClick={showNextAsset}
|
|
203
|
+
disabled={!hasNext}
|
|
204
|
+
className="inline-flex h-9 w-9 items-center justify-center rounded-full border border-border bg-background text-foreground transition hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40"
|
|
205
|
+
>
|
|
206
|
+
<IconChevronRight className="h-5 w-5" />
|
|
207
|
+
</button>
|
|
208
|
+
</div>
|
|
209
|
+
)}
|
|
210
|
+
</DialogContent>
|
|
211
|
+
);
|
|
212
|
+
})()}
|
|
213
|
+
</Dialog>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function AssetPreviewImage({ asset }: { asset: PreviewAsset }) {
|
|
218
|
+
const t = useT();
|
|
219
|
+
const sources = assetPreviewSources(asset);
|
|
220
|
+
const [sourceIndex, setSourceIndex] = useState(0);
|
|
221
|
+
const [unavailable, setUnavailable] = useState(false);
|
|
222
|
+
const sourcesKey = sources.join("\n");
|
|
223
|
+
|
|
224
|
+
useEffect(() => {
|
|
225
|
+
setSourceIndex(0);
|
|
226
|
+
setUnavailable(false);
|
|
227
|
+
}, [sourcesKey]);
|
|
228
|
+
|
|
229
|
+
const src = sources[sourceIndex];
|
|
230
|
+
if (!src || unavailable) {
|
|
231
|
+
return (
|
|
232
|
+
<div className="flex aspect-square w-full max-w-sm items-center justify-center rounded-lg border border-dashed border-border bg-background px-6 text-sm font-medium text-muted-foreground">
|
|
233
|
+
{t("assetDetail.previewUnavailable")}
|
|
234
|
+
</div>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
return (
|
|
238
|
+
<img
|
|
239
|
+
src={src}
|
|
240
|
+
alt={asset.altText ?? asset.title ?? ""}
|
|
241
|
+
className="max-h-[72vh] max-w-full rounded-lg object-contain"
|
|
242
|
+
onError={() => {
|
|
243
|
+
const nextIndex = sourceIndex + 1;
|
|
244
|
+
if (nextIndex < sources.length) setSourceIndex(nextIndex);
|
|
245
|
+
else setUnavailable(true);
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function AssetPreviewDetails({
|
|
252
|
+
asset,
|
|
253
|
+
isVideo,
|
|
254
|
+
}: {
|
|
255
|
+
asset: PreviewAsset;
|
|
256
|
+
isVideo: boolean;
|
|
257
|
+
}) {
|
|
258
|
+
const t = useT();
|
|
259
|
+
const category = assetPreviewCategoryLabel(asset, t);
|
|
260
|
+
return (
|
|
261
|
+
<div className="space-y-5">
|
|
262
|
+
<div>
|
|
263
|
+
<h2 className="text-base font-semibold leading-tight tracking-tight">
|
|
264
|
+
{assetPreviewTitle(asset)}
|
|
265
|
+
</h2>
|
|
266
|
+
<div className="mt-2 flex flex-wrap gap-1.5">
|
|
267
|
+
{asset.status ? (
|
|
268
|
+
<Badge variant="secondary">{asset.status}</Badge>
|
|
269
|
+
) : null}
|
|
270
|
+
{asset.role ? <Badge variant="outline">{asset.role}</Badge> : null}
|
|
271
|
+
<Badge variant="outline">{isVideo ? "video" : "image"}</Badge>
|
|
272
|
+
{category ? <Badge variant="outline">{category}</Badge> : null}
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
<div className="space-y-4 text-sm">
|
|
276
|
+
{isVideo ? (
|
|
277
|
+
<PreviewField
|
|
278
|
+
label={t("assetDetail.video")}
|
|
279
|
+
value={`${asset.durationSeconds || "?"}s · ${asset.aspectRatio || "n/a"} · ${asset.model || "n/a"}`}
|
|
280
|
+
/>
|
|
281
|
+
) : (
|
|
282
|
+
<PreviewField
|
|
283
|
+
label={t("assetDetail.dimensions")}
|
|
284
|
+
value={formatPreviewDimensions(asset.width, asset.height)}
|
|
285
|
+
/>
|
|
286
|
+
)}
|
|
287
|
+
<PreviewField label="MIME" value={asset.mimeType || "n/a"} />
|
|
288
|
+
<PreviewField
|
|
289
|
+
label={t("assetDetail.folder")}
|
|
290
|
+
value={asset.folderId || t("assetDetail.unfiled")}
|
|
291
|
+
/>
|
|
292
|
+
<PreviewField
|
|
293
|
+
label={t("assetDetail.description")}
|
|
294
|
+
value={
|
|
295
|
+
asset.description || asset.altText || t("assetDetail.noDescription")
|
|
296
|
+
}
|
|
297
|
+
multiline
|
|
298
|
+
/>
|
|
299
|
+
<PreviewField
|
|
300
|
+
label={t("assetDetail.prompt")}
|
|
301
|
+
value={asset.prompt || t("assetDetail.noPrompt")}
|
|
302
|
+
multiline
|
|
303
|
+
/>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function PreviewField({
|
|
310
|
+
label,
|
|
311
|
+
value,
|
|
312
|
+
multiline,
|
|
313
|
+
}: {
|
|
314
|
+
label: string;
|
|
315
|
+
value: ReactNode;
|
|
316
|
+
multiline?: boolean;
|
|
317
|
+
}) {
|
|
318
|
+
return (
|
|
319
|
+
<div>
|
|
320
|
+
<div className="text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
|
321
|
+
{label}
|
|
322
|
+
</div>
|
|
323
|
+
<div className={multiline ? "mt-1 whitespace-pre-wrap" : "mt-1 truncate"}>
|
|
324
|
+
{value}
|
|
325
|
+
</div>
|
|
326
|
+
</div>
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function assetPreviewTitle(asset: PreviewAsset): string {
|
|
331
|
+
return (
|
|
332
|
+
asset.lineage?.label || asset.title || asset.prompt || "Untitled asset"
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function assetPreviewCategoryLabel(
|
|
337
|
+
asset: PreviewAsset,
|
|
338
|
+
t: (key: string, options?: Record<string, unknown>) => string,
|
|
339
|
+
): string | null {
|
|
340
|
+
const metadata = (asset.metadata ?? {}) as Record<string, unknown>;
|
|
341
|
+
if (metadata.intent === "subject" || asset.role === "subject_reference") {
|
|
342
|
+
return t("assetDetail.contentOnly");
|
|
343
|
+
}
|
|
344
|
+
const category = (metadata.category as string | undefined) ?? asset.category;
|
|
345
|
+
if (typeof category !== "string") return null;
|
|
346
|
+
if (category === "style-only") return t("assetDetail.styleReference");
|
|
347
|
+
if (category === "skeleton") return t("assetDetail.skeletonPlate");
|
|
348
|
+
return category.replace(/-/g, " ");
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function formatPreviewDimensions(
|
|
352
|
+
width?: number | null,
|
|
353
|
+
height?: number | null,
|
|
354
|
+
) {
|
|
355
|
+
const dimensions = `${width || "?"} x ${height || "?"}`;
|
|
356
|
+
if (!width || !height) return dimensions;
|
|
357
|
+
const divisor = previewGcd(width, height);
|
|
358
|
+
return (
|
|
359
|
+
<span className="flex items-center gap-2">
|
|
360
|
+
{dimensions}
|
|
361
|
+
<span className="h-4 w-px bg-border" />
|
|
362
|
+
{`${width / divisor}:${height / divisor}`}
|
|
363
|
+
</span>
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function previewGcd(a: number, b: number): number {
|
|
368
|
+
return b === 0 ? a : previewGcd(b, a % b);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function isStarterPreviewAsset(asset: PreviewAsset): boolean {
|
|
372
|
+
return (
|
|
373
|
+
asset.id.startsWith("starter-") ||
|
|
374
|
+
Boolean(asset.libraryId?.startsWith("starter:"))
|
|
375
|
+
);
|
|
376
|
+
}
|
|
@@ -5,8 +5,10 @@ import {
|
|
|
5
5
|
IconArrowUpRight,
|
|
6
6
|
IconPhoto,
|
|
7
7
|
} from "@tabler/icons-react";
|
|
8
|
+
import { useState } from "react";
|
|
8
9
|
import { Link } from "react-router";
|
|
9
10
|
|
|
11
|
+
import { AssetPreviewDialog } from "@/components/asset/AssetPreviewDialog";
|
|
10
12
|
import { Button } from "@/components/ui/button";
|
|
11
13
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
12
14
|
|
|
@@ -32,6 +34,7 @@ export function RecentDraftsSection() {
|
|
|
32
34
|
},
|
|
33
35
|
);
|
|
34
36
|
const drafts = ((data as any)?.assets ?? []) as DraftAsset[];
|
|
37
|
+
const [previewAsset, setPreviewAsset] = useState<DraftAsset | null>(null);
|
|
35
38
|
|
|
36
39
|
if (isError) {
|
|
37
40
|
return (
|
|
@@ -74,18 +77,25 @@ export function RecentDraftsSection() {
|
|
|
74
77
|
<Skeleton key={index} className="aspect-square rounded-lg" />
|
|
75
78
|
))
|
|
76
79
|
: drafts.map((draft) => (
|
|
77
|
-
<
|
|
80
|
+
<button
|
|
78
81
|
key={draft.id}
|
|
79
|
-
|
|
82
|
+
type="button"
|
|
83
|
+
onClick={() => setPreviewAsset(draft)}
|
|
80
84
|
title={draft.title || draft.prompt || t("library.draftAsset")}
|
|
81
|
-
className="group block overflow-hidden rounded-lg border border-border bg-card shadow-sm transition hover:border-primary/60 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
85
|
+
className="group block overflow-hidden rounded-lg border border-border bg-card text-left shadow-sm transition hover:border-primary/60 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
82
86
|
>
|
|
83
87
|
<div className="aspect-square bg-muted">
|
|
84
88
|
<DraftThumbnail draft={draft} />
|
|
85
89
|
</div>
|
|
86
|
-
</
|
|
90
|
+
</button>
|
|
87
91
|
))}
|
|
88
92
|
</div>
|
|
93
|
+
|
|
94
|
+
<AssetPreviewDialog
|
|
95
|
+
asset={previewAsset}
|
|
96
|
+
assets={drafts}
|
|
97
|
+
onAssetChange={(next) => setPreviewAsset(next as DraftAsset | null)}
|
|
98
|
+
/>
|
|
89
99
|
</section>
|
|
90
100
|
);
|
|
91
101
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentSidebar,
|
|
3
3
|
focusAgentChat,
|
|
4
|
+
isAgentChatHomeHandoffActive,
|
|
4
5
|
navigateWithAgentChatViewTransition,
|
|
5
6
|
useAgentChatHomeHandoff,
|
|
6
7
|
useAgentChatHomeHandoffLinks,
|
|
@@ -65,6 +66,9 @@ export function Layout({ children }: LayoutProps) {
|
|
|
65
66
|
activePath: location.pathname,
|
|
66
67
|
enabled: !isCreateRoute,
|
|
67
68
|
});
|
|
69
|
+
const chatHomeHandoffPending = isAgentChatHomeHandoffActive(
|
|
70
|
+
ASSETS_CHAT_STORAGE_KEY,
|
|
71
|
+
);
|
|
68
72
|
useAgentChatHomeHandoffLinks({
|
|
69
73
|
storageKey: ASSETS_CHAT_STORAGE_KEY,
|
|
70
74
|
isChatPath: (pathname) => pathname === "/" || pathname.startsWith("/chat/"),
|
|
@@ -155,6 +159,7 @@ export function Layout({ children }: LayoutProps) {
|
|
|
155
159
|
<AgentSidebar
|
|
156
160
|
position="right"
|
|
157
161
|
chatViewTransition
|
|
162
|
+
chatViewTransitionHandoff={chatHomeHandoffPending}
|
|
158
163
|
storageKey={ASSETS_CHAT_STORAGE_KEY}
|
|
159
164
|
browserTabId={getBrowserTabId()}
|
|
160
165
|
openOnChatRunning={chatHomeHandoffActive}
|