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:
Yiling-J
2026-09-17 18:31:43 +08:00
committed by GitHub
parent 7af3647913
commit e2f741eda6
18 changed files with 458 additions and 43 deletions
+15
View File
@@ -260,6 +260,21 @@ describe('team api', () => {
expect(mockUpdateSettings).toHaveBeenCalledWith('t1', 'transcode.hardwareAcceleration', 'auto')
})
it('PATCH /teams/:teamId/settings updates appearance.hideAgent', async () => {
mockUpdateSettings.mockResolvedValue({ appearance: { hideAgent: true } })
const res = await app.request('/teams/t1/settings', {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ key: 'appearance.hideAgent', value: true }),
})
expect(res.status).toBe(200)
const data = await res.json()
expect(data.appearance.hideAgent).toBe(true)
expect(mockUpdateSettings).toHaveBeenCalledWith('t1', 'appearance.hideAgent', true)
})
it('GET /teams/:teamId/user-metadata returns all metadata for the user in the team', async () => {
mockListUserMetadata.mockResolvedValue([
{ key: 'key1', value: 'value1' },
+8 -2
View File
@@ -363,20 +363,26 @@ describe('TeamService', () => {
})
const settings = await teamService.getSettings(team.id)
expect(settings).toEqual({ semanticSearchEnabled: false })
expect(settings).toEqual({ semanticSearchEnabled: false, appearance: { hideAgent: false } })
await teamService.updateSettings(team.id, 'theme', 'dark')
const newSettings = await teamService.getSettings(team.id)
expect(newSettings).toEqual({ theme: 'dark', semanticSearchEnabled: false })
expect(newSettings).toEqual({
theme: 'dark',
semanticSearchEnabled: false,
appearance: { hideAgent: false },
})
await teamService.updateSettings(team.id, 'transcode.videoStrategy', 'all')
await teamService.updateSettings(team.id, 'transcode.hardwareAcceleration', 'auto')
await teamService.updateSettings(team.id, 'appearance.hideAgent', true)
const finalSettings = await teamService.getSettings(team.id)
expect(finalSettings).toEqual({
theme: 'dark',
transcode: { videoStrategy: 'all', hardwareAcceleration: 'auto' },
appearance: { hideAgent: true },
semanticSearchEnabled: false,
})
})
+25 -12
View File
@@ -19,6 +19,7 @@ import {
UserInfo,
SandboxSettings,
UpdateSandboxSettingsRequest,
TeamSettingsResponse,
} from '@shumai/dtos'
export class TeamService {
@@ -288,53 +289,65 @@ export class TeamService {
})
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async getSettings(teamId: string): Promise<any> {
async getSettings(teamId: string): Promise<TeamSettingsResponse> {
const team = await prisma.team.findUnique({
where: { id: teamId },
})
if (!team) throw new HTTPException(404, { message: 'team not found' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const settings = (team.settings || {}) as any
const settings = (team.settings || {}) as TeamSettingsResponse
const embeddingAgent = await prisma.agent.findFirst({
where: { teamId, type: 'embedding', enabled: true },
})
settings.semanticSearchEnabled = !!embeddingAgent
if (!settings.appearance) {
settings.appearance = { hideAgent: false }
} else if (settings.appearance.hideAgent === undefined) {
settings.appearance.hideAgent = false
}
return settings
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async updateSettings(teamId: string, key: string, value: any): Promise<any> {
async updateSettings(teamId: string, key: string, value: unknown): Promise<TeamSettingsResponse> {
const team = await prisma.team.findUnique({ where: { id: teamId } })
if (!team) throw new HTTPException(404, { message: 'team not found' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const settings = (team.settings || {}) as any
const settings = (team.settings || {}) as TeamSettingsResponse
if (key === 'transcode.videoStrategy') {
if (!settings.transcode) {
settings.transcode = {}
}
settings.transcode.videoStrategy = value
settings.transcode.videoStrategy = value as NonNullable<
TeamSettingsResponse['transcode']
>['videoStrategy']
delete settings['transcode.videoStrategy']
} else if (key === 'transcode.hardwareAcceleration') {
if (!settings.transcode) {
settings.transcode = {}
}
settings.transcode.hardwareAcceleration = value
settings.transcode.hardwareAcceleration = value as NonNullable<
TeamSettingsResponse['transcode']
>['hardwareAcceleration']
delete settings['transcode.hardwareAcceleration']
} else if (key === 'appearance.hideAgent') {
if (!settings.appearance) {
settings.appearance = {}
}
settings.appearance.hideAgent = Boolean(value)
delete settings['appearance.hideAgent']
} else {
settings[key] = value
}
const updated = await prisma.team.update({
where: { id: teamId },
data: { settings },
data: { settings: settings as unknown as PrismaJson.Settings },
})
return updated.settings || {}
return (updated.settings || {}) as TeamSettingsResponse
}
async getSandboxSettings(teamId: string): Promise<SandboxSettings> {
@@ -45,13 +45,39 @@ describe('UserMetadataService', () => {
await userMetadataService.upsertMetadata(user.id, team.id, 'key2', 'value2')
const list = await userMetadataService.listMetadata(user.id, team.id)
expect(list).toHaveLength(2)
expect(list).toHaveLength(3)
expect(list).toEqual([
{ key: 'key1', value: 'value1' },
{ key: 'key2', value: 'value2' },
{ key: 'appearance.hideAgent', value: false },
])
})
it('should return team appearance.hideAgent when configured', async () => {
const user = await prisma.user.create({
data: {
name: 'Test User HideAgent',
email: `testha-${Date.now()}@example.com`,
password: 'pw',
},
})
const team = await prisma.team.create({
data: {
name: 'Test Team HideAgent',
settings: {
transcode: { videoStrategy: 'best_match' },
appearance: { hideAgent: true },
},
},
})
const list = await userMetadataService.listMetadata(user.id, team.id)
expect(list).toContainEqual({ key: 'appearance.hideAgent', value: true })
const meta = await userMetadataService.getMetadata(user.id, team.id, 'appearance.hideAgent')
expect(meta).toEqual({ key: 'appearance.hideAgent', value: true })
})
it('should return null if metadata not found', async () => {
const user = await prisma.user.create({
data: { name: 'Test User 3', email: `test3-${Date.now()}@example.com`, password: 'pw' },
@@ -24,23 +24,53 @@ export class UserMetadataService {
}
async listMetadata(userId: string, teamId: string): Promise<UserMetadataItem[]> {
const items = await prisma.userMetadata.findMany({
where: {
userId,
teamId,
},
orderBy: {
key: 'asc',
},
const [items, team] = await Promise.all([
prisma.userMetadata.findMany({
where: {
userId,
teamId,
},
orderBy: {
key: 'asc',
},
}),
prisma.team.findUnique({
where: { id: teamId },
select: { settings: true },
}),
])
const result: UserMetadataItem[] = items
.filter((item) => item.key !== 'appearance.hideAgent')
.map((item) => ({
key: item.key,
value: item.value,
}))
const teamSettings = team?.settings as PrismaJson.Settings | null
const hideAgent = teamSettings?.appearance?.hideAgent ?? false
result.push({
key: 'appearance.hideAgent',
value: hideAgent,
})
return items.map((item) => ({
key: item.key,
value: item.value,
}))
return result
}
async getMetadata(userId: string, teamId: string, key: string): Promise<UserMetadataItem | null> {
if (key === 'appearance.hideAgent') {
const team = await prisma.team.findUnique({
where: { id: teamId },
select: { settings: true },
})
const teamSettings = team?.settings as PrismaJson.Settings | null
return {
key: 'appearance.hideAgent',
value: teamSettings?.appearance?.hideAgent ?? false,
}
}
const item = await prisma.userMetadata.findUnique({
where: {
userIdTeamIdKey: {
+5
View File
@@ -79,9 +79,14 @@ declare global {
enabledModels?: EnabledMediaModelConfig[]
}
export interface AppearanceSettings {
hideAgent?: boolean
}
export interface Settings {
transcode: TranscodeSettings
mediaGeneration?: MediaGenerationSettings
appearance?: AppearanceSettings
}
// ----------------------------------------------------------------------
+18
View File
@@ -89,9 +89,27 @@ export const updateTeamSettingsRequestSchema = z.union([
key: z.literal('transcode.hardwareAcceleration'),
value: z.nativeEnum(HardwareAcceleration),
}),
z.object({
key: z.literal('appearance.hideAgent'),
value: z.boolean(),
}),
])
export type UpdateTeamSettingsRequest = z.infer<typeof updateTeamSettingsRequestSchema>
export interface TeamAppearanceSettings {
hideAgent?: boolean
}
export interface TeamSettingsResponse {
transcode?: {
videoStrategy?: VideoTranscodeStrategy
hardwareAcceleration?: HardwareAcceleration
}
appearance?: TeamAppearanceSettings
semanticSearchEnabled?: boolean
[key: string]: unknown
}
export const sandboxSettingsSchema = z.object({
networkSandboxEnabled: z.boolean(),
allowedDomains: z.array(z.string()),
@@ -5,6 +5,7 @@ import { ResizeHandle } from '@/ui/components/resize-handle'
import { useChatbotStore } from '@/ui/stores/chatbot'
import { useTopNavStore } from '@/ui/stores/top-nav'
import { useUiStore } from '@/ui/stores/ui'
import { useUserMetadataStore } from '@/ui/stores/user-metadata'
import type { AncestorFolder, AssetInfo } from '@shumai/dtos'
import { useQuery } from '@tanstack/react-query'
import { useNavigate } from '@tanstack/react-router'
@@ -36,6 +37,7 @@ export default function AgentsMdManager({
setFileListLeftSidebarCollapsed: setIsLeftSidebarCollapsed,
} = useUiStore()
const { isChatbotOpen, setIsChatbotOpen } = useChatbotStore()
const hideAgent = useUserMetadataStore((s) => Boolean(s.metadata['appearance.hideAgent']))
const { data: folderInfo } = useQuery({
queryKey: ['folders', assetId],
@@ -136,7 +138,7 @@ export default function AgentsMdManager({
/>
</div>
{isChatbotOpen && (
{isChatbotOpen && !hideAgent && (
<>
<ResizeHandle
onResize={(delta) => {
@@ -123,4 +123,25 @@ describe('BreadcrumbNav component', () => {
expect(screen.getByRole('button', { name: /Show omitted folders/i })).toBeDefined()
})
it('renders chatbot toggle button when onChatbotToggle is provided', () => {
const onChatbotToggle = vi.fn()
const { container } = render(
<QueryClientProvider client={queryClient}>
<BreadcrumbNav {...baseProps} onChatbotToggle={onChatbotToggle} />
</QueryClientProvider>,
)
expect(container.querySelector('.lucide-bot')).not.toBeNull()
})
it('does not render chatbot toggle button when onChatbotToggle is undefined', () => {
const { container } = render(
<QueryClientProvider client={queryClient}>
<BreadcrumbNav {...baseProps} onChatbotToggle={undefined} />
</QueryClientProvider>,
)
expect(container.querySelector('.lucide-bot')).toBeNull()
})
})
@@ -19,6 +19,7 @@ import { Button } from '../ui/button'
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'
import { Separator } from '../ui/separator'
import { cn } from '@/ui/lib/utils'
import { useUserMetadataStore } from '@/ui/stores/user-metadata'
type FileBrowserToolbarProps = {
teamId: string
@@ -63,6 +64,7 @@ export function FileBrowserToolbar({
const activeFiltersCount = filterConditions.length
const isCollection = !!collection
const queryClient = useQueryClient()
const hideAgent = useUserMetadataStore((s) => Boolean(s.metadata['appearance.hideAgent']))
const { data: folderInfo } = useQuery({
queryKey: ['folders', assetId],
@@ -365,7 +367,7 @@ export function FileBrowserToolbar({
)}
</Button>
{!isRecentlyDeleted && !isRecents && (
{!isRecentlyDeleted && !isRecents && !hideAgent && (
<>
<Separator orientation="vertical" />
<Button
@@ -101,6 +101,7 @@ export default function FileSystemManager({
const { members, fetchMembers } = useMemberStore()
const { metadata, fetchMetadata, setMetadata: setUserMetadata } = useUserMetadataStore()
const hideAgent = Boolean(metadata['appearance.hideAgent'])
useEffect(() => {
if (teamId) {
@@ -570,7 +571,7 @@ export default function FileSystemManager({
rootFolderId={rootFolderId}
/>
{(!isRightSidebarCollapsed || isChatbotOpen) && (
{(!isRightSidebarCollapsed || (isChatbotOpen && !hideAgent)) && (
<>
<ResizeHandle
onResize={(delta) => {
@@ -582,7 +583,7 @@ export default function FileSystemManager({
style={{ width: rightSidebarWidth }}
className="bg-background flex flex-col flex-shrink-0"
>
{isChatbotOpen ? (
{isChatbotOpen && !hideAgent ? (
<ChatbotSidebar projectId={projectId} contextAssetId={assetId} />
) : singleSelectedFile ? (
<FileViewerRightSidebar
@@ -0,0 +1,135 @@
// @vitest-environment happy-dom
import { cleanup, render, screen, fireEvent, waitFor } from '@testing-library/react'
import React from 'react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { AppearanceSettings } from './AppearanceSettings'
import { useUserMetadataStore } from '@/ui/stores/user-metadata'
import { useChatbotStore } from '@/ui/stores/chatbot'
import { toast } from 'sonner'
const mockGetSettings = vi.fn()
const mockPatchSettings = vi.fn()
vi.mock('@/ui/api/client', () => ({
client: {
api: {
teams: {
':teamId': {
settings: {
$get: () => mockGetSettings(),
$patch: (args: unknown) => mockPatchSettings(args),
},
},
},
},
},
}))
vi.mock('sonner', () => ({
toast: {
success: vi.fn(),
error: vi.fn(),
},
}))
describe('AppearanceSettings', () => {
let queryClient: QueryClient
beforeEach(() => {
vi.clearAllMocks()
queryClient = new QueryClient({
defaultOptions: {
queries: { retry: false },
},
})
mockGetSettings.mockResolvedValue({
ok: true,
json: async () => ({
appearance: { hideAgent: false },
}),
})
mockPatchSettings.mockResolvedValue({
ok: true,
json: async () => ({
appearance: { hideAgent: true },
}),
})
vi.spyOn(useUserMetadataStore.getState(), 'fetchMetadata').mockResolvedValue()
useChatbotStore.setState({ isChatbotOpen: true })
})
afterEach(() => {
cleanup()
})
const renderComponent = () =>
render(
<QueryClientProvider client={queryClient}>
<AppearanceSettings teamId="team-123" />
</QueryClientProvider>,
)
it('renders switch with initial unchecked state when hideAgent is false', async () => {
renderComponent()
await waitFor(() => {
const switchElement = screen.getByRole('switch')
expect(switchElement).toBeDefined()
expect(switchElement.getAttribute('data-state')).toBe('unchecked')
})
})
it('renders switch checked when hideAgent is true', async () => {
mockGetSettings.mockResolvedValueOnce({
ok: true,
json: async () => ({
appearance: { hideAgent: true },
}),
})
renderComponent()
await waitFor(() => {
const switchElement = screen.getByRole('switch')
expect(switchElement).toBeDefined()
expect(switchElement.getAttribute('data-state')).toBe('checked')
})
})
it('updates settings, closes chatbot, and refreshes user metadata on toggle', async () => {
renderComponent()
const switchElement = await screen.findByRole('switch')
fireEvent.click(switchElement)
await waitFor(() => {
expect(mockPatchSettings).toHaveBeenCalledWith({
param: { teamId: 'team-123' },
json: {
key: 'appearance.hideAgent',
value: true,
},
})
expect(useUserMetadataStore.getState().fetchMetadata).toHaveBeenCalledWith('team-123')
expect(useChatbotStore.getState().isChatbotOpen).toBe(false)
expect(toast.success).toHaveBeenCalled()
})
})
it('shows error toast when patch fails', async () => {
mockPatchSettings.mockResolvedValueOnce({
ok: false,
json: async () => ({ message: 'Forbidden' }),
})
renderComponent()
const switchElement = await screen.findByRole('switch')
fireEvent.click(switchElement)
await waitFor(() => {
expect(toast.error).toHaveBeenCalled()
})
})
})
@@ -0,0 +1,99 @@
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import type { TeamSettingsResponse } from '@shumai/dtos'
import { client } from '@/ui/api/client'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/ui/components/ui/card'
import { Switch } from '@/ui/components/ui/switch'
import { Loader2 } from 'lucide-react'
import { toast } from 'sonner'
import { m } from '@/ui/paraglide/messages.js'
import { useUserMetadataStore } from '@/ui/stores/user-metadata'
import { useChatbotStore } from '@/ui/stores/chatbot'
interface AppearanceSettingsProps {
teamId: string
}
export function AppearanceSettings({ teamId }: AppearanceSettingsProps) {
const queryClient = useQueryClient()
const { data: settings, isLoading } = useQuery<TeamSettingsResponse>({
queryKey: ['teams', teamId, 'settings'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].settings.$get({
param: { teamId },
})
if (!res.ok) throw new Error(m.failed_load_settings())
return (await res.json()) as TeamSettingsResponse
},
enabled: !!teamId,
})
const { mutate: updateSettings, isPending: isUpdating } = useMutation({
mutationFn: async (hideAgent: boolean) => {
const res = await client.api.teams[':teamId'].settings.$patch({
param: { teamId },
json: {
key: 'appearance.hideAgent',
value: hideAgent,
},
})
if (!res.ok) throw new Error(m.failed_update_appearance_settings())
return await res.json()
},
onSuccess: async (_, hideAgent) => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'settings'] })
await useUserMetadataStore.getState().fetchMetadata(teamId)
if (hideAgent) {
useChatbotStore.getState().setIsChatbotOpen(false)
}
toast.success(m.appearance_settings_updated())
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : m.failed_update_appearance_settings())
},
})
const hideAgent = Boolean(settings?.appearance?.hideAgent)
const handleToggleHideAgent = (checked: boolean) => {
updateSettings(checked)
}
if (isLoading) {
return (
<div className="flex items-center justify-center p-8">
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
</div>
)
}
return (
<div className="h-full overflow-y-auto pr-1">
<Card>
<CardHeader>
<CardTitle>{m.appearance_settings()}</CardTitle>
<CardDescription>{m.appearance_settings_description()}</CardDescription>
</CardHeader>
<CardContent className="space-y-6">
<div className="flex items-center justify-between space-x-4 rounded-lg border border-border p-4">
<div className="space-y-1">
<label
htmlFor="hide-agent-switch"
className="text-sm font-medium leading-none cursor-pointer"
>
{m.hide_agent()}
</label>
<p className="text-xs text-muted-foreground">{m.hide_agent_description()}</p>
</div>
<Switch
id="hide-agent-switch"
checked={hideAgent}
onCheckedChange={handleToggleHideAgent}
disabled={isUpdating}
/>
</div>
</CardContent>
</Card>
</div>
)
}
+11 -8
View File
@@ -3,12 +3,14 @@ import { BreadcrumbNav } from './breadcrumb-nav'
import { ShumaiLogo } from '@/ui/components/ui/icons'
import { useUiStore } from '@/ui/stores/ui'
import { useChatbotStore } from '@/ui/stores/chatbot'
import { useUserMetadataStore } from '@/ui/stores/user-metadata'
import { useIsMobile } from '@/ui/hooks/use-mobile'
export function TopNav() {
const { projectState } = useTopNavStore()
const uiStore = useUiStore()
const { isChatbotOpen, setIsChatbotOpen } = useChatbotStore()
const hideAgent = useUserMetadataStore((s) => Boolean(s.metadata['appearance.hideAgent']))
const isMobile = useIsMobile()
if (isMobile && projectState?.fileId) {
@@ -72,7 +74,7 @@ export function TopNav() {
isPublic && projectState.onRightSidebarToggle
? projectState.onRightSidebarToggle
: () => {
if (!isPublic && isChatbotOpen) {
if (!isPublic && isChatbotOpen && !hideAgent) {
setIsChatbotOpen(false)
if (isFileView) {
uiStore.setFileViewRightSidebarCollapsed(false)
@@ -92,11 +94,12 @@ export function TopNav() {
}
}
const onChatbotToggle = isPublic
? undefined
: () => {
setIsChatbotOpen(!isChatbotOpen)
}
const onChatbotToggle =
isPublic || hideAgent
? undefined
: () => {
setIsChatbotOpen(!isChatbotOpen)
}
const displayStyle = projectId ? (uiStore.viewModes[projectId] ?? 'card') : 'card'
const onDisplayStyleChange = isPublic
@@ -122,8 +125,8 @@ export function TopNav() {
onLeftSidebarToggle={onLeftSidebarToggle}
isRightSidebarCollapsed={isRightSidebarCollapsed}
onRightSidebarToggle={onRightSidebarToggle}
isChatbotOpen={!isPublic && isChatbotOpen}
onChatbotToggle={onChatbotToggle}
isChatbotOpen={!isPublic && !hideAgent && isChatbotOpen}
onChatbotToggle={hideAgent ? undefined : onChatbotToggle}
isPublic={isPublic}
shareId={shareId}
allowDownload={allowDownload}
+7 -1
View File
@@ -1429,5 +1429,11 @@
"search_emoji": "Search emoji",
"reaction_you": "You reacted with {emoji}",
"reaction_you_and_others": "You and {others} reacted with {emoji}",
"reaction_others": "{others} reacted with {emoji}"
"reaction_others": "{others} reacted with {emoji}",
"appearance_settings": "Appearance",
"appearance_settings_description": "Manage visual appearance and interface display settings for your team.",
"hide_agent": "Hide Agent",
"hide_agent_description": "Hide the AGENTS.md button, agent-chat sidebar, and chatbot trigger button across the entire team.",
"appearance_settings_updated": "Appearance settings updated",
"failed_update_appearance_settings": "Failed to update appearance settings"
}
+7 -1
View File
@@ -1429,5 +1429,11 @@
"search_emoji": "搜索表情",
"reaction_you": "你回应了 {emoji}",
"reaction_you_and_others": "你和 {others} 回应了 {emoji}",
"reaction_others": "{others} 回应了 {emoji}"
"reaction_others": "{others} 回应了 {emoji}",
"appearance_settings": "外观",
"appearance_settings_description": "管理团队的视觉外观与界面显示设置。",
"hide_agent": "隐藏 Agent",
"hide_agent_description": "在整个团队中隐藏 AGENTS.md 按钮、Agent 聊天侧边栏和触发按钮。",
"appearance_settings_updated": "外观设置已更新",
"failed_update_appearance_settings": "更新外观设置失败"
}
@@ -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>