mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 15:14:10 +00:00
feat(settings): add team appearance setting to hide agent features (#411)
* feat(settings): add team appearance setting to hide agent features Add an Appearance subpage under Team Settings allowing team owners to toggle appearance.hideAgent for the team. Return appearance.hideAgent in the user-metadata API, and conditionally hide the AGENTS.md button, agent chatbot sidebar, and chatbot trigger button in the WebUI. * refactor(settings): add strongly typed TeamSettingsResponse to remove explicit any Introduce TeamSettingsResponse and TeamAppearanceSettings in @shumai/dtos, type TeamService.getSettings and updateSettings, and eliminate the explicit any cast in AppearanceSettings.tsx.
This commit is contained in:
@@ -16,6 +16,7 @@ import { useMemberStore } from '@/ui/stores/members'
|
||||
import { useTeamContextStore } from '@/ui/stores/team-context'
|
||||
import { useTopNavStore } from '@/ui/stores/top-nav'
|
||||
import { useUiStore } from '@/ui/stores/ui'
|
||||
import { useUserMetadataStore } from '@/ui/stores/user-metadata'
|
||||
import { type Annotation } from '@/ui/types'
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { createLazyFileRoute } from '@tanstack/react-router'
|
||||
@@ -72,6 +73,7 @@ function FileViewPage() {
|
||||
const [annotations, setAnnotations] = useState<Annotation[]>([])
|
||||
const { fileViewRightSidebarCollapsed } = useUiStore()
|
||||
const { isChatbotOpen } = useChatbotStore()
|
||||
const hideAgent = useUserMetadataStore((s) => Boolean(s.metadata['appearance.hideAgent']))
|
||||
const [currentTime, setCurrentTime] = useState(0)
|
||||
const [selectedCommentId, setSelectedCommentId] = useState<string | null>(null)
|
||||
const [compareActiveAsset, setCompareActiveAsset] = useState<AssetInfo | null>(null)
|
||||
@@ -713,7 +715,7 @@ function FileViewPage() {
|
||||
</FileViewer>
|
||||
)}
|
||||
</div>
|
||||
{(!fileViewRightSidebarCollapsed || isChatbotOpen) && (
|
||||
{(!fileViewRightSidebarCollapsed || (isChatbotOpen && !hideAgent)) && (
|
||||
<>
|
||||
<ResizeHandle
|
||||
onResize={(delta) => {
|
||||
@@ -725,7 +727,7 @@ function FileViewPage() {
|
||||
style={{ width: rightSidebarWidth }}
|
||||
className="flex-shrink-0 bg-background flex flex-col"
|
||||
>
|
||||
{isChatbotOpen ? (
|
||||
{isChatbotOpen && !hideAgent ? (
|
||||
<ChatbotSidebar
|
||||
projectId={projectId}
|
||||
contextAssetId={activeFileId}
|
||||
|
||||
@@ -13,6 +13,7 @@ import { McpConfigCard } from '@/ui/components/settings/McpConfigCard'
|
||||
import { NotificationSettings } from '@/ui/components/settings/NotificationSettings'
|
||||
import { DeveloperSettings } from '@/ui/components/settings/DeveloperSettings'
|
||||
import { QuotasSettings } from '@/ui/components/settings/QuotasSettings'
|
||||
import { AppearanceSettings } from '@/ui/components/settings/AppearanceSettings'
|
||||
import { ImageVideoGenerationSettings } from '@/ui/components/settings/ImageVideoGenerationSettings'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/ui/components/ui/card'
|
||||
import { cn } from '@/ui/lib/utils'
|
||||
@@ -30,6 +31,7 @@ import {
|
||||
Bell,
|
||||
Key,
|
||||
Gauge,
|
||||
Palette,
|
||||
} from 'lucide-react'
|
||||
import { useState, useRef, useEffect } from 'react'
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
|
||||
@@ -52,6 +54,7 @@ type SettingsTab =
|
||||
| 'general'
|
||||
| 'transcode'
|
||||
| 'quotas'
|
||||
| 'appearance'
|
||||
| 'skills'
|
||||
| 'mcp'
|
||||
| 'providers'
|
||||
@@ -65,6 +68,7 @@ const VALID_SETTINGS_TABS: readonly SettingsTab[] = [
|
||||
'general',
|
||||
'transcode',
|
||||
'quotas',
|
||||
'appearance',
|
||||
'skills',
|
||||
'mcp',
|
||||
'providers',
|
||||
@@ -166,6 +170,7 @@ function TeamSettingsPage() {
|
||||
const ownerOnlyTabs: SettingsTab[] = [
|
||||
'transcode',
|
||||
'quotas',
|
||||
'appearance',
|
||||
'providers',
|
||||
'image-video',
|
||||
'skills',
|
||||
@@ -426,6 +431,22 @@ function TeamSettingsPage() {
|
||||
<div className="ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary" />
|
||||
)}
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => handleTabChange('appearance')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'appearance'
|
||||
? 'bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border'
|
||||
: 'text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
||||
)}
|
||||
>
|
||||
<Palette className="w-5 h-5" />
|
||||
{m.appearance()}
|
||||
{activeTab === 'appearance' && (
|
||||
<div className="ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary" />
|
||||
)}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -545,6 +566,7 @@ function TeamSettingsPage() {
|
||||
{activeTab === 'general' && m.general_settings()}
|
||||
{activeTab === 'transcode' && m.media_processing()}
|
||||
{activeTab === 'quotas' && m.resource_quotas()}
|
||||
{activeTab === 'appearance' && m.appearance_settings()}
|
||||
{activeTab === 'skills' && m.skills_management()}
|
||||
{activeTab === 'mcp' && m.mcp_servers()}
|
||||
{activeTab === 'providers' && m.ai_providers()}
|
||||
@@ -558,6 +580,7 @@ function TeamSettingsPage() {
|
||||
{activeTab === 'general' && m.general_settings_description()}
|
||||
{activeTab === 'transcode' && m.transcode_description()}
|
||||
{activeTab === 'quotas' && m.resource_quotas_description()}
|
||||
{activeTab === 'appearance' && m.appearance_settings_description()}
|
||||
{activeTab === 'skills' && m.skills_description()}
|
||||
{activeTab === 'mcp' && m.mcp_servers_description()}
|
||||
{activeTab === 'providers' && m.providers_description()}
|
||||
@@ -827,6 +850,8 @@ function TeamSettingsPage() {
|
||||
{activeTab === 'developer' && <DeveloperSettings teamId={teamId} />}
|
||||
|
||||
{activeTab === 'quotas' && <QuotasSettings teamId={teamId} />}
|
||||
|
||||
{activeTab === 'appearance' && <AppearanceSettings teamId={teamId} />}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user