@vetta-org/theme-ui 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +740 -20
- package/src/action-approval/AppearanceActionPickerView.tsx +2 -78
- package/src/action-approval/AppearanceApprovalDrawerView.tsx +2 -9
- package/src/action-approval/BatchTasksApprovalFrameView.tsx +4 -1
- package/src/action-approval/GenericActionApprovalView.tsx +2 -9
- package/src/action-approval/ManageActionApprovalFrameView.tsx +4 -1
- package/src/action-approval/NavigationOpenApprovalView.tsx +2 -9
- package/src/action-approval/SchedulerActionApprovalDialogView.tsx +3 -1
- package/src/action-approval/SchedulerEditApprovalDrawerView.tsx +3 -10
- package/src/action-approval/index.ts +0 -1
- package/src/activity/ActivityPanel.tsx +13 -10
- package/src/activity/ActivityPanelFrame.test.tsx +32 -0
- package/src/activity/ActivityPanelFrame.tsx +3 -2
- package/src/activity/BackgroundTasksTabPanelView.tsx +1 -1
- package/src/activity/BrowserPanelView.tsx +48 -49
- package/src/activity/CodePreview.tsx +15 -1
- package/src/activity/DebugTabPanelView.tsx +1 -1
- package/src/activity/MarkdownPreviewView.test.tsx +53 -0
- package/src/activity/MarkdownPreviewView.tsx +135 -62
- package/src/activity/PluginTabPickerView.tsx +5 -3
- package/src/activity/PortsTabPanelView.tsx +911 -0
- package/src/activity/ToolCallsSubTabView.tsx +1 -1
- package/src/activity/WorkflowTabPanelView.tsx +1 -1
- package/src/activity/index.ts +9 -0
- package/src/app/AppBackground.tsx +1 -1
- package/src/app/AppBootLoadingView.tsx +4 -2
- package/src/app-shell/DefaultWindowControls.tsx +1 -1
- package/src/app-shell/PageHeaderActionGroup.tsx +1 -1
- package/src/app-shell/PageHeaderContent.tsx +36 -7
- package/src/app-shell/PageHeaderFrame.tsx +15 -3
- package/src/app-shell/PageHeaderSidebarTrigger.tsx +1 -1
- package/src/app-shell/PageHeaderTitle.tsx +1 -1
- package/src/app-shell/WindowControlButton.tsx +1 -1
- package/src/app-shell/header-crowding.test.ts +62 -0
- package/src/app-shell/header-crowding.tsx +137 -0
- package/src/appearance/BackgroundImageFrame.tsx +1 -1
- package/src/appearance/CenterSliceImageFrame.tsx +1 -1
- package/src/appearance/CornerImageFrame.tsx +1 -1
- package/src/appearance/HorizontalSliceImageFrame.tsx +1 -1
- package/src/appearance/NineSliceImageFrame.tsx +1 -1
- package/src/appearance/ThemeSurface.tsx +1 -1
- package/src/batch-tasks/BatchProjectFoldersFieldView.tsx +2 -1
- package/src/batch-tasks/BatchTaskProjectActionsView.test.tsx +97 -0
- package/src/batch-tasks/BatchTaskProjectActionsView.tsx +45 -35
- package/src/batch-tasks/batchTaskUi.tsx +0 -29
- package/src/bottom-panel/BottomPanelView.test.tsx +43 -0
- package/src/bottom-panel/BottomPanelView.tsx +222 -0
- package/src/bottom-panel/index.ts +26 -0
- package/src/chat/AgentAvatarView.tsx +1 -1
- package/src/chat/AnnotationViews.tsx +107 -0
- package/src/chat/AskUserQuestionView.tsx +18 -11
- package/src/chat/AssistantMessageView.tsx +48 -13
- package/src/chat/AtPanelView.test.tsx +61 -0
- package/src/chat/AtPanelView.tsx +63 -38
- package/src/chat/BashTerminalCard.tsx +1 -2
- package/src/chat/ChatHeaderActionsView.tsx +74 -18
- package/src/chat/CompactionStepView.test.tsx +34 -0
- package/src/chat/CompactionStepView.tsx +85 -0
- package/src/chat/ContextRingView.test.tsx +81 -0
- package/src/chat/ContextRingView.tsx +78 -62
- package/src/chat/ExecutionModeSelectorView.tsx +20 -5
- package/src/chat/HeaderActionBarView.tsx +806 -0
- package/src/chat/HeaderActionOverflowMenu.tsx +128 -0
- package/src/chat/InlineModelPicker.test.tsx +81 -0
- package/src/chat/InlineModelPicker.tsx +201 -0
- package/src/chat/InlineTokenChip.tsx +2 -68
- package/src/chat/InputBarBackground.tsx +1 -1
- package/src/chat/InputBarPlaceholder.tsx +26 -3
- package/src/chat/LiveThinkingView.tsx +51 -37
- package/src/chat/MessageBoundaryViews.tsx +21 -0
- package/src/chat/MessageFeedContext.tsx +13 -5
- package/src/chat/MessageFeedLayoutView.tsx +29 -3
- package/src/chat/MessageFeedView.test.tsx +81 -0
- package/src/chat/MessageFeedView.tsx +72 -152
- package/src/chat/MessageInputView.tsx +6 -2
- package/src/chat/MessageLayoutView.tsx +1 -1
- package/src/chat/MessageSelectionContextMenuView.tsx +4 -1
- package/src/chat/MessageTimelineView.tsx +1 -1
- package/src/chat/MessageView.tsx +1 -1
- package/src/chat/MessageVisualView.tsx +1 -1
- package/src/chat/ModelConfiguration.tsx +283 -0
- package/src/chat/ModelSelectorTrigger.tsx +63 -0
- package/src/chat/ModelSelectorView.tsx +1037 -223
- package/src/chat/NewSession.ts +1 -37
- package/src/chat/NewSessionPicker.tsx +3 -2
- package/src/chat/ProjectSelectorView.tsx +3 -2
- package/src/chat/ReasoningStepSlider.tsx +61 -0
- package/src/chat/RemoteSessionBadgeView.tsx +24 -0
- package/src/chat/SkillPromptAreaView.tsx +5 -19
- package/src/chat/TeamMemberReplyCardView.test.tsx +33 -0
- package/src/chat/TeamMemberReplyCardView.tsx +133 -0
- package/src/chat/TextBlockView.tsx +7 -770
- package/src/chat/TodoProgress.tsx +25 -53
- package/src/chat/TodoStatusBarView.tsx +14 -5
- package/src/chat/UserMessageView.tsx +113 -33
- package/src/chat/header-action-narrow.test.ts +21 -0
- package/src/chat/header-action-narrow.ts +38 -0
- package/src/chat/index.ts +33 -27
- package/src/chat/markdown-link.ts +7 -279
- package/src/chat/message-feed-fade.css +80 -0
- package/src/chat/message-feed-fade.test.tsx +75 -0
- package/src/chat/send-button.css +4 -22
- package/src/chat/streaming-reveal.test.ts +218 -0
- package/src/chat/streaming-reveal.ts +13 -0
- package/src/file-explorer/ConfirmDeleteDialogView.tsx +2 -1
- package/src/file-explorer/FileContextMenuView.tsx +44 -11
- package/src/file-explorer/FileExplorerSettingsView.tsx +97 -0
- package/src/file-explorer/FileTreeCreateRow.tsx +1 -1
- package/src/file-explorer/FileTreeNodeView.tsx +59 -18
- package/src/file-explorer/FileTreeView.tsx +236 -129
- package/src/file-explorer/file-tree-dom.ts +23 -0
- package/src/file-explorer/file-tree-rows.test.ts +74 -0
- package/src/file-explorer/file-tree-rows.ts +168 -0
- package/src/file-explorer/index.ts +17 -0
- package/src/file-explorer/types.ts +3 -0
- package/src/file-explorer/useFileTreeMarqueeSelection.ts +24 -16
- package/src/file-preview/FilePreviewDialogView.tsx +2 -2
- package/src/file-preview/FilePreviewView.tsx +12 -2
- package/src/file-preview/ReadonlyCodeView.tsx +46 -0
- package/src/file-preview/TextFileEditorView.tsx +2 -1
- package/src/file-preview/syntax-tokens.css +1 -1
- package/src/image-assets.d.ts +4 -0
- package/src/index.ts +1 -0
- package/src/knowledge/KnowledgeHowItWorksDialogView.tsx +1 -1
- package/src/layout/AppFrame.tsx +3 -2
- package/src/layout/MainContentFrame.tsx +7 -2
- package/src/layout/ResizeHandle.tsx +68 -17
- package/src/layout/SidebarDock.tsx +75 -19
- package/src/layout/SidebarOverlay.tsx +1 -1
- package/src/layout/index.ts +1 -1
- package/src/layout/resize-handle-axis.test.ts +51 -0
- package/src/live-indicators.test.ts +43 -0
- package/src/markdown/CodeBlock.tsx +123 -0
- package/src/markdown/FileLinkBadge.tsx +77 -0
- package/src/markdown/InlineTokenChip.tsx +68 -0
- package/src/markdown/MarkdownContent.tsx +418 -0
- package/src/markdown/MarkdownImage.tsx +41 -0
- package/src/markdown/MathFormula.tsx +46 -0
- package/src/markdown/MermaidBlock.tsx +82 -0
- package/src/markdown/RichCodeBlock.tsx +127 -0
- package/src/markdown/SvgPreview.tsx +45 -0
- package/src/markdown/WebsiteIcon.tsx +94 -0
- package/src/markdown/builtin-renderers.tsx +43 -0
- package/src/markdown/definition.tsx +49 -0
- package/src/markdown/host.tsx +18 -0
- package/src/markdown/image-actions.ts +29 -0
- package/src/markdown/index.ts +12 -0
- package/src/markdown/inline-tokens.ts +187 -0
- package/src/markdown/markdown-link.ts +279 -0
- package/src/markdown/math-client.ts +116 -0
- package/src/markdown/math-render.ts +23 -0
- package/src/markdown/math-syntax.ts +80 -0
- package/src/markdown/math.worker.ts +16 -0
- package/src/markdown/nodes.ts +15 -0
- package/src/markdown/preview-policy.test.ts +31 -0
- package/src/markdown/preview-policy.ts +76 -0
- package/src/markdown/progressive-chunks.test.ts +43 -0
- package/src/markdown/progressive-chunks.ts +58 -0
- package/src/markdown/rich-labels.ts +55 -0
- package/src/markdown/rich-syntax.ts +93 -0
- package/src/markdown/stable-blocks.test.ts +90 -0
- package/src/markdown/stable-blocks.ts +124 -0
- package/src/markdown/streaming-reveal.ts +297 -0
- package/src/markdown/streaming.test.ts +57 -0
- package/src/markdown/streaming.ts +211 -0
- package/src/markdown/use-render-snapshot.ts +24 -0
- package/src/markdown/use-rich-visibility.ts +24 -0
- package/src/overlays/CommandMenuRow.tsx +77 -17
- package/src/overlays/CommandMenuView.tsx +163 -118
- package/src/overlays/ConfirmDialogView.tsx +25 -20
- package/src/overlays/DiagnosticsExportDialogView.tsx +236 -0
- package/src/overlays/MagpieHandoverDialogView.tsx +217 -0
- package/src/overlays/ReleaseNoteMarkdown.test.tsx +24 -0
- package/src/overlays/ReleaseNoteMarkdown.tsx +55 -0
- package/src/overlays/SplashOptionRow.tsx +46 -0
- package/src/overlays/SplashPanel.tsx +85 -0
- package/src/overlays/SplashParts.tsx +217 -0
- package/src/overlays/UpdateCheckerView.tsx +34 -18
- package/src/overlays/UpdateRestartDialogView.tsx +203 -53
- package/src/overlays/assets/diagnostics-banner.webp +0 -0
- package/src/overlays/command-menu-types.ts +15 -1
- package/src/overlays/command-menu.css +1 -20
- package/src/overlays/index.ts +26 -1
- package/src/plugin-ui/index.ts +10 -0
- package/src/project/ConversationTagDotsView.tsx +1 -1
- package/src/project/ConversationTagEditorDialogView.tsx +4 -1
- package/src/project/DefaultConversationSectionView.tsx +15 -24
- package/src/project/DefaultSessionListView.tsx +5 -31
- package/src/project/DefaultSessionRowView.tsx +114 -55
- package/src/project/ManageSessionsSplashView.tsx +439 -0
- package/src/project/NewProjectDialogView.tsx +3 -10
- package/src/project/ProjectContextMenuView.tsx +30 -139
- package/src/project/ProjectDetailPageView.test.tsx +140 -0
- package/src/project/ProjectDetailPageView.tsx +372 -165
- package/src/project/ProjectGroupView.tsx +1 -1
- package/src/project/ProjectRowView.tsx +29 -12
- package/src/project/ProjectSessionsView.tsx +25 -47
- package/src/project/QuickScrollOverlay.tsx +1 -1
- package/src/project/SessionContextMenuView.tsx +15 -7
- package/src/project/SessionRowMoreButton.tsx +50 -0
- package/src/project/SessionRowView.tsx +106 -63
- package/src/project/SessionTitleMarquee.tsx +54 -0
- package/src/project/SidebarProjectDisclosure.tsx +60 -0
- package/src/project/SidebarProjectsSectionView.tsx +6 -1
- package/src/project/index.ts +12 -0
- package/src/project/session-row-transition.ts +9 -0
- package/src/project/types.ts +4 -2
- package/src/project/useActiveSessionAutoScroll.ts +10 -4
- package/src/registry.ts +0 -2
- package/src/scheduler/AutomationDetailPaneView.tsx +68 -0
- package/src/scheduler/AutomationPageView.tsx +118 -121
- package/src/scheduler/ExecutionHistoryView.tsx +7 -5
- package/src/scheduler/TaskListView.tsx +52 -201
- package/src/scheduler/index.ts +7 -12
- package/src/settings/AppshotSettingsView.tsx +0 -1
- package/src/settings/ArchivedProjectsSettingsView.tsx +122 -1
- package/src/settings/BuiltinMcpSectionView.tsx +1 -1
- package/src/settings/EnvironmentGitRowView.tsx +156 -0
- package/src/settings/EnvironmentSettingsView.tsx +25 -3
- package/src/settings/GeneralSettingsView.tsx +18 -24
- package/src/settings/ImChannelGuideDialogView.tsx +2 -2
- package/src/settings/ImFeishuDialogView.tsx +1 -1
- package/src/settings/ImLegacyImportBannerView.tsx +1 -1
- package/src/settings/ImLogDrawerView.tsx +2 -1
- package/src/settings/JsonConfigInputView.tsx +171 -0
- package/src/settings/LauncherSettingsView.test.tsx +95 -0
- package/src/settings/LauncherSettingsView.tsx +273 -0
- package/src/settings/ModelsFetchedModelsDrawerView.tsx +292 -0
- package/src/settings/ModelsProvidersSectionView.tsx +26 -23
- package/src/settings/MotionSelect.tsx +9 -7
- package/src/settings/NotificationSettingsView.tsx +79 -0
- package/src/settings/PermissionsSettingsView.tsx +3 -7
- package/src/settings/PetActionGalleryView.test.tsx +163 -0
- package/src/settings/PetActionGalleryView.tsx +216 -0
- package/src/settings/PetSettingsView.test.tsx +117 -0
- package/src/settings/PetSettingsView.tsx +86 -22
- package/src/settings/PresetProviderModelsListView.tsx +141 -24
- package/src/settings/PresetProviderRowView.tsx +147 -185
- package/src/settings/ProxySettingsSectionView.tsx +182 -0
- package/src/settings/QrBindDialogView.tsx +1 -1
- package/src/settings/RemoteMcpSectionView.tsx +1 -1
- package/src/settings/SettingChrome.tsx +2 -2
- package/src/settings/SettingsAiAssistButtonView.tsx +9 -119
- package/src/settings/SettingsFormFields.tsx +4 -7
- package/src/settings/SettingsSidebarView.tsx +64 -3
- package/src/settings/ShortcutRecorderView.test.tsx +108 -0
- package/src/settings/ShortcutRecorderView.tsx +15 -9
- package/src/settings/ShortcutsSettingsView.tsx +1 -5
- package/src/settings/SpaceEditorDialogView.tsx +158 -0
- package/src/settings/SpacesSettingsView.tsx +150 -0
- package/src/settings/WebhookEndpointListView.tsx +4 -5
- package/src/settings/assets/space-editor-illustration.webp +0 -0
- package/src/settings/index.ts +59 -68
- package/src/shared/ActivityStatusDot.tsx +69 -0
- package/src/shared/AvatarStackView.tsx +13 -13
- package/src/shared/BotAvatar.tsx +11 -9
- package/src/shared/CodeBlockCopyButton.tsx +1 -1
- package/src/shared/ContextMenuView.tsx +4 -11
- package/src/shared/MarkdownTable.tsx +2 -2
- package/src/shared/SegmentedControl.test.tsx +68 -0
- package/src/shared/SegmentedControl.tsx +10 -2
- package/src/shared/SyntaxHighlightedCode.tsx +0 -0
- package/src/shared/TabBar.outline.test.tsx +59 -0
- package/src/shared/TabBar.tsx +23 -18
- package/src/shared/VettaKbd.test.tsx +52 -0
- package/src/shared/VettaKbd.tsx +100 -0
- package/src/shared/connected-tab-outline.test.ts +2 -2
- package/src/shared/connected-tab-outline.ts +2 -1
- package/src/shared/index.ts +7 -0
- package/src/shared/kbd-keys.test.ts +61 -0
- package/src/shared/kbd-keys.ts +253 -0
- package/src/shared/platform.ts +9 -0
- package/src/shared/provider-icon/icons.ts +4 -2
- package/src/shared/provider-icon/index.tsx +1 -1
- package/src/shared/provider-icon/magpie.svg +1 -0
- package/src/sidebar/AddProjectMenuTriggerView.tsx +33 -24
- package/src/sidebar/DefaultSidebar.tsx +3 -1
- package/src/sidebar/MessageCenterDialogView.tsx +3 -2
- package/src/sidebar/MessageCenterEmptyState.tsx +1 -1
- package/src/sidebar/MessageCenterTabs.tsx +1 -1
- package/src/sidebar/MessageCenterToolbarButton.tsx +1 -1
- package/src/sidebar/MessageCenterTriggerView.tsx +2 -2
- package/src/sidebar/ProjectsPanelEmptyState.tsx +26 -7
- package/src/sidebar/SessionStatusIcon.tsx +16 -1
- package/src/sidebar/SettingsMenuThemeSection.tsx +1 -1
- package/src/sidebar/SettingsMenuTriggerView.test.tsx +42 -0
- package/src/sidebar/SettingsMenuTriggerView.tsx +29 -50
- package/src/sidebar/ShowMoreSessionsButton.tsx +1 -1
- package/src/sidebar/SidebarFilterSelectView.tsx +8 -16
- package/src/sidebar/SidebarNavBadgeView.tsx +1 -1
- package/src/sidebar/SidebarNavIcon.tsx +1 -1
- package/src/sidebar/SidebarNavItemButton.tsx +1 -1
- package/src/sidebar/SidebarNavMorePanel.tsx +19 -7
- package/src/sidebar/SidebarNavigation.tsx +24 -15
- package/src/sidebar/SidebarPanel.tsx +11 -2
- package/src/sidebar/SidebarSectionActionButton.test.tsx +91 -0
- package/src/sidebar/SidebarSectionActionButton.tsx +52 -0
- package/src/sidebar/SidebarSectionTriggerLabel.tsx +20 -0
- package/src/sidebar/SidebarTopBar.tsx +10 -7
- package/src/sidebar/WaitingPulseBadge.tsx +19 -0
- package/src/sidebar/index.ts +1 -16
- package/src/skills/index.ts +0 -19
- package/src/skills/skill-icon.tsx +4 -8
- package/src/styles.css +26 -6
- package/src/chat/DefaultSceneCarousel.tsx +0 -113
- package/src/chat/SceneCard.tsx +0 -138
- package/src/scheduler/HistoryDrawerView.tsx +0 -149
- package/src/scheduler/TaskFormDialogView.tsx +0 -60
- package/src/settings/AchievementNavigationButtonView.tsx +0 -90
- package/src/settings/AchievementPromotionDialogView.tsx +0 -91
- package/src/settings/AchievementSettingsView.tsx +0 -44
- package/src/settings/PetBubbleStylePreviewView.tsx +0 -44
- package/src/settings/QuickPanelSettingsSectionView.tsx +0 -66
- package/src/settings/SubscriptionActionsView.tsx +0 -63
- package/src/settings/SubscriptionCardsView.tsx +0 -212
- package/src/settings/TeamDetailView.tsx +0 -148
- package/src/settings/TeamDialogsView.tsx +0 -151
- package/src/settings/TeamListView.tsx +0 -57
- package/src/settings/TeamSettingsView.tsx +0 -51
- package/src/settings/TokenActivityChartView.tsx +0 -286
- package/src/settings/UsageStatsView.tsx +0 -101
- package/src/settings/achievements/AchievementCurtains.tsx +0 -50
- package/src/settings/achievements/AchievementPromotionBadge3D.tsx +0 -350
- package/src/settings/achievements/AchievementPromotionConfetti.tsx +0 -71
- package/src/settings/achievements/AchievementTitle.tsx +0 -52
- package/src/settings/achievements/index.ts +0 -13
- package/src/settings/shouldCloseEmptyApiKeyEditor.test.ts +0 -135
- package/src/settings/shouldCloseEmptyApiKeyEditor.ts +0 -40
- package/src/settings/token-activity.test.ts +0 -195
- package/src/settings/token-activity.ts +0 -320
- package/src/sidebar/AddProjectMenuItem.tsx +0 -21
- package/src/sidebar/AddProjectMenuPopoverView.tsx +0 -52
- package/src/sidebar/NotificationMessageListView.tsx +0 -136
- package/src/sidebar/SettingsMenuAccountSection.tsx +0 -32
- package/src/sidebar/SettingsMenuQuotaSection.tsx +0 -45
- package/src/skills/SceneCardView.tsx +0 -194
- package/src/skills/SkillCardView.tsx +0 -186
- package/src/skills/SkillDetailDialogView.tsx +0 -138
- package/src/skills/SkillTagGroupView.tsx +0 -56
- package/src/skills/SkillToggleSwitch.tsx +0 -31
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { JSX } from "react";
|
|
2
|
-
import { Button } from "@vetta-org/ui";
|
|
3
|
-
import { cn } from "@vetta-org/ui";
|
|
4
|
-
|
|
5
|
-
export interface AchievementNavigationAssets {
|
|
6
|
-
readonly activeBackground: string;
|
|
7
|
-
readonly disabledBackground: string;
|
|
8
|
-
readonly activeArrow: string;
|
|
9
|
-
readonly disabledArrow: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface AchievementNavigationButtonViewProps {
|
|
13
|
-
readonly disabled: boolean;
|
|
14
|
-
readonly direction: "previous" | "next";
|
|
15
|
-
readonly label: string;
|
|
16
|
-
readonly onClick: () => void;
|
|
17
|
-
readonly assets: AchievementNavigationAssets;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function AchievementNavigationButtonView({
|
|
21
|
-
disabled,
|
|
22
|
-
direction,
|
|
23
|
-
label,
|
|
24
|
-
onClick,
|
|
25
|
-
assets,
|
|
26
|
-
}: AchievementNavigationButtonViewProps): JSX.Element {
|
|
27
|
-
const previous = direction === "previous";
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Button
|
|
31
|
-
variant="ghost"
|
|
32
|
-
disabled={disabled}
|
|
33
|
-
aria-label={label}
|
|
34
|
-
title={label}
|
|
35
|
-
className={cn(
|
|
36
|
-
"absolute top-1/2 z-30 h-[120px] w-[60px] rounded-none border-0 bg-transparent p-0 hover:bg-transparent disabled:opacity-100",
|
|
37
|
-
previous ? "left-16" : "right-16",
|
|
38
|
-
)}
|
|
39
|
-
style={{
|
|
40
|
-
transform: "translateY(-50%)",
|
|
41
|
-
pointerEvents: "auto",
|
|
42
|
-
cursor: disabled ? "default" : "pointer",
|
|
43
|
-
}}
|
|
44
|
-
onClick={onClick}
|
|
45
|
-
>
|
|
46
|
-
<img
|
|
47
|
-
aria-hidden="true"
|
|
48
|
-
alt=""
|
|
49
|
-
draggable={false}
|
|
50
|
-
src={assets.activeBackground}
|
|
51
|
-
className={cn(
|
|
52
|
-
"pointer-events-none absolute inset-0 h-full w-full object-contain transition-opacity duration-150",
|
|
53
|
-
disabled ? "opacity-0" : "opacity-100",
|
|
54
|
-
)}
|
|
55
|
-
/>
|
|
56
|
-
<img
|
|
57
|
-
aria-hidden="true"
|
|
58
|
-
alt=""
|
|
59
|
-
draggable={false}
|
|
60
|
-
src={assets.disabledBackground}
|
|
61
|
-
className={cn(
|
|
62
|
-
"pointer-events-none absolute inset-0 h-full w-full object-contain transition-opacity duration-150",
|
|
63
|
-
disabled ? "opacity-100" : "opacity-0",
|
|
64
|
-
)}
|
|
65
|
-
/>
|
|
66
|
-
<img
|
|
67
|
-
aria-hidden="true"
|
|
68
|
-
alt=""
|
|
69
|
-
draggable={false}
|
|
70
|
-
src={assets.activeArrow}
|
|
71
|
-
className={cn(
|
|
72
|
-
"pointer-events-none relative z-10 w-10 object-contain transition-opacity duration-150",
|
|
73
|
-
previous && "rotate-180",
|
|
74
|
-
disabled ? "opacity-0" : "opacity-100",
|
|
75
|
-
)}
|
|
76
|
-
/>
|
|
77
|
-
<img
|
|
78
|
-
aria-hidden="true"
|
|
79
|
-
alt=""
|
|
80
|
-
draggable={false}
|
|
81
|
-
src={assets.disabledArrow}
|
|
82
|
-
className={cn(
|
|
83
|
-
"pointer-events-none absolute left-1/2 top-1/2 z-10 w-10 -translate-x-1/2 -translate-y-1/2 object-contain transition-opacity duration-150",
|
|
84
|
-
previous && "rotate-180",
|
|
85
|
-
disabled ? "opacity-100" : "opacity-0",
|
|
86
|
-
)}
|
|
87
|
-
/>
|
|
88
|
-
</Button>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { useCallback, useRef, useState, type JSX, type ReactNode } from "react";
|
|
2
|
-
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@vetta-org/ui";
|
|
3
|
-
|
|
4
|
-
export interface AchievementPromotionDialogViewLabels {
|
|
5
|
-
readonly title: string;
|
|
6
|
-
readonly stageName: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface AchievementPromotionDialogViewProps {
|
|
10
|
-
readonly onComplete: () => void;
|
|
11
|
-
readonly labels: AchievementPromotionDialogViewLabels;
|
|
12
|
-
/** 3D badge + confetti stay host-provided (or theme achievements slots). */
|
|
13
|
-
readonly renderBadge: (handlers: {
|
|
14
|
-
onCelebrate: () => void;
|
|
15
|
-
onComplete: () => void;
|
|
16
|
-
onHideText: () => void;
|
|
17
|
-
onRevealText: () => void;
|
|
18
|
-
}) => ReactNode;
|
|
19
|
-
readonly renderConfetti: (triggerToken: number) => ReactNode;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function AchievementPromotionDialogView({
|
|
23
|
-
onComplete,
|
|
24
|
-
labels,
|
|
25
|
-
renderBadge,
|
|
26
|
-
renderConfetti,
|
|
27
|
-
}: AchievementPromotionDialogViewProps): JSX.Element {
|
|
28
|
-
const [confettiTriggerToken, setConfettiTriggerToken] = useState(0);
|
|
29
|
-
const [textVisible, setTextVisible] = useState(false);
|
|
30
|
-
const textRef = useRef<HTMLDivElement>(null);
|
|
31
|
-
|
|
32
|
-
const revealText = useCallback(() => {
|
|
33
|
-
textRef.current?.animate(
|
|
34
|
-
[
|
|
35
|
-
{ opacity: 0, transform: "translateY(16px)" },
|
|
36
|
-
{ opacity: 1, transform: "translateY(0)" },
|
|
37
|
-
],
|
|
38
|
-
{
|
|
39
|
-
duration: 500,
|
|
40
|
-
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
41
|
-
},
|
|
42
|
-
);
|
|
43
|
-
setTextVisible(true);
|
|
44
|
-
}, []);
|
|
45
|
-
const hideText = useCallback(() => {
|
|
46
|
-
setTextVisible(false);
|
|
47
|
-
}, []);
|
|
48
|
-
const celebrate = useCallback(() => {
|
|
49
|
-
setConfettiTriggerToken((token) => token + 1);
|
|
50
|
-
}, []);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<Dialog open onOpenChange={(open) => !open && onComplete()}>
|
|
54
|
-
<DialogContent
|
|
55
|
-
className="h-[min(680px,calc(100vh-2rem))] overflow-visible border-transparent bg-transparent p-0 sm:max-w-[760px]"
|
|
56
|
-
overlayClassName="bg-transparent supports-backdrop-filter:backdrop-blur-none"
|
|
57
|
-
showCloseButton={false}
|
|
58
|
-
onEscapeKeyDown={(event) => event.preventDefault()}
|
|
59
|
-
onPointerDownOutside={(event) => event.preventDefault()}
|
|
60
|
-
>
|
|
61
|
-
<div
|
|
62
|
-
ref={textRef}
|
|
63
|
-
className={`pointer-events-none absolute inset-x-0 bottom-12 z-20 text-center transition-opacity ease-out ${
|
|
64
|
-
textVisible ? "opacity-100" : "opacity-0"
|
|
65
|
-
}`}
|
|
66
|
-
style={{
|
|
67
|
-
WebkitTextStroke: "2px var(--background)",
|
|
68
|
-
paintOrder: "stroke fill",
|
|
69
|
-
transitionDuration: textVisible ? "500ms" : "950ms",
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<DialogTitle className="text-[20px] font-semibold text-primary">{labels.title}</DialogTitle>
|
|
73
|
-
<DialogDescription className="mt-2 text-[15px] text-foreground">
|
|
74
|
-
{labels.stageName}
|
|
75
|
-
</DialogDescription>
|
|
76
|
-
</div>
|
|
77
|
-
<div className="relative z-10 h-full w-full">
|
|
78
|
-
{renderBadge({
|
|
79
|
-
onCelebrate: celebrate,
|
|
80
|
-
onComplete,
|
|
81
|
-
onHideText: hideText,
|
|
82
|
-
onRevealText: revealText,
|
|
83
|
-
})}
|
|
84
|
-
</div>
|
|
85
|
-
<div className="pointer-events-none absolute inset-0 z-15">
|
|
86
|
-
{renderConfetti(confettiTriggerToken)}
|
|
87
|
-
</div>
|
|
88
|
-
</DialogContent>
|
|
89
|
-
</Dialog>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { JSX, ReactNode } from "react";
|
|
2
|
-
import { MotionSelect } from "./MotionSelect";
|
|
3
|
-
|
|
4
|
-
export interface AchievementSetOptionView {
|
|
5
|
-
readonly id: string;
|
|
6
|
-
readonly label: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface AchievementSettingsViewProps {
|
|
10
|
-
readonly setSelectorLabel: string;
|
|
11
|
-
readonly selectedSetId: string;
|
|
12
|
-
readonly setOptions: readonly AchievementSetOptionView[];
|
|
13
|
-
readonly onSelectSetId: (id: string) => void;
|
|
14
|
-
readonly carousel: ReactNode;
|
|
15
|
-
readonly promotionDialog: ReactNode;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function AchievementSettingsView({
|
|
19
|
-
setSelectorLabel,
|
|
20
|
-
selectedSetId,
|
|
21
|
-
setOptions,
|
|
22
|
-
onSelectSetId,
|
|
23
|
-
carousel,
|
|
24
|
-
promotionDialog,
|
|
25
|
-
}: AchievementSettingsViewProps): JSX.Element {
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<div className="mx-auto w-full max-w-[920px] px-8 pb-28 pt-4">
|
|
29
|
-
<div className="mb-4 flex items-center justify-end gap-2">
|
|
30
|
-
<span className="text-[12px] text-muted-foreground">{setSelectorLabel}</span>
|
|
31
|
-
<MotionSelect
|
|
32
|
-
value={selectedSetId}
|
|
33
|
-
onValueChange={onSelectSetId}
|
|
34
|
-
options={setOptions.map((set) => ({ value: set.id, label: set.label }))}
|
|
35
|
-
triggerClassName="min-w-40"
|
|
36
|
-
aria-label={setSelectorLabel}
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
{carousel}
|
|
40
|
-
</div>
|
|
41
|
-
{promotionDialog}
|
|
42
|
-
</>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { JSX, ReactNode } from "react";
|
|
2
|
-
import { cn } from "@vetta-org/ui";
|
|
3
|
-
|
|
4
|
-
export interface PetBubbleStylePreviewViewProps {
|
|
5
|
-
readonly description: string;
|
|
6
|
-
readonly disabled: boolean;
|
|
7
|
-
readonly label: string;
|
|
8
|
-
readonly onSelect: () => void;
|
|
9
|
-
readonly preview: ReactNode;
|
|
10
|
-
readonly selected: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function PetBubbleStylePreviewView({
|
|
14
|
-
description,
|
|
15
|
-
disabled,
|
|
16
|
-
label,
|
|
17
|
-
onSelect,
|
|
18
|
-
preview,
|
|
19
|
-
selected,
|
|
20
|
-
}: PetBubbleStylePreviewViewProps): JSX.Element {
|
|
21
|
-
return (
|
|
22
|
-
<button
|
|
23
|
-
aria-label={label}
|
|
24
|
-
aria-pressed={selected}
|
|
25
|
-
className={cn(
|
|
26
|
-
"overflow-hidden rounded-lg border border-border bg-card text-left transition-colors",
|
|
27
|
-
"hover:border-primary/40 hover:bg-accent/40 focus-visible:outline-none focus-visible:border-ring",
|
|
28
|
-
"disabled:cursor-not-allowed disabled:opacity-60",
|
|
29
|
-
selected && "border-primary/40 bg-primary/10 ring-1 ring-inset ring-primary/30",
|
|
30
|
-
)}
|
|
31
|
-
disabled={disabled}
|
|
32
|
-
onClick={onSelect}
|
|
33
|
-
type="button"
|
|
34
|
-
>
|
|
35
|
-
<div className="flex min-h-32 items-center justify-center overflow-hidden bg-muted px-8 py-10">
|
|
36
|
-
{preview}
|
|
37
|
-
</div>
|
|
38
|
-
<div className="border-t border-border px-3 py-2">
|
|
39
|
-
<div className="truncate text-[12px] font-medium text-foreground">{label}</div>
|
|
40
|
-
<div className="mt-0.5 line-clamp-2 text-[11px] text-muted-foreground">{description}</div>
|
|
41
|
-
</div>
|
|
42
|
-
</button>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { JSX } from "react";
|
|
2
|
-
import { cn } from "@vetta-org/ui";
|
|
3
|
-
import { MotionSelect } from "./MotionSelect";
|
|
4
|
-
import { SettingRow, SettingSection, type SettingSectionMeta } from "./SettingChrome";
|
|
5
|
-
|
|
6
|
-
export interface QuickPanelOptionView {
|
|
7
|
-
readonly value: string;
|
|
8
|
-
readonly label: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface QuickPanelSettingsSectionViewProps {
|
|
12
|
-
readonly section: SettingSectionMeta;
|
|
13
|
-
readonly sectionTitle?: string;
|
|
14
|
-
readonly triggerTitle: string;
|
|
15
|
-
readonly triggerDescription: string;
|
|
16
|
-
readonly trigger: string;
|
|
17
|
-
readonly triggerOptions: readonly QuickPanelOptionView[];
|
|
18
|
-
readonly onTriggerChange: (value: string) => void;
|
|
19
|
-
readonly behaviorTitle: string;
|
|
20
|
-
readonly behaviorDescription: string;
|
|
21
|
-
readonly behavior: string;
|
|
22
|
-
readonly behaviorOptions: readonly QuickPanelOptionView[];
|
|
23
|
-
readonly onBehaviorChange: (value: string) => void;
|
|
24
|
-
readonly behaviorDisabled: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function QuickPanelSettingsSectionView({
|
|
28
|
-
section,
|
|
29
|
-
sectionTitle,
|
|
30
|
-
triggerTitle,
|
|
31
|
-
triggerDescription,
|
|
32
|
-
trigger,
|
|
33
|
-
triggerOptions,
|
|
34
|
-
onTriggerChange,
|
|
35
|
-
behaviorTitle,
|
|
36
|
-
behaviorDescription,
|
|
37
|
-
behavior,
|
|
38
|
-
behaviorOptions,
|
|
39
|
-
onBehaviorChange,
|
|
40
|
-
behaviorDisabled,
|
|
41
|
-
}: QuickPanelSettingsSectionViewProps): JSX.Element {
|
|
42
|
-
return (
|
|
43
|
-
<SettingSection section={section} title={sectionTitle}>
|
|
44
|
-
<SettingRow title={triggerTitle} description={triggerDescription}>
|
|
45
|
-
<MotionSelect
|
|
46
|
-
value={trigger}
|
|
47
|
-
onValueChange={onTriggerChange}
|
|
48
|
-
options={triggerOptions}
|
|
49
|
-
triggerClassName="min-w-[150px]"
|
|
50
|
-
/>
|
|
51
|
-
</SettingRow>
|
|
52
|
-
|
|
53
|
-
<SettingRow title={behaviorTitle} description={behaviorDescription} border={false}>
|
|
54
|
-
<div className={cn("transition-opacity", behaviorDisabled && "pointer-events-none opacity-40")}>
|
|
55
|
-
<MotionSelect
|
|
56
|
-
value={behavior}
|
|
57
|
-
onValueChange={onBehaviorChange}
|
|
58
|
-
options={behaviorOptions}
|
|
59
|
-
triggerClassName="min-w-[120px]"
|
|
60
|
-
disabled={behaviorDisabled}
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
</SettingRow>
|
|
64
|
-
</SettingSection>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Button, cn } from "@vetta-org/ui";
|
|
2
|
-
import type { JSX } from "react";
|
|
3
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
|
-
import type { SubscriptionCardsViewModel } from "./SubscriptionCardsView";
|
|
5
|
-
|
|
6
|
-
/** 订阅区操作按钮(刷新 + 升级),渲染在账户页顶部右上角。 */
|
|
7
|
-
export function SubscriptionActionsView({ model }: { model: SubscriptionCardsViewModel }): JSX.Element {
|
|
8
|
-
const [showDone, setShowDone] = useState(false);
|
|
9
|
-
const prevRefreshing = useRef(model.refreshing);
|
|
10
|
-
const refreshLabel = showDone
|
|
11
|
-
? model.labels.updated
|
|
12
|
-
: model.refreshing
|
|
13
|
-
? model.labels.refreshing
|
|
14
|
-
: model.labels.refresh;
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (prevRefreshing.current && !model.refreshing) {
|
|
18
|
-
setShowDone(true);
|
|
19
|
-
const timer = setTimeout(() => setShowDone(false), 1600);
|
|
20
|
-
prevRefreshing.current = model.refreshing;
|
|
21
|
-
return () => clearTimeout(timer);
|
|
22
|
-
}
|
|
23
|
-
prevRefreshing.current = model.refreshing;
|
|
24
|
-
}, [model.refreshing]);
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div className="flex shrink-0 items-center gap-1">
|
|
28
|
-
<Button
|
|
29
|
-
type="button"
|
|
30
|
-
variant="ghost"
|
|
31
|
-
size="icon"
|
|
32
|
-
onClick={() => void model.actions.refresh()}
|
|
33
|
-
disabled={model.refreshing}
|
|
34
|
-
title={refreshLabel}
|
|
35
|
-
aria-label={refreshLabel}
|
|
36
|
-
className={cn("h-7 w-7 shrink-0", showDone && "text-emerald-400")}
|
|
37
|
-
>
|
|
38
|
-
{showDone ? (
|
|
39
|
-
<span className="icon-[solar--check-circle-linear] h-3.5 w-3.5" />
|
|
40
|
-
) : (
|
|
41
|
-
<span
|
|
42
|
-
className={cn(
|
|
43
|
-
"icon-[solar--refresh-linear] h-3.5 w-3.5",
|
|
44
|
-
model.refreshing && "animate-spin",
|
|
45
|
-
)}
|
|
46
|
-
/>
|
|
47
|
-
)}
|
|
48
|
-
</Button>
|
|
49
|
-
{model.actions.upgrade && model.labels.upgrade ? (
|
|
50
|
-
<Button
|
|
51
|
-
type="button"
|
|
52
|
-
variant="default"
|
|
53
|
-
size="sm"
|
|
54
|
-
onClick={() => model.actions.upgrade?.()}
|
|
55
|
-
className="h-7 gap-1.5 px-2 text-[12px] font-medium"
|
|
56
|
-
>
|
|
57
|
-
<span className="icon-[solar--course-up-linear] h-3.5 w-3.5" />
|
|
58
|
-
{model.labels.upgrade}
|
|
59
|
-
</Button>
|
|
60
|
-
) : null}
|
|
61
|
-
</div>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { cn } from "@vetta-org/ui";
|
|
2
|
-
import type { JSX, ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
export type ModelCost = { cacheRead: number; cacheWrite: number; input: number; output: number };
|
|
5
|
-
export type RemoteModel = {
|
|
6
|
-
api?: string;
|
|
7
|
-
contextWindow?: number;
|
|
8
|
-
id: string;
|
|
9
|
-
input?: string[];
|
|
10
|
-
maxTokens?: number;
|
|
11
|
-
multiplier?: ModelCost;
|
|
12
|
-
name?: string;
|
|
13
|
-
reasoning?: boolean;
|
|
14
|
-
tags?: string[];
|
|
15
|
-
};
|
|
16
|
-
export type RemoteProvider = { api?: string; baseUrl?: string; icon?: string; models?: RemoteModel[] };
|
|
17
|
-
|
|
18
|
-
export interface SubscriptionWindowViewModel {
|
|
19
|
-
consumed: number;
|
|
20
|
-
kind: string;
|
|
21
|
-
label: string;
|
|
22
|
-
limit: number;
|
|
23
|
-
/** 已本地化的重置倒计时文案,空串则不展示。格式化在调用方完成(文案要走 i18n)。 */
|
|
24
|
-
resetLabel: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface SubscriptionCardsViewModel {
|
|
28
|
-
actions: {
|
|
29
|
-
refresh: () => Promise<void>;
|
|
30
|
-
/** 打开官网定价页外链(ADR-0051:desktop 不做站内支付,仅外链引流)。缺省不渲染按钮。 */
|
|
31
|
-
upgrade?: () => void;
|
|
32
|
-
};
|
|
33
|
-
expiry: string | null;
|
|
34
|
-
goProvider: RemoteProvider | undefined;
|
|
35
|
-
labels: {
|
|
36
|
-
expiryDate: (date: string) => string;
|
|
37
|
-
freeModel: string;
|
|
38
|
-
modelMultiplier: (value: string) => string;
|
|
39
|
-
refresh: string;
|
|
40
|
-
refreshing: string;
|
|
41
|
-
thinking: string;
|
|
42
|
-
unlimitedQuota: string;
|
|
43
|
-
updated: string;
|
|
44
|
-
upgrade?: string;
|
|
45
|
-
vision: string;
|
|
46
|
-
};
|
|
47
|
-
refreshing: boolean;
|
|
48
|
-
showGoCard: boolean;
|
|
49
|
-
windows: SubscriptionWindowViewModel[];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function formatMultiplier(n: number): string {
|
|
53
|
-
return Number.isInteger(n) ? String(n) : String(Number(n.toFixed(2)));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function QuotaWindows({
|
|
57
|
-
model,
|
|
58
|
-
unlimited,
|
|
59
|
-
}: {
|
|
60
|
-
model: SubscriptionCardsViewModel;
|
|
61
|
-
unlimited: boolean;
|
|
62
|
-
}): JSX.Element | null {
|
|
63
|
-
if (unlimited) {
|
|
64
|
-
return (
|
|
65
|
-
<div className="flex items-center gap-2 rounded-lg border border-border/50 bg-muted/30 px-3 py-2.5 text-[13px] font-medium text-foreground">
|
|
66
|
-
<span className="icon-[solar--infinity-linear] h-4 w-4 shrink-0 text-primary" />
|
|
67
|
-
{model.labels.unlimitedQuota}
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
if (model.windows.length === 0) return null;
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<div className="grid grid-cols-[repeat(auto-fit,minmax(min(100%,148px),1fr))] gap-x-5 gap-y-3">
|
|
75
|
-
{model.windows.map((windowInfo) => {
|
|
76
|
-
const pct =
|
|
77
|
-
windowInfo.limit > 0
|
|
78
|
-
? Math.min(100, Math.round((windowInfo.consumed / windowInfo.limit) * 100))
|
|
79
|
-
: 0;
|
|
80
|
-
return (
|
|
81
|
-
<div key={windowInfo.kind} className="min-w-0">
|
|
82
|
-
<div className="flex items-center justify-between gap-2 text-[12px]">
|
|
83
|
-
<span className="truncate font-medium text-foreground">{windowInfo.label}</span>
|
|
84
|
-
<span className="shrink-0 tabular-nums text-muted-foreground">{pct}%</span>
|
|
85
|
-
</div>
|
|
86
|
-
<div className="mt-1.5 h-1.5 w-full overflow-hidden rounded-full bg-border">
|
|
87
|
-
<div
|
|
88
|
-
className="h-full rounded-full bg-primary transition-[width] duration-300"
|
|
89
|
-
style={{ width: `${pct}%` }}
|
|
90
|
-
/>
|
|
91
|
-
</div>
|
|
92
|
-
{windowInfo.resetLabel && (
|
|
93
|
-
<div className="mt-1 text-[10px] text-muted-foreground">
|
|
94
|
-
{windowInfo.resetLabel}
|
|
95
|
-
</div>
|
|
96
|
-
)}
|
|
97
|
-
</div>
|
|
98
|
-
);
|
|
99
|
-
})}
|
|
100
|
-
</div>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function ModelRow({
|
|
105
|
-
labels,
|
|
106
|
-
model,
|
|
107
|
-
}: {
|
|
108
|
-
labels: SubscriptionCardsViewModel["labels"];
|
|
109
|
-
model: RemoteModel;
|
|
110
|
-
}): JSX.Element {
|
|
111
|
-
const mul = model.multiplier;
|
|
112
|
-
const showMultiplier = !!mul && (mul.input > 0 || mul.output > 0);
|
|
113
|
-
const isFree = !!mul && mul.input === 0 && mul.output === 0;
|
|
114
|
-
return (
|
|
115
|
-
<div className="flex items-center gap-3 py-1.5">
|
|
116
|
-
<span className="min-w-0 flex-1 truncate text-[12px] font-medium text-foreground">
|
|
117
|
-
{model.name || model.id}
|
|
118
|
-
</span>
|
|
119
|
-
<div className="flex shrink-0 items-center gap-1 text-[10px]">
|
|
120
|
-
{showMultiplier && mul && (
|
|
121
|
-
<span className="flex items-center gap-1 text-muted-foreground">
|
|
122
|
-
<span className="icon-[solar--layers-minimalistic-linear] h-3 w-3 shrink-0 opacity-70" />
|
|
123
|
-
<span className="tabular-nums">{labels.modelMultiplier(formatMultiplier(mul.input))}</span>
|
|
124
|
-
</span>
|
|
125
|
-
)}
|
|
126
|
-
{isFree && <span className="rounded bg-accent px-1 py-0.5 text-muted-foreground">{labels.freeModel}</span>}
|
|
127
|
-
{model.tags?.map((tag) => (
|
|
128
|
-
<span key={tag} className="rounded bg-accent px-1 py-0.5 text-muted-foreground">
|
|
129
|
-
{tag.trim()}
|
|
130
|
-
</span>
|
|
131
|
-
))}
|
|
132
|
-
{model.input?.includes("image") && (
|
|
133
|
-
<span className="rounded bg-primary/10 px-1 py-0.5 text-primary">{labels.vision}</span>
|
|
134
|
-
)}
|
|
135
|
-
{model.reasoning && (
|
|
136
|
-
<span className="rounded bg-primary/10 px-1 py-0.5 text-primary">{labels.thinking}</span>
|
|
137
|
-
)}
|
|
138
|
-
</div>
|
|
139
|
-
</div>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function ModelsList({ model }: { model: SubscriptionCardsViewModel }): JSX.Element | null {
|
|
144
|
-
const models = model.goProvider?.models ?? [];
|
|
145
|
-
if (models.length === 0) return null;
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<div className="divide-y divide-border/40">
|
|
149
|
-
{models.map((remoteModel) => (
|
|
150
|
-
<ModelRow key={remoteModel.id} model={remoteModel} labels={model.labels} />
|
|
151
|
-
))}
|
|
152
|
-
</div>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function VettaGoCard({
|
|
157
|
-
model,
|
|
158
|
-
beforeWindows,
|
|
159
|
-
children,
|
|
160
|
-
}: {
|
|
161
|
-
model: SubscriptionCardsViewModel;
|
|
162
|
-
beforeWindows?: ReactNode;
|
|
163
|
-
children?: ReactNode;
|
|
164
|
-
}): JSX.Element {
|
|
165
|
-
const unlimited = model.windows.length > 0 && model.windows.every((windowInfo) => windowInfo.limit <= 0);
|
|
166
|
-
|
|
167
|
-
return (
|
|
168
|
-
<div className="flex flex-col gap-4">
|
|
169
|
-
{model.expiry && (
|
|
170
|
-
<div className="flex items-center gap-1.5 text-[11px] text-muted-foreground">
|
|
171
|
-
<span className="icon-[solar--calendar-linear] h-3.5 w-3.5 shrink-0" />
|
|
172
|
-
{model.labels.expiryDate(model.expiry)}
|
|
173
|
-
</div>
|
|
174
|
-
)}
|
|
175
|
-
|
|
176
|
-
{beforeWindows}
|
|
177
|
-
|
|
178
|
-
<QuotaWindows model={model} unlimited={unlimited} />
|
|
179
|
-
|
|
180
|
-
{children ? <div>{children}</div> : null}
|
|
181
|
-
|
|
182
|
-
<ModelsList model={model} />
|
|
183
|
-
</div>
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export function SubscriptionCardsView({
|
|
188
|
-
model,
|
|
189
|
-
beforeWindows,
|
|
190
|
-
children,
|
|
191
|
-
}: {
|
|
192
|
-
model: SubscriptionCardsViewModel;
|
|
193
|
-
/** Rendered above the quota windows (e.g. usage stat tiles). */
|
|
194
|
-
beforeWindows?: ReactNode;
|
|
195
|
-
/** Rendered between quota windows and models (e.g. embedded token usage chart). */
|
|
196
|
-
children?: ReactNode;
|
|
197
|
-
}): JSX.Element | null {
|
|
198
|
-
if (!model.showGoCard) {
|
|
199
|
-
// No Go plan card to nest into: still surface whatever was passed in.
|
|
200
|
-
return beforeWindows || children ? (
|
|
201
|
-
<div className="flex flex-col gap-4">
|
|
202
|
-
{beforeWindows}
|
|
203
|
-
{children}
|
|
204
|
-
</div>
|
|
205
|
-
) : null;
|
|
206
|
-
}
|
|
207
|
-
return (
|
|
208
|
-
<VettaGoCard model={model} beforeWindows={beforeWindows}>
|
|
209
|
-
{children}
|
|
210
|
-
</VettaGoCard>
|
|
211
|
-
);
|
|
212
|
-
}
|