feat(themes): apply OpenCode color themes app-wide with a settings picker (#364)

- Vendor the 36 OpenCode theme palettes into the shared package, synced
  from the pinned OpenCode release tag via pnpm themes:sync.
- Add a colorTheme user preference across the settings schema, defaults,
  and the assistant internal API.
- Extend palettes with success, warning, info, and diff colors, and add a
  resolver that maps palettes to CSS tokens and applies them to the DOM.
- Apply the theme app-wide through a ThemeProvider context, adopting the
  tokens in message, repo, session, and settings components, agent
  colors, git status styles, and diff viewers.
- Add a theme picker to General settings and make model quick-select
  follow the active theme (fixes #355).
This commit is contained in:
Chris Scott authored and GitHub committed 2026-09-28 00:19:32 -04:00
1 parent 702e3c4e13
commit 5bd688de4b
116 files changed
+2702 -760

No files matched your search

+3 -1
View File
@@ -13,6 +13,7 @@ import {
ensureDirectoryExists,
} from './file-operations'
import { ASSISTANT_NOTIFICATION_LIMITS, OpenCodeConfigSchema } from '@opencode-manager/shared/schemas'
import { MANAGER_COLOR_THEME_ID, OPENCODE_THEMES } from '@opencode-manager/shared/themes'
import { ASSISTANT_REPO_ID, ASSISTANT_REPO_PATH, ASSISTANT_OPENCODE_DIR_NAME } from '@opencode-manager/shared/utils'
import { getAssistantModePath, getReposPath } from '@opencode-manager/shared/config/env'
import type { Database } from 'bun:sqlite'
@@ -623,6 +624,7 @@ Retrieve the user's full settings, including all preferences.
{
preferences: {
theme: 'dark' | 'light' | 'system',
colorTheme?: string, // one of: ${[MANAGER_COLOR_THEME_ID, ...OPENCODE_THEMES.map((theme) => theme.id)].join(', ')}
mode: 'plan' | 'build',
defaultModel?: string,
defaultAgent?: string,
@@ -650,7 +652,7 @@ Update a subset of safe user preferences.
**Allowed Keys:**
The following preference keys can be modified:
- \`theme\`, \`mode\`, \`defaultModel\`, \`defaultAgent\`
- \`theme\`, \`colorTheme\`, \`mode\`, \`defaultModel\`, \`defaultAgent\`
- \`autoScroll\`, \`expandDiffs\`, \`expandToolCalls\`, \`showReasoning\`
- \`simpleChatMode\`, \`leaderKey\`, \`directShortcuts\`
- \`keyboardShortcuts\`, \`customCommands\`, \`notifications\`
+6 -1
View File
@@ -12,6 +12,7 @@ import {
UserPreferencesSchema,
DEFAULT_USER_PREFERENCES,
} from '../types/settings'
import { isColorThemeId, MANAGER_COLOR_THEME_ID } from '@opencode-manager/shared/themes'
const CUSTOM_OPENCODE_SERVER_PASSWORD_KEY = 'opencode_server_password'
const MANAGED_OPENCODE_SERVER_PASSWORD_KEY = 'opencode_server_managed_password'
@@ -63,7 +64,11 @@ export class SettingsService {
try {
const parsed = parseJsonc(row.preferences) as Record<string, unknown>
if (!isColorThemeId(parsed.colorTheme)) {
parsed.colorTheme = MANAGER_COLOR_THEME_ID
}
const validated = UserPreferencesSchema.parse({
...DEFAULT_USER_PREFERENCES,
...parsed,
@@ -58,6 +58,30 @@ describe('internal/settings routes', () => {
expect(body.preferences.mode).toBe('build')
})
it('GET /api/internal/settings returns manager colorTheme by default', async () => {
const res = await app.request('/api/internal/settings', {
headers: { authorization: `Bearer ${token}` },
})
expect(res.status).toBe(200)
const body = await res.json() as { preferences: { colorTheme: string } }
expect(body.preferences.colorTheme).toBe('manager')
})
it('GET /api/internal/settings recovers from a stored colorTheme removed from the catalog without losing other preferences', async () => {
db.prepare(
`INSERT INTO user_preferences (user_id, preferences, updated_at)
VALUES (?, ?, ?)`
).run('default', JSON.stringify({ colorTheme: 'removed-theme', autoScroll: false }), Date.now())
const res = await app.request('/api/internal/settings', {
headers: { authorization: `Bearer ${token}` },
})
expect(res.status).toBe(200)
const body = await res.json() as { preferences: { colorTheme: string; autoScroll: boolean } }
expect(body.preferences.colorTheme).toBe('manager')
expect(body.preferences.autoScroll).toBe(false)
})
it('PATCH /api/internal/settings returns 401 without bearer token', async () => {
const res = await app.request('/api/internal/settings', {
method: 'PATCH',
@@ -86,6 +110,25 @@ describe('internal/settings routes', () => {
expect(body.preferences.theme).toBe('dark')
})
it('PATCH /api/internal/settings with { colorTheme: "dracula" } persists and returns new settings', async () => {
const patchRes = await app.request('/api/internal/settings', {
method: 'PATCH',
body: JSON.stringify({ colorTheme: 'dracula' }),
headers: {
'content-type': 'application/json',
authorization: `Bearer ${token}`,
},
})
expect(patchRes.status).toBe(200)
const getRes = await app.request('/api/internal/settings', {
headers: { authorization: `Bearer ${token}` },
})
expect(getRes.status).toBe(200)
const body = await getRes.json() as { preferences: { colorTheme: string } }
expect(body.preferences.colorTheme).toBe('dracula')
})
it('PATCH /api/internal/settings with { gitCredentials: [...] } returns 400 (strict reject)', async () => {
const res = await app.request('/api/internal/settings', {
method: 'PATCH',
@@ -122,6 +165,20 @@ describe('internal/settings routes', () => {
expect(res.status).toBe(400)
})
it('PATCH /api/internal/settings with { colorTheme: "not-a-theme" } returns 400 (unknown theme reject)', async () => {
const res = await app.request('/api/internal/settings', {
method: 'PATCH',
body: JSON.stringify({ colorTheme: 'not-a-theme' }),
headers: {
'content-type': 'application/json',
authorization: `Bearer ${token}`,
},
})
expect(res.status).toBe(400)
const body = await res.json() as { error: string }
expect(body.error).toBe('Invalid request body')
})
it('PATCH /api/internal/settings with { tts: { voice: "x", speed: 1.5 } } merges and preserves apiKey/endpoint', async () => {
// Seed a full TTS config (including secrets) directly via settingsService
settingsService.updateSettings({
+3 -1
View File
@@ -147,6 +147,7 @@ Retrieve the user's full settings and preferences.
{
preferences: {
theme: 'dark' | 'light' | 'system',
colorTheme?: string, // 'manager' or an OpenCode theme id from shared/src/themes; unknown stored ids read as 'manager'
mode: 'plan' | 'build',
defaultModel?: string,
defaultAgent?: string,
@@ -177,11 +178,12 @@ Update a subset of safe user preferences.
**Allowed Keys:**
The following preference keys can be modified:
- `theme`, `mode`, `defaultModel`, `defaultAgent`
- `theme`, `colorTheme`, `mode`, `defaultModel`, `defaultAgent`
- `autoScroll`, `expandDiffs`, `expandToolCalls`, `showReasoning`
- `simpleChatMode`, `leaderKey`, `directShortcuts`
- `keyboardShortcuts`, `customCommands`, `notifications`
- `repoOrder`, `repoSortMode`
- `colorTheme` must be `manager` or a catalog theme id; unknown ids return 400.
- `tts` — Non-secret TTS preferences (`enabled`, `provider`, `autoPlay`, `voice`, `model`, `speed`). TTS must already be configured in the UI (the endpoint returns 400 otherwise).
- `stt` — Non-secret STT preferences (`enabled`, `provider`, `model`, `language`). STT must already be configured in the UI (the endpoint returns 400 otherwise).
+25
View File
@@ -22,6 +22,31 @@
<link rel="apple-touch-startup-image" href="/splash/splash-2048x2732.png" media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta name="theme-color" content="#0a0a0a" />
<script>
(function () {
try {
var snapshot = JSON.parse(localStorage.getItem('ocm-appearance'));
if (!snapshot) return;
var root = document.documentElement;
if (snapshot.dark) {
root.classList.add('dark');
} else {
root.classList.remove('dark');
}
if (snapshot.tokens) {
for (var token in snapshot.tokens) {
root.style.setProperty('--color-' + token, snapshot.tokens[token]);
}
}
if (snapshot.themeColor) {
var meta = document.querySelector('meta[name="theme-color"]');
if (meta) meta.setAttribute('content', snapshot.themeColor);
}
} catch (error) {
void error;
}
})();
</script>
<meta name="description" content="AI-powered coding assistant interface" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
+28 -27
View File
@@ -19,10 +19,10 @@ import { MobileTabBar } from '@/components/navigation/MobileTabBar'
import { MobileSheetHost } from '@/components/navigation/MobileSheetHost'
import { RouteErrorBoundary } from '@/components/ui/route-error-boundary'
import { DesktopSidebar } from '@/components/navigation/DesktopSidebar'
import { useTheme } from './hooks/useTheme'
import { useRightEdgeSwipe, useSwipeBack } from './hooks/useMobile'
import { useMobileTabBar } from '@/hooks/useMobileTabBar'
import { TTSProvider } from './contexts/TTSContext'
import { ThemeProvider } from './contexts/ThemeContext'
import { AuthProvider } from './contexts/AuthContext'
import { EventProvider, usePermissions, useEventContext } from '@/contexts/EventContext'
import { SwipeNavigationProvider, useSwipeNavigation } from '@/contexts/SwipeNavigationContext'
@@ -88,7 +88,6 @@ function AppShell() {
const location = useLocation()
const rootRef = useRef<HTMLDivElement>(null)
const { openSheet, open } = useMobileTabBar()
useTheme()
const swipeNav = useSwipeNavigation()
@@ -153,31 +152,33 @@ function AppShell() {
)
return (
<AuthProvider>
<EventProvider>
<div ref={rootRef} className="flex h-dvh w-full min-w-0">
<DesktopSidebar />
<main className="flex-1 min-w-0 min-h-0 flex flex-col">
<Outlet />
</main>
</div>
<MobileTabBar />
<MobileSheetHost />
<PermissionDialogWrapper />
<SSHHostKeyDialogWrapper />
<SettingsDialog />
<HealthMonitor />
<VersionNotifier />
<PwaUpdatePrompt />
<Toaster
position="bottom-right"
expand={false}
richColors
closeButton
duration={2500}
/>
</EventProvider>
</AuthProvider>
<ThemeProvider>
<AuthProvider>
<EventProvider>
<div ref={rootRef} className="flex h-dvh w-full min-w-0">
<DesktopSidebar />
<main className="flex-1 min-w-0 min-h-0 flex flex-col">
<Outlet />
</main>
</div>
<MobileTabBar />
<MobileSheetHost />
<PermissionDialogWrapper />
<SSHHostKeyDialogWrapper />
<SettingsDialog />
<HealthMonitor />
<VersionNotifier />
<PwaUpdatePrompt />
<Toaster
position="bottom-right"
expand={false}
richColors
closeButton
duration={2500}
/>
</EventProvider>
</AuthProvider>
</ThemeProvider>
)
}
+3 -59
View File
@@ -21,11 +21,13 @@ import {
type SkillScope,
type InstallSkillFromGithubRequest,
type InstallSkillResponse,
type SettingsResponse as SharedSettingsResponse,
} from '@opencode-manager/shared'
import type { NotificationPreferences } from '@opencode-manager/shared/types'
import { saveFile } from '@/lib/download'
export type { TTSConfig, STTConfig, OpenCodeConfigFile, OpenCodeConfigSourceFile, OpenCodeConfigSourceName, UpdateOpenCodeConfigRequest, ModelConfig, ProviderConfig, SandboxPreferences, NotificationPreferences, SkillFileInfo, CreateSkillRequest, UpdateSkillRequest, SkillScope, InstallSkillFromGithubRequest, InstallSkillResponse }
export type { UserPreferences, UpdateSettingsRequest, CustomCommand, GitCredential, GitIdentity } from '@opencode-manager/shared'
export { DEFAULT_TTS_CONFIG, DEFAULT_STT_CONFIG, DEFAULT_KEYBOARD_SHORTCUTS, DEFAULT_USER_PREFERENCES, DEFAULT_LEADER_KEY, BLOCKED_SERVER_ENV_KEYS }
export { isOpenCodeConfigSourceName } from '@opencode-manager/shared'
@@ -43,65 +45,7 @@ export function downloadOpenCodeConfigSource(source: OpenCodeConfigSourceFile):
void saveFile(blob, source.name)
}
export interface CustomCommand {
name: string
description: string
promptTemplate: string
}
export interface GitCredential {
id?: string
name: string
host: string
type: 'pat' | 'ssh'
token?: string
sshPrivateKey?: string
sshPrivateKeyEncrypted?: string
hasPassphrase?: boolean
username?: string
passphrase?: string
}
export interface GitIdentity {
name: string
email: string
}
export interface UserPreferences {
theme: 'dark' | 'light' | 'system'
mode: 'plan' | 'build'
defaultModel?: string
defaultAgent?: string
autoScroll: boolean
expandDiffs: boolean
expandToolCalls: boolean
showReasoning: boolean
simpleChatMode: boolean
leaderKey?: string
directShortcuts?: string[]
keyboardShortcuts: Record<string, string>
customCommands: CustomCommand[]
gitCredentials?: GitCredential[]
defaultGitCredentialId?: string
gitIdentity?: GitIdentity
tts?: TTSConfig
stt?: STTConfig
notifications?: NotificationPreferences
repoOrder?: number[]
repoSortMode?: 'recent' | 'manual' | 'name'
serverEnvVars?: Array<{ key: string; value: string }>
sandbox?: SandboxPreferences
}
export interface SettingsResponse {
preferences: UserPreferences
updatedAt: number
restartRequired?: boolean
}
export interface UpdateSettingsRequest {
preferences: Partial<UserPreferences>
}
export type SettingsResponse = SharedSettingsResponse & { restartRequired?: boolean }
export interface OpenCodeConfigSaveResponse extends OpenCodeConfigFile {
restartRequired?: boolean
@@ -31,23 +31,6 @@ const findAgent = (agents: AgentInfo[], agentId: string): AgentInfo | undefined
return agents.find(a => a.id.toLowerCase() === agentId.toLowerCase())
}
const bashStyleVars: Record<string, string> = {
'--agent-color-light': '#a753ae',
'--agent-color-dark': '#edb2f1',
'--agent-bg-light': 'rgba(167, 83, 174, 0.2)',
'--agent-bg-dark': 'rgba(237, 178, 241, 0.2)',
'--agent-bg-hover-light': 'rgba(167, 83, 174, 0.3)',
'--agent-bg-hover-dark': 'rgba(237, 178, 241, 0.3)',
'--agent-border-light': 'rgba(167, 83, 174, 0.6)',
'--agent-border-dark': 'rgba(237, 178, 241, 0.6)',
'--agent-border-hover-light': 'rgba(167, 83, 174, 0.5)',
'--agent-border-hover-dark': 'rgba(237, 178, 241, 0.5)',
'--agent-shadow-light': 'rgba(167, 83, 174, 0.2)',
'--agent-shadow-dark': 'rgba(237, 178, 241, 0.2)',
'--agent-shadow-hover-light': 'rgba(167, 83, 174, 0.3)',
'--agent-shadow-hover-dark': 'rgba(237, 178, 241, 0.3)',
}
export function AgentQuickSelect({
directory,
currentAgent,
@@ -70,7 +53,7 @@ export function AgentQuickSelect({
const currentAgentInfo = findAgent(agents, currentAgent)
const styleVars = isBashMode
? bashStyleVars
? getAgentStyleVars('plan')
: getAgentStyleVars(currentAgent, currentAgentInfo?.color)
const displayName = isBashMode ? 'Bash' : capitalize(currentAgentInfo?.name ?? currentAgent)
@@ -78,7 +61,7 @@ export function AgentQuickSelect({
<button
data-toggle-mode
style={styleVars as React.CSSProperties}
className="px-2 md:px-3.5 py-1 h-[36px] rounded-lg text-sm font-medium border min-w-[56px] max-w-[80px] md:max-w-[100px] flex-shrink-0 flex items-center justify-center transition-all duration-200 active:scale-95 hover:scale-105 shadow-md text-[var(--agent-color-light)] dark:text-[var(--agent-color-dark)] bg-[var(--agent-bg-light)] dark:bg-[var(--agent-bg-dark)] border-[var(--agent-border-light)] dark:border-[var(--agent-border-dark)] hover:bg-[var(--agent-bg-hover-light)] dark:hover:bg-[var(--agent-bg-hover-dark)] hover:border-[var(--agent-border-hover-light)] dark:hover:border-[var(--agent-border-hover-dark)] shadow-[var(--agent-shadow-light)] dark:shadow-[var(--agent-shadow-dark)] hover:shadow-[var(--agent-shadow-hover-light)] dark:hover:shadow-[var(--agent-shadow-hover-dark)]"
className="px-2 md:px-3.5 py-1 h-[36px] rounded-lg text-sm font-medium border min-w-[56px] max-w-[80px] md:max-w-[100px] flex-shrink-0 flex items-center justify-center transition-all duration-200 active:scale-95 hover:scale-105 shadow-md text-[var(--agent-color)] bg-[var(--agent-bg)] border-[var(--agent-border)] hover:bg-[var(--agent-bg-hover)] hover:border-[var(--agent-border-hover)] shadow-[var(--agent-shadow)] hover:shadow-[var(--agent-shadow-hover)]"
>
<span className="truncate">{displayName}</span>
</button>
@@ -104,7 +87,7 @@ export function AgentQuickSelect({
<div className="flex flex-col min-w-0">
<span
className="font-medium"
style={{ color: itemStyleVars['--agent-color-light'] }}
style={{ color: itemStyleVars['--agent-color'] }}
>
{capitalize(agent.name)}
</span>
@@ -93,25 +93,25 @@ const statusConfig: Record<
modified: {
icon: FileEdit,
color: GIT_STATUS_COLORS.modified,
bgColor: "bg-amber-500/10",
bgColor: "bg-warning/10",
label: GIT_STATUS_LABELS.modified,
},
added: {
icon: FilePlus,
color: GIT_STATUS_COLORS.added,
bgColor: "bg-emerald-500/10",
bgColor: "bg-success/10",
label: GIT_STATUS_LABELS.added,
},
deleted: {
icon: FileX,
color: GIT_STATUS_COLORS.deleted,
bgColor: "bg-rose-500/10",
bgColor: "bg-destructive/10",
label: GIT_STATUS_LABELS.deleted,
},
renamed: {
icon: FileText,
color: GIT_STATUS_COLORS.renamed,
bgColor: "bg-blue-500/10",
bgColor: "bg-info/10",
label: GIT_STATUS_LABELS.renamed,
},
untracked: {
@@ -123,7 +123,7 @@ const statusConfig: Record<
copied: {
icon: FileText,
color: GIT_STATUS_COLORS.copied,
bgColor: "bg-emerald-500/10",
bgColor: "bg-success/10",
label: GIT_STATUS_LABELS.copied,
},
};
@@ -155,16 +155,16 @@ function DiffLineComponent({
const bgClass =
line.type === "add"
? "bg-emerald-500/10"
? "bg-diff-add/10"
: line.type === "remove"
? "bg-rose-500/10"
? "bg-diff-delete/10"
: "";
const textClass =
line.type === "add"
? "text-emerald-700 dark:text-emerald-300"
? "text-diff-add"
: line.type === "remove"
? "text-rose-700 dark:text-rose-300"
? "text-diff-delete"
: "text-foreground";
const lineNumber = line.newLineNumber ?? line.oldLineNumber;
@@ -175,8 +175,8 @@ function DiffLineComponent({
className={cn(
"flex font-mono text-sm border-l-2 transition-colors min-w-0",
bgClass,
line.type === "add" && "border-l-emerald-500",
line.type === "remove" && "border-l-rose-500",
line.type === "add" && "border-l-diff-add",
line.type === "remove" && "border-l-diff-delete",
line.type === "context" && "border-l-transparent",
isClickable && "cursor-pointer hover:bg-accent/30",
)}
@@ -196,10 +196,10 @@ function DiffLineComponent({
)}
<div className="w-6 flex-shrink-0 flex items-center justify-center bg-muted/20">
{line.type === "add" && (
<Plus className="w-3 h-3 text-emerald-600 dark:text-emerald-400" />
<Plus className="w-3 h-3 text-diff-add" />
)}
{line.type === "remove" && (
<Minus className="w-3 h-3 text-rose-600 dark:text-rose-400" />
<Minus className="w-3 h-3 text-diff-delete" />
)}
</div>
<pre
@@ -325,8 +325,8 @@ export function FileDiffView({
</span>
{!diffData.isBinary && (
<>
<span className="text-green-500">+{diffData.additions}</span>
<span className="text-red-500">-{diffData.deletions}</span>
<span className="text-diff-add">+{diffData.additions}</span>
<span className="text-diff-delete">-{diffData.deletions}</span>
</>
)}
{diffData.diff && (
@@ -0,0 +1,58 @@
import { describe, it, expect } from 'vitest'
import { render, screen, fireEvent } from '@testing-library/react'
import { FilePreview } from './FilePreview'
import type { FileInfo } from '@/types/files'
const OUTLINE_DARK_OVERRIDE = /(^|\s)dark:bg-input\/30(\s|$)/
function textFile(name: string, mimeType: string): FileInfo {
return {
name,
path: `docker/${name}`,
isDirectory: false,
size: 32,
mimeType,
content: btoa('# heading\nline two'),
lastModified: new Date('2026-07-28T09:12:40Z'),
}
}
describe('FilePreview header buttons', () => {
it('renders the active line wrap toggle as a primary button without the outline dark override', () => {
render(<FilePreview file={textFile('Dockerfile', 'text/plain')} />)
const active = screen.getByTitle('Disable line wrap')
expect(active).toHaveClass('bg-primary', 'text-primary-foreground')
expect(active.className).not.toMatch(OUTLINE_DARK_OVERRIDE)
fireEvent.click(active)
const inactive = screen.getByTitle('Enable line wrap')
expect(inactive).not.toHaveClass('bg-primary')
expect(inactive.className).toMatch(OUTLINE_DARK_OVERRIDE)
})
it('renders the active markdown preview toggle as a primary button without the outline dark override', () => {
render(<FilePreview file={textFile('README.md', 'text/markdown')} />)
const active = screen.getByTitle('Show raw markdown')
expect(active).toHaveClass('bg-primary', 'text-primary-foreground')
expect(active.className).not.toMatch(OUTLINE_DARK_OVERRIDE)
})
it('keeps the success and destructive tints on the edit actions in dark mode', () => {
render(<FilePreview file={textFile('Dockerfile', 'text/plain')} />)
const editButton = screen.getByTitle('Disable line wrap').nextElementSibling as HTMLElement
fireEvent.click(editButton)
const headerButtons = Array.from(screen.getByTitle('Disable line wrap').parentElement?.querySelectorAll('button') ?? [])
const saveButton = headerButtons.find((button) => button.classList.contains('bg-success/10'))
const cancelButton = headerButtons.find((button) => button.classList.contains('bg-destructive/10'))
expect(saveButton).toHaveClass('bg-success/10', 'border-success', 'dark:hover:bg-success/20')
expect(cancelButton).toHaveClass('bg-destructive/10', 'border-destructive', 'dark:hover:bg-destructive/20')
expect(saveButton.className).not.toMatch(OUTLINE_DARK_OVERRIDE)
expect(cancelButton.className).not.toMatch(OUTLINE_DARK_OVERRIDE)
})
})
@@ -10,6 +10,8 @@ import { MarkdownRenderer } from './MarkdownRenderer'
const VIRTUALIZATION_THRESHOLD_BYTES = 50_000
const MARKDOWN_PREVIEW_SIZE_LIMIT = 1_000_000
const SUCCESS_TINT_BUTTON_CLASS = 'h-7 w-7 p-0 border border-success bg-success/10 text-success hover:bg-success/20 hover:text-success dark:hover:bg-success/20'
const DESTRUCTIVE_TINT_BUTTON_CLASS = 'h-7 w-7 p-0 border border-destructive bg-destructive/10 text-destructive hover:bg-destructive/20 hover:text-destructive dark:hover:bg-destructive/20'
interface FilePreviewProps {
file: FileInfo
@@ -308,7 +310,7 @@ export const FilePreview = memo(function FilePreview({ file, hideHeader = false,
return (
<div
key={index}
className={`flex transition-colors duration-300 ${isHighlighted ? 'bg-yellow-500/30' : ''}`}
className={`flex transition-colors duration-300 ${isHighlighted ? 'bg-warning/30' : ''}`}
style={{ minHeight: '20px', lineHeight: '20px' }}
>
<span className="w-12 flex-shrink-0 text-right pr-3 text-muted-foreground select-none border-r border-border/50 text-xs">
@@ -368,10 +370,10 @@ export const FilePreview = memo(function FilePreview({ file, hideHeader = false,
<span className="truncate flex-shrink-0">{formatFileSize(file.size)}</span>
<span className="hidden sm:inline truncate flex-shrink-0">{formatDate(file.lastModified)}</span>
{shouldVirtualize && (
<span className="text-xs text-blue-500 flex-shrink-0">Virtualized</span>
<span className="text-xs text-info flex-shrink-0">Virtualized</span>
)}
{hasVirtualizedChanges && (
<span className="text-xs text-yellow-500 flex-shrink-0">Unsaved changes</span>
<span className="text-xs text-warning flex-shrink-0">Unsaved changes</span>
)}
</div>
</div>
@@ -379,10 +381,10 @@ export const FilePreview = memo(function FilePreview({ file, hideHeader = false,
<div className="flex items-center gap-1 flex-shrink-0 mt-1">
{isMarkdownFile && viewMode !== 'edit' && (
<Button
variant="outline"
size="sm"
onClick={(e) => { e.stopPropagation(); e.preventDefault(); setMarkdownPreview(!markdownPreview) }}
className={`h-7 w-7 p-0 ${markdownPreview ? 'bg-primary text-primary-foreground' : ''}`}
variant={markdownPreview ? 'default' : 'outline'}
size="sm"
onClick={(e) => { e.stopPropagation(); e.preventDefault(); setMarkdownPreview(!markdownPreview) }}
className="h-7 w-7 p-0"
title={markdownPreview ? "Show raw markdown" : "Preview rendered markdown"}
>
{markdownPreview ? <Code className="w-3 h-3" /> : <Eye className="w-3 h-3" />}
@@ -391,10 +393,10 @@ export const FilePreview = memo(function FilePreview({ file, hideHeader = false,
{isTextFile && !markdownPreview && (
<Button
variant="outline"
size="sm"
onClick={(e) => { e.stopPropagation(); e.preventDefault(); setLineWrap(!lineWrap) }}
className={`h-7 w-7 p-0 ${lineWrap ? 'bg-primary text-primary-foreground' : ''}`}
variant={lineWrap ? 'default' : 'outline'}
size="sm"
onClick={(e) => { e.stopPropagation(); e.preventDefault(); setLineWrap(!lineWrap) }}
className="h-7 w-7 p-0"
title={lineWrap ? "Disable line wrap" : "Enable line wrap"}
>
<WrapText className="w-3 h-3" />
@@ -408,13 +410,13 @@ export const FilePreview = memo(function FilePreview({ file, hideHeader = false,
)}
{showSaveButton && (
<Button variant="outline" size="sm" onClick={(e) => { e.stopPropagation(); e.preventDefault(); if (shouldVirtualize) { handleVirtualizedSaveClick(); } else { handleSave(); } }} disabled={isSaving || (shouldVirtualize && !hasVirtualizedChanges)} className="border-green-600 bg-green-600/10 text-green-600 hover:bg-green-600/20 h-7 w-7 p-0">
<Button variant="ghost" size="sm" onClick={(e) => { e.stopPropagation(); e.preventDefault(); if (shouldVirtualize) { handleVirtualizedSaveClick(); } else { handleSave(); } }} disabled={isSaving || (shouldVirtualize && !hasVirtualizedChanges)} className={SUCCESS_TINT_BUTTON_CLASS}>
<Save className="w-3 h-3" />
</Button>
)}
{showCancelButton && (
<Button variant="outline" size="sm" onClick={(e) => { e.stopPropagation(); e.preventDefault(); handleCancel() }} className="border-destructive bg-destructive/10 text-destructive hover:bg-destructive/20 h-7 w-7 p-0">
<Button variant="ghost" size="sm" onClick={(e) => { e.stopPropagation(); e.preventDefault(); handleCancel() }} className={DESTRUCTIVE_TINT_BUTTON_CLASS}>
<XIcon className="w-3 h-3" />
</Button>
)}
@@ -426,7 +428,7 @@ export const FilePreview = memo(function FilePreview({ file, hideHeader = false,
)}
{viewMode !== 'edit' && isMobileModal && onCloseModal && (
<Button variant="outline" size="sm" onClick={(e) => { e.stopPropagation(); e.preventDefault(); onCloseModal() }} className="border-destructive bg-destructive/10 text-destructive hover:bg-destructive/20 h-7 w-7 p-0">
<Button variant="ghost" size="sm" onClick={(e) => { e.stopPropagation(); e.preventDefault(); onCloseModal() }} className={DESTRUCTIVE_TINT_BUTTON_CLASS}>
<X className="w-3 h-3" />
</Button>
)}
@@ -197,7 +197,7 @@ function TreeNode({ file, level, onFileSelect, onDirectoryClick, selectedFile, o
<Edit3 className="w-4 h-4 mr-2" />
Rename
</DropdownMenuItem>
<DropdownMenuItem onClick={handleDelete} className="text-red-600">
<DropdownMenuItem onClick={handleDelete} className="text-destructive">
<Trash2 className="w-4 h-4 mr-2" />
Delete
</DropdownMenuItem>
@@ -117,8 +117,8 @@ export function ContentDiffViewer({ before, after }: ContentDiffViewerProps) {
key={index}
className={cn(
'flex font-mono text-xs',
isAdd && 'bg-green-500/10',
isRemove && 'bg-red-500/10',
isAdd && 'bg-diff-add/10',
isRemove && 'bg-diff-delete/10',
)}
>
{!isMobile && (
@@ -132,14 +132,14 @@ export function ContentDiffViewer({ before, after }: ContentDiffViewerProps) {
</div>
)}
<div className="w-4 flex-shrink-0 flex items-center justify-center">
{isAdd && <Plus className="w-2.5 h-2.5 text-green-500" />}
{isRemove && <Minus className="w-2.5 h-2.5 text-red-500" />}
{isAdd && <Plus className="w-2.5 h-2.5 text-diff-add" />}
{isRemove && <Minus className="w-2.5 h-2.5 text-diff-delete" />}
</div>
<pre
className={cn(
'flex-1 px-1 py-0.5 whitespace-pre-wrap break-all',
isAdd && 'text-green-600 dark:text-green-400',
isRemove && 'text-red-600 dark:text-red-400',
isAdd && 'text-diff-add',
isRemove && 'text-diff-delete',
)}
>
{truncateLine(line.content)}
@@ -14,7 +14,7 @@ export function DiffStats({ additions, deletions, variant = 'default' }: DiffSta
return (
<span className="flex items-center gap-1 text-xs font-mono">
{additions > 0 && (
<span className="text-green-600 dark:text-green-400">
<span className="text-diff-add">
{compact ? `+${additions}` : `+${additions}`}
</span>
)}
@@ -22,7 +22,7 @@ export function DiffStats({ additions, deletions, variant = 'default' }: DiffSta
<span className="text-muted-foreground">{compact ? '/' : ' '}</span>
)}
{deletions > 0 && (
<span className="text-red-600 dark:text-red-400">
<span className="text-diff-delete">
{compact ? `-${deletions}` : `-${deletions}`}
</span>
)}
@@ -148,7 +148,7 @@ export const ClickableUserMessage = memo(function ClickableUserMessage({
return (
<button
onClick={onClick}
className="text-left text-sm whitespace-pre-wrap break-words w-full group/edit hover:bg-blue-600/10 rounded p-1 -m-1 transition-colors flex items-start gap-2"
className="text-left text-sm whitespace-pre-wrap break-words w-full group/edit hover:bg-primary/10 rounded p-1 -m-1 transition-colors flex items-start gap-2"
title="Click to edit and resend"
>
<span className="flex-1">{content}</span>
@@ -47,13 +47,13 @@ function PatchViewer({ patch }: { patch: string }) {
<pre className="bg-accent p-2 text-xs overflow-x-auto">
{lines.map((line, index) => {
const tone = line.startsWith('@@')
? 'text-blue-600 dark:text-blue-400'
? 'text-info'
: line.startsWith('+++') || line.startsWith('---')
? 'text-muted-foreground'
: line.startsWith('+')
? 'text-green-600 dark:text-green-400'
? 'text-diff-add'
: line.startsWith('-')
? 'text-red-600 dark:text-red-400'
? 'text-diff-delete'
: 'text-muted-foreground'
return <div key={index} className={tone}>{line || ' '}</div>
})}
@@ -102,12 +102,12 @@ function FileToolRender({ part, filediff, filePath, content, toolName, onFileCli
className="w-full px-3 py-1.5 bg-card hover:bg-card-hover text-left flex items-center justify-between text-sm gap-2"
>
<div className="flex items-center gap-2 min-w-0">
<span className="text-green-600 dark:text-green-400 flex-shrink-0">✓</span>
<span className="text-success flex-shrink-0">✓</span>
<span className="font-medium flex-shrink-0">{toolName}</span>
{filePath && (
<span
onClick={handleFileClick}
className="text-blue-600 dark:text-blue-400 text-xs truncate hover:underline cursor-pointer"
className="text-primary text-xs truncate hover:underline cursor-pointer"
>
{getRelativePath(filePath)}
</span>
@@ -239,7 +239,7 @@ describe('FloatingTTSButton', () => {
const button = screen.getByRole('button', { name: /stop playback/i })
expect(button).toHaveClass('from-red-600')
expect(button).toHaveClass('bg-destructive')
expect(button).toHaveClass('rounded-lg')
expect(button).not.toHaveClass('rounded-full')
expect(button).not.toHaveClass('hidden')
@@ -251,7 +251,7 @@ describe('FloatingTTSButton', () => {
setup({ activeMessageId: TEST_MESSAGE_ID, isLoading: true })
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
expect(screen.getByRole('button', { name: /stop playback/i })).toHaveClass('from-red-600')
expect(screen.getByRole('button', { name: /stop playback/i })).toHaveClass('bg-destructive')
})
it('shows autoplay state with button color when autoPlay is enabled', () => {
@@ -260,7 +260,7 @@ describe('FloatingTTSButton', () => {
const button = screen.getByRole('button', { name: /auto-play enabled/i })
expect(button).toHaveClass('from-blue-500')
expect(button).toHaveClass('bg-primary')
expect(button).toHaveClass('rounded-lg')
expect(screen.queryByText('Play')).not.toBeInTheDocument()
expect(screen.queryByText('Auto')).not.toBeInTheDocument()
@@ -273,8 +273,8 @@ describe('FloatingTTSButton', () => {
const button = screen.getByRole('button', { name: /play latest reply/i })
expect(button).toHaveClass('from-amber-500')
expect(button).not.toHaveClass('from-blue-500')
expect(button).toHaveClass('from-warning')
expect(button).not.toHaveClass('bg-primary')
expect(screen.queryByText('Play')).not.toBeInTheDocument()
})
})
@@ -82,10 +82,10 @@ export function FloatingTTSButton({ messageId, content }: FloatingTTSButtonProps
: 'TTS controls'
const pillAriaLabel = `${pillTitle}. ${autoPlay ? 'Auto-play enabled.' : 'Auto-play disabled.'} hold to toggle auto-play`
const buttonToneClasses = showStop
? 'justify-center px-3 py-1.5 rounded-lg bg-gradient-to-br from-red-600 to-red-700 border border-red-500/60 shadow-red-500/30 ring-red-500/20 hover:ring-red-500/40 text-white'
? 'justify-center px-3 py-1.5 rounded-lg bg-destructive border border-destructive/60 shadow-destructive/30 ring-destructive/20 hover:ring-destructive/40 text-destructive-foreground'
: autoPlay
? 'justify-center px-3 py-1.5 rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border border-blue-400/60 shadow-blue-500/30 ring-blue-500/20 hover:ring-blue-500/40 text-white'
: 'justify-center px-3 py-1.5 rounded-lg bg-gradient-to-br from-amber-500 to-orange-600 border border-amber-400/60 shadow-amber-500/30 ring-amber-500/20 hover:ring-amber-500/40 text-white'
? 'justify-center px-3 py-1.5 rounded-lg bg-primary border border-primary/60 shadow-primary/30 ring-primary/20 hover:ring-primary/40 text-primary-foreground'
: 'justify-center px-3 py-1.5 rounded-lg bg-gradient-to-br from-warning to-highlight border border-warning/60 shadow-warning/30 ring-warning/20 hover:ring-warning/40 text-warning-foreground'
return (
<button
@@ -5,7 +5,7 @@ export function MessageSkeleton() {
<div className="flex flex-col space-y-2 p-2 overflow-x-hidden">
{/* User message skeleton */}
<div className="flex flex-col">
<div className="w-full rounded-lg p-1.5 bg-blue-600/20 border border-blue-600/30">
<div className="w-full rounded-lg p-1.5 bg-primary/20 border border-primary/30">
<div className="flex items-center gap-2 mb-1">
<div className="h-3 w-12 bg-muted animate-pulse rounded" />
<div className="h-3 w-16 bg-muted animate-pulse rounded" />
@@ -24,7 +24,7 @@ export function MessageSkeleton() {
<div className="h-3 w-16 bg-muted animate-pulse rounded" />
<div className="h-3 w-16 bg-muted animate-pulse rounded" />
<div className="flex items-center gap-1">
<div className="h-3 w-20 bg-blue-600/20 animate-pulse rounded" />
<div className="h-3 w-20 bg-primary/20 animate-pulse rounded" />
</div>
</div>
<div className="space-y-2">
@@ -36,7 +36,7 @@ export function MessageSkeleton() {
</div>
</div>
<div className="flex flex-col">
<div className="w-full rounded-lg p-1.5 bg-blue-600/20 border border-blue-600/30">
<div className="w-full rounded-lg p-1.5 bg-primary/20 border border-primary/30">
<div className="flex items-center gap-2 mb-1">
<div className="h-3 w-12 bg-muted animate-pulse rounded" />
<div className="h-3 w-16 bg-muted animate-pulse rounded" />
@@ -55,7 +55,7 @@ export function MessageSkeleton() {
<div className="h-3 w-16 bg-muted animate-pulse rounded" />
<div className="h-3 w-16 bg-muted animate-pulse rounded" />
<div className="flex items-center gap-1">
<div className="h-3 w-20 bg-blue-600/20 animate-pulse rounded" />
<div className="h-3 w-20 bg-primary/20 animate-pulse rounded" />
</div>
</div>
<div className="space-y-2">
@@ -69,7 +69,7 @@ export function MessageSkeleton() {
{/* Second user message skeleton */}
<div className="flex flex-col">
<div className="w-full rounded-lg p-1.5 bg-blue-600/20 border border-blue-600/30">
<div className="w-full rounded-lg p-1.5 bg-primary/20 border border-primary/30">
<div className="flex items-center gap-2 mb-1">
<div className="h-3 w-12 bg-muted animate-pulse rounded" />
<div className="h-3 w-16 bg-muted animate-pulse rounded" />
@@ -88,7 +88,7 @@ export function MessageSkeleton() {
<div className="h-3 w-16 bg-muted animate-pulse rounded" />
<div className="flex items-center gap-1">
<span className="animate-pulse">●</span>
<div className="h-3 w-24 bg-blue-600/20 animate-pulse rounded" />
<div className="h-3 w-24 bg-primary/20 animate-pulse rounded" />
</div>
</div>
<div className="flex items-center gap-2 text-muted-foreground">
@@ -122,14 +122,14 @@ function UserAttachments({ files: attachedFiles, agents: attachedAgents, skills:
key={`file-${index}`}
className="inline-flex items-center gap-1 px-2 py-1 rounded bg-muted border border-border text-sm text-foreground"
>
<span className="text-blue-600 dark:text-blue-400">@</span>
<span className="text-primary">@</span>
<span className="font-medium">{attachmentLabel(file)}</span>
</span>
))}
{agents.map((agent, index) => (
<span
key={`agent-${index}`}
className="inline-flex items-center px-2 py-1 rounded bg-purple-500/10 border border-purple-500/30 text-xs text-purple-600 dark:text-purple-400"
className="inline-flex items-center px-2 py-1 rounded bg-primary/10 border border-primary/30 text-xs text-primary"
>
agent: {agent.name}
</span>
@@ -137,7 +137,7 @@ function UserAttachments({ files: attachedFiles, agents: attachedAgents, skills:
{skills.map((skill, index) => (
<span
key={`skill-${index}`}
className="inline-flex items-center px-2 py-1 rounded bg-blue-500/10 border border-blue-500/30 text-xs text-blue-600 dark:text-blue-400"
className="inline-flex items-center px-2 py-1 rounded bg-info/10 border border-info/30 text-xs text-info"
>
skill: {skill.name}
</span>
@@ -171,7 +171,7 @@ function TTSButton({ messageId, content }: TTSButtonProps) {
return (
<button
onClick={handleClick}
className={`p-1.5 rounded ${isThisPlaying ? 'bg-red-500/20 text-red-500 hover:bg-red-500/30' : 'bg-card hover:bg-card-hover text-muted-foreground hover:text-foreground'}`}
className={`p-1.5 rounded ${isThisPlaying ? 'bg-destructive/20 text-destructive hover:bg-destructive/30' : 'bg-card hover:bg-card-hover text-muted-foreground hover:text-foreground'}`}
title={isThisPlaying ? 'Stop playback' : 'Read aloud'}
disabled={isLoading && !isThisPlaying}
>
@@ -249,8 +249,8 @@ function SessionNotice({
const tone = completion.state === 'error'
? 'text-destructive'
: completion.state === 'cancelled'
? 'text-amber-600 dark:text-amber-400'
: 'text-blue-600 dark:text-blue-400'
? 'text-warning'
: 'text-info'
const content = (
<>
<span className={tone}>{completion.heading}</span>
@@ -286,7 +286,7 @@ function ShellMessage({ message }: { message: SessionMessageShell }) {
return (
<div className="rounded-lg border border-border bg-card/50 p-2 my-1">
<div className="flex items-center gap-2 text-sm min-w-0">
<span className="text-green-600 dark:text-green-400 shrink-0">$</span>
<span className="text-success shrink-0">$</span>
<span className="text-foreground truncate">{message.command}</span>
<span className="text-muted-foreground text-xs ml-auto shrink-0">{statusLabel}</span>
</div>
@@ -312,7 +312,7 @@ function CompactionBanner({ message }: { message: SessionMessageCompaction }) {
if (message.status === 'failed') {
return (
<div className="my-1 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-1.5 text-xs text-red-600 dark:text-red-400">
<div className="my-1 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive">
Compaction failed: {message.error.message}
</div>
)
@@ -328,13 +328,13 @@ function CompactionBanner({ message }: { message: SessionMessageCompaction }) {
function QueuedPromptRow({ item }: { item: SessionInboxUser }) {
return (
<div className="w-full rounded-lg p-1.5 bg-amber-500/10 border border-amber-500/30">
<div className="w-full rounded-lg p-1.5 bg-warning/10 border border-warning/30">
<div className="flex items-center gap-2 mb-1">
<span className="text-xs font-medium text-muted-foreground">You</span>
<span className="text-xs text-muted-foreground">
{new Date(item.time.created).toLocaleTimeString()}
</span>
<span className="text-xs font-semibold bg-amber-500 text-amber-950 px-1.5 py-0.5 rounded">
<span className="text-xs font-semibold bg-warning text-warning-foreground px-1.5 py-0.5 rounded">
{item.delivery === 'queue' ? 'QUEUED' : 'STEERING'}
</span>
</div>
@@ -397,8 +397,8 @@ const MessageRow = memo(function MessageRow({
<div
className={`w-full rounded-lg p-1.5 ${
isEditingThisMessage
? 'bg-blue-600/30 border border-blue-600/50'
: 'bg-blue-600/20 border border-blue-600/30'
? 'bg-primary/30 border border-primary/50'
: 'bg-primary/20 border border-primary/30'
}`}
>
<div className="flex items-center justify-between gap-2 mb-1">
@@ -564,7 +564,7 @@ const MessageRow = memo(function MessageRow({
if (message.type === 'skill') {
return (
<div className="my-1 rounded-lg border border-blue-500/20 bg-blue-500/5 px-3 py-1.5 text-xs text-muted-foreground">
<div className="my-1 rounded-lg border border-info/20 bg-info/5 px-3 py-1.5 text-xs text-muted-foreground">
Skill loaded: <span className="font-medium text-foreground">{message.name}</span>
</div>
)
+14 -14
View File
@@ -1147,7 +1147,7 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read)
const renderVoiceButton = (variant: VoiceButtonVariant) => {
const isDesktop = variant === 'desktop'
const isBusy = isRecording || isTogglingRecording || (isProcessing && !isRecording)
const spinnerClassName = `w-5 h-5 animate-spin rounded-full border-2 ${isDesktop ? 'border-muted-foreground' : 'border-white'} border-t-transparent`
const spinnerClassName = `w-5 h-5 animate-spin rounded-full border-2 ${isDesktop ? 'border-muted-foreground' : 'border-foreground'} border-t-transparent`
const voiceGestureHandlers = isDesktop ? {} : {
onPointerDown: handleVoicePointerDown,
onPointerMove: handleVoicePointerMove,
@@ -1157,12 +1157,12 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read)
const buttonClassName = isDesktop
? `hidden md:flex p-2 rounded-lg transition-all duration-200 active:scale-95 hover:scale-105 shadow-md border items-center justify-center touch-none select-none ${
isBusy
? 'bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border-red-500/60 animate-pulse'
? 'bg-destructive hover:bg-destructive/90 text-destructive-foreground border-destructive/60 animate-pulse'
: 'bg-muted hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground border-border'
}`
: `px-4 py-2 rounded-lg transition-all duration-150 flex items-center justify-center min-w-[52px] border touch-none select-none ${
isBusy
? 'bg-gradient-to-t from-green-700 via-green-500 to-emerald-400 text-white border-green-300/70 shadow-lg shadow-green-500/40'
? 'bg-success text-success-foreground border-success/70 shadow-lg shadow-success/40'
: 'bg-muted hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground border-border active:bg-muted-foreground/30 active:scale-95'
}`
@@ -1226,11 +1226,11 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read)
return (
<div className={`relative backdrop-blur-md bg-background opacity-95 border border-border dark:border-white/30 rounded-xl p-2 md:p-3 mb-4 md:mb-1 w-full transition-all ${hasPendingPermissionForSession ? 'border-orange-500/50 ring-1 ring-orange-500/30' : ''}`}>
<div className={`relative backdrop-blur-md bg-background opacity-95 border border-border dark:border-border/30 rounded-xl p-2 md:p-3 mb-4 md:mb-1 w-full transition-all ${hasPendingPermissionForSession ? 'border-highlight/50 ring-1 ring-highlight/30' : ''}`}>
{showStopButton && (
<button
onClick={handleStop}
className="absolute bottom-full right-0 mb-2 md:hidden z-50 p-3 rounded-xl transition-all duration-200 active:scale-95 hover:scale-105 bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border border-red-500/60 shadow-lg shadow-red-500/30"
className="absolute bottom-full right-0 mb-2 md:hidden z-50 p-3 rounded-xl transition-all duration-200 active:scale-95 hover:scale-105 bg-destructive hover:bg-destructive/90 text-destructive-foreground border border-destructive/60 shadow-lg shadow-destructive/30"
title="Stop"
>
<SquareFill className="w-5 h-5" />
@@ -1253,8 +1253,8 @@ return (
}
className={`w-full bg-muted/50 pl-2 md:pl-3 pr-3 py-2 text-[16px] text-foreground placeholder-muted-foreground focus:outline-none focus:bg-muted/70 resize-none min-h-[40px] max-h-[120px] disabled:opacity-50 disabled:cursor-not-allowed md:text-sm rounded-lg [field-sizing:content] ${
isBashMode
? 'border-purple-500/50 bg-purple-500/5 focus:bg-purple-500/10'
: isDragging ? 'border-blue-500/50 border-dashed bg-blue-500/5' : ''
? 'border-primary/50 bg-primary/5 focus:bg-primary/10'
: isDragging ? 'border-info/50 border-dashed bg-info/5' : ''
}`}
rows={1}
/>
@@ -1286,7 +1286,7 @@ return (
<button
type="button"
onClick={onScrollToBottom}
className="flex items-center gap-1.5 px-3 min-h-[36px] rounded-lg text-xs font-medium border bg-zinc-950/80 hover:bg-zinc-900/90 text-blue-300 hover:text-blue-200 border-blue-400/20 shadow-md backdrop-blur-md transition-all duration-200 active:scale-95 ring-1 ring-blue-400/15"
className="flex items-center gap-1.5 px-3 min-h-[36px] rounded-lg text-xs font-medium border bg-background/80 hover:bg-accent/90 text-primary hover:text-primary-hover border-primary/20 shadow-md backdrop-blur-md transition-all duration-200 active:scale-95 ring-1 ring-primary/15"
title="Scroll to bottom"
aria-label="Scroll to bottom"
>
@@ -1317,11 +1317,11 @@ return (
directory={directory}
>
<button
className="px-2.5 py-0.5 md:px-3 min-h-[36px] min-w-0 rounded-lg text-xs md:text-sm font-medium border bg-muted border-border text-muted-foreground hover:bg-muted-foreground/10 hover:border-foreground/30 transition-colors cursor-pointer flex-1 md:flex-initial md:w-auto max-w-[110px] md:max-w-[220px] dark:border-white/30 flex flex-col items-start justify-center overflow-hidden"
className="px-2.5 py-0.5 md:px-3 min-h-[36px] min-w-0 rounded-lg text-xs md:text-sm font-medium border bg-muted border-border text-muted-foreground hover:bg-muted-foreground/10 hover:border-foreground/30 transition-colors cursor-pointer flex-1 md:flex-initial md:w-auto max-w-[110px] md:max-w-[220px] dark:border-border/30 flex flex-col items-start justify-center overflow-hidden"
>
<span className="truncate w-full text-left">{displayModelName || 'Select model'}</span>
{hasVariants && currentVariant && (
<span className="text-[10px] text-orange-500 truncate w-full text-center capitalize">{currentVariant}</span>
<span className="text-[10px] text-highlight truncate w-full text-center capitalize">{currentVariant}</span>
)}
</button>
</ModelQuickSelect>
@@ -1334,7 +1334,7 @@ return (
{!isMobile && (
<button
onClick={onScrollToBottom}
className={`p-2 rounded-lg bg-zinc-950/80 hover:bg-zinc-900/90 text-blue-300 hover:text-blue-200 transition-all duration-200 active:scale-95 hover:scale-105 shadow-md border border-blue-400/20 backdrop-blur-md ring-1 ring-blue-400/15 ${showScrollButton ? 'visible' : 'invisible'}`}
className={`p-2 rounded-lg bg-background/80 hover:bg-accent/90 text-primary hover:text-primary-hover transition-all duration-200 active:scale-95 hover:scale-105 shadow-md border border-primary/20 backdrop-blur-md ring-1 ring-primary/15 ${showScrollButton ? 'visible' : 'invisible'}`}
title="Scroll to bottom"
>
<ArrowDown className="w-6 h-6" />
@@ -1343,7 +1343,7 @@ return (
{showStopButton && (
<button
onClick={handleStop}
className="hidden md:block p-1.5 px-5 md:p-2 md:px-6 rounded-lg transition-all duration-200 active:scale-95 hover:scale-105 bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border border-red-500/60 hover:border-red-400 shadow-md shadow-red-500/30 hover:shadow-red-500/40 ring-1 ring-red-500/20 hover:ring-red-500/30"
className="hidden md:block p-1.5 px-5 md:p-2 md:px-6 rounded-lg transition-all duration-200 active:scale-95 hover:scale-105 bg-destructive hover:bg-destructive/90 text-destructive-foreground border border-destructive/60 hover:border-destructive shadow-md shadow-destructive/30 hover:shadow-destructive/40 ring-1 ring-destructive/20 hover:ring-destructive/30"
title="Stop"
>
<SquareFill className="w-4 h-4 md:w-5 md:h-5" />
@@ -1376,8 +1376,8 @@ return (
disabled={hasPendingPermissionForSession ? false : ((!prompt.trim() && imageAttachments.length === 0) || (isPromptSubmitPending && !isStreamingResponse))}
className={`px-4 md:px-5 py-1.5 md:py-2 rounded-lg text-sm font-medium transition-colors dark:border flex-shrink-0 min-w-[52px] ${
hasPendingPermissionForSession
? 'bg-orange-500 hover:bg-orange-600 border-orange-400 text-primary-foreground ring-orange-500/20'
: 'bg-primary hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground disabled:cursor-not-allowed text-primary-foreground border-white/30'
? 'bg-highlight hover:bg-highlight/90 border-highlight text-highlight-foreground ring-highlight/20'
: 'bg-primary hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground disabled:cursor-not-allowed text-primary-foreground border-border/30'
}`}
title={hasPendingPermissionForSession ? 'View pending permission' : (isStreamingResponse ? 'Queue message' : 'Send')}
>
@@ -31,24 +31,24 @@ export const RetryPart = memo(function RetryPart({ retry }: RetryPartProps) {
}, [nextTimestamp])
return (
<div className="flex items-center gap-3 p-3 my-2 rounded-lg bg-amber-500/10 border border-amber-500/30">
<div className="flex items-center gap-3 p-3 my-2 rounded-lg bg-warning/10 border border-warning/30">
<div className="flex-shrink-0">
<div className="relative">
<RefreshCw className="w-5 h-5 text-amber-500 animate-spin" style={{ animationDuration: '2s' }} />
<AlertTriangle className="w-3 h-3 text-amber-600 absolute -bottom-0.5 -right-0.5" />
<RefreshCw className="w-5 h-5 text-warning animate-spin" style={{ animationDuration: '2s' }} />
<AlertTriangle className="w-3 h-3 text-warning absolute -bottom-0.5 -right-0.5" />
</div>
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
<span className="text-sm font-medium text-amber-600 dark:text-amber-400">
<span className="text-sm font-medium text-warning">
Retry attempt {retry.attempt}
</span>
{countdown > 0 ? (
<span className="text-xs text-amber-500/80">
<span className="text-xs text-warning/80">
(retrying in {countdown}s)
</span>
) : (
<span className="text-xs text-amber-500/80">
<span className="text-xs text-warning/80">
(retrying...)
</span>
)}
@@ -46,7 +46,7 @@ export function StepFileChanges({ files, snapshot, onFileClick }: StepFileChange
type="button"
title={file}
onClick={() => onFileClick?.(file)}
className="block max-w-full truncate text-left text-xs font-mono text-blue-600 dark:text-blue-400 hover:underline cursor-pointer"
className="block max-w-full truncate text-left text-xs font-mono text-primary hover:underline cursor-pointer"
>
{getRelativePath(file)}
</button>
+3 -3
View File
@@ -71,12 +71,12 @@ function MermaidBlock({ code }: MermaidBlockProps) {
if (error) {
return (
<div className="relative my-4">
<div className="bg-red-500/10 border border-red-500/30 rounded-lg p-4">
<div className="flex items-center gap-2 text-red-500 mb-2">
<div className="bg-destructive/10 border border-destructive/30 rounded-lg p-4">
<div className="flex items-center gap-2 text-destructive mb-2">
<AlertCircle className="w-4 h-4" />
<span className="text-sm font-medium">Mermaid Error</span>
</div>
<pre className="text-xs text-red-400 mb-3 whitespace-pre-wrap">{error}</pre>
<pre className="text-xs text-destructive mb-3 whitespace-pre-wrap">{error}</pre>
<pre className="bg-accent p-3 rounded-lg overflow-x-auto text-sm border border-border">
<code>{code}</code>
</pre>
@@ -88,7 +88,7 @@ function ClickableJson({ json, onFileClick }: { json: unknown; onFileClick?: (fi
e.stopPropagation()
onFileClick?.(ref.filePath)
}}
className="text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 cursor-pointer underline decoration-dotted"
className="text-primary hover:text-primary-hover cursor-pointer underline decoration-dotted"
title={`Click to open ${ref.filePath}`}
>
{ref.fullMatch}
@@ -140,12 +140,12 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
const getStatusColor = () => {
switch (part.state.status) {
case 'completed':
return 'text-green-600 dark:text-green-400'
return 'text-success'
case 'error':
return 'text-red-600 dark:text-red-400'
return 'text-destructive'
case 'running':
if (isWaitingPermission) return 'text-orange-600 dark:text-orange-400'
return 'text-yellow-600 dark:text-yellow-400'
if (isWaitingPermission) return 'text-highlight'
return 'text-warning'
default:
return 'text-muted-foreground'
}
@@ -197,7 +197,7 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
const backgroundIndicator = isBackgrounded ? (
<Badge
variant="outline"
className="shrink-0 border-yellow-600/40 bg-yellow-500/10 text-yellow-700 dark:text-yellow-400"
className="shrink-0 border-warning/40 bg-warning/10 text-warning"
title="Continues running in the background; the session is notified when it finishes"
>
background
@@ -206,7 +206,7 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
const sandboxIndicator = isSandboxedCommand ? (
<Badge
variant="outline"
className="shrink-0 gap-1 border-green-600/40 bg-green-500/15 text-green-700 dark:text-green-400"
className="shrink-0 gap-1 border-success/40 bg-success/15 text-success"
title="Executed inside the sandbox microVM"
>
<Shield className="w-3 h-3" />
@@ -232,17 +232,17 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
)}
{isRunning && (
<div className="flex gap-1">
<span className="w-2.5 h-2.5 rounded-full bg-blue-500 animate-bounce" style={{ animationDelay: '0ms' }} />
<span className="w-2.5 h-2.5 rounded-full bg-blue-500 animate-bounce" style={{ animationDelay: '150ms' }} />
<span className="w-2.5 h-2.5 rounded-full bg-blue-500 animate-bounce" style={{ animationDelay: '300ms' }} />
<span className="w-2.5 h-2.5 rounded-full bg-primary animate-bounce" style={{ animationDelay: '0ms' }} />
<span className="w-2.5 h-2.5 rounded-full bg-primary animate-bounce" style={{ animationDelay: '150ms' }} />
<span className="w-2.5 h-2.5 rounded-full bg-primary animate-bounce" style={{ animationDelay: '300ms' }} />
</div>
)}
{isCompleted && <span className="text-green-600 text-sm font-medium">✓</span>}
{isError && <span className="text-red-600 text-sm font-medium">✗</span>}
{isCompleted && <span className="text-success text-sm font-medium">✓</span>}
{isError && <span className="text-destructive text-sm font-medium">✗</span>}
<span className="font-medium text-foreground truncate">{description}</span>
<span className="text-[11px] font-medium text-orange-600 dark:text-orange-400 shrink-0">sub-agent</span>
<span className="text-[11px] font-medium text-highlight shrink-0">sub-agent</span>
{backgroundIndicator}
{subagentSessionId && <ExternalLink className="w-3 h-3 shrink-0 text-blue-600 dark:text-blue-400" />}
{subagentSessionId && <ExternalLink className="w-3 h-3 shrink-0 text-primary" />}
</div>
)
@@ -250,7 +250,7 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
return (
<button
onClick={() => onChildSessionClick?.(subagentSessionId)}
className="my-1 w-full rounded-lg border border-blue-500/20 bg-blue-500/5 px-3 py-1.5 text-left text-xs text-muted-foreground hover:bg-blue-500/10 hover:border-blue-500/30 transition-all duration-200 shadow-sm shadow-blue-500/5"
className="my-1 w-full rounded-lg border border-info/20 bg-info/5 px-3 py-1.5 text-left text-xs text-muted-foreground hover:bg-info/10 hover:border-info/30 transition-all duration-200 shadow-sm shadow-info/5"
title="View subagent session"
>
{content}
@@ -259,7 +259,7 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
}
return (
<div className="my-1 rounded-lg border border-blue-500/20 bg-blue-500/5 px-3 py-1.5 text-xs text-muted-foreground shadow-sm shadow-blue-500/5">
<div className="my-1 rounded-lg border border-info/20 bg-info/5 px-3 py-1.5 text-xs text-muted-foreground shadow-sm shadow-info/5">
{content}
</div>
)
@@ -279,9 +279,9 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
<div className="my-2">
<div className="flex items-center gap-2 text-sm mb-2">
{isBackgrounded ? (
<Loader2 className="w-3.5 h-3.5 animate-spin text-yellow-600 dark:text-yellow-400" />
<Loader2 className="w-3.5 h-3.5 animate-spin text-warning" />
) : (
<span className="text-green-600 dark:text-green-400">✓</span>
<span className="text-success">✓</span>
)}
<span className="font-medium">$</span>
<span className="text-foreground">{command}</span>
@@ -304,12 +304,12 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
const getBorderStyle = () => {
switch (part.state.status) {
case 'running':
if (isWaitingPermission) return 'border-orange-500/50 shadow-sm shadow-orange-500/20'
return 'border-yellow-500/50 shadow-sm shadow-yellow-500/10'
if (isWaitingPermission) return 'border-highlight/50 shadow-sm shadow-highlight/20'
return 'border-warning/50 shadow-sm shadow-warning/10'
case 'streaming':
return 'border-blue-500/30'
return 'border-primary/30'
case 'error':
return 'border-red-500/30'
return 'border-destructive/30'
case 'completed':
return 'border-border'
default:
@@ -338,7 +338,7 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
onFileClick(previewText)
}
}}
className="text-blue-600 dark:text-blue-400 text-xs truncate hover:text-blue-700 dark:hover:text-blue-300 cursor-pointer underline decoration-dotted"
className="text-primary text-xs truncate hover:text-primary-hover cursor-pointer underline decoration-dotted"
title={`Click to open ${previewText}`}
>
{previewText}
@@ -355,9 +355,9 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
{part.state.status === 'streaming' && (
<div className="flex items-center gap-2 text-sm text-muted-foreground">
<div className="flex gap-0.5">
<span className="w-1.5 h-1.5 rounded-full bg-blue-500 animate-bounce" style={{ animationDelay: '0ms' }} />
<span className="w-1.5 h-1.5 rounded-full bg-blue-500 animate-bounce" style={{ animationDelay: '150ms' }} />
<span className="w-1.5 h-1.5 rounded-full bg-blue-500 animate-bounce" style={{ animationDelay: '300ms' }} />
<span className="w-1.5 h-1.5 rounded-full bg-primary animate-bounce" style={{ animationDelay: '0ms' }} />
<span className="w-1.5 h-1.5 rounded-full bg-primary animate-bounce" style={{ animationDelay: '150ms' }} />
<span className="w-1.5 h-1.5 rounded-full bg-primary animate-bounce" style={{ animationDelay: '300ms' }} />
</div>
<span>Preparing tool call...</span>
</div>
@@ -371,9 +371,9 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
<CopyButton content={displayCommand ?? ''} title="Copy command" />
</div>
<div className="bg-accent p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap break-words">
<span className="text-green-600 dark:text-green-400">$</span> {displayCommand ?? ''}
<span className="text-success">$</span> {displayCommand ?? ''}
</div>
<div className={`flex items-center gap-2 mt-2 text-xs ${isWaitingPermission ? 'text-orange-600 dark:text-orange-400' : 'text-yellow-600 dark:text-yellow-400'}`}>
<div className={`flex items-center gap-2 mt-2 text-xs ${isWaitingPermission ? 'text-highlight' : 'text-warning'}`}>
<Loader2 className="w-3 h-3 animate-spin" />
<span>{isWaitingPermission ? 'Waiting for permission...' : 'Running...'}</span>
</div>
@@ -382,7 +382,7 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
<div className="text-sm">
<div className="text-muted-foreground mb-1">Input:</div>
<ClickableJson json={part.state.input} onFileClick={onFileClick} />
<div className={`flex items-center gap-2 mt-2 text-xs ${isWaitingPermission ? 'text-orange-600 dark:text-orange-400' : 'text-yellow-600 dark:text-yellow-400'}`}>
<div className={`flex items-center gap-2 mt-2 text-xs ${isWaitingPermission ? 'text-highlight' : 'text-warning'}`}>
<Loader2 className="w-3 h-3 animate-spin" />
<span>{isWaitingPermission ? 'Waiting for permission...' : 'Running...'}</span>
</div>
@@ -399,7 +399,7 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
<CopyButton content={displayCommand ?? ''} title="Copy command" />
</div>
<div className="bg-accent p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap break-words">
<span className="text-green-600 dark:text-green-400">$</span> {displayCommand ?? ''}
<span className="text-success">$</span> {displayCommand ?? ''}
</div>
</div>
) : (
@@ -430,10 +430,10 @@ export const ToolCallPart = memo(function ToolCallPart({ part, messageID, onFile
{part.state.status === 'error' && (
<div className="text-sm">
<div className="text-red-600 dark:text-red-400 mb-1">Error:</div>
<div className="text-destructive mb-1">Error:</div>
<BoundedPre
content={part.state.error.message}
className="bg-accent p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap break-words text-red-600 dark:text-red-300"
className="bg-accent p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap break-words text-destructive"
/>
</div>
)}
@@ -14,7 +14,7 @@ function WaveformBars() {
{[0, 1, 2, 3, 4].map((i) => (
<div
key={i}
className="w-1.5 rounded-full bg-white"
className="w-1.5 rounded-full bg-success-foreground"
style={{
height: '100%',
animation: `waveBar 0.9s ease-in-out infinite`,
@@ -48,8 +48,8 @@ export function VoiceStatusOverlay({ show, label, state }: VoiceStatusOverlayPro
className="pointer-events-none absolute inset-x-0 bottom-0 z-10"
>
<span className="sr-only">{label}</span>
<div className="animate-voice-overlay-in relative flex h-44 w-full flex-col items-center justify-between overflow-hidden rounded-xl border border-green-300/70 bg-gradient-to-t from-green-700 via-green-500 to-emerald-400 px-1 py-4 text-white shadow-lg shadow-green-500/40">
<div className="absolute inset-x-1 top-1 h-10 rounded-full bg-white/20 blur-sm" />
<div className="animate-voice-overlay-in relative flex h-44 w-full flex-col items-center justify-between overflow-hidden rounded-xl border border-success/70 bg-success px-1 py-4 text-success-foreground shadow-lg shadow-success/40">
<div className="absolute inset-x-1 top-1 h-10 rounded-full bg-success-foreground/20 blur-sm" />
<div className="relative flex flex-1 flex-col items-center justify-center gap-1">
{isLoading ? (
state === 'processing' ? (
@@ -0,0 +1,89 @@
import { describe, it, expect, vi } from 'vitest'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { ModelQuickSelect } from './ModelQuickSelect'
vi.mock('@/hooks/useModelSelection', () => ({
useModelSelection: () => ({
model: { providerID: 'anthropic', modelID: 'claude-sonnet-4' },
modelString: 'anthropic/claude-sonnet-4',
recentModels: [],
favoriteModels: [],
setModel: vi.fn(),
setActiveModel: vi.fn(),
restoreSessionModel: vi.fn(),
toggleFavorite: vi.fn(),
removeRecentModel: vi.fn(),
isModelStateLoading: false,
}),
}))
vi.mock('@/hooks/useVariants', () => ({
useVariants: () => ({
availableVariants: [],
currentVariant: undefined,
setVariant: vi.fn(),
cycleVariant: vi.fn(),
clearVariant: vi.fn(),
hasVariants: false,
}),
}))
vi.mock('@/hooks/useProviders', () => ({
useProviders: () => ({
data: {
providers: [
{
id: 'anthropic',
name: 'Anthropic',
isConnected: true,
models: {
'claude-sonnet-4': { id: 'claude-sonnet-4', name: 'Claude Sonnet 4' },
},
},
],
},
}),
}))
const DARK_ONLY_CLASS = /text-white|bg-zinc-950|bg-white\/|border-white\//
function findDarkOnlyClassOffenders(root: HTMLElement) {
return Array.from(root.querySelectorAll<HTMLElement>('*')).filter((element) =>
DARK_ONLY_CLASS.test(element.getAttribute('class') ?? ''),
)
}
async function openSelector(user: ReturnType<typeof userEvent.setup>) {
render(
<ModelQuickSelect>
<span>Select model</span>
</ModelQuickSelect>,
)
await user.click(screen.getByText('Select model'))
return screen.findByRole('dialog', { name: 'Select model' })
}
describe('ModelQuickSelect theme tokens', () => {
it('renders the quick view with theme tokens instead of dark-only classes', async () => {
const user = userEvent.setup()
const dialog = await openSelector(user)
expect(dialog).toHaveClass('bg-popover')
expect(findDarkOnlyClassOffenders(dialog)).toEqual([])
const moreModels = screen.getByRole('button', { name: /More models/ })
expect(moreModels).toHaveClass('text-foreground')
})
it('renders the provider view with theme tokens instead of dark-only classes', async () => {
const user = userEvent.setup()
const dialog = await openSelector(user)
await user.click(screen.getByRole('button', { name: /More models/ }))
expect(findDarkOnlyClassOffenders(dialog)).toEqual([])
})
})
@@ -61,11 +61,17 @@ const VIRTUAL_LIST_OVERSCAN = 8
const EMPTY_PROVIDERS: Provider[] = []
const EMPTY_MODELS: ModelListItem[] = []
const EMPTY_MODELS_BY_PROVIDER = new Map<string, ModelListItem[]>()
const ICON_BUTTON_CLASS =
'flex h-9 w-9 items-center justify-center rounded-full border border-border bg-muted text-foreground/80 hover:bg-accent'
function createSearchText(...values: string[]) {
return values.join(' ').toLowerCase()
}
function formatModelCount(count: number) {
return `${count} ${count === 1 ? 'model' : 'models'}`
}
function createModelListItem(provider: Provider, modelID: string, model: Model): ModelListItem {
const providerName = formatProviderName(provider)
const displayName = formatModelName(model)
@@ -158,7 +164,7 @@ function VirtualizedList<T>({
className={['h-full overflow-y-auto', className].filter(Boolean).join(' ')}
>
{items.length === 0 ? (
<div className="py-10 text-center text-sm text-white/50">{emptyLabel}</div>
<div className="py-10 text-center text-sm text-muted-foreground">{emptyLabel}</div>
) : (
<div className="relative" style={{ height: items.length * itemHeight }}>
{visibleItems.map((item, index) => (
@@ -444,17 +450,17 @@ export function ModelQuickSelect({
return (
<div
key={item.key}
className={`group flex w-full items-center gap-2 rounded-xl py-2 text-left transition-colors hover:bg-white/5 ${isSelected ? 'bg-orange-500/10' : ''}`}
className={`group flex w-full items-center gap-2 rounded-xl py-2 text-left transition-colors hover:bg-accent ${isSelected ? 'bg-highlight/10' : ''}`}
>
<button
type="button"
onClick={() => handleModelSelect(item.providerID, item.modelID)}
className="min-w-0 flex-1 px-2 text-left"
>
<span className="block truncate text-sm font-medium text-white">
<span className="block truncate text-sm font-medium text-foreground">
{getPrimaryLabel(item)}
</span>
<span className="mt-0.5 block truncate text-xs text-white/50">
<span className="mt-0.5 block truncate text-xs text-muted-foreground">
{getDescription(item)}
</span>
</button>
@@ -465,10 +471,10 @@ export function ModelQuickSelect({
event.stopPropagation()
removeRecentModel({ providerID: item.providerID, modelID: item.modelID })
}}
className="rounded-full p-1.5 text-white/30 hover:bg-white/10 hover:text-white/70"
className="rounded-full p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground"
aria-label="Remove from recent"
>
<Trash2 className="h-3.5 w-3.5 text-red-400" />
<Trash2 className="h-3.5 w-3.5 text-destructive" />
</button>
)}
<button
@@ -477,12 +483,12 @@ export function ModelQuickSelect({
event.stopPropagation()
toggleFavorite({ providerID: item.providerID, modelID: item.modelID })
}}
className="rounded-full p-1.5 text-white/50 transition-opacity hover:bg-white/10 hover:text-white"
className="rounded-full p-1.5 text-muted-foreground transition-opacity hover:bg-accent hover:text-foreground"
aria-label={isFavorite ? 'Remove from favorites' : 'Add to favorites'}
>
<Star className={`h-4 w-4 ${isFavorite ? 'fill-yellow-400 text-yellow-400' : ''}`} />
<Star className={`h-4 w-4 ${isFavorite ? 'fill-warning text-warning' : ''}`} />
</button>
{isSelected && <Check className="h-5 w-5 shrink-0 pr-2 text-orange-500" />}
{isSelected && <Check className="h-5 w-5 shrink-0 pr-2 text-highlight" />}
</div>
)
}
@@ -495,13 +501,31 @@ export function ModelQuickSelect({
key={provider.id}
type="button"
onClick={() => handleProviderSelect(provider.id)}
className="flex w-full items-center gap-3 rounded-xl py-2.5 text-left transition-colors hover:bg-white/5"
className="flex w-full items-center gap-3 rounded-xl py-2.5 text-left transition-colors hover:bg-accent"
>
<span className="min-w-0 flex-1">
<span className="block truncate text-sm font-medium text-white">{provider.label}</span>
<span className="mt-0.5 block truncate text-xs text-white/50">{provider.count} {provider.count === 1 ? 'model' : 'models'}</span>
<span className="block truncate text-sm font-medium text-foreground">{provider.label}</span>
<span className="mt-0.5 block truncate text-xs text-muted-foreground">{formatModelCount(provider.count)}</span>
</span>
<ChevronRight className="h-5 w-5 shrink-0 text-white/40" />
<ChevronRight className="h-5 w-5 shrink-0 text-muted-foreground" />
</button>
)
}
const renderSidebarProviderOption = (provider: ProviderListItem) => {
return (
<button
key={provider.id}
type="button"
onClick={() => handleProviderSelect(provider.id)}
className={`w-full text-left px-3 py-2 rounded-lg text-sm transition-colors ${
selectedProviderId === provider.id
? 'bg-highlight/20 text-highlight font-medium'
: 'text-muted-foreground hover:bg-accent'
}`}
>
<div className="truncate">{provider.label}</div>
<div className="text-xs text-muted-foreground">{formatModelCount(provider.count)}</div>
</button>
)
}
@@ -512,12 +536,12 @@ export function ModelQuickSelect({
return (
<>
<DropdownMenuLabel>Variant</DropdownMenuLabel>
<DropdownMenuItem onClick={() => clearVariant()} className={!currentVariant ? 'text-orange-500' : ''}>
<DropdownMenuItem onClick={() => clearVariant()} className={!currentVariant ? 'text-highlight' : ''}>
Default
{!currentVariant && <Check className="ml-auto h-4 w-4" />}
</DropdownMenuItem>
{availableVariants.map(variant => (
<DropdownMenuItem key={variant} onClick={() => setVariant(variant)} className={currentVariant === variant ? 'text-orange-500' : ''}>
<DropdownMenuItem key={variant} onClick={() => setVariant(variant)} className={currentVariant === variant ? 'text-highlight' : ''}>
<span className="capitalize">{variant}</span>
{currentVariant === variant && <Check className="ml-auto h-4 w-4" />}
</DropdownMenuItem>
@@ -550,7 +574,7 @@ export function ModelQuickSelect({
isOpen={isOpen}
onClose={() => handleOpenChange(false)}
heightClass="h-[70dvh] max-h-[720px]"
className="z-[300] border-white/10 bg-zinc-950 text-white shadow-2xl md:mx-auto md:max-w-lg"
className="z-[300] border-border bg-popover text-foreground shadow-2xl md:mx-auto md:max-w-lg"
ariaLabel="Select model"
>
<div className={`flex items-center justify-between gap-2 px-4 ${showAllModels ? 'pb-2 pt-2' : 'pb-3 pt-0'}`}>
@@ -559,18 +583,18 @@ export function ModelQuickSelect({
<button
type="button"
onClick={handleMoreModelsBack}
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/5 text-white/80 hover:bg-white/10"
className={`${ICON_BUTTON_CLASS} shrink-0`}
aria-label="Back to quick models"
>
<ChevronLeft className="h-5 w-5" />
</button>
<div className="relative flex-1">
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-white/40" />
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
value={searchQuery}
onChange={(event) => setSearchQuery(event.target.value)}
placeholder={selectedProviderId ? 'Search models...' : 'Search providers...'}
className="h-9 border-white/10 bg-white/5 pl-9 text-sm text-white placeholder:text-white/40"
className="h-9 border-border bg-muted pl-9 text-sm text-foreground placeholder:text-muted-foreground"
autoComplete="off"
name="model-search"
/>
@@ -581,7 +605,7 @@ export function ModelQuickSelect({
<button
type="button"
onClick={() => handleOpenChange(false)}
className="flex h-9 w-9 items-center justify-center rounded-full border border-white/10 bg-white/5 text-white/80 hover:bg-white/10"
className={ICON_BUTTON_CLASS}
aria-label="Close model selector"
>
<X className="h-5 w-5" />
@@ -589,9 +613,9 @@ export function ModelQuickSelect({
<div className="min-w-0 flex-1 px-3 text-center">
<h2 className="truncate text-base font-semibold tracking-tight">
{selectedModelLabel}
<span className="ml-1.5 inline-block h-2 w-2 rounded-full bg-orange-500" />
<span className="ml-1.5 inline-block h-2 w-2 rounded-full bg-highlight" />
</h2>
<p className="truncate text-xs text-white/45">
<p className="truncate text-xs text-muted-foreground">
{currentVariant ? `${selectedModelDescription} · ${currentVariant}` : selectedModelDescription}
</p>
</div>
@@ -601,11 +625,11 @@ export function ModelQuickSelect({
<button
type="button"
disabled={!model && !hasVariants}
className="flex h-9 w-24 items-center justify-center gap-1 rounded-md border border-white/10 bg-white/5 px-1.5 text-sm font-medium capitalize text-white/70 hover:bg-white/10 disabled:opacity-30"
className="flex h-9 w-24 items-center justify-center gap-1 rounded-md border border-border bg-muted px-1.5 text-sm font-medium capitalize text-muted-foreground hover:bg-accent disabled:opacity-30"
aria-label={`Current variant: ${selectedVariantLabel}`}
>
<span className="truncate">{selectedVariantLabel}</span>
<ChevronDown className="h-3.5 w-3.5 shrink-0 text-white/40" />
<ChevronDown className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="z-[350] min-w-56">
@@ -620,47 +644,19 @@ export function ModelQuickSelect({
{showAllModels ? (
<div className="flex-1 flex overflow-hidden min-h-0">
{/* Provider sidebar — desktop only */}
<div className="hidden md:flex md:flex-col w-48 lg:w-56 border-r border-white/10 overflow-y-auto flex-shrink-0">
<div className="hidden md:flex md:flex-col w-48 lg:w-56 border-r border-border overflow-y-auto flex-shrink-0">
<div className="p-3 space-y-1">
{connectedProviderItems.length > 0 && (
<>
<p className="px-3 pb-1 text-xs font-medium text-white/45">Connected</p>
{connectedProviderItems.map(provider => (
<button
key={provider.id}
type="button"
onClick={() => handleProviderSelect(provider.id)}
className={`w-full text-left px-3 py-2 rounded-lg text-sm transition-colors ${
selectedProviderId === provider.id
? 'bg-orange-500/20 text-orange-300 font-medium'
: 'text-white/70 hover:bg-white/5'
}`}
>
<div className="truncate">{provider.label}</div>
<div className="text-xs text-white/40">{provider.count} {provider.count === 1 ? 'model' : 'models'}</div>
</button>
))}
{availableProviderItems.length > 0 && <div className="mx-3 my-1 h-px bg-white/10" />}
<p className="px-3 pb-1 text-xs font-medium text-muted-foreground">Connected</p>
{connectedProviderItems.map(renderSidebarProviderOption)}
{availableProviderItems.length > 0 && <div className="mx-3 my-1 h-px bg-border" />}
</>
)}
{availableProviderItems.length > 0 && (
<>
<p className="px-3 pb-1 text-xs font-medium text-white/45">Available</p>
{availableProviderItems.map(provider => (
<button
key={provider.id}
type="button"
onClick={() => handleProviderSelect(provider.id)}
className={`w-full text-left px-3 py-2 rounded-lg text-sm transition-colors ${
selectedProviderId === provider.id
? 'bg-orange-500/20 text-orange-300 font-medium'
: 'text-white/70 hover:bg-white/5'
}`}
>
<div className="truncate">{provider.label}</div>
<div className="text-xs text-white/40">{provider.count} {provider.count === 1 ? 'model' : 'models'}</div>
</button>
))}
<p className="px-3 pb-1 text-xs font-medium text-muted-foreground">Available</p>
{availableProviderItems.map(renderSidebarProviderOption)}
</>
)}
</div>
@@ -698,20 +694,20 @@ export function ModelQuickSelect({
<div className="space-y-1">
{connectedProviderItems.length > 0 && (
<>
<p className="px-1 pb-1 text-xs font-medium text-white/45">Connected</p>
<p className="px-1 pb-1 text-xs font-medium text-muted-foreground">Connected</p>
{connectedProviderItems.map(renderProviderOption)}
{availableProviderItems.length > 0 && <div className="-mx-4 my-2 h-px bg-white/10" />}
{availableProviderItems.length > 0 && <div className="-mx-4 my-2 h-px bg-border" />}
</>
)}
{availableProviderItems.length > 0 && (
<>
<p className="px-1 pb-1 text-xs font-medium text-white/45">Available</p>
<p className="px-1 pb-1 text-xs font-medium text-muted-foreground">Available</p>
{availableProviderItems.map(renderProviderOption)}
</>
)}
</div>
{filteredProviderItems.length === 0 && (
<div className="py-10 text-center text-sm text-white/50">No providers found</div>
<div className="py-10 text-center text-sm text-muted-foreground">No providers found</div>
)}
</div>
)}
@@ -723,7 +719,7 @@ export function ModelQuickSelect({
<div className="min-h-0 flex-1 space-y-4 overflow-y-auto px-4 pb-3">
{quickSections.map(section => (
<section key={section.title}>
<h3 className="mb-1.5 flex items-center gap-1.5 text-xs font-medium text-white/45">
<h3 className="mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
{section.icon}
{section.title}
</h3>
@@ -733,14 +729,14 @@ export function ModelQuickSelect({
</section>
))}
</div>
<div className="flex-shrink-0 border-t border-white/10">
<div className="flex-shrink-0 border-t border-border">
<button
type="button"
onClick={() => setShowAllModels(true)}
className="flex w-full items-center justify-between bg-card px-6 py-4 text-left text-sm font-semibold text-white transition-colors hover:bg-accent active:bg-card"
className="flex w-full items-center justify-between bg-card px-6 py-4 text-left text-sm font-semibold text-foreground transition-colors hover:bg-accent active:bg-card"
>
<span>More models</span>
<ChevronRight className="h-5 w-5 text-white/50" />
<ChevronRight className="h-5 w-5 text-muted-foreground" />
</button>
</div>
</div>
@@ -182,7 +182,7 @@ const TabBarRow = memo(function TabBarRow({ tabs }: TabBarRowProps) {
<div className="relative">
<Icon className="w-5 h-5" />
{tab.badge && (
<span className="absolute -top-0.5 -right-1 w-2 h-2 rounded-full bg-orange-500 ring-2 ring-card animate-pulse" />
<span className="absolute -top-0.5 -right-1 w-2 h-2 rounded-full bg-highlight ring-2 ring-card animate-pulse" />
)}
</div>
<span className="leading-none">{tab.label}</span>
@@ -150,7 +150,7 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) {
{(repoDisplayName || currentBranch) && (
<div className="flex items-center gap-2 text-xs text-muted-foreground">
{repoDisplayName && (
<span className="font-medium text-orange-600 dark:text-orange-400">{repoDisplayName}</span>
<span className="font-medium text-highlight">{repoDisplayName}</span>
)}
{currentBranch && (
@@ -207,7 +207,7 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) {
onClick={() => handleCommandClick(command)}
className="flex w-full min-w-0 items-start gap-3 rounded-md px-3 py-2 text-left transition-colors hover:bg-accent"
>
<span className="font-mono text-sm font-medium text-blue-600 dark:text-blue-400">{command.name}</span>
<span className="font-mono text-sm font-medium text-primary">{command.name}</span>
{command.description && (
<span className="min-w-0 flex-1 truncate text-xs text-muted-foreground">{command.description}</span>
)}
@@ -38,7 +38,7 @@ export function NotificationsSheet({ isOpen, onClose }: NotificationsSheetProps)
<BottomSheetContent className="flex flex-col gap-4">
<div>
<div className="flex items-center gap-2 mb-3">
<Bell className="w-5 h-5 text-orange-500" />
<Bell className="w-5 h-5 text-highlight" />
<h3 className="font-semibold text-foreground">Pending permissions</h3>
</div>
{permissionCount === 0 ? (
@@ -72,7 +72,7 @@ export function NotificationsSheet({ isOpen, onClose }: NotificationsSheetProps)
<div>
<div className="flex items-center gap-2 mb-3">
<HelpCircle className="w-5 h-5 text-blue-500" />
<HelpCircle className="w-5 h-5 text-info" />
<h3 className="font-semibold text-foreground">Pending forms</h3>
</div>
{formCount === 0 ? (
@@ -72,18 +72,18 @@ export function RepoNavGroup({
onClick={onOpenRepo}
aria-current={isCurrent ? 'page' : undefined}
className={cn(
'flex min-w-0 flex-1 flex-col justify-center gap-0.5 pr-2 text-left hover:bg-white/[0.03]',
'flex min-w-0 flex-1 flex-col justify-center gap-0.5 pr-2 text-left hover:bg-accent/30',
onToggle ? 'pl-0' : 'pl-4',
)}
>
<span className="truncate text-[15px] font-bold tracking-tight text-orange-600 dark:text-orange-400">
<span className="truncate text-[15px] font-bold tracking-tight text-highlight">
{name}
</span>
{branch && (
<span
className={cn(
'truncate font-mono text-[11.5px]',
isWorktree ? 'text-purple-400' : 'text-muted-foreground',
isWorktree ? 'text-primary' : 'text-muted-foreground',
)}
>
{branch}
@@ -129,14 +129,14 @@ export function SessionNavRow({ item, isCurrent, onSelect, repoLabel }: SessionN
</span>
<span className="min-w-0 flex-1 truncate">{item.session.title || 'Untitled Session'}</span>
{repoLabel && (
<span className="max-w-24 shrink-0 truncate text-xs text-orange-600 dark:text-orange-400">{repoLabel}</span>
<span className="max-w-24 shrink-0 truncate text-xs text-highlight">{repoLabel}</span>
)}
<SessionStatusIndicator sessionID={item.session.id} size="sm" />
{hasPermission(item.session.id) && (
<Bell className="h-3 w-3 shrink-0 text-orange-500" aria-label="Pending permission" />
<Bell className="h-3 w-3 shrink-0 text-highlight" aria-label="Pending permission" />
)}
{hasForm(item.session.id) && (
<HelpCircle className="h-3 w-3 shrink-0 text-blue-500" aria-label="Pending form" />
<HelpCircle className="h-3 w-3 shrink-0 text-info" aria-label="Pending form" />
)}
<span className="ml-auto min-w-[30px] shrink-0 text-right text-xs tabular-nums text-muted-foreground">
{formatShortRelativeTime(new Date(item.session.time.updated))}
@@ -238,11 +238,11 @@ export function AddRepoDialog({ open, onOpenChange }: AddRepoDialogProps) {
className="bg-muted border-border text-foreground placeholder:text-muted-foreground min-h-[44px] text-base"
/>
{directoryNameError ? (
<p className="text-xs text-amber-400">
<p className="text-xs text-warning">
{directoryNameError}.
</p>
) : directoryCollision ? (
<p className="text-xs text-amber-400">
<p className="text-xs text-warning">
A repository named '{directoryName}' already exists.
{directoryCollision.repoUrl && directoryCollision.repoUrl !== repoUrl
? ` (${directoryCollision.repoUrl})`
@@ -313,7 +313,7 @@ export function AddRepoDialog({ open, onOpenChange }: AddRepoDialogProps) {
)}
</Button>
{mutation.isError && (
<p className="text-sm text-red-400">
<p className="text-sm text-destructive">
{mutation.error.message}
</p>
)}
@@ -106,9 +106,9 @@ export function CreateWorktreeDialog({
<div className="space-y-4">
{!canCreate ? (
<div className="flex items-start gap-2 bg-yellow-500/10 border border-yellow-500/30 rounded p-3">
<AlertCircle className="w-4 h-4 text-yellow-600 dark:text-yellow-400 mt-0.5 flex-shrink-0" />
<p className="text-sm text-yellow-700 dark:text-yellow-300">
<div className="flex items-start gap-2 bg-warning/10 border border-warning/30 rounded p-3">
<AlertCircle className="w-4 h-4 text-warning mt-0.5 flex-shrink-0" />
<p className="text-sm text-warning">
Worktrees can only be created for repositories with a remote URL.
</p>
</div>
@@ -152,7 +152,7 @@ export function CreateWorktreeDialog({
{remoteBranches.map((branch) => (
<SelectItem key={`remote-${branch.name}`} value={branch.shortName}>
<div className="flex items-center gap-2">
<GitBranch className="w-3.5 h-3.5 text-blue-500" />
<GitBranch className="w-3.5 h-3.5 text-info" />
<span>{branch.shortName}</span>
<span className="text-xs text-muted-foreground">(remote)</span>
</div>
@@ -168,9 +168,9 @@ export function CreateWorktreeDialog({
)}
{error && (
<div className="flex items-start gap-2 bg-red-500/10 border border-red-500/30 rounded p-3">
<AlertCircle className="w-4 h-4 text-red-600 dark:text-red-400 mt-0.5 flex-shrink-0" />
<p className="text-sm text-red-600 dark:text-red-400">{error}</p>
<div className="flex items-start gap-2 bg-destructive/10 border border-destructive/30 rounded p-3">
<AlertCircle className="w-4 h-4 text-destructive mt-0.5 flex-shrink-0" />
<p className="text-sm text-destructive">{error}</p>
</div>
)}
@@ -185,7 +185,7 @@ export function CreateWorktreeDialog({
<Button
onClick={handleCreate}
disabled={!canCreate || !branchName.trim() || !baseBranch || worktreeMutation.isPending}
className="bg-blue-600 hover:bg-blue-700 disabled:opacity-50"
className="bg-primary hover:bg-primary-hover disabled:opacity-50"
>
{worktreeMutation.isPending ? (
<>
@@ -64,7 +64,7 @@ export function RenameRepoDialog({
setEditName('')
inputRef.current?.focus()
}}
className="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 rounded-full hover:bg-red-500/10 text-red-500 transition-colors"
className="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 rounded-full hover:bg-destructive/10 text-destructive transition-colors"
>
<X className="w-5 h-5" />
</button>
@@ -114,7 +114,7 @@ describe('RepoCard', () => {
}
const { container } = renderWithRouter(<RepoCard {...props} />)
const indicator = container.querySelector('.bg-orange-500')
const indicator = container.querySelector('.bg-highlight')
expect(indicator).toBeTruthy()
})
+7 -7
View File
@@ -73,10 +73,10 @@ export function RepoCard({
<div
onClick={handleCardClick}
className={`relative border rounded-xl overflow-hidden transition-all duration-200 w-full ${
isReady ? "cursor-pointer active:scale-[0.98] hover:border-blue-500/50 hover:bg-accent/50 hover:shadow-md" : "cursor-default"
isReady ? "cursor-pointer active:scale-[0.98] hover:border-primary/50 hover:bg-accent/50 hover:shadow-md" : "cursor-default"
} ${
isSelected
? "border-blue-500 bg-blue-500/5"
? "border-primary bg-primary/5"
: "border-border bg-card"
}`}
>
@@ -88,7 +88,7 @@ export function RepoCard({
{repoName}
</h3>
{isReady && (
<div className={`w-2 h-2 rounded-full shrink-0 ${isDirty ? 'bg-orange-500' : 'bg-green-500'}`} />
<div className={`w-2 h-2 rounded-full shrink-0 ${isDirty ? 'bg-highlight' : 'bg-success'}`} />
)}
</div>
@@ -108,17 +108,17 @@ export function RepoCard({
<div className="flex flex-1 items-center gap-2 min-w-0 overflow-hidden">
{isCloning ? (
<span className="flex items-center gap-1.5">
<Loader2 className="w-3.5 h-3.5 animate-spin text-blue-500" />
<Loader2 className="w-3.5 h-3.5 animate-spin text-primary" />
Cloning...
</span>
) : (
<>
<span className={`flex items-center gap-1 shrink-0 ${repo.isWorktree ? 'text-purple-400' : ''}`}>
<span className={`flex items-center gap-1 shrink-0 ${repo.isWorktree ? 'text-primary' : ''}`}>
<GitBranch className="w-3.5 h-3.5 shrink-0" />
<span className="truncate max-w-[80px]">{branchToDisplay || "main"}</span>
</span>
{isDirty && (
<span className="flex items-center gap-1 text-orange-600 dark:text-orange-400 shrink-0">
<span className="flex items-center gap-1 text-highlight shrink-0">
<AlertCircle className="w-3.5 h-3.5 shrink-0" />
<span className="text-xs whitespace-nowrap">
{unstagedCount > 0 && unstagedCount}
@@ -128,7 +128,7 @@ export function RepoCard({
</span>
)}
{(ahead > 0 || behind > 0) && (
<span className="flex items-center gap-1 text-blue-600 dark:text-blue-400 shrink-0">
<span className="flex items-center gap-1 text-info shrink-0">
<span className="text-xs whitespace-nowrap">
{ahead > 0 && `↑${ahead}`}
{behind > 0 && `↓${behind}`}
+4 -4
View File
@@ -321,8 +321,8 @@ export function RepoList() {
case !repos || repos.length === 0:
return (
<div className="text-center p-12">
<GitBranch className="w-12 h-12 mx-auto mb-4 text-zinc-600" />
<p className="text-zinc-500">
<GitBranch className="w-12 h-12 mx-auto mb-4 text-muted-foreground" />
<p className="text-muted-foreground">
No repositories yet. Add one to get started.
</p>
</div>
@@ -406,8 +406,8 @@ export function RepoList() {
case sortedViewModels.length === 0:
return (
<div className="text-center p-12">
<Search className="w-12 h-12 mx-auto mb-4 text-zinc-600" />
<p className="text-zinc-500">
<Search className="w-12 h-12 mx-auto mb-4 text-muted-foreground" />
<p className="text-muted-foreground">
{sections[0]?.emptyMessage || `No repositories found${searchQuery ? ` matching "${searchQuery}"` : ''}`}
</p>
</div>
@@ -44,7 +44,7 @@ export function RepoMcpServerList({
</div>
) : isLoadingStatus ? (
<div className="flex items-center justify-center py-8">
<Loader2 className="w-4 h-4 animate-spin text-blue-600 dark:text-blue-400" />
<Loader2 className="w-4 h-4 animate-spin text-primary" />
<span className="ml-2 text-sm text-muted-foreground">Loading...</span>
</div>
) : (
@@ -76,17 +76,17 @@ export function RepoMcpServerList({
title="Click for options"
>
{status?.status === 'connected' && (
<span className="text-xs bg-green-600 text-white px-2 py-0.5 rounded-full inline-flex items-center gap-1">
<span className="text-xs bg-success text-success-foreground px-2 py-0.5 rounded-full inline-flex items-center gap-1">
Connected<ChevronDown className="h-3 w-3" />
</span>
)}
{status?.status === 'needs_auth' && (
<span className="text-xs border border-yellow-500 text-yellow-600 px-2 py-0.5 rounded-full inline-flex items-center gap-1">
<span className="text-xs border border-warning text-warning px-2 py-0.5 rounded-full inline-flex items-center gap-1">
Needs Auth<ChevronDown className="h-3 w-3" />
</span>
)}
{status?.status === 'failed' && (
<span className="text-xs bg-red-500 text-white px-2 py-0.5 rounded-full inline-flex items-center gap-1">
<span className="text-xs bg-destructive text-destructive-foreground px-2 py-0.5 rounded-full inline-flex items-center gap-1">
<AlertCircle className="h-3 w-3" />Failed<ChevronDown className="h-3 w-3" />
</span>
)}
@@ -124,7 +124,7 @@ export function RepoMcpServerList({
)}
</div>
{failed && status.status === 'failed' && (
<div className="flex items-center gap-1 mt-1 text-xs text-red-500">
<div className="flex items-center gap-1 mt-1 text-xs text-destructive">
<XCircle className="w-3 h-3 flex-shrink-0" />
<span className="truncate">{status.error}</span>
</div>
@@ -195,8 +195,8 @@ export function WorkspaceManager({
aria-pressed={isActive}
>
<GitBranch className="h-3.5 w-3.5 text-primary flex-shrink-0" />
<span className={isActive ? 'truncate text-orange-600 dark:text-orange-400' : 'truncate'}>{label}</span>
{isActive && <span className="text-xs text-orange-600 dark:text-orange-400">Selected</span>}
<span className={isActive ? 'truncate text-highlight' : 'truncate'}>{label}</span>
{isActive && <span className="text-xs text-highlight">Selected</span>}
<span className="ml-auto hidden truncate text-xs text-muted-foreground md:block md:max-w-[45%]">
{directory}
</span>
@@ -26,7 +26,7 @@ export function WorktreeTabs({
const workspaceLabel = value === 'workspaces' && activeWorkspaceLabel ? activeWorkspaceLabel : 'Workspaces'
const tabClassName =
'group min-w-0 flex-1 gap-1.5 px-2 sm:flex-none sm:px-3 data-[state=active]:border data-[state=active]:border-primary/50 data-[state=active]:bg-primary/10 data-[state=inactive]:hover:bg-accent data-[state=inactive]:hover:text-foreground'
const activeLabelClassName = 'group-data-[state=active]:text-orange-600 dark:group-data-[state=active]:text-orange-400'
const activeLabelClassName = 'group-data-[state=active]:text-highlight'
return (
<div className="px-4 pt-2 flex-shrink-0">
@@ -35,10 +35,10 @@ export function PromptTemplateCard({ template, selected = false, onApply, onEdit
const content = (
<>
<div className="flex flex-wrap items-center gap-2">
<Badge className="border-transparent bg-orange-500 text-[10px] uppercase tracking-wide text-white">
<Badge className="border-transparent bg-highlight text-[10px] uppercase tracking-wide text-highlight-foreground">
{template.category}
</Badge>
<Badge className="border-transparent bg-slate-600 text-[10px] uppercase tracking-wide text-white">
<Badge className="border-transparent bg-muted text-[10px] uppercase tracking-wide text-foreground">
{template.cadenceHint}
</Badge>
</div>
@@ -74,7 +74,7 @@ export function RunDetailPanel({ repoId, activeRun, selectedRunLoading, onCancel
{selectedRunLoading && !activeRun ? (
<div className="flex items-center justify-center p-4"><Loader2 className="h-6 w-6 animate-spin text-muted-foreground" /></div>
) : (
<pre className={`whitespace-pre-wrap break-words text-sm font-mono leading-6 ${activeRun.status === 'cancelled' ? 'text-muted-foreground' : 'text-red-300'}`}>{activeRun.errorText ?? 'No error recorded.'}</pre>
<pre className={`whitespace-pre-wrap break-words text-sm font-mono leading-6 ${activeRun.status === 'cancelled' ? 'text-muted-foreground' : 'text-destructive'}`}>{activeRun.errorText ?? 'No error recorded.'}</pre>
)}
</TabsContent>
</Tabs>
@@ -36,9 +36,9 @@ export function RunHistoryCards({
)
function getRunStatusIcon(status: ScheduleRun['status']) {
if (status === 'completed') return <CheckCircle2 className="h-3.5 w-3.5 text-green-400" />
if (status === 'failed') return <XCircle className="h-3.5 w-3.5 text-red-400" />
if (status === 'running') return <Loader2 className="h-3.5 w-3.5 animate-spin text-blue-400" />
if (status === 'completed') return <CheckCircle2 className="h-3.5 w-3.5 text-success" />
if (status === 'failed') return <XCircle className="h-3.5 w-3.5 text-destructive" />
if (status === 'running') return <Loader2 className="h-3.5 w-3.5 animate-spin text-primary" />
return <Ban className="h-3.5 w-3.5 text-muted-foreground" />
}
@@ -122,7 +122,7 @@ export function RunHistoryCards({
)}
</div>
{run.errorText && (
<p className="mt-0.5 truncate text-xs text-red-400/80">{run.errorText}</p>
<p className="mt-0.5 truncate text-xs text-destructive/80">{run.errorText}</p>
)}
</div>
<ChevronDown className={`h-6 w-6 flex-shrink-0 text-muted-foreground transition-transform duration-200 self-start ${isExpanded ? 'rotate-180' : ''}`} />
@@ -134,7 +134,7 @@ export function RunHistoryCards({
disabled={deleteRunPending}
title="Delete run"
aria-label="Delete run"
className="flex items-center px-2.5 text-muted-foreground transition-colors hover:text-red-400 disabled:opacity-50"
className="flex items-center px-2.5 text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50"
>
<Trash2 className="h-4 w-4" />
</button>
@@ -323,23 +323,23 @@ export function formatTimestamp(value: number | null): string {
export function getRunTone(run: ScheduleRun): string {
if (run.status === 'completed') {
return 'bg-emerald-500/15 text-emerald-300 border-emerald-500/30'
return 'bg-success/15 text-success border-success/30'
}
if (run.status === 'failed') {
return 'bg-red-500/15 text-red-300 border-red-500/30'
return 'bg-destructive/15 text-destructive border-destructive/30'
}
if (run.status === 'cancelled') {
return 'bg-slate-500/15 text-slate-300 border-slate-500/30'
return 'bg-muted text-muted-foreground border-border'
}
return 'bg-amber-500/15 text-amber-300 border-amber-500/30'
return 'bg-warning/15 text-warning border-warning/30'
}
export function getJobStatusTone(job: ScheduleJob): string {
return job.enabled
? 'bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20'
? 'bg-success/10 text-success border-success/20'
: 'bg-muted text-muted-foreground border-border'
}
@@ -150,7 +150,7 @@ export function BackgroundWorkBar({ sessionID, directory, messages, isSessionAct
className="ml-auto flex items-center gap-1 rounded-md border border-border bg-card/60 px-2 py-1 text-muted-foreground hover:text-foreground"
aria-expanded={expanded}
>
<Loader2 className="h-3 w-3 animate-spin text-yellow-600 dark:text-yellow-400" />
<Loader2 className="h-3 w-3 animate-spin text-warning" />
{shells.length} background shell{shells.length === 1 ? '' : 's'}
{expanded ? <ChevronUp className="h-3 w-3" /> : <ChevronDown className="h-3 w-3" />}
</button>
@@ -161,7 +161,7 @@ export function BackgroundWorkBar({ sessionID, directory, messages, isSessionAct
<ul className="rounded-md border border-border bg-card/60">
{shells.map((shell) => (
<li key={shell.id} className="flex items-center gap-2 border-b border-border px-2 py-1 last:border-b-0">
<Terminal className="h-3 w-3 shrink-0 text-green-600 dark:text-green-400" />
<Terminal className="h-3 w-3 shrink-0 text-success" />
<span className="min-w-0 flex-1 truncate font-mono" title={shell.command}>{shell.command}</span>
<Button variant="ghost" size="sm" className="h-6 px-2 text-xs" onClick={() => setViewing(shell)}>
Output
@@ -8,9 +8,9 @@ interface ContextUsageIndicatorProps {
}
const getUsageTextColor = (percentage: number) => {
if (percentage < 50) return 'text-green-700 dark:text-green-400'
if (percentage < 80) return 'text-yellow-700 dark:text-yellow-400'
return 'text-red-700 dark:text-red-400'
if (percentage < 50) return 'text-success'
if (percentage < 80) return 'text-warning'
return 'text-destructive'
}
export function ContextUsageIndicator({ directory, sessionID, isConnected, isReconnecting }: ContextUsageIndicatorProps) {
@@ -25,7 +25,7 @@ export function ContextUsageIndicator({ directory, sessionID, isConnected, isRec
}
if (isReconnecting) {
return <span className="text-xs text-yellow-700 dark:text-yellow-400 font-medium">Reconnecting...</span>
return <span className="text-xs text-warning font-medium">Reconnecting...</span>
}
if (!isConnected) {
@@ -75,7 +75,7 @@ export function EditSessionTitleDialog({ isOpen, currentTitle, onClose, onSave }
setEditTitle("");
inputRef.current?.focus();
}}
className="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 rounded-full hover:bg-red-500/10 text-red-500 transition-colors"
className="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 rounded-full hover:bg-destructive/10 text-destructive transition-colors"
>
<X className="w-5 h-5" />
</button>
+22 -22
View File
@@ -203,7 +203,7 @@ export function FormPrompt({ form, onReply, onCancel, onMinimize }: FormPromptPr
max={typeof field.maximum === 'number' ? field.maximum : undefined}
step={field.type === 'integer' ? 1 : 'any'}
onChange={(e) => setFieldAnswer(field.key, e.target.value === '' ? '' : Number(e.target.value))}
className="w-full rounded-lg border border-border bg-white/60 dark:bg-white/5 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none"
className="w-full rounded-lg border border-border bg-muted/60 dark:bg-muted/5 px-3 py-2 text-sm focus:border-primary focus:outline-none"
/>
</div>
)
@@ -296,19 +296,19 @@ export function FormPrompt({ form, onReply, onCancel, onMinimize }: FormPromptPr
value={typeof value === 'string' ? value : ''}
onChange={(e) => setFieldAnswer(field.key, e.target.value)}
placeholder={field.placeholder ?? 'Type your answer...'}
className="min-h-[60px] sm:min-h-[80px] text-[16px] sm:text-xs md:text-sm resize-none border-blue-500/30 focus:border-blue-500"
className="min-h-[60px] sm:min-h-[80px] text-[16px] sm:text-xs md:text-sm resize-none border-primary/30 focus:border-primary"
/>
</div>
)
}
return (
<div className="w-full bg-gradient-to-br from-blue-100 to-blue-200 dark:from-blue-950 dark:to-blue-900 border-2 border-blue-300 dark:border-blue-700 rounded-xl shadow-lg shadow-blue-500/20 mb-1 overflow-hidden">
<div className="flex items-center px-3 py-2 sm:px-4 sm:py-2.5 border-b border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/50">
<div className="w-full bg-gradient-to-br from-primary/10 to-primary/20 border-2 border-primary/40 rounded-xl shadow-lg shadow-primary/20 mb-1 overflow-hidden">
<div className="flex items-center px-3 py-2 sm:px-4 sm:py-2.5 border-b border-primary/20 bg-primary/5">
<button
onClick={() => (isMinimized ? setIsMinimized(false) : handleMinimize())}
aria-expanded={!isMinimized}
className="flex items-center gap-1.5 flex-1 text-left text-xs sm:text-sm font-semibold text-blue-600 dark:text-white"
className="flex items-center gap-1.5 flex-1 text-left text-xs sm:text-sm font-semibold text-primary"
>
{isMinimized ? (
<ChevronUp className="w-3 h-3 opacity-60 flex-shrink-0" />
@@ -321,14 +321,14 @@ export function FormPrompt({ form, onReply, onCancel, onMinimize }: FormPromptPr
onClick={handleCancel}
disabled={isSubmitting}
aria-label="Dismiss form"
className="p-1.5 sm:p-2 hover:bg-red-500/20 text-muted-foreground hover:text-red-500 transition-colors"
className="p-1.5 sm:p-2 hover:bg-destructive/20 text-muted-foreground hover:text-destructive transition-colors"
>
<X className="w-3.5 h-3.5 sm:w-4 sm:h-4" />
</button>
</div>
{!isMinimized && (
<div className="p-2 sm:p-3 max-h-[50vh] sm:max-h-[70vh] overflow-y-auto overflow-x-hidden bg-background/60 dark:bg-black/30 space-y-3">
<div className="p-2 sm:p-3 max-h-[50vh] sm:max-h-[70vh] overflow-y-auto overflow-x-hidden bg-background/60 dark:bg-background/30 space-y-3">
{renderFields.map((field) =>
field.type === 'external' ? (
<ExternalFieldCard key={field.key} field={field} />
@@ -339,7 +339,7 @@ export function FormPrompt({ form, onReply, onCancel, onMinimize }: FormPromptPr
</div>
)}
<div className="flex gap-1.5 sm:gap-2 px-2 py-2 sm:px-3 sm:py-3 border-t border-blue-200 dark:border-blue-800">
<div className="flex gap-1.5 sm:gap-2 px-2 py-2 sm:px-3 sm:py-3 border-t border-primary/20">
<Button
size="sm"
onClick={handleCancel}
@@ -352,7 +352,7 @@ export function FormPrompt({ form, onReply, onCancel, onMinimize }: FormPromptPr
size="sm"
onClick={handleSubmit}
disabled={isSubmitting || !canSubmit}
className="flex-1 h-8 sm:h-10 text-xs sm:text-sm bg-emerald-600 hover:bg-emerald-700 text-white"
className="flex-1 h-8 sm:h-10 text-xs sm:text-sm bg-success hover:bg-success/90 text-success-foreground"
>
{isSubmitting ? <Loader2 className="w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin" /> : 'Submit'}
</Button>
@@ -376,7 +376,7 @@ function FieldLabel({
<div className="space-y-0.5">
<label htmlFor={id} className="block text-xs sm:text-sm font-semibold text-foreground">
{label}
{required && <span className="text-red-500 ml-0.5">*</span>}
{required && <span className="text-destructive ml-0.5">*</span>}
</label>
{description && (
<p id={`${id}-description`} className="text-[10px] sm:text-xs text-foreground/70">
@@ -402,7 +402,7 @@ function FieldGroup({
<fieldset className="space-y-2">
<legend className="text-xs sm:text-sm font-semibold text-foreground">
{label}
{required && <span className="text-red-500 ml-0.5">*</span>}
{required && <span className="text-destructive ml-0.5">*</span>}
</legend>
{description && <p className="text-[10px] sm:text-xs text-foreground/70">{description}</p>}
{children}
@@ -429,24 +429,24 @@ function OptionButton({
className={cn(
'w-full text-left p-2 sm:p-3 rounded-lg transition-all duration-200 active:scale-[0.98]',
selected
? 'bg-blue-200 dark:bg-blue-700/50'
: 'bg-white/40 dark:bg-white/5 hover:bg-white/60 dark:hover:bg-white/10',
? 'bg-primary/20'
: 'bg-muted/40 dark:bg-muted/5 hover:bg-muted/60 dark:hover:bg-muted/10',
)}
>
<div className="flex items-start gap-1.5 sm:gap-2">
<div
className={cn(
'w-4 h-4 sm:w-5 sm:h-5 rounded-full border-2 flex items-center justify-center flex-shrink-0 transition-colors',
selected ? 'border-blue-500 bg-blue-500' : 'border-muted-foreground',
selected ? 'border-primary bg-primary' : 'border-muted-foreground',
)}
>
{selected && <Check className="w-2.5 h-2.5 sm:w-3 sm:h-3 text-white" />}
{selected && <Check className="w-2.5 h-2.5 sm:w-3 sm:h-3 text-primary-foreground" />}
</div>
<div className="min-w-0">
<span
className={cn(
'text-xs sm:text-sm font-semibold',
selected ? 'text-blue-600 dark:text-blue-300' : 'text-foreground',
selected ? 'text-primary' : 'text-foreground',
)}
>
{label}
@@ -495,23 +495,23 @@ function CustomOption({
className={cn(
'w-full text-left p-2 sm:p-3 rounded-lg transition-all duration-200',
expanded || selected
? 'bg-blue-200 dark:bg-blue-700/50'
: 'bg-white/40 dark:bg-white/5 hover:bg-white/60 dark:hover:bg-white/10',
? 'bg-primary/20'
: 'bg-muted/40 dark:bg-muted/5 hover:bg-muted/60 dark:hover:bg-muted/10',
)}
>
<div className="flex items-center gap-1.5 sm:gap-2">
<div
className={cn(
'w-4 h-4 sm:w-5 sm:h-5 rounded-full border-2 flex items-center justify-center flex-shrink-0 transition-colors',
selected ? 'border-blue-500 bg-blue-500' : 'border-muted-foreground',
selected ? 'border-primary bg-primary' : 'border-muted-foreground',
)}
>
{selected && <Check className="w-2.5 h-2.5 sm:w-3 sm:h-3 text-white" />}
{selected && <Check className="w-2.5 h-2.5 sm:w-3 sm:h-3 text-primary-foreground" />}
</div>
<span
className={cn(
'text-xs sm:text-sm font-semibold',
expanded || selected ? 'text-blue-600 dark:text-blue-300' : 'text-foreground',
expanded || selected ? 'text-primary' : 'text-foreground',
)}
>
Other...
@@ -527,7 +527,7 @@ function CustomOption({
value={value}
onChange={(e) => onChange(e.target.value)}
placeholder="Type your own answer..."
className="min-h-[60px] sm:min-h-[80px] text-[16px] sm:text-xs md:text-sm resize-none border-blue-500/30 focus:border-blue-500"
className="min-h-[60px] sm:min-h-[80px] text-[16px] sm:text-xs md:text-sm resize-none border-primary/30 focus:border-primary"
onKeyDown={(e) => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault()
@@ -10,18 +10,18 @@ interface MinimizedFormIndicatorProps {
export function MinimizedFormIndicator({ form, onRestore, onDismiss }: MinimizedFormIndicatorProps) {
return (
<div className="w-full bg-gradient-to-br from-orange-100 to-orange-200 dark:from-orange-950 dark:to-orange-900 border-2 border-orange-300 dark:border-orange-700 rounded-lg shadow-lg mb-2 overflow-hidden">
<div className="flex items-center px-3 py-2 sm:px-4 sm:py-2.5 border-b border-orange-200 dark:border-orange-800 bg-orange-50 dark:bg-orange-900/50">
<div className="w-full bg-gradient-to-br from-highlight/10 to-highlight/20 border-2 border-highlight/40 rounded-lg shadow-lg mb-2 overflow-hidden">
<div className="flex items-center px-3 py-2 sm:px-4 sm:py-2.5 border-b border-highlight/20 bg-highlight/5">
<button
onClick={onRestore}
className="flex-1 text-left text-xs font-semibold text-orange-600 dark:text-white"
className="flex-1 text-left text-xs font-semibold text-highlight"
>
{getFormText(form) || 'Form pending'}
</button>
<button
onClick={onDismiss}
aria-label="Dismiss form"
className="p-1.5 hover:bg-red-500/20 text-muted-foreground hover:text-red-500 transition-colors hidden sm:block"
className="p-1.5 hover:bg-destructive/20 text-muted-foreground hover:text-destructive transition-colors hidden sm:block"
>
<X className="w-3.5 h-3.5" />
</button>
@@ -119,7 +119,7 @@ export function PermissionRequestDialog({
</div>
)}
{isFromDifferentSession ? (
<div className="bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20 rounded-md px-2 py-1.5 truncate">
<div className="bg-warning/10 text-warning border border-warning/20 rounded-md px-2 py-1.5 truncate">
From another session: <span className="font-medium">{displaySessionName}</span>
</div>
) : (
+10 -10
View File
@@ -52,13 +52,13 @@ export const SessionCard = ({
return (
<div className="relative" onClick={close}>
<div
className={`absolute top-0.5 right-0 bottom-0.5 w-20 bg-red-600 flex items-center justify-center rounded-r-lg transition-opacity ${
className={`absolute top-0.5 right-0 bottom-0.5 w-20 bg-destructive flex items-center justify-center rounded-r-lg transition-opacity ${
!isSwipingBack && (isOpen || swipeOffset > 40) ? "opacity-100" : "opacity-0 pointer-events-none"
}`}
>
<button
aria-label="Delete session"
className="h-full w-full flex items-center justify-center text-white hover:bg-red-700"
className="h-full w-full flex items-center justify-center text-destructive-foreground hover:bg-destructive/90"
onClick={handleDeleteClick}
>
<Trash2 className="w-5 h-5" />
@@ -72,7 +72,7 @@ export const SessionCard = ({
: "rounded-r-lg"
} ${
isSelected
? "border-blue-500 shadow-lg shadow-blue-900/30 dark:shadow-blue-900/30 bg-accent"
? "border-primary shadow-lg shadow-primary/30 bg-accent"
: isActive
? "bg-accent border-border"
: "bg-card border-border hover:bg-accent hover:border-border"
@@ -105,8 +105,8 @@ export const SessionCard = ({
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-1">
{isPinned && <Pin className="w-3 h-3 text-orange-500 shrink-0" />}
<h3 className="text-base font-semibold text-orange-600 dark:text-orange-400 truncate">
{isPinned && <Pin className="w-3 h-3 text-highlight shrink-0" />}
<h3 className="text-base font-semibold text-highlight truncate">
{session.title || "Untitled Session"}
</h3>
</div>
@@ -118,7 +118,7 @@ export const SessionCard = ({
})}
</span>
{workspaceLabel ? (
<span className="text-purple-400 truncate max-w-[140px]">{workspaceLabel}</span>
<span className="text-primary truncate max-w-[140px]">{workspaceLabel}</span>
) : null}
</div>
</div>
@@ -127,8 +127,8 @@ export const SessionCard = ({
<>
<div className="flex flex-col flex-1 min-w-0">
<div className="flex items-center gap-1">
{isPinned && <Pin className="w-3 h-3 text-orange-500 shrink-0" />}
<h3 className="text-sm font-semibold text-orange-600 dark:text-orange-400 truncate">
{isPinned && <Pin className="w-3 h-3 text-highlight shrink-0" />}
<h3 className="text-sm font-semibold text-highlight truncate">
{session.title || "Untitled Session"}
</h3>
</div>
@@ -140,7 +140,7 @@ export const SessionCard = ({
})}
</span>
{workspaceLabel ? (
<span className="text-purple-400 truncate max-w-[120px]">{workspaceLabel}</span>
<span className="text-primary truncate max-w-[120px]">{workspaceLabel}</span>
) : null}
<SessionStatusIndicator sessionID={session.id} size="sm" />
</div>
@@ -176,7 +176,7 @@ export const SessionCard = ({
{manageMode && (
<button
aria-label="Delete session"
className="h-6 w-6 p-0 text-foreground hover:text-red-600 dark:hover:text-red-400 bg-transparent border-none cursor-pointer"
className="h-6 w-6 p-0 text-foreground hover:text-destructive bg-transparent border-none cursor-pointer"
onClick={(e) => {
e.stopPropagation();
onDelete(e);
@@ -148,7 +148,7 @@ export function AccountSettings() {
)}
{success && (
<Alert className="border-green-500 text-green-700 dark:text-green-400">
<Alert className="border-success text-success">
<CheckCircle className="h-4 w-4" />
<AlertDescription>{success}</AlertDescription>
</Alert>
@@ -84,7 +84,7 @@ export function AgentsMdEditor() {
if (error) {
return (
<div className="text-center py-8 text-red-500">
<div className="text-center py-8 text-destructive">
Failed to load AGENTS.md
</div>
)
@@ -155,7 +155,7 @@ export function AgentsMdEditor() {
</div>
{hasChanges && (
<p className="text-xs text-amber-500">You have unsaved changes</p>
<p className="text-xs text-warning">You have unsaved changes</p>
)}
</div>
)
@@ -6,6 +6,7 @@ import { useSettings } from '@/hooks/useSettings'
import { useVersionCheck } from '@/hooks/useVersionCheck'
import type { UserPreferences } from '@/api/types/settings'
import type { VersionInfo } from '@/api/settings'
import { createUseSettingsMock } from '@/test/test-utils'
vi.mock('@/hooks/useSettings')
vi.mock('@/hooks/useVersionCheck')
@@ -31,18 +32,7 @@ const baseVersionInfo: VersionInfo = {
}
function mockUseSettings(overrides: Partial<ReturnType<typeof useSettings>> = {}) {
vi.mocked(useSettings).mockReturnValue({
settings: undefined,
preferences: basePreferences,
isLoading: false,
error: null,
updateSettings: vi.fn(),
updateSettingsAsync: vi.fn(),
resetSettings: vi.fn(),
isUpdating: false,
isResetting: false,
...overrides,
})
vi.mocked(useSettings).mockReturnValue(createUseSettingsMock({ preferences: basePreferences, ...overrides }))
}
function mockVersionInfo(overrides: Partial<VersionInfo> = {}) {
@@ -73,7 +63,7 @@ describe('GeneralSettings', () => {
expect(screen.getByText('v1.2.3')).toBeInTheDocument()
expect(screen.getByRole('link', { name: 'v1.3.0 available' })).toHaveAttribute('href', 'https://example.com/release')
expect(screen.getByLabelText('Theme')).toBeInTheDocument()
expect(screen.getByLabelText('Appearance')).toBeInTheDocument()
expect(screen.getByRole('switch', { name: 'Simple chat mode' })).not.toBeChecked()
expect(screen.getByRole('switch', { name: 'Auto-scroll' })).toBeChecked()
expect(screen.getByRole('switch', { name: 'Show reasoning' })).not.toBeChecked()
@@ -88,7 +78,7 @@ describe('GeneralSettings', () => {
mockVersionInfo()
render(<GeneralSettings />)
await user.click(screen.getByRole('combobox', { name: 'Theme' }))
await user.click(screen.getByRole('combobox', { name: 'Appearance' }))
await user.click(screen.getByRole('option', { name: 'Light' }))
expect(updateSettings).toHaveBeenCalledWith({ theme: 'light' })
@@ -97,6 +87,23 @@ describe('GeneralSettings', () => {
expect(updateSettings).toHaveBeenCalledWith({ autoScroll: false })
})
it('defaults the color theme to Manager and persists a chosen OpenCode theme', async () => {
const user = userEvent.setup()
const updateSettings = vi.fn()
mockUseSettings({ updateSettings })
mockVersionInfo()
render(<GeneralSettings />)
expect(screen.getByRole('combobox', { name: 'Theme' })).toHaveTextContent('Manager')
await user.click(screen.getByRole('combobox', { name: 'Theme' }))
expect(screen.getByRole('option', { name: 'Manager' })).toBeInTheDocument()
expect(screen.getByRole('option', { name: 'OpenCode' })).toBeInTheDocument()
await user.click(screen.getByRole('option', { name: 'Dracula' }))
expect(updateSettings).toHaveBeenCalledWith({ colorTheme: 'dracula' })
})
it('hides the reasoning, tool call, and diff rows while simple chat mode is on', () => {
mockUseSettings({ preferences: { ...basePreferences, simpleChatMode: true } })
mockVersionInfo()
@@ -1,5 +1,6 @@
import { useSettings } from '@/hooks/useSettings'
import { useVersionCheck } from '@/hooks/useVersionCheck'
import { MANAGER_COLOR_THEME_ID, OPENCODE_THEMES, isColorThemeId } from '@opencode-manager/shared/themes'
import { Loader2 } from 'lucide-react'
import { Label } from '@/components/ui/label'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
@@ -35,7 +36,7 @@ export function GeneralSettings() {
href={versionInfo.releaseUrl ?? ''}
target="_blank"
rel="noopener noreferrer"
className="text-xs font-medium text-green-500 hover:text-green-400 transition-colors"
className="text-xs font-medium text-success hover:text-success/80 transition-colors"
>
v{versionInfo.latestVersion} available
</a>
@@ -49,16 +50,16 @@ export function GeneralSettings() {
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
<div className="min-w-0 space-y-0.5">
<Label htmlFor="theme">Theme</Label>
<Label htmlFor="appearance">Appearance</Label>
<p className="text-sm text-muted-foreground">
Choose your preferred color scheme
Choose light, dark, or follow your system
</p>
</div>
<Select
value={preferences?.theme || 'dark'}
onValueChange={(value) => updateSettings({ theme: value as 'dark' | 'light' | 'system' })}
>
<SelectTrigger id="theme" className="w-full shrink-0 sm:w-40">
<SelectTrigger id="appearance" className="w-full shrink-0 sm:w-40">
<SelectValue placeholder="Select a theme" />
</SelectTrigger>
<SelectContent>
@@ -69,6 +70,33 @@ export function GeneralSettings() {
</Select>
</div>
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
<div className="min-w-0 space-y-0.5">
<Label htmlFor="colorTheme">Theme</Label>
<p className="text-sm text-muted-foreground">
Use the Manager palette or an OpenCode theme
</p>
</div>
<Select
value={preferences?.colorTheme ?? MANAGER_COLOR_THEME_ID}
onValueChange={(value) => {
if (isColorThemeId(value)) updateSettings({ colorTheme: value })
}}
>
<SelectTrigger id="colorTheme" className="w-full shrink-0 sm:w-40">
<SelectValue placeholder="Select a theme" />
</SelectTrigger>
<SelectContent className="max-h-80">
<SelectItem value={MANAGER_COLOR_THEME_ID}>Manager</SelectItem>
{OPENCODE_THEMES.map((theme) => (
<SelectItem key={theme.id} value={theme.id}>
{theme.name}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
<div className="divide-y divide-border">
<div className="flex items-start justify-between gap-4 py-3">
<div className="min-w-0 space-y-0.5">
@@ -33,7 +33,7 @@ const SOURCE_OPTIONS: Array<{ value: SourceFilter; label: string }> = [
const LEVEL_CHIP_CLASSES: Record<ManagerLogLevel, string> = {
error: 'bg-destructive/15 text-destructive',
warn: 'bg-amber-500/15 text-amber-600 dark:text-amber-400',
warn: 'bg-warning/15 text-warning',
info: 'bg-accent text-accent-foreground',
debug: 'bg-muted text-muted-foreground',
}
@@ -80,7 +80,7 @@ export function ManagerTokenSettings({ isOpen: controlledOpen, onToggle }: Manag
onClick={handleCopy}
disabled={!token}
>
{copied ? <Check className="h-4 w-4 text-green-500" /> : <Copy className="h-4 w-4" />}
{copied ? <Check className="h-4 w-4 text-success" /> : <Copy className="h-4 w-4" />}
</Button>
<Button
variant={confirmRotate ? 'destructive' : 'outline'}
@@ -263,7 +263,7 @@ export function McpOAuthDialog({
{step === 'waiting' && (
<div className="space-y-4">
<div className="flex items-center justify-center py-4">
<Loader2 className="h-5 w-5 animate-spin text-blue-500" />
<Loader2 className="h-5 w-5 animate-spin text-primary" />
<span className="ml-2 text-sm text-muted-foreground">Waiting for authorization...</span>
</div>
<p className="text-xs text-center text-muted-foreground">
@@ -287,7 +287,7 @@ export function McpOAuthDialog({
{step === 'popup_closed' && (
<div className="flex flex-col items-center justify-center py-6 gap-2">
<Loader2 className="h-5 w-5 animate-spin text-blue-500" />
<Loader2 className="h-5 w-5 animate-spin text-primary" />
<p className="text-sm text-muted-foreground">
Checking authentication status...
</p>
@@ -307,7 +307,7 @@ export function McpOAuthDialog({
{step === 'success' && (
<div className="flex flex-col items-center justify-center py-6 gap-2">
<CheckCircle className="h-8 w-8 text-green-500" />
<CheckCircle className="h-8 w-8 text-success" />
<p className="text-sm font-medium">Authentication successful</p>
</div>
)}
@@ -91,7 +91,7 @@ export function McpServerCard({
}
description={getServerDescription(serverConfig)}
belowDescription={errorMessage ? (
<div className="flex items-start gap-1.5 mt-1.5 text-xs text-red-500">
<div className="flex items-start gap-1.5 mt-1.5 text-xs text-destructive">
<XCircle className="h-3 w-3 flex-shrink-0 mt-0.5" />
<span className="break-words line-clamp-2">{errorMessage}</span>
</div>
@@ -9,7 +9,7 @@ interface McpStatusBadgeProps {
export function McpStatusBadge({ status }: McpStatusBadgeProps) {
switch (status.status) {
case 'connected':
return <Badge variant="default" className="text-xs bg-green-600">Connected</Badge>
return <Badge variant="default" className="text-xs bg-success text-success-foreground">Connected</Badge>
case 'pending':
return <Badge variant="outline" className="text-xs">Connecting</Badge>
case 'disabled':
@@ -23,7 +23,7 @@ export function McpStatusBadge({ status }: McpStatusBadgeProps) {
)
case 'needs_auth':
return (
<Badge variant="outline" className="text-xs flex items-center gap-1 border-yellow-500 text-yellow-600">
<Badge variant="outline" className="text-xs flex items-center gap-1 border-warning text-warning">
<Key className="h-3 w-3" />
Auth Required
</Badge>
@@ -63,7 +63,7 @@ export function NotificationSettings() {
<h2 className="text-lg font-semibold text-foreground mb-4">
Push Notifications
</h2>
<div className="flex items-center gap-3 text-yellow-500">
<div className="flex items-center gap-3 text-warning">
<BellOff className="h-5 w-5" />
<p className="text-sm">
Notification permission was denied. Please enable notifications in
@@ -280,7 +280,7 @@ export function OpenCodeConfigEditor({
{editError && (
<div className="max-h-40 shrink-0 space-y-2 overflow-y-auto border-t bg-background p-3">
<p className="break-words text-xs text-red-500 sm:text-sm">
<p className="break-words text-xs text-destructive sm:text-sm">
{editError}
{editErrorLine != null && (
<button
@@ -293,7 +293,7 @@ export function OpenCodeConfigEditor({
)}
</p>
{validationIssues.length > 0 && (
<ul className="max-h-28 space-y-1 pl-4 text-xs text-red-500 list-disc sm:text-sm">
<ul className="max-h-28 space-y-1 pl-4 text-xs text-destructive list-disc sm:text-sm">
{validationIssues.map((issue) => (
<li key={getIssueText(issue)}>
{issue.line != null ? (
@@ -206,9 +206,9 @@ export function OpenCodeConfigManager() {
return (
<div className="min-w-0 space-y-4">
{health?.opencodeRestartPending && (
<div className="flex flex-col gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 p-3 sm:flex-row sm:items-center sm:justify-between">
<div className="flex flex-col gap-2 rounded-md border border-warning/40 bg-warning/10 p-3 sm:flex-row sm:items-center sm:justify-between">
<div className="flex items-center gap-2">
<AlertTriangle className="h-4 w-4 shrink-0 text-amber-500" />
<AlertTriangle className="h-4 w-4 shrink-0 text-warning" />
<p className="text-sm">
Some saved changes require a server restart to take effect.
</p>
@@ -242,7 +242,7 @@ export function OpenCodeConfigManager() {
<>
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
<div className="flex min-w-0 items-start gap-2">
<FileText className="mt-0.5 h-4 w-4 shrink-0 text-blue-500" />
<FileText className="mt-0.5 h-4 w-4 shrink-0 text-primary" />
<div className="min-w-0">
<p className="truncate text-sm font-medium">{getConfigFileName(config.path)}</p>
<details className="text-xs text-muted-foreground">
@@ -332,14 +332,14 @@ export function OpenCodeConfigManager() {
onClick={() => toggleSection('agentsMd', agentsMdRef)}
>
<div className="flex min-w-0 items-center gap-3">
<FileText className="h-4 w-4 shrink-0 text-blue-500" />
<FileText className="h-4 w-4 shrink-0 text-primary" />
<div className="min-w-0 text-left">
<h4 className="text-sm font-medium">Global Agent Instructions (AGENTS.md)</h4>
<p className={SECTION_META_CLASS}>Applies across OpenCode</p>
</div>
</div>
<div className="flex shrink-0 items-center gap-3">
<span className="text-xs font-medium text-blue-500">Edit AGENTS.md</span>
<span className="text-xs font-medium text-primary">Edit AGENTS.md</span>
<ChevronDown className={cn(SECTION_CHEVRON_CLASS, expandedSections.agentsMd && 'rotate-180')} />
</div>
</button>
@@ -528,7 +528,7 @@ export function OpenCodeConfigManager() {
onClick={() => toggleSection('hostImport', hostImportRef)}
>
<div className="flex min-w-0 items-center gap-3">
<Download className="h-4 w-4 shrink-0 text-blue-500" />
<Download className="h-4 w-4 shrink-0 text-primary" />
<h4 className={SECTION_TITLE_CLASS}>Existing OpenCode Host Import</h4>
</div>
<ChevronDown className={cn(SECTION_CHEVRON_CLASS, expandedSections.hostImport && 'rotate-180')} />
@@ -582,7 +582,7 @@ export function OpenCodeConfigManager() {
</div>
</div>
{!isImportStatusLoading && workspaceConfigPathsToRemove.length > 0 && (
<p className="flex items-start gap-2 text-xs text-amber-600 dark:text-amber-500">
<p className="flex items-start gap-2 text-xs text-warning">
<AlertTriangle className="mt-0.5 h-3.5 w-3.5 shrink-0" />
<span>
Importing replaces the workspace configuration files. These files will be removed:{' '}
@@ -23,12 +23,12 @@ export function OpenCodeConfigSourcesNotice({ config, targetName }: OpenCodeConf
if (!writeTargetName) return null
return (
<Alert className="border-blue-500/30 bg-blue-500/5">
<Info className="h-4 w-4 text-blue-500" />
<Alert className="border-info/30 bg-info/5">
<Info className="h-4 w-4 text-info" />
<details className="group" open>
<summary className="flex cursor-pointer list-none items-center justify-between gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 [&::-webkit-details-marker]:hidden">
<AlertTitle className="mb-0">Multiple configuration files are merged</AlertTitle>
<ChevronDown className="h-4 w-4 shrink-0 text-blue-500 transition-transform group-open:rotate-180" />
<ChevronDown className="h-4 w-4 shrink-0 text-info transition-transform group-open:rotate-180" />
</summary>
<AlertDescription>
<p>
@@ -36,8 +36,8 @@ export function OpenCodeServerAuthSettings({ isOpen: controlledOpen, onToggle }:
const getStatusIcon = () => {
if (!status) return null
if (status.source === 'db') return <CheckCircle2 className="h-4 w-4 text-green-500" />
if (status.source === 'env') return <CheckCircle2 className="h-4 w-4 text-blue-500" />
if (status.source === 'db') return <CheckCircle2 className="h-4 w-4 text-success" />
if (status.source === 'env') return <CheckCircle2 className="h-4 w-4 text-info" />
return <CheckCircle2 className="h-4 w-4 text-muted-foreground" />
}
@@ -194,7 +194,7 @@ export function ProviderSettings() {
</div>
<div className="flex flex-wrap items-center gap-2">
{hasKey ? (
<Badge variant="default" className="bg-green-600 hover:bg-green-700 shrink-0">
<Badge variant="default" className="bg-success text-success-foreground hover:bg-success/90 shrink-0">
<Check className="h-3 w-3 mr-1" />
Connected
</Badge>
@@ -304,7 +304,7 @@ export function ProviderSettings() {
)}
</div>
<div className="flex items-center gap-1">
<Badge variant="default" className="bg-green-600 hover:bg-green-700 shrink-0 text-xs">
<Badge variant="default" className="bg-success text-success-foreground hover:bg-success/90 shrink-0 text-xs">
<Check className="h-3 w-3 mr-1" />
Connected
</Badge>
@@ -183,12 +183,12 @@ export function STTSettings() {
<div className="flex items-center gap-2 text-sm">
{saveStatus === 'saved' && (
<>
<CheckCircle2 className="h-4 w-4 text-green-500" />
<span className="text-green-600">Saved</span>
<CheckCircle2 className="h-4 w-4 text-success" />
<span className="text-success">Saved</span>
</>
)}
{saveStatus === 'idle' && isDirty && isValid && (
<span className="text-amber-600">Unsaved changes</span>
<span className="text-warning">Unsaved changes</span>
)}
{saveStatus === 'idle' && !isDirty && (
<span className="text-muted-foreground">All changes saved</span>
@@ -379,8 +379,8 @@ export function STTSettings() {
)}
{sttError && (
<div className="rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 p-4">
<div className="text-sm text-amber-800 dark:text-amber-200 flex items-start gap-2">
<div className="rounded-lg bg-warning/10 border border-warning/20 p-4">
<div className="text-sm text-warning flex items-start gap-2">
<XCircle className="h-4 w-4 mt-0.5 shrink-0" />
<div>{sttError}</div>
</div>
@@ -414,19 +414,19 @@ export function STTSettings() {
</div>
)}
{!isTesting && !isProcessing && testResult === 'success' && testTranscript && (
<div className="mt-2 p-2 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded max-h-24 overflow-y-auto">
<div className="mt-2 p-2 bg-success/10 border border-success/20 rounded max-h-24 overflow-y-auto">
<div className="flex items-center gap-1 mb-1">
<CheckCircle2 className="h-3 w-3 text-green-600 dark:text-green-400" />
<span className="text-xs font-medium text-green-700 dark:text-green-300">Test successful</span>
<CheckCircle2 className="h-3 w-3 text-success" />
<span className="text-xs font-medium text-success">Test successful</span>
</div>
<p className="text-sm text-green-800 dark:text-green-200">{testTranscript}</p>
<p className="text-sm text-success">{testTranscript}</p>
</div>
)}
{!isTesting && !isProcessing && testResult === 'failed' && (
<div className="mt-2 p-2 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded">
<div className="mt-2 p-2 bg-destructive/10 border border-destructive/20 rounded">
<div className="flex items-center gap-1">
<XCircle className="h-3 w-3 text-red-600 dark:text-red-400" />
<span className="text-xs font-medium text-red-700 dark:text-red-300">Test failed - {sttError || 'no speech detected'}</span>
<XCircle className="h-3 w-3 text-destructive" />
<span className="text-xs font-medium text-destructive">Test failed - {sttError || 'no speech detected'}</span>
</div>
</div>
)}
@@ -439,7 +439,7 @@ export function STTSettings() {
!canTest && !isRecording && !isProcessing
? 'bg-muted text-muted-foreground cursor-not-allowed'
: isRecording
? 'bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border-2 border-red-500/60 shadow-lg shadow-red-500/30'
? 'bg-destructive hover:bg-destructive/90 text-destructive-foreground border-2 border-destructive/60 shadow-lg shadow-destructive/30'
: isProcessing
? 'bg-muted text-muted-foreground cursor-wait'
: 'bg-primary hover:bg-primary/90 text-primary-foreground'
@@ -6,6 +6,8 @@ import { useSettings } from '@/hooks/useSettings'
import { useServerHealth } from '@/hooks/useServerHealth'
import { showToast } from '@/lib/toast'
import { FetchError } from '@/api/fetchWrapper'
import type { UserPreferences } from '@/api/types/settings'
import { createUseSettingsMock } from '@/test/test-utils'
vi.mock('@/hooks/useSettings')
vi.mock('@/hooks/useServerHealth')
@@ -15,18 +17,13 @@ vi.mock('@/lib/toast', () => ({
function mockUseSettings(overrides: Partial<ReturnType<typeof useSettings>> = {}) {
const updateSettingsAsync = vi.fn().mockResolvedValue(undefined)
vi.mocked(useSettings).mockReturnValue({
settings: undefined,
preferences: { sandbox: { enabled: false } },
isLoading: false,
error: null,
updateSettings: vi.fn(),
updateSettingsAsync,
resetSettings: vi.fn(),
isUpdating: false,
isResetting: false,
...overrides,
})
vi.mocked(useSettings).mockReturnValue(
createUseSettingsMock({
preferences: { sandbox: { enabled: false } } as UserPreferences,
updateSettingsAsync,
...overrides,
}),
)
return { updateSettingsAsync }
}
@@ -3,6 +3,8 @@ import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { ServerEnvVarsSettings } from './ServerEnvVarsSettings'
import { useSettings } from '@/hooks/useSettings'
import type { UserPreferences } from '@/api/types/settings'
import { createUseSettingsMock } from '@/test/test-utils'
const mocks = vi.hoisted(() => ({
updateSettingsAsync: vi.fn(),
@@ -13,17 +15,12 @@ vi.mock('@/hooks/useSettings')
vi.mock('@/lib/toast', () => ({ showToast: mocks.showToast }))
function mockSettings(serverEnvVars: Array<{ key: string; value: string }> = []): void {
vi.mocked(useSettings).mockReturnValue({
settings: undefined,
preferences: { serverEnvVars },
isLoading: false,
error: null,
updateSettings: vi.fn(),
updateSettingsAsync: mocks.updateSettingsAsync,
resetSettings: vi.fn(),
isUpdating: false,
isResetting: false,
} as ReturnType<typeof useSettings>)
vi.mocked(useSettings).mockReturnValue(
createUseSettingsMock({
preferences: { serverEnvVars } as UserPreferences,
updateSettingsAsync: mocks.updateSettingsAsync,
}),
)
}
describe('ServerEnvVarsSettings', () => {
@@ -36,7 +36,7 @@ export function ServerHealthStatus({ onOpenVersionDialog }: ServerHealthStatusPr
<>
<div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-3">
<div className="flex min-w-0 flex-wrap items-center gap-2">
<div className={`h-3 w-3 rounded-full ${isUnhealthy ? 'bg-destructive animate-pulse' : 'bg-green-500'}`} />
<div className={`h-3 w-3 rounded-full ${isUnhealthy ? 'bg-destructive animate-pulse' : 'bg-success'}`} />
<p className="font-medium text-sm">
Server Status: {isUnhealthy ? 'Unhealthy' : 'Healthy'}
</p>
@@ -3,7 +3,7 @@ import { render, screen, fireEvent, within, act } from '@testing-library/react'
import { MemoryRouter, useLocation, useNavigate } from 'react-router-dom'
import { SettingsDialog } from './SettingsDialog'
import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'
import { DESKTOP_MEDIA_QUERY } from '@/hooks/useMediaQuery'
import { stubMatchMedia } from '@/test/test-utils'
vi.mock('@/components/settings/GeneralSettings', () => ({
GeneralSettings: () => <div data-testid="general-settings">General Settings Content</div>,
@@ -53,27 +53,6 @@ vi.mock('@/hooks/useMobile', () => ({
})),
}))
function stubMatchMedia(matches: boolean): () => void {
const listeners = new Set<() => void>()
const mediaQueryList = {
media: DESKTOP_MEDIA_QUERY,
matches,
addEventListener: (_type: string, listener: () => void) => {
listeners.add(listener)
},
removeEventListener: (_type: string, listener: () => void) => {
listeners.delete(listener)
},
}
const original = window.matchMedia
void original
Object.defineProperty(window, 'matchMedia', {
configurable: true,
writable: true,
value: () => mediaQueryList,
})
}
describe('SettingsDialog', () => {
beforeEach(() => {
vi.clearAllMocks()
@@ -233,7 +233,7 @@ export function SettingsDialog() {
>
<div className="flex items-center gap-4">
<div className="p-3 bg-accent rounded-lg">
<item.icon className="w-6 h-6 text-blue-600 dark:text-blue-400" />
<item.icon className="w-6 h-6 text-primary" />
</div>
<div className="flex-1 min-w-0">
<h3 className="font-semibold text-foreground mb-1">{item.label}</h3>
@@ -6,7 +6,7 @@ import type { ManagerLogEntry } from '@opencode-manager/shared/schemas'
import { SettingsDialog } from './SettingsDialog'
import { logsApi } from '@/api/logs'
import { DEFAULTS } from '@/config'
import { DESKTOP_MEDIA_QUERY } from '@/hooks/useMediaQuery'
import { stubMatchMedia } from '@/test/test-utils'
vi.mock('@/api/logs', () => ({
logsApi: {
@@ -48,25 +48,6 @@ function makeResponse(entries: ManagerLogEntry[]) {
}
}
function stubMatchMedia(matches: boolean): void {
const listeners = new Set<() => void>()
const mediaQueryList = {
media: DESKTOP_MEDIA_QUERY,
matches,
addEventListener: (_type: string, listener: () => void) => {
listeners.add(listener)
},
removeEventListener: (_type: string, listener: () => void) => {
listeners.delete(listener)
},
}
Object.defineProperty(window, 'matchMedia', {
configurable: true,
writable: true,
value: () => mediaQueryList,
})
}
function createWrapper() {
const queryClient = new QueryClient({
defaultOptions: {
@@ -254,12 +254,12 @@ export function TTSSettings() {
)}
{saveStatus === 'saved' && (
<>
<CheckCircle2 className="h-4 w-4 text-green-500" />
<span className="text-green-600">Saved</span>
<CheckCircle2 className="h-4 w-4 text-success" />
<span className="text-success">Saved</span>
</>
)}
{saveStatus === 'idle' && isDirty && isValid && (
<span className="text-amber-600">Unsaved changes</span>
<span className="text-warning">Unsaved changes</span>
)}
{saveStatus === 'idle' && !isDirty && (
<span className="text-muted-foreground">All changes saved</span>
@@ -325,12 +325,12 @@ export function TTSSettings() {
}}
className={`flex flex-col items-center justify-center gap-2 rounded-lg border-2 p-4 transition ${
watchProvider === 'builtin'
? 'border-blue-500 bg-blue-50 dark:bg-blue-900/20'
: 'border-border hover:border-blue-300'
? 'border-primary bg-primary/10'
: 'border-border hover:border-primary/50'
}`}
>
<MonitorSpeaker className={`h-6 w-6 ${watchProvider === 'builtin' ? 'text-blue-600 dark:text-blue-400' : 'text-muted-foreground'}`} />
<span className={`font-medium ${watchProvider === 'builtin' ? 'text-blue-700 dark:text-blue-300' : ''}`}>
<MonitorSpeaker className={`h-6 w-6 ${watchProvider === 'builtin' ? 'text-primary' : 'text-muted-foreground'}`} />
<span className={`font-medium ${watchProvider === 'builtin' ? 'text-primary' : ''}`}>
Built-in Browser
</span>
<span className="text-xs text-muted-foreground text-center">
@@ -344,12 +344,12 @@ export function TTSSettings() {
}}
className={`flex flex-col items-center justify-center gap-2 rounded-lg border-2 p-4 transition ${
watchProvider === 'external'
? 'border-blue-500 bg-blue-50 dark:bg-blue-900/20'
: 'border-border hover:border-blue-300'
? 'border-primary bg-primary/10'
: 'border-border hover:border-primary/50'
}`}
>
<Globe className={`h-6 w-6 ${watchProvider === 'external' ? 'text-blue-600 dark:text-blue-400' : 'text-muted-foreground'}`} />
<span className={`font-medium ${watchProvider === 'external' ? 'text-blue-700 dark:text-blue-300' : ''}`}>
<Globe className={`h-6 w-6 ${watchProvider === 'external' ? 'text-primary' : 'text-muted-foreground'}`} />
<span className={`font-medium ${watchProvider === 'external' ? 'text-primary' : ''}`}>
External API
</span>
<span className="text-xs text-muted-foreground text-center">
@@ -565,8 +565,8 @@ export function TTSSettings() {
/>
{!hasWebSpeechSupport && (
<div className="rounded-lg bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 p-4">
<div className="text-sm text-yellow-800 dark:text-yellow-200">
<div className="rounded-lg bg-warning/10 border border-warning/20 p-4">
<div className="text-sm text-warning">
<strong>Browser Not Supported</strong>: Your browser doesn't support Web Speech API.
Please use Chrome, Safari, Firefox, or Edge, or switch to an external API provider.
</div>
@@ -84,7 +84,7 @@ export function VersionSelectDialog({ open, onOpenChange }: VersionSelectDialogP
)}
{error && (
<div className="text-center py-8 text-red-500">
<div className="text-center py-8 text-destructive">
Failed to fetch versions
</div>
)}
@@ -106,7 +106,7 @@ export function VersionSelectDialog({ open, onOpenChange }: VersionSelectDialogP
isSelected
? 'border-primary bg-primary/10'
: isCurrent
? 'border-green-500/50 bg-green-500/10 cursor-default'
? 'border-success/50 bg-success/10 cursor-default'
: 'border-border hover:border-primary/50 hover:bg-muted/50'
}`}
>
@@ -115,7 +115,7 @@ export function VersionSelectDialog({ open, onOpenChange }: VersionSelectDialogP
<div className="font-medium flex items-center gap-2">
v{release.version}
{isCurrent && (
<span className="text-xs px-1.5 py-0.5 rounded bg-green-500/20 text-green-600 dark:text-green-400">
<span className="text-xs px-1.5 py-0.5 rounded bg-success/20 text-success">
Current
</span>
)}
@@ -108,7 +108,7 @@ export function SkillLibraryList({
<SettingsListRow
key={getSkillKey(skill)}
title={skill.name}
titleClassName="text-orange-600 dark:text-orange-400"
titleClassName="text-highlight"
description={skill.description}
onClick={primaryAction ? () => primaryAction.onClick(skill) : undefined}
primaryAction={primaryAction ? { label: primaryAction.label, onClick: () => primaryAction.onClick(skill) } : undefined}
@@ -207,7 +207,7 @@ export function BranchesTab({ repoId, currentBranch }: BranchesTabProps) {
key={branch.name}
className={cn(
'flex items-center gap-2 px-3 py-2 w-full text-left transition-colors',
isCurrent && 'bg-orange-500/10',
isCurrent && 'bg-highlight/10',
isCheckedOutElsewhere ? 'opacity-60 cursor-not-allowed' : 'hover:bg-accent/50'
)}
onClick={handleClick}
@@ -215,13 +215,13 @@ export function BranchesTab({ repoId, currentBranch }: BranchesTabProps) {
title={isCheckedOutElsewhere ? 'Branch is checked out in another worktree' : undefined}
>
{isRemote ? (
<Globe className="w-4 h-4 text-blue-500" />
<Globe className="w-4 h-4 text-info" />
) : (
<GitBranch className={cn('w-4 h-4', isCurrent ? GIT_UI_COLORS.current : 'text-muted-foreground')} />
)}
<span className="flex-1 text-sm truncate">{branch.name}</span>
{(isCheckedOutElsewhere || (isCurrent && isRepoWorktree)) && (
<span className="text-[10px] px-1.5 py-0.5 rounded bg-purple-500/20 text-purple-400">worktree</span>
<span className="text-[10px] px-1.5 py-0.5 rounded bg-primary/20 text-primary">worktree</span>
)}
{branch.type === 'local' && !branch.upstream && !branch.isWorktree && !(isCurrent && isRepoWorktree) && (
<span className="text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground">local</span>
@@ -70,10 +70,10 @@ export function GitFlatFileItem({ file, isSelected, onSelect, onStage, onUnstage
{(file.additions !== undefined || file.deletions !== undefined) && (
<div className="flex items-center gap-1 text-xs flex-shrink-0">
{file.additions !== undefined && file.additions > 0 && (
<span className="text-green-500">+{file.additions}</span>
<span className="text-diff-add">+{file.additions}</span>
)}
{file.deletions !== undefined && file.deletions > 0 && (
<span className="text-red-500">-{file.deletions}</span>
<span className="text-diff-delete">-{file.deletions}</span>
)}
</div>
)}
@@ -99,7 +99,7 @@ export function GitFlatFileItem({ file, isSelected, onSelect, onStage, onUnstage
onClick={handleDiscard}
title="Discard changes"
>
<RotateCcw className="w-3 h-3 text-rose-500" />
<RotateCcw className="w-3 h-3 text-destructive" />
</Button>
)}
</div>
@@ -110,8 +110,8 @@ export function GitFlatFileList({
</span>
{(totalAdditions !== undefined && totalAdditions > 0 || totalDeletions !== undefined && totalDeletions > 0) && (
<div className="flex items-center gap-1 text-xs">
{totalAdditions !== undefined && totalAdditions > 0 && <span className="text-green-500">+{totalAdditions}</span>}
{totalDeletions !== undefined && totalDeletions > 0 && <span className="text-red-500">-{totalDeletions}</span>}
{totalAdditions !== undefined && totalAdditions > 0 && <span className="text-diff-add">+{totalAdditions}</span>}
{totalDeletions !== undefined && totalDeletions > 0 && <span className="text-diff-delete">-{totalDeletions}</span>}
</div>
)}
{!readOnly && (
@@ -120,7 +120,7 @@ export function GitFlatFileList({
<Button
variant="ghost"
size="sm"
className="h-6 px-2 text-xs text-rose-500 hover:text-rose-600"
className="h-6 px-2 text-xs text-destructive hover:text-destructive/90"
onClick={handleDiscardAll}
>
Discard All
@@ -91,7 +91,7 @@ export function SSHHostKeyDialog({
<DialogTitle className="flex items-center gap-2 flex-wrap">
<WarningIcon className={cn(
"h-5 w-5",
request.isKeyChanged ? "text-red-500" : "text-amber-500"
request.isKeyChanged ? "text-destructive" : "text-warning"
)} />
<span>{request.isKeyChanged ? 'Host Key Changed' : 'Verify SSH Host Key'}</span>
</DialogTitle>
@@ -137,7 +137,7 @@ export function SSHHostKeyDialog({
<div className="text-xs text-muted-foreground">
<div className="flex justify-between">
<span>Auto-reject in:</span>
<span className={cn("font-mono", isExpired && "text-red-500")}>
<span className={cn("font-mono", isExpired && "text-destructive")}>
{isExpired ? 'Expired' : formatTime(timeRemaining)}
</span>
</div>
+1 -1
View File
@@ -17,7 +17,7 @@ export function BackButton({ to = "/", className = "" }: BackButtonProps) {
<button
onClick={handleBack}
aria-label="Go back"
className={`text-zinc-400 hover:text-zinc-100 transition-all duration-200 hover:scale-105 text-sm md:text-md border border-zinc-700 rounded-md px-3 py-1.5 hover ${className}`}
className={`text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 text-sm md:text-md border border-border rounded-md px-3 py-1.5 hover ${className}`}
>
<ArrowLeft className="w-4 h-4" />
</button>
+1 -1
View File
@@ -11,7 +11,7 @@ const buttonVariants = cva(
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
secondary:
+2 -2
View File
@@ -94,8 +94,8 @@ const EditorRow = memo(function EditorRow({
data-active-match={h.first && h.index === activeHighlightIndex ? 'true' : undefined}
className={
h.index === activeHighlightIndex
? 'rounded-sm bg-orange-400 text-black'
: 'rounded-sm bg-yellow-300/60 text-black'
? 'rounded-sm bg-highlight text-highlight-foreground'
: 'rounded-sm bg-warning/60 text-warning-foreground'
}
>
{line.substring(h.start, h.end)}
@@ -59,7 +59,7 @@ export function ConfirmDestructiveDialog({
variant="destructive"
onClick={onConfirm}
disabled={isPending}
className="flex-1 sm:flex-none bg-red-600 hover:bg-red-700 text-white font-semibold border-red-600"
className="flex-1 sm:flex-none bg-destructive hover:bg-destructive/90 text-destructive-foreground font-semibold border-destructive"
>
{isPending && pendingLabel ? pendingLabel : confirmLabel}
</Button>
+2 -2
View File
@@ -64,9 +64,9 @@ export function CopyButton({
title={copied ? 'Copied!' : title}
>
{copied ? (
<Check className={cn(sizeClasses, 'text-green-500')} />
<Check className={cn(sizeClasses, 'text-success')} />
) : (
<Copy className={cn(sizeClasses, copied && 'text-green-500')} />
<Copy className={cn(sizeClasses, copied && 'text-success')} />
)}
</button>
)
+1 -1
View File
@@ -16,7 +16,7 @@ export function ErrorBanner({ title, summary, detail, onDismiss, className }: Er
<Alert className={cn('bg-card border-border border-l-[3px] border-l-destructive', className)}>
<div className="flex flex-col gap-2">
<div className="flex items-start gap-2">
<AlertCircle className="h-4 w-4 mt-0.5 flex-shrink-0 text-red-400" />
<AlertCircle className="h-4 w-4 mt-0.5 flex-shrink-0 text-destructive" />
<div className="flex-1 min-w-0">
{title && (
<AlertTitle className="mb-1 font-medium leading-none tracking-tight text-foreground">{title}</AlertTitle>
@@ -6,14 +6,14 @@ type BadgeColor = 'orange' | 'blue'
const colorStyles: Record<BadgeColor, { bg: string; hover: string; text: string }> = {
orange: {
bg: 'bg-orange-500/10',
hover: 'hover:bg-orange-500/20',
text: 'text-orange-500',
bg: 'bg-highlight/10',
hover: 'hover:bg-highlight/20',
text: 'text-highlight',
},
blue: {
bg: 'bg-blue-500/10',
hover: 'hover:bg-blue-500/20',
text: 'text-blue-500',
bg: 'bg-info/10',
hover: 'hover:bg-info/20',
text: 'text-info',
},
}
@@ -56,7 +56,7 @@ export function PendingActionBadge({
<span
className={cn(
'absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full animate-pulse',
color === 'orange' ? 'bg-orange-500' : 'bg-blue-500'
color === 'orange' ? 'bg-highlight' : 'bg-info'
)}
/>
</Button>
@@ -77,23 +77,23 @@ export const SessionStatusIndicator = memo(function SessionStatusIndicator({
const intensity = Math.max(0, 1 - distance / (maxDistance + 2))
if (statusType === 'retry') {
if (intensity > 0.8) return 'bg-amber-500'
if (intensity > 0.5) return 'bg-amber-500/70'
if (intensity > 0.2) return 'bg-amber-500/40'
return 'bg-amber-500/20'
if (intensity > 0.8) return 'bg-warning'
if (intensity > 0.5) return 'bg-warning/70'
if (intensity > 0.2) return 'bg-warning/40'
return 'bg-warning/20'
}
if (statusType === 'compact') {
if (intensity > 0.8) return 'bg-purple-500'
if (intensity > 0.5) return 'bg-purple-500/70'
if (intensity > 0.2) return 'bg-purple-500/40'
return 'bg-purple-500/20'
if (intensity > 0.8) return 'bg-primary'
if (intensity > 0.5) return 'bg-primary/70'
if (intensity > 0.2) return 'bg-primary/40'
return 'bg-primary/20'
}
if (intensity > 0.8) return 'bg-blue-500'
if (intensity > 0.5) return 'bg-blue-500/70'
if (intensity > 0.2) return 'bg-blue-500/40'
return 'bg-blue-500/20'
if (intensity > 0.8) return 'bg-info'
if (intensity > 0.5) return 'bg-info/70'
if (intensity > 0.2) return 'bg-info/40'
return 'bg-info/20'
}
const segmentClass = size === 'sm' ? 'w-0.5 h-2' : 'w-1 h-4'
@@ -112,7 +112,7 @@ export const SessionStatusIndicator = memo(function SessionStatusIndicator({
{showLabel && status.type === 'retry' && (
<span className="text-xs text-muted-foreground">
Retry #{status.attempt}
{retryCountdown > 0 && <span className="text-amber-500 ml-1">({retryCountdown}s)</span>}
{retryCountdown > 0 && <span className="text-warning ml-1">({retryCountdown}s)</span>}
</span>
)}
</div>
+2 -2
View File
@@ -62,7 +62,7 @@ export function SettingsList({
if (isLoading) {
return (
<div className="flex items-center justify-center py-8">
<Loader2 className="w-4 h-4 animate-spin text-blue-600 dark:text-blue-400" />
<Loader2 className="w-4 h-4 animate-spin text-primary" />
<span className="ml-2 text-sm text-muted-foreground">{loadingLabel ?? 'Loading...'}</span>
</div>
)
@@ -71,7 +71,7 @@ export function SettingsList({
if (error) {
return (
<div className="text-center py-6 text-muted-foreground">
<AlertCircle className="w-10 h-10 mx-auto mb-3 opacity-50 text-red-500" />
<AlertCircle className="w-10 h-10 mx-auto mb-3 opacity-50 text-destructive" />
<p className="text-sm">{errorTitle ?? 'Failed to load'}</p>
<p className="text-xs mt-1">{error.message}</p>
</div>
+2 -2
View File
@@ -179,8 +179,8 @@ export function SidebarCollapseToggle({ collapsed, onToggle }: SidebarCollapseTo
<span aria-hidden="true" className="relative flex items-center justify-center">
<span
className={cn(
'h-8 w-1 rounded-full bg-orange-500/60 transition-colors duration-150',
'group-hover:bg-orange-500 group-focus-visible:bg-orange-500'
'h-8 w-1 rounded-full bg-highlight/60 transition-colors duration-150',
'group-hover:bg-highlight group-focus-visible:bg-highlight'
)}
/>
<ChevronLeft
+2 -2
View File
@@ -9,7 +9,7 @@ const Switch = React.forwardRef<
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-gray-500 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-green-600 data-[state=checked]:border-green-500 data-[state=unchecked]:bg-gray-700",
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-success data-[state=checked]:border-success data-[state=unchecked]:bg-input",
className
)}
{...props}
@@ -17,7 +17,7 @@ const Switch = React.forwardRef<
>
<SwitchPrimitives.Thumb
className={cn(
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 disabled:bg-gray-400"
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 disabled:bg-muted"
)}
/>
</SwitchPrimitives.Root>
@@ -84,7 +84,7 @@ const VirtualizedLine = memo(function VirtualizedLine({
}: VirtualizedLineProps) {
return (
<div
className={`absolute flex overflow-hidden ${isHighlighted ? 'bg-yellow-500/30' : 'bg-background'}`}
className={`absolute flex overflow-hidden ${isHighlighted ? 'bg-warning/30' : 'bg-background'}`}
style={{
transform: `translate3d(0, ${top}px, 0)`,
height,
@@ -112,7 +112,7 @@ const VirtualizedLine = memo(function VirtualizedLine({
value={content}
onChange={(e) => onLineChange(lineNum, e.target.value)}
className={`flex-1 bg-transparent outline-none pl-2 text-[16px] md:text-sm ${
isEdited ? 'bg-yellow-500/10' : ''
isEdited ? 'bg-warning/10' : ''
} ${
lineWrap ? 'whitespace-pre-wrap break-all' : 'whitespace-pre'
}`}
+43
View File
@@ -0,0 +1,43 @@
/* eslint-disable react-refresh/only-export-components */
import { createContext, useContext, useEffect, useState } from 'react'
import { useSettings } from '@/hooks/useSettings'
import { applyColorTheme, getDocumentThemeMode, type ThemeMode } from '@/lib/theme/colorTheme'
const ThemeContext = createContext<ThemeMode | null>(null)
export function ThemeProvider({ children }: { children: React.ReactNode }) {
const { preferences } = useSettings()
const [themeMode, setThemeMode] = useState<ThemeMode>(getDocumentThemeMode)
const hasPreferences = preferences !== undefined
const theme = preferences?.theme || 'dark'
const colorTheme = preferences?.colorTheme
useEffect(() => {
if (!hasPreferences) return
const root = document.documentElement
const applyTheme = (isDark: boolean) => {
root.classList.toggle('dark', isDark)
setThemeMode(isDark ? 'dark' : 'light')
applyColorTheme(root, colorTheme, isDark)
}
if (theme === 'system') {
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
applyTheme(mediaQuery.matches)
const listener = (event: MediaQueryListEvent) => applyTheme(event.matches)
mediaQuery.addEventListener('change', listener)
return () => mediaQuery.removeEventListener('change', listener)
}
applyTheme(theme === 'dark')
}, [hasPreferences, theme, colorTheme])
return <ThemeContext.Provider value={themeMode}>{children}</ThemeContext.Provider>
}
export function useThemeMode(): ThemeMode | null {
return useContext(ThemeContext)
}
+134
View File
@@ -0,0 +1,134 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { act, render, renderHook } from '@testing-library/react'
import type { ReactNode } from 'react'
import { useTheme } from './useTheme'
import { ThemeProvider } from '@/contexts/ThemeContext'
import { useSettings } from './useSettings'
import { APPEARANCE_STORAGE_KEY } from '@/lib/theme/colorTheme'
import type { UserPreferences } from '@/api/types/settings'
import { createUseSettingsMock, stubMatchMedia } from '@/test/test-utils'
vi.mock('@/hooks/useSettings')
function mockPreferences(preferences: Partial<UserPreferences> | undefined) {
vi.mocked(useSettings).mockReturnValue(
createUseSettingsMock({ preferences: preferences as UserPreferences | undefined }),
)
}
function createWrapper() {
return function Wrapper({ children }: { children: ReactNode }) {
return <ThemeProvider>{children}</ThemeProvider>
}
}
function Consumer() {
useTheme()
return null
}
describe('useTheme', () => {
beforeEach(() => {
document.documentElement.className = ''
document.documentElement.removeAttribute('style')
window.localStorage.clear()
})
afterEach(() => {
document.documentElement.className = ''
document.documentElement.removeAttribute('style')
Reflect.deleteProperty(window, 'matchMedia')
vi.clearAllMocks()
})
it('applies the dark Dracula palette and reports dark', () => {
mockPreferences({ theme: 'dark', colorTheme: 'dracula' })
const { result } = renderHook(() => useTheme(), { wrapper: createWrapper() })
expect(document.documentElement.classList.contains('dark')).toBe(true)
expect(document.documentElement.style.getPropertyValue('--color-background')).toBe('#1d1e28')
expect(result.current).toBe('dark')
})
it('applies the light Dracula palette and reports light', () => {
mockPreferences({ theme: 'light', colorTheme: 'dracula' })
const { result } = renderHook(() => useTheme(), { wrapper: createWrapper() })
expect(document.documentElement.classList.contains('dark')).toBe(false)
expect(document.documentElement.style.getPropertyValue('--color-background')).toBe('#f8f8f2')
expect(result.current).toBe('light')
})
it('clears palette overrides when the manager theme is selected', () => {
mockPreferences({ theme: 'dark', colorTheme: 'dracula' })
const { rerender } = renderHook(() => useTheme(), { wrapper: createWrapper() })
expect(document.documentElement.style.getPropertyValue('--color-background')).toBe('#1d1e28')
mockPreferences({ theme: 'dark', colorTheme: 'manager' })
rerender()
expect(document.documentElement.style.getPropertyValue('--color-background')).toBe('')
})
it('follows the system color scheme and updates when it changes', () => {
const { mediaQueryList, listeners } = stubMatchMedia(false)
mockPreferences({ theme: 'system', colorTheme: 'dracula' })
renderHook(() => useTheme(), { wrapper: createWrapper() })
expect(document.documentElement.style.getPropertyValue('--color-background')).toBe('#f8f8f2')
act(() => {
mediaQueryList.matches = true
listeners.forEach((listener) => listener({ matches: true } as MediaQueryListEvent))
})
expect(document.documentElement.style.getPropertyValue('--color-background')).toBe('#1d1e28')
})
it('registers a single matchMedia listener for multiple consumers under one provider', () => {
const { listeners } = stubMatchMedia(false)
mockPreferences({ theme: 'system', colorTheme: 'dracula' })
render(
<ThemeProvider>
<Consumer />
<Consumer />
</ThemeProvider>,
)
expect(listeners.size).toBe(1)
})
it('falls back to the document mode outside a provider', () => {
document.documentElement.classList.add('dark')
const dark = renderHook(() => useTheme())
expect(dark.result.current).toBe('dark')
document.documentElement.classList.remove('dark')
const light = renderHook(() => useTheme())
expect(light.result.current).toBe('light')
})
it('keeps the boot-replayed appearance while preferences are loading', () => {
document.documentElement.style.setProperty('--color-background', '#1d1e28')
window.localStorage.setItem(APPEARANCE_STORAGE_KEY, 'replayed')
mockPreferences(undefined)
const { result } = renderHook(() => useTheme(), { wrapper: createWrapper() })
expect(result.current).toBe('light')
expect(document.documentElement.style.getPropertyValue('--color-background')).toBe('#1d1e28')
expect(window.localStorage.getItem(APPEARANCE_STORAGE_KEY)).toBe('replayed')
})
it('persists the appearance snapshot through the provider', () => {
mockPreferences({ theme: 'dark', colorTheme: 'dracula' })
renderHook(() => useTheme(), { wrapper: createWrapper() })
expect(window.localStorage.getItem(APPEARANCE_STORAGE_KEY)).not.toBeNull()
})
})
+5 -33
View File
@@ -1,35 +1,7 @@
import { useEffect, useState } from 'react'
import { useSettings } from './useSettings'
import { useThemeMode } from '@/contexts/ThemeContext'
import { getDocumentThemeMode } from '@/lib/theme/colorTheme'
export function useTheme() {
const { preferences } = useSettings()
const [currentTheme, setCurrentTheme] = useState<'light' | 'dark'>('dark')
useEffect(() => {
const theme = preferences?.theme || 'dark'
const root = document.documentElement
const applyTheme = (isDark: boolean) => {
if (isDark) {
root.classList.add('dark')
setCurrentTheme('dark')
} else {
root.classList.remove('dark')
setCurrentTheme('light')
}
}
if (theme === 'system') {
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
applyTheme(mediaQuery.matches)
const listener = (e: MediaQueryListEvent) => applyTheme(e.matches)
mediaQuery.addEventListener('change', listener)
return () => mediaQuery.removeEventListener('change', listener)
} else {
applyTheme(theme === 'dark')
}
}, [preferences?.theme])
return currentTheme
export function useTheme(): 'light' | 'dark' {
const contextMode = useThemeMode()
return contextMode ?? getDocumentThemeMode()
}
+39 -33
View File
@@ -2,6 +2,7 @@
@theme {
--color-background: #0a0a0a;
--color-background-gradient: #0d0d0d;
--color-foreground: #fafafa;
--color-card: #141414;
--color-card-hover: #1a1a1a;
@@ -15,13 +16,29 @@
--color-muted: #18181b;
--color-popover: #18181b;
--color-destructive: #dc2626;
--color-destructive-foreground: #ffffff;
--color-secondary: #27272a;
--color-secondary-foreground: #fafafa;
--color-accent-foreground: #fafafa;
--color-success: #34d399;
--color-success-foreground: #ffffff;
--color-warning: #fbbf24;
--color-warning-foreground: #0a0a0a;
--color-info: #60a5fa;
--color-info-foreground: #ffffff;
--color-highlight: #fb923c;
--color-highlight-foreground: #ffffff;
--color-diff-add: #22c55e;
--color-diff-delete: #ef4444;
--color-agent-plan: #edb2f1;
--color-agent-build: #89b5ff;
--color-agent-docs: #ffb224;
--color-agent-ask: #0091ff;
}
:root:not(.dark) {
--color-background: #ffffff;
--color-background-gradient: #f0f0f0;
--color-foreground: #111827;
--color-card: #f9fafb;
--color-card-hover: #f3f4f6;
@@ -35,23 +52,34 @@
--color-muted: #f4f4f5;
--color-popover: #ffffff;
--color-destructive: #dc2626;
--color-destructive-foreground: #ffffff;
--color-secondary: #f4f4f5;
--color-secondary-foreground: #111827;
--color-accent-foreground: #111827;
--color-success: #059669;
--color-success-foreground: #ffffff;
--color-warning: #d97706;
--color-warning-foreground: #ffffff;
--color-info: #2563eb;
--color-info-foreground: #ffffff;
--color-highlight: #ea580c;
--color-highlight-foreground: #ffffff;
--color-diff-add: #16a34a;
--color-diff-delete: #dc2626;
--color-agent-plan: #a753ae;
--color-agent-build: #034cff;
--color-agent-docs: #ffb224;
--color-agent-ask: #0091ff;
}
html {
background-color: #0a0a0a;
background-color: var(--color-background);
min-height: calc(100% + env(safe-area-inset-top));
overscroll-behavior-x: none;
}
:root:not(.dark) html {
background-color: #ffffff;
}
body {
background: linear-gradient(to bottom right, #0a0a0a, #0d0d0d, #0a0a0a);
background: linear-gradient(to bottom right, var(--color-background), var(--color-background-gradient), var(--color-background));
color: var(--color-foreground);
transition: background-color 0.3s ease, color 0.3s ease;
min-height: 100vh;
@@ -68,15 +96,6 @@ body {
overflow: hidden;
}
:root:not(.dark) body {
background: linear-gradient(to bottom right, #ffffff, #f0f0f0, #ffffff);
min-height: 100vh;
min-height: 100dvh;
overflow: hidden;
position: fixed;
width: 100%;
}
/* Custom animations */
@keyframes spin {
to {
@@ -208,40 +227,27 @@ body {
}
.prose-enhanced a {
color: #60a5fa;
color: var(--color-info);
text-decoration: none;
}
.dark .prose-enhanced a {
color: #60a5fa;
}
.prose-enhanced a:hover {
color: #93c5fd;
color: color-mix(in oklab, var(--color-info) 80%, var(--color-foreground));
text-decoration: underline;
}
.prose-enhanced hr {
margin-top: 2em;
margin-bottom: 2em;
border-color: #d0d0d0;
}
.dark .prose-enhanced hr {
border-color: #3f3f46;
border-color: var(--color-border);
}
.prose-enhanced blockquote {
margin-top: 1em;
margin-bottom: 1em;
padding-left: 1em;
border-left: 3px solid #d0d0d0;
color: #6b7280;
}
.dark .prose-enhanced blockquote {
border-left: 3px solid #3f3f46;
color: #a1a1aa;
border-left: 3px solid var(--color-border);
color: var(--color-muted-foreground);
}
.prose-enhanced pre {
+65
View File
@@ -0,0 +1,65 @@
import { describe, expect, it } from 'vitest'
import { getAgentStyleVars } from './agent-colors'
const themeNameCases: Array<[string, string]> = [
['primary', 'var(--color-primary)'],
['secondary', 'var(--color-foreground)'],
['accent', 'var(--color-info)'],
['success', 'var(--color-success)'],
['warning', 'var(--color-warning)'],
['error', 'var(--color-destructive)'],
['info', 'var(--color-info)'],
]
describe('getAgentStyleVars', () => {
it('uses a six-digit hex api color as-is', () => {
const vars = getAgentStyleVars('plan', '#123abc')
expect(vars['--agent-color']).toBe('#123abc')
expect(vars['--agent-bg']).toBe('color-mix(in oklab, #123abc 20%, transparent)')
})
it.each(themeNameCases)('maps the %s theme name to %s', (name, expected) => {
expect(getAgentStyleVars('custom', name)['--agent-color']).toBe(expected)
})
it('maps theme names case-insensitively', () => {
expect(getAgentStyleVars('custom', 'PRIMARY')['--agent-color']).toBe('var(--color-primary)')
})
it.each(['plan', 'build', 'docs', 'ask'])('maps the %s default agent name to its token', (name) => {
expect(getAgentStyleVars(name)['--agent-color']).toBe(`var(--color-agent-${name})`)
})
it('maps default agent names case-insensitively', () => {
expect(getAgentStyleVars('PLAN')['--agent-color']).toBe('var(--color-agent-plan)')
expect(getAgentStyleVars('Build')['--agent-color']).toBe('var(--color-agent-build)')
})
it('falls back to the muted foreground for unknown agents', () => {
expect(getAgentStyleVars('unknown')['--agent-color']).toBe('var(--color-muted-foreground)')
})
it('derives the alpha variants from the resolved color', () => {
const vars = getAgentStyleVars('plan')
expect(vars['--agent-bg']).toBe('color-mix(in oklab, var(--color-agent-plan) 20%, transparent)')
expect(vars['--agent-bg-hover']).toBe('color-mix(in oklab, var(--color-agent-plan) 30%, transparent)')
expect(vars['--agent-border']).toBe('color-mix(in oklab, var(--color-agent-plan) 60%, transparent)')
expect(vars['--agent-border-hover']).toBe('color-mix(in oklab, var(--color-agent-plan) 50%, transparent)')
expect(vars['--agent-shadow']).toBe('color-mix(in oklab, var(--color-agent-plan) 20%, transparent)')
expect(vars['--agent-shadow-hover']).toBe('color-mix(in oklab, var(--color-agent-plan) 30%, transparent)')
})
it('returns only the mode-independent vars', () => {
expect(Object.keys(getAgentStyleVars('plan')).sort()).toEqual([
'--agent-bg',
'--agent-bg-hover',
'--agent-border',
'--agent-border-hover',
'--agent-color',
'--agent-shadow',
'--agent-shadow-hover',
])
})
})
+32 -71
View File
@@ -1,48 +1,37 @@
function hexToRgb(hex: string): { r: number; g: number; b: number } | null {
const cleanHex = hex.replace(/^#/, '')
if (cleanHex.length !== 6) {
return null
}
const result = /^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(cleanHex)
if (!result) {
return null
}
return {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16),
}
const THEME_NAME_TOKENS: Record<string, string> = {
primary: 'var(--color-primary)',
secondary: 'var(--color-foreground)',
accent: 'var(--color-info)',
success: 'var(--color-success)',
warning: 'var(--color-warning)',
error: 'var(--color-destructive)',
info: 'var(--color-info)',
}
const DEFAULT_AGENT_COLORS: Record<string, { light: string; dark: string }> = {
plan: { light: '#a753ae', dark: '#edb2f1' },
build: { light: '#034cff', dark: '#89b5ff' },
docs: { light: '#ffb224', dark: '#ffb224' },
ask: { light: '#0091ff', dark: '#0091ff' },
}
const DEFAULT_AGENT_NAMES = new Set(['plan', 'build', 'docs', 'ask'])
const FALLBACK_COLOR = { light: '#6b7280', dark: '#9ca3af' }
const FALLBACK_COLOR = 'var(--color-muted-foreground)'
function isValidHex(color: string | undefined): color is string {
function isValidHex(color: string | undefined): boolean {
if (!color) return false
return /^#[0-9A-Fa-f]{6}$/.test(color)
}
function getAgentColor(
agentName: string,
apiColor?: string
): { light: string; dark: string } {
if (isValidHex(apiColor)) {
return { light: apiColor, dark: apiColor }
function resolveAgentColor(agentName: string, apiColor?: string): string {
if (isValidHex(apiColor) && apiColor) {
return apiColor
}
if (apiColor) {
const themeToken = THEME_NAME_TOKENS[apiColor.toLowerCase()]
if (themeToken) {
return themeToken
}
}
const lookupName = agentName.toLowerCase()
const defaultColor = DEFAULT_AGENT_COLORS[lookupName]
if (defaultColor) {
return defaultColor
if (DEFAULT_AGENT_NAMES.has(lookupName)) {
return `var(--color-agent-${lookupName})`
}
return FALLBACK_COLOR
@@ -52,44 +41,16 @@ export function getAgentStyleVars(
agentName: string,
apiColor?: string
): Record<string, string> {
const colors = getAgentColor(agentName, apiColor)
const lightRgb = hexToRgb(colors.light)
const darkRgb = hexToRgb(colors.dark)
const fallbackLight = FALLBACK_COLOR.light
const fallbackDark = FALLBACK_COLOR.dark
const lightVars = lightRgb
? {
r: lightRgb.r,
g: lightRgb.g,
b: lightRgb.b,
}
: hexToRgb(fallbackLight)!
const darkVars = darkRgb
? {
r: darkRgb.r,
g: darkRgb.g,
b: darkRgb.b,
}
: hexToRgb(fallbackDark)!
const color = resolveAgentColor(agentName, apiColor)
const mix = (percent: number) => `color-mix(in oklab, ${color} ${percent}%, transparent)`
return {
'--agent-color-light': colors.light,
'--agent-color-dark': colors.dark,
'--agent-bg-light': `rgba(${lightVars.r}, ${lightVars.g}, ${lightVars.b}, 0.2)`,
'--agent-bg-dark': `rgba(${darkVars.r}, ${darkVars.g}, ${darkVars.b}, 0.2)`,
'--agent-bg-hover-light': `rgba(${lightVars.r}, ${lightVars.g}, ${lightVars.b}, 0.3)`,
'--agent-bg-hover-dark': `rgba(${darkVars.r}, ${darkVars.g}, ${darkVars.b}, 0.3)`,
'--agent-border-light': `rgba(${lightVars.r}, ${lightVars.g}, ${lightVars.b}, 0.6)`,
'--agent-border-dark': `rgba(${darkVars.r}, ${darkVars.g}, ${darkVars.b}, 0.6)`,
'--agent-border-hover-light': `rgba(${lightVars.r}, ${lightVars.g}, ${lightVars.b}, 0.5)`,
'--agent-border-hover-dark': `rgba(${darkVars.r}, ${darkVars.g}, ${darkVars.b}, 0.5)`,
'--agent-shadow-light': `rgba(${lightVars.r}, ${lightVars.g}, ${lightVars.b}, 0.2)`,
'--agent-shadow-dark': `rgba(${darkVars.r}, ${darkVars.g}, ${darkVars.b}, 0.2)`,
'--agent-shadow-hover-light': `rgba(${lightVars.r}, ${lightVars.g}, ${lightVars.b}, 0.3)`,
'--agent-shadow-hover-dark': `rgba(${darkVars.r}, ${darkVars.g}, ${darkVars.b}, 0.3)`,
'--agent-color': color,
'--agent-bg': mix(20),
'--agent-bg-hover': mix(30),
'--agent-border': mix(60),
'--agent-border-hover': mix(50),
'--agent-shadow': mix(20),
'--agent-shadow-hover': mix(30),
}
}
+15 -15
View File
@@ -1,22 +1,22 @@
export const GIT_STATUS_COLORS = {
modified: 'text-amber-600 dark:text-amber-400',
added: 'text-emerald-600 dark:text-emerald-400',
deleted: 'text-rose-600 dark:text-rose-400',
renamed: 'text-blue-600 dark:text-blue-400',
untracked: 'text-gray-500 dark:text-gray-400',
copied: 'text-emerald-600 dark:text-emerald-400',
modified: 'text-warning',
added: 'text-success',
deleted: 'text-destructive',
renamed: 'text-info',
untracked: 'text-muted-foreground',
copied: 'text-success',
} as const
export const GIT_UI_COLORS = {
ahead: 'text-emerald-600 dark:text-emerald-400',
behind: 'text-amber-600 dark:text-amber-400',
current: 'text-orange-600 dark:text-orange-400',
remote: 'text-blue-600 dark:text-blue-400',
stage: 'text-emerald-600 dark:text-emerald-400',
unstage: 'text-rose-600 dark:text-rose-400',
stagedBadge: 'bg-emerald-500/10 text-emerald-600 dark:bg-emerald-500/20 dark:text-emerald-400',
unpushed: 'bg-blue-500/10 text-blue-600 dark:bg-blue-500/20 dark:text-blue-400',
pushed: 'bg-purple-500/10 text-purple-600 dark:bg-purple-500/20 dark:text-purple-400',
ahead: 'text-success',
behind: 'text-warning',
current: 'text-highlight',
remote: 'text-info',
stage: 'text-success',
unstage: 'text-destructive',
stagedBadge: 'bg-success/10 text-success dark:bg-success/20',
unpushed: 'bg-info/10 text-info dark:bg-info/20',
pushed: 'bg-primary/10 text-primary dark:bg-primary/20',
} as const
export const GIT_STATUS_LABELS = {
Loaded 100 of 116 files, more files were not shown because too many files have changed in this diff. Show more