@vetta-org/theme-ui 0.1.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 +195 -0
- package/src/action-approval/AppearanceActionPickerView.tsx +291 -0
- package/src/action-approval/AppearanceApprovalDrawerView.tsx +69 -0
- package/src/action-approval/AppearancePickerApprovalView.tsx +31 -0
- package/src/action-approval/ApprovalParts.tsx +376 -0
- package/src/action-approval/BatchTasksApprovalFrameView.tsx +138 -0
- package/src/action-approval/BatchTasksExecutionApprovalView.tsx +158 -0
- package/src/action-approval/BatchTasksTaskApprovalView.tsx +152 -0
- package/src/action-approval/GeneralSetExecutionModeApprovalView.tsx +76 -0
- package/src/action-approval/GenericActionApprovalView.tsx +127 -0
- package/src/action-approval/ManageActionApprovalFrameTypes.ts +27 -0
- package/src/action-approval/ManageActionApprovalFrameView.tsx +136 -0
- package/src/action-approval/NavigationOpenApprovalView.tsx +119 -0
- package/src/action-approval/SchedulerActionApprovalDialogView.tsx +191 -0
- package/src/action-approval/SchedulerEditApprovalDrawerView.tsx +113 -0
- package/src/action-approval/SchedulerUpdateApprovalView.tsx +14 -0
- package/src/action-approval/ThemeChangeApprovalView.tsx +30 -0
- package/src/action-approval/WebhookDeleteApprovalView.tsx +56 -0
- package/src/action-approval/WebhookTestApprovalView.tsx +51 -0
- package/src/action-approval/cn.ts +4 -0
- package/src/action-approval/index.ts +88 -0
- package/src/activity/ActivityPanel.tsx +269 -0
- package/src/activity/ActivityPanelFrame.tsx +36 -0
- package/src/activity/BackgroundTasksTabPanelView.tsx +382 -0
- package/src/activity/BatchProgressTabPanelView.tsx +22 -0
- package/src/activity/BrowserPanelView.tsx +169 -0
- package/src/activity/ChatTabPanelView.tsx +36 -0
- package/src/activity/CodePreview.tsx +57 -0
- package/src/activity/DebugTabPanelView.tsx +67 -0
- package/src/activity/FileTabContentView.tsx +46 -0
- package/src/activity/FloatingActivityTabView.tsx +107 -0
- package/src/activity/HtmlPreviewView.tsx +135 -0
- package/src/activity/JourneyPanelView.tsx +327 -0
- package/src/activity/KnowledgeHistoryPanelView.tsx +93 -0
- package/src/activity/MarkdownPreviewView.tsx +217 -0
- package/src/activity/PluginTabPickerView.tsx +182 -0
- package/src/activity/RequestHistorySubTabView.tsx +102 -0
- package/src/activity/ScheduleExecutionTabPanelView.tsx +162 -0
- package/src/activity/TodoTabPanelView.tsx +66 -0
- package/src/activity/ToolCallsSubTabView.tsx +184 -0
- package/src/activity/WorkflowTabPanelView.tsx +129 -0
- package/src/activity/index.ts +110 -0
- package/src/app/AppBackground.tsx +24 -0
- package/src/app/AppBootLoadingView.tsx +51 -0
- package/src/app/RouteContentLoadingView.tsx +20 -0
- package/src/app/index.ts +13 -0
- package/src/app-boot.ts +1 -0
- package/src/app-shell/DefaultPageHeader.tsx +46 -0
- package/src/app-shell/DefaultWindowControls.tsx +32 -0
- package/src/app-shell/PageHeaderActionGroup.tsx +15 -0
- package/src/app-shell/PageHeaderContent.tsx +70 -0
- package/src/app-shell/PageHeaderFrame.tsx +53 -0
- package/src/app-shell/PageHeaderSidebarTrigger.tsx +21 -0
- package/src/app-shell/PageHeaderTitle.tsx +25 -0
- package/src/app-shell/PageHeaderWindowActions.tsx +22 -0
- package/src/app-shell/WindowControlButton.tsx +35 -0
- package/src/app-shell/index.ts +49 -0
- package/src/appearance/BackgroundImageFrame.tsx +57 -0
- package/src/appearance/CenterSliceImageFrame.tsx +64 -0
- package/src/appearance/CornerImageFrame.tsx +63 -0
- package/src/appearance/HorizontalSliceImageFrame.tsx +97 -0
- package/src/appearance/NineSliceImageFrame.tsx +65 -0
- package/src/appearance/ThemeSurface.tsx +91 -0
- package/src/appearance/index.ts +12 -0
- package/src/batch-tasks/BatchProjectArtifactFieldView.tsx +36 -0
- package/src/batch-tasks/BatchProjectDialogView.tsx +61 -0
- package/src/batch-tasks/BatchProjectFoldersFieldView.tsx +108 -0
- package/src/batch-tasks/BatchProjectGroupView.tsx +77 -0
- package/src/batch-tasks/BatchProjectNameFieldView.tsx +29 -0
- package/src/batch-tasks/BatchProjectNotificationFieldView.tsx +42 -0
- package/src/batch-tasks/BatchProjectRuntimeFieldsView.tsx +67 -0
- package/src/batch-tasks/BatchTaskActionButtonsView.tsx +67 -0
- package/src/batch-tasks/BatchTaskCardView.tsx +142 -0
- package/src/batch-tasks/BatchTaskGridView.tsx +95 -0
- package/src/batch-tasks/BatchTaskListView.tsx +10 -0
- package/src/batch-tasks/BatchTaskProjectActionsView.tsx +73 -0
- package/src/batch-tasks/BatchTaskProjectBlockView.tsx +117 -0
- package/src/batch-tasks/BatchTaskProjectHeaderView.tsx +74 -0
- package/src/batch-tasks/BatchTasksPageView.tsx +126 -0
- package/src/batch-tasks/batchTaskUi.tsx +101 -0
- package/src/batch-tasks/index.ts +70 -0
- package/src/batch-tasks/types.ts +120 -0
- package/src/chat/ActionButtonBarView.tsx +45 -0
- package/src/chat/AgentAvatarView.tsx +59 -0
- package/src/chat/AppshotCardView.tsx +89 -0
- package/src/chat/AskUserQuestionView.tsx +177 -0
- package/src/chat/AssistantMessageView.tsx +147 -0
- package/src/chat/AtPanelView.tsx +220 -0
- package/src/chat/BackgroundTasksBadgeView.tsx +28 -0
- package/src/chat/BashTerminalCard.tsx +225 -0
- package/src/chat/ChatExportHostView.tsx +17 -0
- package/src/chat/ChatHeaderActionsView.tsx +75 -0
- package/src/chat/ContextRingView.tsx +100 -0
- package/src/chat/CopyIconButton.tsx +61 -0
- package/src/chat/DefaultGuidingWords.tsx +75 -0
- package/src/chat/DefaultSceneCarousel.tsx +113 -0
- package/src/chat/DefaultSkillBadgeRow.tsx +103 -0
- package/src/chat/DrawerCard.tsx +149 -0
- package/src/chat/EditDiffView.tsx +137 -0
- package/src/chat/ExecutionModeSelectorView.tsx +124 -0
- package/src/chat/ExportMessageListView.tsx +20 -0
- package/src/chat/GuideBadgeSwiperView.tsx +79 -0
- package/src/chat/InlineTokenChip.tsx +68 -0
- package/src/chat/InputActionBarView.tsx +112 -0
- package/src/chat/InputBarBackground.tsx +25 -0
- package/src/chat/InputBarCapsule.tsx +56 -0
- package/src/chat/InputBarContextMenuView.tsx +79 -0
- package/src/chat/InputBarPlaceholder.tsx +84 -0
- package/src/chat/InputBarToolbarButton.tsx +42 -0
- package/src/chat/KnowledgeToolViews.tsx +119 -0
- package/src/chat/LiveThinkingView.tsx +102 -0
- package/src/chat/MessageActions.tsx +109 -0
- package/src/chat/MessageBlockSegmentsView.tsx +203 -0
- package/src/chat/MessageBoundaryViews.tsx +93 -0
- package/src/chat/MessageCardsView.tsx +126 -0
- package/src/chat/MessageFeedContext.tsx +14 -0
- package/src/chat/MessageFeedLayoutView.tsx +97 -0
- package/src/chat/MessageFeedView.tsx +228 -0
- package/src/chat/MessageInputView.tsx +193 -0
- package/src/chat/MessageLayoutView.tsx +156 -0
- package/src/chat/MessageListFooterView.tsx +127 -0
- package/src/chat/MessageSelectionContextMenuView.tsx +66 -0
- package/src/chat/MessageTimelineView.tsx +261 -0
- package/src/chat/MessageView.tsx +82 -0
- package/src/chat/MessageVisualView.tsx +43 -0
- package/src/chat/ModelSelectorView.tsx +407 -0
- package/src/chat/NewSession.ts +107 -0
- package/src/chat/NewSessionBackground.tsx +54 -0
- package/src/chat/NewSessionPageLayoutView.tsx +96 -0
- package/src/chat/NewSessionPicker.tsx +270 -0
- package/src/chat/ProgressGroupView.tsx +323 -0
- package/src/chat/ProjectSelectorView.tsx +253 -0
- package/src/chat/QueueCardView.tsx +151 -0
- package/src/chat/ReadImageView.tsx +73 -0
- package/src/chat/SandboxGrantsBadgeView.tsx +101 -0
- package/src/chat/SandboxPermissionCard.tsx +64 -0
- package/src/chat/SceneCard.tsx +138 -0
- package/src/chat/SendButton.tsx +135 -0
- package/src/chat/SessionDropZoneView.tsx +85 -0
- package/src/chat/SessionViewerPageView.tsx +56 -0
- package/src/chat/SkillCard.tsx +56 -0
- package/src/chat/SkillPromptAreaView.tsx +129 -0
- package/src/chat/SuggestionBubblesView.tsx +58 -0
- package/src/chat/TextBlockView.tsx +770 -0
- package/src/chat/TextPreview.tsx +37 -0
- package/src/chat/ThinkingBlockView.tsx +183 -0
- package/src/chat/TodoCard.tsx +243 -0
- package/src/chat/TodoProgress.tsx +205 -0
- package/src/chat/TodoStatusBarView.tsx +140 -0
- package/src/chat/ToolCallBlockView.tsx +188 -0
- package/src/chat/UsageBarView.tsx +19 -0
- package/src/chat/UserMessageContextMenuView.tsx +87 -0
- package/src/chat/UserMessageView.tsx +241 -0
- package/src/chat/WorkflowFooterItemsView.tsx +170 -0
- package/src/chat/WriteContentView.tsx +12 -0
- package/src/chat/index.ts +524 -0
- package/src/chat/markdown-link.test.ts +238 -0
- package/src/chat/markdown-link.ts +279 -0
- package/src/chat/send-button.css +318 -0
- package/src/chat/useHorizontalDragScroll.ts +146 -0
- package/src/file-explorer/ConfirmDeleteDialogView.tsx +62 -0
- package/src/file-explorer/FileContextMenuView.tsx +209 -0
- package/src/file-explorer/FileTreeCreateRow.tsx +82 -0
- package/src/file-explorer/FileTreeNodeView.tsx +274 -0
- package/src/file-explorer/FileTreeView.tsx +301 -0
- package/src/file-explorer/FilesPanelView.tsx +91 -0
- package/src/file-explorer/drag-target.test.ts +34 -0
- package/src/file-explorer/drag-target.ts +26 -0
- package/src/file-explorer/fileIcons.ts +1 -0
- package/src/file-explorer/index.ts +28 -0
- package/src/file-explorer/nativeFileDrag.test.ts +30 -0
- package/src/file-explorer/nativeFileDrag.ts +14 -0
- package/src/file-explorer/types.ts +40 -0
- package/src/file-explorer/useFileTreeMarqueeSelection.ts +115 -0
- package/src/file-preview/FilePreviewDialogView.tsx +241 -0
- package/src/file-preview/FilePreviewView.tsx +162 -0
- package/src/file-preview/LightboxImageView.tsx +131 -0
- package/src/file-preview/PluginFilePreviewView.tsx +24 -0
- package/src/file-preview/PreviewBodyView.tsx +99 -0
- package/src/file-preview/PreviewErrorBoundary.tsx +51 -0
- package/src/file-preview/TextCodeEditorView.tsx +72 -0
- package/src/file-preview/TextFileEditorView.tsx +213 -0
- package/src/file-preview/index.ts +56 -0
- package/src/file-preview/keyboard-target.test.ts +49 -0
- package/src/file-preview/keyboard-target.ts +33 -0
- package/src/file-preview/syntax-tokens.css +77 -0
- package/src/file-preview/syntax-tokens.test.ts +31 -0
- package/src/file-preview/syntax-tokens.ts +155 -0
- package/src/file-preview/text-code-editor-theme.ts +321 -0
- package/src/file-preview/text-editor-language.test.ts +58 -0
- package/src/file-preview/text-editor-language.ts +182 -0
- package/src/file-preview/types.ts +29 -0
- package/src/flowing/FlowingPanelView.tsx +79 -0
- package/src/flowing/FlowingWorkflowView.tsx +54 -0
- package/src/flowing/UserNodeView.tsx +148 -0
- package/src/flowing/WorkflowBindDialogView.tsx +145 -0
- package/src/flowing/WorkflowProgressView.tsx +149 -0
- package/src/flowing/index.ts +27 -0
- package/src/flowing-chat/ChatBubbleView.tsx +219 -0
- package/src/flowing-chat/ChatComposerView.tsx +362 -0
- package/src/flowing-chat/ChatMembersBarView.tsx +86 -0
- package/src/flowing-chat/ChatPanelView.tsx +73 -0
- package/src/flowing-chat/index.ts +21 -0
- package/src/index.ts +22 -0
- package/src/knowledge/KnowledgeBaseSwitcherView.tsx +154 -0
- package/src/knowledge/KnowledgeBreadcrumbView.tsx +92 -0
- package/src/knowledge/KnowledgeContentsPanelView.tsx +77 -0
- package/src/knowledge/KnowledgeContextMenuView.tsx +70 -0
- package/src/knowledge/KnowledgeFilesSkeleton.tsx +22 -0
- package/src/knowledge/KnowledgeGridView.tsx +113 -0
- package/src/knowledge/KnowledgeHowItWorksDialogView.tsx +85 -0
- package/src/knowledge/KnowledgeImportDialogView.tsx +153 -0
- package/src/knowledge/KnowledgeListView.tsx +107 -0
- package/src/knowledge/KnowledgePendingFilesDialogView.tsx +76 -0
- package/src/knowledge/KnowledgeProcessingBadgeView.tsx +18 -0
- package/src/knowledge/KnowledgeRenameDialogView.tsx +66 -0
- package/src/knowledge/KnowledgeSourcePickerView.tsx +60 -0
- package/src/knowledge/KnowledgeViewShared.tsx +103 -0
- package/src/knowledge/cn.ts +4 -0
- package/src/knowledge/coloredFileIcons.ts +1 -0
- package/src/knowledge/index.ts +66 -0
- package/src/knowledge/types.ts +31 -0
- package/src/knowledge/useMarqueeSelection.ts +95 -0
- package/src/layout/AppFrame.tsx +34 -0
- package/src/layout/MainContentFrame.tsx +54 -0
- package/src/layout/ResizeHandle.tsx +91 -0
- package/src/layout/SidebarDock.tsx +33 -0
- package/src/layout/SidebarOverlay.tsx +36 -0
- package/src/layout/index.ts +10 -0
- package/src/overlays/CommandMenuRow.tsx +119 -0
- package/src/overlays/CommandMenuView.tsx +183 -0
- package/src/overlays/ConfirmDialogView.tsx +109 -0
- package/src/overlays/DetailDrawer.tsx +63 -0
- package/src/overlays/DetailDrawerEnter.tsx +37 -0
- package/src/overlays/KnowledgeDropOverlayView.tsx +43 -0
- package/src/overlays/RouteErrorPageView.tsx +72 -0
- package/src/overlays/ToasterView.tsx +76 -0
- package/src/overlays/UpdateCheckerView.tsx +206 -0
- package/src/overlays/UpdateRestartDialogView.tsx +107 -0
- package/src/overlays/command-menu-types.ts +47 -0
- package/src/overlays/command-menu.css +69 -0
- package/src/overlays/detail-drawer-guard.test.ts +16 -0
- package/src/overlays/detail-drawer-guard.ts +13 -0
- package/src/overlays/index.ts +44 -0
- package/src/plugin-ui/index.ts +26 -0
- package/src/project/BatchQueueStatusView.tsx +352 -0
- package/src/project/ConversationTagDotsView.tsx +130 -0
- package/src/project/ConversationTagEditorDialogView.tsx +273 -0
- package/src/project/DefaultConversationSectionView.tsx +74 -0
- package/src/project/DefaultSessionListView.tsx +128 -0
- package/src/project/DefaultSessionRowView.tsx +125 -0
- package/src/project/NewProjectDialogView.tsx +140 -0
- package/src/project/ProjectContextMenuView.tsx +187 -0
- package/src/project/ProjectDetailPageView.tsx +351 -0
- package/src/project/ProjectGroupView.tsx +37 -0
- package/src/project/ProjectRowView.tsx +111 -0
- package/src/project/ProjectSessionsLoadingView.tsx +14 -0
- package/src/project/ProjectSessionsView.tsx +96 -0
- package/src/project/ProjectsLoadingView.tsx +15 -0
- package/src/project/ProjectsPanelMenusView.tsx +23 -0
- package/src/project/ProjectsPanelView.tsx +56 -0
- package/src/project/QuickScrollOverlay.tsx +188 -0
- package/src/project/ScheduleStatusView.tsx +110 -0
- package/src/project/SessionContextMenuView.tsx +71 -0
- package/src/project/SessionRenameInputView.tsx +49 -0
- package/src/project/SessionRowView.tsx +119 -0
- package/src/project/SidebarProjectsSectionView.tsx +35 -0
- package/src/project/index.ts +87 -0
- package/src/project/types.ts +21 -0
- package/src/project/useActiveSessionAutoScroll.ts +171 -0
- package/src/registry.ts +62 -0
- package/src/scheduler/AutomationPageView.tsx +159 -0
- package/src/scheduler/ExecutionHistoryView.tsx +179 -0
- package/src/scheduler/HistoryDrawerView.tsx +149 -0
- package/src/scheduler/TaskFormDialogView.tsx +60 -0
- package/src/scheduler/TaskListView.tsx +219 -0
- package/src/scheduler/index.ts +30 -0
- package/src/settings/AchievementNavigationButtonView.tsx +90 -0
- package/src/settings/AchievementPromotionDialogView.tsx +91 -0
- package/src/settings/AchievementSettingsView.tsx +44 -0
- package/src/settings/AppshotSettingsView.tsx +132 -0
- package/src/settings/ArchivedProjectsSettingsView.tsx +80 -0
- package/src/settings/BuiltinMcpSecretsDialogView.tsx +278 -0
- package/src/settings/BuiltinMcpSectionView.tsx +164 -0
- package/src/settings/EnvironmentSettingsView.tsx +176 -0
- package/src/settings/GeneralSettingsView.tsx +174 -0
- package/src/settings/ImChannelCardView.tsx +152 -0
- package/src/settings/ImChannelGuideDialogView.tsx +126 -0
- package/src/settings/ImFeishuDialogView.tsx +156 -0
- package/src/settings/ImLegacyImportBannerView.tsx +44 -0
- package/src/settings/ImLogDrawerView.tsx +75 -0
- package/src/settings/ImStatusBadgeView.tsx +39 -0
- package/src/settings/McpDefaultIcon.tsx +27 -0
- package/src/settings/McpJsonEditorView.tsx +56 -0
- package/src/settings/ModelsProviderFormView.tsx +128 -0
- package/src/settings/ModelsProvidersSectionView.tsx +52 -0
- package/src/settings/MotionSelect.tsx +125 -0
- package/src/settings/PermissionsSettingsView.tsx +106 -0
- package/src/settings/PetBubbleStylePreviewView.tsx +44 -0
- package/src/settings/PetSettingsView.tsx +165 -0
- package/src/settings/PresetProviderModelsListView.tsx +58 -0
- package/src/settings/PresetProviderRowView.tsx +302 -0
- package/src/settings/PresetProvidersSectionView.tsx +70 -0
- package/src/settings/QrBindDialogView.tsx +165 -0
- package/src/settings/QuickPanelSettingsSectionView.tsx +66 -0
- package/src/settings/RemoteMcpSectionView.tsx +192 -0
- package/src/settings/SettingChrome.tsx +104 -0
- package/src/settings/SettingsAiAssistButtonView.tsx +150 -0
- package/src/settings/SettingsAiAssistDialogView.tsx +251 -0
- package/src/settings/SettingsFormFields.tsx +121 -0
- package/src/settings/SettingsPageShellView.tsx +84 -0
- package/src/settings/SettingsSidebarView.tsx +133 -0
- package/src/settings/ShortcutRecorderView.tsx +88 -0
- package/src/settings/ShortcutsSettingsView.tsx +66 -0
- package/src/settings/SubscriptionActionsView.tsx +63 -0
- package/src/settings/SubscriptionCardsView.tsx +212 -0
- package/src/settings/TeamDetailView.tsx +148 -0
- package/src/settings/TeamDialogsView.tsx +151 -0
- package/src/settings/TeamListView.tsx +57 -0
- package/src/settings/TeamSettingsView.tsx +51 -0
- package/src/settings/TokenActivityChartView.tsx +286 -0
- package/src/settings/UsageStatsView.tsx +101 -0
- package/src/settings/WebhookEndpointListView.tsx +123 -0
- package/src/settings/WechatBindDialogView.tsx +45 -0
- package/src/settings/achievements/AchievementCurtains.tsx +50 -0
- package/src/settings/achievements/AchievementPromotionBadge3D.tsx +350 -0
- package/src/settings/achievements/AchievementPromotionConfetti.tsx +71 -0
- package/src/settings/achievements/AchievementTitle.tsx +52 -0
- package/src/settings/achievements/index.ts +13 -0
- package/src/settings/index.ts +226 -0
- package/src/settings/shouldCloseEmptyApiKeyEditor.test.ts +135 -0
- package/src/settings/shouldCloseEmptyApiKeyEditor.ts +40 -0
- package/src/settings/token-activity.test.ts +195 -0
- package/src/settings/token-activity.ts +320 -0
- package/src/shared/AvatarStackView.tsx +45 -0
- package/src/shared/BotAvatar.tsx +395 -0
- package/src/shared/CodeBlockCopyButton.tsx +48 -0
- package/src/shared/CollapsePanel.tsx +125 -0
- package/src/shared/ContextMenuView.tsx +134 -0
- package/src/shared/MacKeyboardPreview.tsx +260 -0
- package/src/shared/MarkdownTable.tsx +216 -0
- package/src/shared/MultiplierTag.tsx +15 -0
- package/src/shared/ScrollFade.tsx +114 -0
- package/src/shared/SegmentedControl.tsx +82 -0
- package/src/shared/SyntaxHighlightedCode.tsx +0 -0
- package/src/shared/TabBar.tsx +696 -0
- package/src/shared/TimePicker.tsx +96 -0
- package/src/shared/connected-tab-outline.test.ts +22 -0
- package/src/shared/connected-tab-outline.ts +39 -0
- package/src/shared/fileIcons.test.ts +28 -0
- package/src/shared/fileIcons.ts +322 -0
- package/src/shared/index.ts +38 -0
- package/src/shared/markdown-table-clipboard.ts +31 -0
- package/src/shared/provider-icon/icons.ts +56 -0
- package/src/shared/provider-icon/index.tsx +42 -0
- package/src/shared/provider-icon/svg-url.d.ts +4 -0
- package/src/shared/tab-drag.test.ts +14 -0
- package/src/shared/tab-drag.ts +15 -0
- package/src/shared/useDelayedUnmount.ts +36 -0
- package/src/sidebar/AddProjectMenuItem.tsx +21 -0
- package/src/sidebar/AddProjectMenuPopoverView.tsx +52 -0
- package/src/sidebar/AddProjectMenuTriggerView.tsx +50 -0
- package/src/sidebar/ChatMessageListView.tsx +66 -0
- package/src/sidebar/DefaultSidebar.tsx +91 -0
- package/src/sidebar/FlowingMessageListView.tsx +111 -0
- package/src/sidebar/MessageCenterDialogView.tsx +81 -0
- package/src/sidebar/MessageCenterEmptyState.tsx +24 -0
- package/src/sidebar/MessageCenterTabs.tsx +86 -0
- package/src/sidebar/MessageCenterToolbarButton.tsx +25 -0
- package/src/sidebar/MessageCenterTriggerView.tsx +39 -0
- package/src/sidebar/NotificationMessageListView.tsx +136 -0
- package/src/sidebar/ProjectsPanelEmptyState.tsx +20 -0
- package/src/sidebar/RunningPulseDot.tsx +10 -0
- package/src/sidebar/SessionStatusIcon.tsx +43 -0
- package/src/sidebar/SettingsMenuAccountSection.tsx +32 -0
- package/src/sidebar/SettingsMenuActionButton.tsx +24 -0
- package/src/sidebar/SettingsMenuDivider.tsx +5 -0
- package/src/sidebar/SettingsMenuQuotaSection.tsx +45 -0
- package/src/sidebar/SettingsMenuSettingsItem.tsx +18 -0
- package/src/sidebar/SettingsMenuThemeSection.tsx +51 -0
- package/src/sidebar/SettingsMenuTriggerView.tsx +65 -0
- package/src/sidebar/ShowMoreSessionsButton.tsx +37 -0
- package/src/sidebar/SidebarFilterSelectView.tsx +95 -0
- package/src/sidebar/SidebarNavBadgeView.tsx +58 -0
- package/src/sidebar/SidebarNavIcon.tsx +33 -0
- package/src/sidebar/SidebarNavItemButton.tsx +59 -0
- package/src/sidebar/SidebarNavMorePanel.tsx +199 -0
- package/src/sidebar/SidebarNavigation.tsx +223 -0
- package/src/sidebar/SidebarPanel.tsx +48 -0
- package/src/sidebar/SidebarTopBar.tsx +103 -0
- package/src/sidebar/SidebarUpdateIcon.tsx +79 -0
- package/src/sidebar/index.ts +118 -0
- package/src/sidebar/nav-badge-text.test.ts +23 -0
- package/src/sidebar/nav-badge-text.ts +19 -0
- package/src/sidebar/useSidebarNavDrag.ts +139 -0
- package/src/skills/PluginCardView.tsx +150 -0
- package/src/skills/SceneCardView.tsx +194 -0
- package/src/skills/SkillCardView.tsx +186 -0
- package/src/skills/SkillDetailDialogView.tsx +138 -0
- package/src/skills/SkillTagGroupView.tsx +56 -0
- package/src/skills/SkillToggleSwitch.tsx +31 -0
- package/src/skills/index.ts +29 -0
- package/src/skills/skill-icon.test.ts +38 -0
- package/src/skills/skill-icon.tsx +126 -0
- package/src/styles.css +75 -0
- package/src/utils/platform.ts +2 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from "react";
|
|
2
|
+
import { Button } from "@vetta-org/ui";
|
|
3
|
+
import { SettingRow, SettingSection, type SettingSectionMeta } from "./SettingChrome";
|
|
4
|
+
|
|
5
|
+
export interface ShortcutActionRowView {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly description: string;
|
|
9
|
+
readonly recorder: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ShortcutsSettingsViewProps {
|
|
13
|
+
readonly title: string;
|
|
14
|
+
readonly resetAllLabel: string;
|
|
15
|
+
readonly shortcutHint: string;
|
|
16
|
+
readonly globalSection: SettingSectionMeta;
|
|
17
|
+
readonly globalSectionTitle?: string;
|
|
18
|
+
readonly aiAssistSlot: ReactNode;
|
|
19
|
+
readonly onResetAll: () => void;
|
|
20
|
+
readonly shortcutActions: readonly ShortcutActionRowView[];
|
|
21
|
+
readonly quickPanelSection: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function ShortcutsSettingsView({
|
|
25
|
+
title,
|
|
26
|
+
resetAllLabel,
|
|
27
|
+
shortcutHint,
|
|
28
|
+
globalSection,
|
|
29
|
+
globalSectionTitle,
|
|
30
|
+
aiAssistSlot,
|
|
31
|
+
onResetAll,
|
|
32
|
+
shortcutActions,
|
|
33
|
+
quickPanelSection,
|
|
34
|
+
}: ShortcutsSettingsViewProps): JSX.Element {
|
|
35
|
+
return (
|
|
36
|
+
<div className="mx-auto w-full max-w-[680px] px-8 pt-2 pb-4">
|
|
37
|
+
<div className="mb-6 flex flex-wrap items-center justify-between gap-3">
|
|
38
|
+
<h1 className="text-[20px] font-bold text-foreground">{title}</h1>
|
|
39
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
40
|
+
{aiAssistSlot}
|
|
41
|
+
<Button variant="secondary" size="sm" onClick={onResetAll}>
|
|
42
|
+
<span className="icon-[mdi--restore] h-3.5 w-3.5" />
|
|
43
|
+
{resetAllLabel}
|
|
44
|
+
</Button>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<SettingSection section={globalSection} title={globalSectionTitle}>
|
|
49
|
+
{shortcutActions.map((action, idx) => (
|
|
50
|
+
<SettingRow
|
|
51
|
+
key={action.id}
|
|
52
|
+
title={action.label}
|
|
53
|
+
description={action.description}
|
|
54
|
+
border={idx < shortcutActions.length - 1}
|
|
55
|
+
>
|
|
56
|
+
{action.recorder}
|
|
57
|
+
</SettingRow>
|
|
58
|
+
))}
|
|
59
|
+
</SettingSection>
|
|
60
|
+
|
|
61
|
+
{quickPanelSection}
|
|
62
|
+
|
|
63
|
+
<p className="mt-4 text-[12px] leading-relaxed text-muted-foreground/50">{shortcutHint}</p>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { useState, type JSX } from "react";
|
|
2
|
+
import { Button } from "@vetta-org/ui";
|
|
3
|
+
import { SettingSection, type SettingSectionMeta } from "./SettingChrome";
|
|
4
|
+
|
|
5
|
+
export interface TeamMemberView {
|
|
6
|
+
readonly id: number | string;
|
|
7
|
+
readonly user_id: number;
|
|
8
|
+
readonly username: string;
|
|
9
|
+
readonly avatar?: string | null;
|
|
10
|
+
readonly role: "owner" | "admin" | "member" | string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TeamDetailViewData {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly invite_code: string;
|
|
16
|
+
readonly members: readonly TeamMemberView[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface TeamDetailViewLabels {
|
|
20
|
+
readonly backToList: string;
|
|
21
|
+
readonly codeLabel: string;
|
|
22
|
+
readonly resetCode: string;
|
|
23
|
+
readonly members: string;
|
|
24
|
+
readonly memberCount: (count: number) => string;
|
|
25
|
+
readonly ownerRole: string;
|
|
26
|
+
readonly adminRole: string;
|
|
27
|
+
readonly memberRole: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface TeamDetailViewProps {
|
|
31
|
+
readonly detail: TeamDetailViewData;
|
|
32
|
+
readonly labels: TeamDetailViewLabels;
|
|
33
|
+
readonly infoSection: SettingSectionMeta;
|
|
34
|
+
readonly membersSection: SettingSectionMeta;
|
|
35
|
+
readonly onBack: () => void;
|
|
36
|
+
readonly onResetCode: () => void;
|
|
37
|
+
readonly onRemoveMember: (userId: number) => void;
|
|
38
|
+
readonly onLeave: () => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function memberRoleLabel(role: string, labels: TeamDetailViewLabels): string {
|
|
42
|
+
if (role === "owner") return labels.ownerRole;
|
|
43
|
+
if (role === "admin") return labels.adminRole;
|
|
44
|
+
return labels.memberRole;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function TeamDetailView({
|
|
48
|
+
detail,
|
|
49
|
+
labels,
|
|
50
|
+
infoSection,
|
|
51
|
+
membersSection,
|
|
52
|
+
onBack,
|
|
53
|
+
onResetCode,
|
|
54
|
+
onRemoveMember,
|
|
55
|
+
onLeave,
|
|
56
|
+
}: TeamDetailViewProps): JSX.Element {
|
|
57
|
+
const [copied, setCopied] = useState(false);
|
|
58
|
+
|
|
59
|
+
const handleCopyInviteCode = async () => {
|
|
60
|
+
await navigator.clipboard.writeText(detail.invite_code);
|
|
61
|
+
setCopied(true);
|
|
62
|
+
setTimeout(() => setCopied(false), 2000);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div className="space-y-4">
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
onClick={onBack}
|
|
70
|
+
className="flex items-center gap-1 text-[12px] text-muted-foreground transition-colors hover:text-foreground"
|
|
71
|
+
>
|
|
72
|
+
<span className="icon-[mdi--arrow-left] h-3.5 w-3.5" />
|
|
73
|
+
{labels.backToList}
|
|
74
|
+
</button>
|
|
75
|
+
|
|
76
|
+
<SettingSection section={infoSection} title={detail.name}>
|
|
77
|
+
<div className="flex items-center justify-between border-b border-border px-5 py-3.5">
|
|
78
|
+
<div>
|
|
79
|
+
<div className="text-[13px] font-medium text-foreground">{labels.codeLabel}</div>
|
|
80
|
+
<div className="mt-0.5 font-mono text-[11px] text-muted-foreground">{detail.invite_code}</div>
|
|
81
|
+
</div>
|
|
82
|
+
<div className="flex gap-1.5">
|
|
83
|
+
<Button variant="ghost" size="xs" onClick={() => void handleCopyInviteCode()}>
|
|
84
|
+
{copied ? (
|
|
85
|
+
<span className="icon-[mdi--check] h-3.5 w-3.5 text-emerald-400" />
|
|
86
|
+
) : (
|
|
87
|
+
<span className="icon-[mdi--content-copy] h-3.5 w-3.5" />
|
|
88
|
+
)}
|
|
89
|
+
</Button>
|
|
90
|
+
<Button variant="ghost" size="xs" onClick={onResetCode} title={labels.resetCode}>
|
|
91
|
+
<span className="icon-[mdi--refresh] h-3.5 w-3.5" />
|
|
92
|
+
</Button>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div className="flex items-center justify-between px-5 py-3.5">
|
|
97
|
+
<div className="text-[13px] font-medium text-foreground">{labels.members}</div>
|
|
98
|
+
<div className="text-[12px] text-muted-foreground">
|
|
99
|
+
{labels.memberCount(detail.members.length)}
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</SettingSection>
|
|
103
|
+
|
|
104
|
+
<SettingSection section={membersSection}>
|
|
105
|
+
{detail.members.map((member, i) => (
|
|
106
|
+
<div
|
|
107
|
+
key={member.id}
|
|
108
|
+
className={`flex items-center justify-between px-5 py-3 ${
|
|
109
|
+
i < detail.members.length - 1 ? "border-b border-border" : ""
|
|
110
|
+
}`}
|
|
111
|
+
>
|
|
112
|
+
<div className="flex items-center gap-3">
|
|
113
|
+
{member.avatar ? (
|
|
114
|
+
<img src={member.avatar} alt="" className="h-7 w-7 rounded-full" />
|
|
115
|
+
) : (
|
|
116
|
+
<div className="flex h-7 w-7 items-center justify-center rounded-full bg-accent text-[11px] font-medium text-muted-foreground">
|
|
117
|
+
{member.username[0]}
|
|
118
|
+
</div>
|
|
119
|
+
)}
|
|
120
|
+
<div>
|
|
121
|
+
<span className="text-[13px] text-foreground">{member.username}</span>
|
|
122
|
+
<span className="ml-2 text-[11px] text-muted-foreground">
|
|
123
|
+
{memberRoleLabel(member.role, labels)}
|
|
124
|
+
</span>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
{member.role !== "owner" && (
|
|
128
|
+
<Button
|
|
129
|
+
variant="ghost"
|
|
130
|
+
size="xs"
|
|
131
|
+
className="text-muted-foreground hover:text-destructive"
|
|
132
|
+
onClick={() => onRemoveMember(member.user_id)}
|
|
133
|
+
>
|
|
134
|
+
<span className="icon-[mdi--close] h-3.5 w-3.5" />
|
|
135
|
+
</Button>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
))}
|
|
139
|
+
</SettingSection>
|
|
140
|
+
|
|
141
|
+
{detail.members.some((member) => member.role !== "owner") && (
|
|
142
|
+
<div className="flex justify-end">
|
|
143
|
+
<Button variant="outline" size="sm" className="text-destructive" onClick={onLeave} />
|
|
144
|
+
</div>
|
|
145
|
+
)}
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { useState, type JSX } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogFooter,
|
|
7
|
+
DialogHeader,
|
|
8
|
+
DialogTitle,
|
|
9
|
+
cn,
|
|
10
|
+
} from "@vetta-org/ui";
|
|
11
|
+
|
|
12
|
+
const inputClassName =
|
|
13
|
+
"h-8 w-full min-w-0 rounded-lg border border-border/60 bg-transparent px-2.5 py-1 text-base shadow-none transition-[border-color,background-color] outline-none placeholder:text-muted-foreground hover:border-border focus-visible:border-ring/60 md:text-sm dark:bg-input/20";
|
|
14
|
+
|
|
15
|
+
export interface TeamDialogLabelsView {
|
|
16
|
+
readonly createTitle: string;
|
|
17
|
+
readonly createPlaceholder: string;
|
|
18
|
+
readonly createFailed: string;
|
|
19
|
+
readonly creating: string;
|
|
20
|
+
readonly createButton: string;
|
|
21
|
+
readonly joinTitle: string;
|
|
22
|
+
readonly joinPlaceholder: string;
|
|
23
|
+
readonly joinFailed: string;
|
|
24
|
+
readonly joining: string;
|
|
25
|
+
readonly joinButton: string;
|
|
26
|
+
readonly cancel: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CreateTeamDialogViewProps {
|
|
30
|
+
readonly open: boolean;
|
|
31
|
+
readonly labels: TeamDialogLabelsView;
|
|
32
|
+
readonly onOpenChange: (open: boolean) => void;
|
|
33
|
+
readonly onCreate: (name: string) => Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function CreateTeamDialogView({
|
|
37
|
+
open,
|
|
38
|
+
labels,
|
|
39
|
+
onOpenChange,
|
|
40
|
+
onCreate,
|
|
41
|
+
}: CreateTeamDialogViewProps): JSX.Element {
|
|
42
|
+
const [name, setName] = useState("");
|
|
43
|
+
const [loading, setLoading] = useState(false);
|
|
44
|
+
const [error, setError] = useState("");
|
|
45
|
+
|
|
46
|
+
const handleCreate = async () => {
|
|
47
|
+
if (!name.trim()) return;
|
|
48
|
+
setLoading(true);
|
|
49
|
+
setError("");
|
|
50
|
+
try {
|
|
51
|
+
await onCreate(name.trim());
|
|
52
|
+
setName("");
|
|
53
|
+
} catch (e: unknown) {
|
|
54
|
+
setError(e instanceof Error ? e.message : labels.createFailed);
|
|
55
|
+
} finally {
|
|
56
|
+
setLoading(false);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
62
|
+
<DialogContent>
|
|
63
|
+
<DialogHeader>
|
|
64
|
+
<DialogTitle>{labels.createTitle}</DialogTitle>
|
|
65
|
+
</DialogHeader>
|
|
66
|
+
<div className="space-y-3">
|
|
67
|
+
<input
|
|
68
|
+
placeholder={labels.createPlaceholder}
|
|
69
|
+
value={name}
|
|
70
|
+
onChange={(e) => setName(e.target.value)}
|
|
71
|
+
onKeyDown={(e) => e.key === "Enter" && void handleCreate()}
|
|
72
|
+
// biome-ignore lint/a11y/noAutofocus: preserve original dialog focus
|
|
73
|
+
autoFocus
|
|
74
|
+
className={cn(inputClassName)}
|
|
75
|
+
/>
|
|
76
|
+
{error && <p className="text-[12px] text-destructive">{error}</p>}
|
|
77
|
+
</div>
|
|
78
|
+
<DialogFooter>
|
|
79
|
+
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
|
80
|
+
{labels.cancel}
|
|
81
|
+
</Button>
|
|
82
|
+
<Button onClick={() => void handleCreate()} disabled={loading || !name.trim()}>
|
|
83
|
+
{loading ? labels.creating : labels.createButton}
|
|
84
|
+
</Button>
|
|
85
|
+
</DialogFooter>
|
|
86
|
+
</DialogContent>
|
|
87
|
+
</Dialog>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface JoinTeamDialogViewProps {
|
|
92
|
+
readonly open: boolean;
|
|
93
|
+
readonly labels: TeamDialogLabelsView;
|
|
94
|
+
readonly onOpenChange: (open: boolean) => void;
|
|
95
|
+
readonly onJoin: (code: string) => Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function JoinTeamDialogView({
|
|
99
|
+
open,
|
|
100
|
+
labels,
|
|
101
|
+
onOpenChange,
|
|
102
|
+
onJoin,
|
|
103
|
+
}: JoinTeamDialogViewProps): JSX.Element {
|
|
104
|
+
const [code, setCode] = useState("");
|
|
105
|
+
const [loading, setLoading] = useState(false);
|
|
106
|
+
const [error, setError] = useState("");
|
|
107
|
+
|
|
108
|
+
const handleJoin = async () => {
|
|
109
|
+
if (!code.trim()) return;
|
|
110
|
+
setLoading(true);
|
|
111
|
+
setError("");
|
|
112
|
+
try {
|
|
113
|
+
await onJoin(code.trim());
|
|
114
|
+
setCode("");
|
|
115
|
+
} catch (e: unknown) {
|
|
116
|
+
setError(e instanceof Error ? e.message : labels.joinFailed);
|
|
117
|
+
} finally {
|
|
118
|
+
setLoading(false);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
124
|
+
<DialogContent>
|
|
125
|
+
<DialogHeader>
|
|
126
|
+
<DialogTitle>{labels.joinTitle}</DialogTitle>
|
|
127
|
+
</DialogHeader>
|
|
128
|
+
<div className="space-y-3">
|
|
129
|
+
<input
|
|
130
|
+
placeholder={labels.joinPlaceholder}
|
|
131
|
+
value={code}
|
|
132
|
+
onChange={(e) => setCode(e.target.value)}
|
|
133
|
+
onKeyDown={(e) => e.key === "Enter" && void handleJoin()}
|
|
134
|
+
// biome-ignore lint/a11y/noAutofocus: preserve original dialog focus
|
|
135
|
+
autoFocus
|
|
136
|
+
className={cn(inputClassName)}
|
|
137
|
+
/>
|
|
138
|
+
{error && <p className="text-[12px] text-destructive">{error}</p>}
|
|
139
|
+
</div>
|
|
140
|
+
<DialogFooter>
|
|
141
|
+
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
|
142
|
+
{labels.cancel}
|
|
143
|
+
</Button>
|
|
144
|
+
<Button onClick={() => void handleJoin()} disabled={loading || !code.trim()}>
|
|
145
|
+
{loading ? labels.joining : labels.joinButton}
|
|
146
|
+
</Button>
|
|
147
|
+
</DialogFooter>
|
|
148
|
+
</DialogContent>
|
|
149
|
+
</Dialog>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import { SettingSection, type SettingSectionMeta } from "./SettingChrome";
|
|
3
|
+
|
|
4
|
+
export interface TeamListItemView {
|
|
5
|
+
readonly id: number;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly roleLabel: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface TeamListViewProps {
|
|
11
|
+
readonly teams: readonly TeamListItemView[];
|
|
12
|
+
readonly loading: boolean;
|
|
13
|
+
readonly emptyLabel: string;
|
|
14
|
+
readonly section: SettingSectionMeta;
|
|
15
|
+
readonly onSelect: (id: number) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function TeamListView({
|
|
19
|
+
teams,
|
|
20
|
+
loading,
|
|
21
|
+
emptyLabel,
|
|
22
|
+
section,
|
|
23
|
+
onSelect,
|
|
24
|
+
}: TeamListViewProps): JSX.Element {
|
|
25
|
+
if (teams.length === 0) {
|
|
26
|
+
return (
|
|
27
|
+
<SettingSection section={section}>
|
|
28
|
+
<div className="px-5 py-8 text-center text-[13px] text-muted-foreground">{emptyLabel}</div>
|
|
29
|
+
</SettingSection>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<SettingSection section={section}>
|
|
35
|
+
{teams.map((team, i) => (
|
|
36
|
+
<button
|
|
37
|
+
key={team.id}
|
|
38
|
+
type="button"
|
|
39
|
+
onClick={() => onSelect(team.id)}
|
|
40
|
+
className={`flex w-full items-center justify-between px-5 py-3.5 text-left transition-colors hover:bg-accent/50 ${i < teams.length - 1 ? "border-b border-border" : ""}`}
|
|
41
|
+
disabled={loading}
|
|
42
|
+
>
|
|
43
|
+
<div className="flex items-center gap-3">
|
|
44
|
+
<div className="flex h-8 w-8 items-center justify-center rounded-lg bg-primary/10 text-[13px] font-bold text-primary">
|
|
45
|
+
{team.name[0]}
|
|
46
|
+
</div>
|
|
47
|
+
<div>
|
|
48
|
+
<div className="text-[13px] font-medium text-foreground">{team.name}</div>
|
|
49
|
+
<div className="text-[11px] text-muted-foreground">{team.roleLabel}</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<span className="icon-[mdi--chevron-right] h-4 w-4 text-muted-foreground/50" />
|
|
53
|
+
</button>
|
|
54
|
+
))}
|
|
55
|
+
</SettingSection>
|
|
56
|
+
);
|
|
57
|
+
}
|