The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 20:45 UTC
refactor(web): the appearance settings page lives in its own file (#22668)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 21, 2026 at 01:39 UTC
501f5c5757c6e5b60e59b9756c125e37154909d0
3 files changed
+439
-424
apps/web/src/components/settings/AppearanceSettingsPanel.tsx
new
+438
@@ -0,0 +1,438 @@
1
+import type { CSSProperties } from "react";
2
+import { useState } from "react";
3
+import {
4
+ DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE,
5
+ DEFAULT_UNIFIED_SETTINGS,
6
+ type ChatWidth,
7
+ type EnvironmentIdentificationMode,
8
+ MAX_APPEARANCE_CONTRAST,
9
+ MAX_GLASS_OPACITY,
10
+ MAX_PANEL_ANIMATION_DURATION_MS,
11
+ MIN_APPEARANCE_CONTRAST,
12
+ MIN_GLASS_OPACITY,
13
+ MIN_PANEL_ANIMATION_DURATION_MS,
14
+} from "@t3tools/contracts/settings";
15
+import {
16
+ resolveEnvironmentIdentificationPillLabel,
17
+ useEnvironmentStageLabel,
18
+} from "../SidebarStageBackdrop";
19
+import { useCustomThemes } from "../../hooks/useCustomThemes";
20
+import { useTheme } from "../../hooks/useTheme";
21
+import { useScopedSettings, useUpdateScopedSettings } from "./useScopedSettings";
22
+import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select";
23
+import { Switch } from "../ui/switch";
24
+import { ThemeLibrary } from "./ThemeSettings";
25
+import {
26
+ SettingResetButton,
27
+ SettingsPageContainer,
28
+ SettingsRow,
29
+ SettingsSection,
30
+} from "./settingsLayout";
31
+import { searchableSetting } from "./settingsSearch";
32
+import { PanelAnimationsPreview } from "./PanelAnimationsPreview";
33
+import { TypographySection } from "./TypographySettings";
34
+
35
+const ENVIRONMENT_IDENTIFICATION_LABELS: Record<EnvironmentIdentificationMode, string> = {
36
+ artwork: "Artwork",
37
+ pill: "Version pill",
38
+ none: "None",
39
+};
40
+
41
+const CHAT_WIDTH_LABELS: Record<ChatWidth, string> = {
42
+ comfortable: "Comfortable",
43
+ wide: "Wide",
44
+ full: "Full",
45
+};
46
+
47
+export function AppearanceSettingsPanel() {
48
+ const {
49
+ appearanceMode,
50
+ refreshTheme,
51
+ resolvedTheme,
52
+ setAppearanceMode,
53
+ setTheme,
54
+ setThemeHalf,
55
+ theme,
56
+ themeHalves,
57
+ } = useTheme();
58
+ const customThemes = useCustomThemes();
59
+ const [isImportThemeOpen, setIsImportThemeOpen] = useState(false);
60
+ const settings = useScopedSettings();
61
+ const updateSettings = useUpdateScopedSettings();
62
+ const environmentStageLabel = useEnvironmentStageLabel();
63
+ const showEnvironmentIdentification =
64
+ resolveEnvironmentIdentificationPillLabel(environmentStageLabel) !== null;
65
+ const glassOpacityRatio =
66
+ (settings.glassOpacity - MIN_GLASS_OPACITY) / (MAX_GLASS_OPACITY - MIN_GLASS_OPACITY);
67
+ const glassOpacitySliderStyle = {
68
+ "--settings-slider-progress": `${glassOpacityRatio * 100}%`,
69
+ "--settings-slider-fill-offset": `${0.5 - glassOpacityRatio}rem`,
70
+ } as CSSProperties;
71
+ const appearanceContrastRatio =
72
+ (settings.appearanceContrast - MIN_APPEARANCE_CONTRAST) /
73
+ (MAX_APPEARANCE_CONTRAST - MIN_APPEARANCE_CONTRAST);
74
+ const appearanceContrastSliderStyle = {
75
+ "--settings-slider-progress": `${appearanceContrastRatio * 100}%`,
76
+ "--settings-slider-fill-offset": `${0.5 - appearanceContrastRatio}rem`,
77
+ } as CSSProperties;
78
+ const panelAnimationDurationRatio =
79
+ (settings.panelAnimationDurationMs - MIN_PANEL_ANIMATION_DURATION_MS) /
80
+ (MAX_PANEL_ANIMATION_DURATION_MS - MIN_PANEL_ANIMATION_DURATION_MS);
81
+ const panelAnimationDurationSliderStyle = {
82
+ "--settings-slider-progress": `${panelAnimationDurationRatio * 100}%`,
83
+ "--settings-slider-fill-offset": `${0.5 - panelAnimationDurationRatio}rem`,
84
+ } as CSSProperties;
85
+
86
+ return (
87
+ <SettingsPageContainer>
88
+ <SettingsSection id="appearance" title="Colors & themes" variant="plain" hideTitle>
89
+ <div id={searchableSetting("theme").id}>
90
+ <ThemeLibrary
91
+ appearanceMode={appearanceMode}
92
+ customThemes={customThemes}
93
+ initialAppearance={resolvedTheme}
94
+ refreshTheme={refreshTheme}
95
+ isImportOpen={isImportThemeOpen}
96
+ setAppearanceMode={setAppearanceMode}
97
+ setTheme={setTheme}
98
+ setThemeHalf={setThemeHalf}
99
+ theme={theme}
100
+ themeHalves={themeHalves}
101
+ onImportOpenChange={setIsImportThemeOpen}
102
+ />
103
+ </div>
104
+ </SettingsSection>
105
+
106
+ <SettingsSection id="appearance-interface" title="Interface">
107
+ <SettingsRow
108
+ {...searchableSetting("setting-appearance-contrast")}
109
+ description="Adjust the contrast of colors and borders across the interface."
110
+ resetAction={
111
+ settings.appearanceContrast !== DEFAULT_UNIFIED_SETTINGS.appearanceContrast ? (
112
+ <SettingResetButton
113
+ label="contrast"
114
+ onClick={() =>
115
+ updateSettings({
116
+ appearanceContrast: DEFAULT_UNIFIED_SETTINGS.appearanceContrast,
117
+ })
118
+ }
119
+ />
120
+ ) : null
121
+ }
122
+ control={
123
+ <div className="flex w-full items-center gap-3 sm:w-52">
124
+ <output
125
+ className="min-w-12 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
126
+ htmlFor="appearance-contrast"
127
+ >
128
+ {settings.appearanceContrast}%
129
+ </output>
130
+ <input
131
+ aria-label="Contrast"
132
+ className="settings-slider min-w-0 flex-1"
133
+ id="appearance-contrast"
134
+ max={MAX_APPEARANCE_CONTRAST}
135
+ min={MIN_APPEARANCE_CONTRAST}
136
+ onChange={(event) => {
137
+ const appearanceContrast = Number(event.currentTarget.value);
138
+ if (
139
+ Number.isInteger(appearanceContrast) &&
140
+ appearanceContrast >= MIN_APPEARANCE_CONTRAST &&
141
+ appearanceContrast <= MAX_APPEARANCE_CONTRAST
142
+ ) {
143
+ updateSettings({ appearanceContrast });
144
+ }
145
+ }}
146
+ step={5}
147
+ style={appearanceContrastSliderStyle}
148
+ type="range"
149
+ value={settings.appearanceContrast}
150
+ />
151
+ </div>
152
+ }
153
+ />
154
+
155
+ <SettingsRow
156
+ {...searchableSetting("setting-glass-opacity")}
157
+ description="Higher values make menus, dialogs, and the composer more solid."
158
+ resetAction={
159
+ settings.glassOpacity !== DEFAULT_UNIFIED_SETTINGS.glassOpacity ? (
160
+ <SettingResetButton
161
+ label="glass opacity"
162
+ onClick={() =>
163
+ updateSettings({ glassOpacity: DEFAULT_UNIFIED_SETTINGS.glassOpacity })
164
+ }
165
+ />
166
+ ) : null
167
+ }
168
+ control={
169
+ <div className="flex w-full items-center gap-3 sm:w-52">
170
+ <output
171
+ className="min-w-12 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
172
+ htmlFor="glass-opacity"
173
+ >
174
+ {settings.glassOpacity}%
175
+ </output>
176
+ <input
177
+ aria-label="Glass opacity"
178
+ className="settings-slider min-w-0 flex-1"
179
+ id="glass-opacity"
180
+ max={MAX_GLASS_OPACITY}
181
+ min={MIN_GLASS_OPACITY}
182
+ onChange={(event) => {
183
+ const glassOpacity = Number(event.currentTarget.value);
184
+ if (
185
+ Number.isInteger(glassOpacity) &&
186
+ glassOpacity >= MIN_GLASS_OPACITY &&
187
+ glassOpacity <= MAX_GLASS_OPACITY
188
+ ) {
189
+ updateSettings({ glassOpacity });
190
+ }
191
+ }}
192
+ step={5}
193
+ style={glassOpacitySliderStyle}
194
+ type="range"
195
+ value={settings.glassOpacity}
196
+ />
197
+ </div>
198
+ }
199
+ />
200
+
201
+ {showEnvironmentIdentification ? (
202
+ <SettingsRow
203
+ {...searchableSetting("environment-identification")}
204
+ description="Choose how Dev and Nightly environments are identified."
205
+ resetAction={
206
+ settings.environmentIdentificationMode !== DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE ? (
207
+ <SettingResetButton
208
+ label="environment identification"
209
+ onClick={() =>
210
+ updateSettings({
211
+ environmentIdentificationMode: DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE,
212
+ })
213
+ }
214
+ />
215
+ ) : null
216
+ }
217
+ control={
218
+ <Select
219
+ value={settings.environmentIdentificationMode}
220
+ onValueChange={(value) => {
221
+ if (value === "artwork" || value === "pill" || value === "none") {
222
+ updateSettings({ environmentIdentificationMode: value });
223
+ }
224
+ }}
225
+ >
226
+ <SelectTrigger
227
+ size="sm"
228
+ className="w-full sm:w-40"
229
+ aria-label="Environment identification"
230
+ >
231
+ <SelectValue>
232
+ {ENVIRONMENT_IDENTIFICATION_LABELS[settings.environmentIdentificationMode]}
233
+ </SelectValue>
234
+ </SelectTrigger>
235
+ <SelectPopup align="end" alignItemWithTrigger={false}>
236
+ {Object.entries(ENVIRONMENT_IDENTIFICATION_LABELS).map(([value, label]) => (
237
+ <SelectItem hideIndicator key={value} value={value}>
238
+ {label}
239
+ </SelectItem>
240
+ ))}
241
+ </SelectPopup>
242
+ </Select>
243
+ }
244
+ />
245
+ ) : null}
246
+
247
+ <SettingsRow
248
+ {...searchableSetting("diff-color-scheme")}
249
+ description="Choose colors for additions and deletions, including change counts."
250
+ resetAction={
251
+ settings.diffColorScheme !== DEFAULT_UNIFIED_SETTINGS.diffColorScheme ? (
252
+ <SettingResetButton
253
+ label="diff colors"
254
+ onClick={() =>
255
+ updateSettings({ diffColorScheme: DEFAULT_UNIFIED_SETTINGS.diffColorScheme })
256
+ }
257
+ />
258
+ ) : null
259
+ }
260
+ control={
261
+ <div className="w-full sm:w-40">
262
+ <Select
263
+ value={settings.diffColorScheme}
264
+ onValueChange={(value) => {
265
+ if (value === "red-green" || value === "blue-orange")
266
+ updateSettings({ diffColorScheme: value });
267
+ }}
268
+ >
269
+ <SelectTrigger size="sm" className="w-full min-w-0" aria-label="Diff colors">
270
+ <span
271
+ aria-hidden="true"
272
+ className={
273
+ settings.diffColorScheme === "blue-orange"
274
+ ? "flex shrink-0 flex-row-reverse gap-1"
275
+ : "flex shrink-0 gap-1"
276
+ }
277
+ >
278
+ <span className="size-2 rounded-full bg-diff-deletion" />
279
+ <span className="size-2 rounded-full bg-diff-addition" />
280
+ </span>
281
+ <SelectValue>
282
+ {settings.diffColorScheme === "blue-orange" ? "Blue & orange" : "Red & green"}
283
+ </SelectValue>
284
+ </SelectTrigger>
285
+ <SelectPopup align="end" alignItemWithTrigger={false}>
286
+ <SelectItem value="red-green">Red & green (default)</SelectItem>
287
+ <SelectItem value="blue-orange">Blue & orange</SelectItem>
288
+ </SelectPopup>
289
+ </Select>
290
+ </div>
291
+ }
292
+ />
293
+
294
+ <SettingsRow
295
+ {...searchableSetting("composer-context")}
296
+ description="Keep branch and worktree controls below the composer after a thread starts."
297
+ resetAction={
298
+ settings.persistComposerContextStrip !==
299
+ DEFAULT_UNIFIED_SETTINGS.persistComposerContextStrip ? (
300
+ <SettingResetButton
301
+ label="composer context"
302
+ onClick={() =>
303
+ updateSettings({
304
+ persistComposerContextStrip:
305
+ DEFAULT_UNIFIED_SETTINGS.persistComposerContextStrip,
306
+ })
307
+ }
308
+ />
309
+ ) : null
310
+ }
311
+ control={
312
+ <Switch
313
+ checked={settings.persistComposerContextStrip}
314
+ onCheckedChange={(checked) =>
315
+ updateSettings({ persistComposerContextStrip: Boolean(checked) })
316
+ }
317
+ aria-label="Keep composer context visible in active threads"
318
+ />
319
+ }
320
+ />
321
+
322
+ <SettingsRow
323
+ {...searchableSetting("chat-width")}
324
+ description="Set how wide messages and the composer can grow on large screens."
325
+ resetAction={
326
+ settings.chatWidth !== DEFAULT_UNIFIED_SETTINGS.chatWidth ? (
327
+ <SettingResetButton
328
+ label="chat width"
329
+ onClick={() => updateSettings({ chatWidth: DEFAULT_UNIFIED_SETTINGS.chatWidth })}
330
+ />
331
+ ) : null
332
+ }
333
+ control={
334
+ <div className="w-full sm:w-40">
335
+ <Select
336
+ value={settings.chatWidth}
337
+ onValueChange={(value) => {
338
+ if (value === "comfortable" || value === "wide" || value === "full")
339
+ updateSettings({ chatWidth: value });
340
+ }}
341
+ >
342
+ <SelectTrigger size="sm" className="w-full min-w-0" aria-label="Chat width">
343
+ <SelectValue>{CHAT_WIDTH_LABELS[settings.chatWidth]}</SelectValue>
344
+ </SelectTrigger>
345
+ <SelectPopup align="end" alignItemWithTrigger={false}>
346
+ <SelectItem value="comfortable">Comfortable (default)</SelectItem>
347
+ <SelectItem value="wide">Wide</SelectItem>
348
+ <SelectItem value="full">Full</SelectItem>
349
+ </SelectPopup>
350
+ </Select>
351
+ </div>
352
+ }
353
+ />
354
+ <SettingsRow
355
+ {...searchableSetting("math-rendering")}
356
+ description="Typeset LaTeX math, such as $x^2$ or \[x^2\], in messages and Markdown previews. The composer keeps TeX source editable."
357
+ resetAction={
358
+ settings.mathRenderingEnabled !== DEFAULT_UNIFIED_SETTINGS.mathRenderingEnabled ? (
359
+ <SettingResetButton
360
+ label="math rendering"
361
+ onClick={() =>
362
+ updateSettings({
363
+ mathRenderingEnabled: DEFAULT_UNIFIED_SETTINGS.mathRenderingEnabled,
364
+ })
365
+ }
366
+ />
367
+ ) : null
368
+ }
369
+ control={
370
+ <Switch
371
+ checked={settings.mathRenderingEnabled}
372
+ onCheckedChange={(checked) =>
373
+ updateSettings({ mathRenderingEnabled: Boolean(checked) })
374
+ }
375
+ aria-label="Render math"
376
+ />
377
+ }
378
+ />
379
+ </SettingsSection>
380
+
381
+ <SettingsSection id="motion" title="Motion">
382
+ <SettingsRow
383
+ {...searchableSetting("panel-animations")}
384
+ description="Set how fast panels open and close."
385
+ control={
386
+ <div className="grid w-full grid-cols-[5rem_minmax(0,1fr)] items-center gap-3 sm:w-auto sm:grid-cols-[7rem_13rem] sm:gap-4">
387
+ <PanelAnimationsPreview durationMs={settings.panelAnimationDurationMs} />
388
+ <div className="flex w-full items-center gap-3">
389
+ <output
390
+ className="min-w-16 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
391
+ htmlFor="panel-animation-duration"
392
+ >
393
+ {settings.panelAnimationDurationMs} ms
394
+ </output>
395
+ <input
396
+ aria-label="Panel animation duration"
397
+ className="settings-slider min-w-0 flex-1"
398
+ id="panel-animation-duration"
399
+ max={MAX_PANEL_ANIMATION_DURATION_MS}
400
+ min={MIN_PANEL_ANIMATION_DURATION_MS}
401
+ onChange={(event) => {
402
+ const panelAnimationDurationMs = Number(event.currentTarget.value);
403
+ if (
404
+ Number.isInteger(panelAnimationDurationMs) &&
405
+ panelAnimationDurationMs >= MIN_PANEL_ANIMATION_DURATION_MS &&
406
+ panelAnimationDurationMs <= MAX_PANEL_ANIMATION_DURATION_MS
407
+ ) {
408
+ updateSettings({ panelAnimationDurationMs });
409
+ }
410
+ }}
411
+ step={25}
412
+ style={panelAnimationDurationSliderStyle}
413
+ type="range"
414
+ value={settings.panelAnimationDurationMs}
415
+ />
416
+ </div>
417
+ </div>
418
+ }
419
+ resetAction={
420
+ settings.panelAnimationDurationMs !==
421
+ DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs ? (
422
+ <SettingResetButton
423
+ label="panel animations"
424
+ onClick={() =>
425
+ updateSettings({
426
+ panelAnimationDurationMs: DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs,
427
+ })
428
+ }
429
+ />
430
+ ) : null
431
+ }
432
+ />
433
+ </SettingsSection>
434
+
435
+ <TypographySection />
436
+ </SettingsPageContainer>
437
+ );
438
+}
apps/web/src/components/settings/SettingsPanels.tsx
-423
@@ -4,7 +4,6 @@ import { NotificationSettings } from "./NotificationSettings";
4
import { PRIVACY_POLICY_URL } from "../../legalLinks";
5
import { CheckIcon, ChevronRightIcon, SettingsIcon } from "lucide-react";
6
import { Link, useNavigate } from "@tanstack/react-router";
7
-import type { CSSProperties } from "react";
7
import { useEffect, useRef, useState } from "react";
8
import {
9
type BackgroundActivityProfile,
@@ -14,18 +13,9 @@ import {
13
type SidebarProjectGroupingMode,
14
} from "@t3tools/contracts";
15
import {
17
- DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE,
16
DEFAULT_UNIFIED_SETTINGS,
19
- type ChatWidth,
17
type DiffLayout,
21
- type EnvironmentIdentificationMode,
22
- MAX_APPEARANCE_CONTRAST,
23
- MAX_GLASS_OPACITY,
24
- MAX_PANEL_ANIMATION_DURATION_MS,
18
MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
26
- MIN_APPEARANCE_CONTRAST,
27
- MIN_GLASS_OPACITY,
28
- MIN_PANEL_ANIMATION_DURATION_MS,
19
MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
20
type ResponseStreamingMode,
21
type QuitConfirmationMode,
@@ -49,13 +39,8 @@ import {
39
} from "../../components/desktopUpdate.logic";
40
import { ProviderModelPicker } from "../chat/ProviderModelPicker";
41
import { TraitsPicker } from "../chat/TraitsPicker";
52
-import {
53
- resolveEnvironmentIdentificationPillLabel,
54
- useEnvironmentStageLabel,
55
-} from "../SidebarStageBackdrop";
42
import { isElectron } from "../../env";
43
import { buildHostedChannelSelectionUrl, type HostedAppChannel } from "../../hostedPairing";
58
-import { useCustomThemes } from "../../hooks/useCustomThemes";
44
import {
45
readAppearanceModePreference,
46
readThemeHalves,
@@ -110,7 +95,6 @@ import { Switch } from "../ui/switch";
95
import { ScopedSwitch } from "./ScopedSwitch";
96
import { stackedThreadToast, toastManager } from "../ui/toast";
97
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
113
-import { ThemeLibrary } from "./ThemeSettings";
98
import {
99
backgroundActivityOverrideSettings,
100
backgroundActivitySharedPolicySettings,
@@ -137,14 +121,6 @@ import {
121
useSettingsSearchTargetId,
122
} from "./settingsLayout";
123
import { searchableSetting } from "./settingsSearch";
140
-import { PanelAnimationsPreview } from "./PanelAnimationsPreview";
141
-import { TypographySection } from "./TypographySettings";
142
-
143
-const ENVIRONMENT_IDENTIFICATION_LABELS: Record<EnvironmentIdentificationMode, string> = {
144
- artwork: "Artwork",
145
- pill: "Version pill",
146
- none: "None",
147
-};
124
125
const RESPONSE_STREAMING_MODE_LABELS: Record<ResponseStreamingMode, string> = {
126
turn: "Wait for the full response",
@@ -169,12 +145,6 @@ const TIMESTAMP_FORMAT_LABELS = {
145
"24-hour": "24-hour",
146
} as const;
147
172
-const CHAT_WIDTH_LABELS: Record<ChatWidth, string> = {
173
- comfortable: "Comfortable",
174
- wide: "Wide",
175
- full: "Full",
176
-};
177
-
148
const DIFF_LAYOUT_LABELS: Record<DiffLayout, string> = {
149
stacked: "Stacked",
150
split: "Split",
@@ -1037,399 +1007,6 @@ function BackgroundActivityAdvancedDialog({
1007
);
1008
}
1009
1040
-export function AppearanceSettingsPanel() {
1041
- const {
1042
- appearanceMode,
1043
- refreshTheme,
1044
- resolvedTheme,
1045
- setAppearanceMode,
1046
- setTheme,
1047
- setThemeHalf,
1048
- theme,
1049
- themeHalves,
1050
- } = useTheme();
1051
- const customThemes = useCustomThemes();
1052
- const [isImportThemeOpen, setIsImportThemeOpen] = useState(false);
1053
- const settings = useScopedSettings();
1054
- const updateSettings = useUpdateScopedSettings();
1055
- const environmentStageLabel = useEnvironmentStageLabel();
1056
- const showEnvironmentIdentification =
1057
- resolveEnvironmentIdentificationPillLabel(environmentStageLabel) !== null;
1058
- const glassOpacityRatio =
1059
- (settings.glassOpacity - MIN_GLASS_OPACITY) / (MAX_GLASS_OPACITY - MIN_GLASS_OPACITY);
1060
- const glassOpacitySliderStyle = {
1061
- "--settings-slider-progress": `${glassOpacityRatio * 100}%`,
1062
- "--settings-slider-fill-offset": `${0.5 - glassOpacityRatio}rem`,
1063
- } as CSSProperties;
1064
- const appearanceContrastRatio =
1065
- (settings.appearanceContrast - MIN_APPEARANCE_CONTRAST) /
1066
- (MAX_APPEARANCE_CONTRAST - MIN_APPEARANCE_CONTRAST);
1067
- const appearanceContrastSliderStyle = {
1068
- "--settings-slider-progress": `${appearanceContrastRatio * 100}%`,
1069
- "--settings-slider-fill-offset": `${0.5 - appearanceContrastRatio}rem`,
1070
- } as CSSProperties;
1071
- const panelAnimationDurationRatio =
1072
- (settings.panelAnimationDurationMs - MIN_PANEL_ANIMATION_DURATION_MS) /
1073
- (MAX_PANEL_ANIMATION_DURATION_MS - MIN_PANEL_ANIMATION_DURATION_MS);
1074
- const panelAnimationDurationSliderStyle = {
1075
- "--settings-slider-progress": `${panelAnimationDurationRatio * 100}%`,
1076
- "--settings-slider-fill-offset": `${0.5 - panelAnimationDurationRatio}rem`,
1077
- } as CSSProperties;
1078
-
1079
- return (
1080
- <SettingsPageContainer>
1081
- <SettingsSection id="appearance" title="Colors & themes" variant="plain" hideTitle>
1082
- <div id={searchableSetting("theme").id}>
1083
- <ThemeLibrary
1084
- appearanceMode={appearanceMode}
1085
- customThemes={customThemes}
1086
- initialAppearance={resolvedTheme}
1087
- refreshTheme={refreshTheme}
1088
- isImportOpen={isImportThemeOpen}
1089
- setAppearanceMode={setAppearanceMode}
1090
- setTheme={setTheme}
1091
- setThemeHalf={setThemeHalf}
1092
- theme={theme}
1093
- themeHalves={themeHalves}
1094
- onImportOpenChange={setIsImportThemeOpen}
1095
- />
1096
- </div>
1097
- </SettingsSection>
1098
-
1099
- <SettingsSection id="appearance-interface" title="Interface">
1100
- <SettingsRow
1101
- {...searchableSetting("setting-appearance-contrast")}
1102
- description="Adjust the contrast of colors and borders across the interface."
1103
- resetAction={
1104
- settings.appearanceContrast !== DEFAULT_UNIFIED_SETTINGS.appearanceContrast ? (
1105
- <SettingResetButton
1106
- label="contrast"
1107
- onClick={() =>
1108
- updateSettings({
1109
- appearanceContrast: DEFAULT_UNIFIED_SETTINGS.appearanceContrast,
1110
- })
1111
- }
1112
- />
1113
- ) : null
1114
- }
1115
- control={
1116
- <div className="flex w-full items-center gap-3 sm:w-52">
1117
- <output
1118
- className="min-w-12 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
1119
- htmlFor="appearance-contrast"
1120
- >
1121
- {settings.appearanceContrast}%
1122
- </output>
1123
- <input
1124
- aria-label="Contrast"
1125
- className="settings-slider min-w-0 flex-1"
1126
- id="appearance-contrast"
1127
- max={MAX_APPEARANCE_CONTRAST}
1128
- min={MIN_APPEARANCE_CONTRAST}
1129
- onChange={(event) => {
1130
- const appearanceContrast = Number(event.currentTarget.value);
1131
- if (
1132
- Number.isInteger(appearanceContrast) &&
1133
- appearanceContrast >= MIN_APPEARANCE_CONTRAST &&
1134
- appearanceContrast <= MAX_APPEARANCE_CONTRAST
1135
- ) {
1136
- updateSettings({ appearanceContrast });
1137
- }
1138
- }}
1139
- step={5}
1140
- style={appearanceContrastSliderStyle}
1141
- type="range"
1142
- value={settings.appearanceContrast}
1143
- />
1144
- </div>
1145
- }
1146
- />
1147
-
1148
- <SettingsRow
1149
- {...searchableSetting("setting-glass-opacity")}
1150
- description="Higher values make menus, dialogs, and the composer more solid."
1151
- resetAction={
1152
- settings.glassOpacity !== DEFAULT_UNIFIED_SETTINGS.glassOpacity ? (
1153
- <SettingResetButton
1154
- label="glass opacity"
1155
- onClick={() =>
1156
- updateSettings({ glassOpacity: DEFAULT_UNIFIED_SETTINGS.glassOpacity })
1157
- }
1158
- />
1159
- ) : null
1160
- }
1161
- control={
1162
- <div className="flex w-full items-center gap-3 sm:w-52">
1163
- <output
1164
- className="min-w-12 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
1165
- htmlFor="glass-opacity"
1166
- >
1167
- {settings.glassOpacity}%
1168
- </output>
1169
- <input
1170
- aria-label="Glass opacity"
1171
- className="settings-slider min-w-0 flex-1"
1172
- id="glass-opacity"
1173
- max={MAX_GLASS_OPACITY}
1174
- min={MIN_GLASS_OPACITY}
1175
- onChange={(event) => {
1176
- const glassOpacity = Number(event.currentTarget.value);
1177
- if (
1178
- Number.isInteger(glassOpacity) &&
1179
- glassOpacity >= MIN_GLASS_OPACITY &&
1180
- glassOpacity <= MAX_GLASS_OPACITY
1181
- ) {
1182
- updateSettings({ glassOpacity });
1183
- }
1184
- }}
1185
- step={5}
1186
- style={glassOpacitySliderStyle}
1187
- type="range"
1188
- value={settings.glassOpacity}
1189
- />
1190
- </div>
1191
- }
1192
- />
1193
-
1194
- {showEnvironmentIdentification ? (
1195
- <SettingsRow
1196
- {...searchableSetting("environment-identification")}
1197
- description="Choose how Dev and Nightly environments are identified."
1198
- resetAction={
1199
- settings.environmentIdentificationMode !== DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE ? (
1200
- <SettingResetButton
1201
- label="environment identification"
1202
- onClick={() =>
1203
- updateSettings({
1204
- environmentIdentificationMode: DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE,
1205
- })
1206
- }
1207
- />
1208
- ) : null
1209
- }
1210
- control={
1211
- <Select
1212
- value={settings.environmentIdentificationMode}
1213
- onValueChange={(value) => {
1214
- if (value === "artwork" || value === "pill" || value === "none") {
1215
- updateSettings({ environmentIdentificationMode: value });
1216
- }
1217
- }}
1218
- >
1219
- <SelectTrigger
1220
- size="sm"
1221
- className="w-full sm:w-40"
1222
- aria-label="Environment identification"
1223
- >
1224
- <SelectValue>
1225
- {ENVIRONMENT_IDENTIFICATION_LABELS[settings.environmentIdentificationMode]}
1226
- </SelectValue>
1227
- </SelectTrigger>
1228
- <SelectPopup align="end" alignItemWithTrigger={false}>
1229
- {Object.entries(ENVIRONMENT_IDENTIFICATION_LABELS).map(([value, label]) => (
1230
- <SelectItem hideIndicator key={value} value={value}>
1231
- {label}
1232
- </SelectItem>
1233
- ))}
1234
- </SelectPopup>
1235
- </Select>
1236
- }
1237
- />
1238
- ) : null}
1239
-
1240
- <SettingsRow
1241
- {...searchableSetting("diff-color-scheme")}
1242
- description="Choose colors for additions and deletions, including change counts."
1243
- resetAction={
1244
- settings.diffColorScheme !== DEFAULT_UNIFIED_SETTINGS.diffColorScheme ? (
1245
- <SettingResetButton
1246
- label="diff colors"
1247
- onClick={() =>
1248
- updateSettings({ diffColorScheme: DEFAULT_UNIFIED_SETTINGS.diffColorScheme })
1249
- }
1250
- />
1251
- ) : null
1252
- }
1253
- control={
1254
- <div className="w-full sm:w-40">
1255
- <Select
1256
- value={settings.diffColorScheme}
1257
- onValueChange={(value) => {
1258
- if (value === "red-green" || value === "blue-orange")
1259
- updateSettings({ diffColorScheme: value });
1260
- }}
1261
- >
1262
- <SelectTrigger size="sm" className="w-full min-w-0" aria-label="Diff colors">
1263
- <span
1264
- aria-hidden="true"
1265
- className={
1266
- settings.diffColorScheme === "blue-orange"
1267
- ? "flex shrink-0 flex-row-reverse gap-1"
1268
- : "flex shrink-0 gap-1"
1269
- }
1270
- >
1271
- <span className="size-2 rounded-full bg-diff-deletion" />
1272
- <span className="size-2 rounded-full bg-diff-addition" />
1273
- </span>
1274
- <SelectValue>
1275
- {settings.diffColorScheme === "blue-orange" ? "Blue & orange" : "Red & green"}
1276
- </SelectValue>
1277
- </SelectTrigger>
1278
- <SelectPopup align="end" alignItemWithTrigger={false}>
1279
- <SelectItem value="red-green">Red & green (default)</SelectItem>
1280
- <SelectItem value="blue-orange">Blue & orange</SelectItem>
1281
- </SelectPopup>
1282
- </Select>
1283
- </div>
1284
- }
1285
- />
1286
-
1287
- <SettingsRow
1288
- {...searchableSetting("composer-context")}
1289
- description="Keep branch and worktree controls below the composer after a thread starts."
1290
- resetAction={
1291
- settings.persistComposerContextStrip !==
1292
- DEFAULT_UNIFIED_SETTINGS.persistComposerContextStrip ? (
1293
- <SettingResetButton
1294
- label="composer context"
1295
- onClick={() =>
1296
- updateSettings({
1297
- persistComposerContextStrip:
1298
- DEFAULT_UNIFIED_SETTINGS.persistComposerContextStrip,
1299
- })
1300
- }
1301
- />
1302
- ) : null
1303
- }
1304
- control={
1305
- <Switch
1306
- checked={settings.persistComposerContextStrip}
1307
- onCheckedChange={(checked) =>
1308
- updateSettings({ persistComposerContextStrip: Boolean(checked) })
1309
- }
1310
- aria-label="Keep composer context visible in active threads"
1311
- />
1312
- }
1313
- />
1314
-
1315
- <SettingsRow
1316
- {...searchableSetting("chat-width")}
1317
- description="Set how wide messages and the composer can grow on large screens."
1318
- resetAction={
1319
- settings.chatWidth !== DEFAULT_UNIFIED_SETTINGS.chatWidth ? (
1320
- <SettingResetButton
1321
- label="chat width"
1322
- onClick={() => updateSettings({ chatWidth: DEFAULT_UNIFIED_SETTINGS.chatWidth })}
1323
- />
1324
- ) : null
1325
- }
1326
- control={
1327
- <div className="w-full sm:w-40">
1328
- <Select
1329
- value={settings.chatWidth}
1330
- onValueChange={(value) => {
1331
- if (value === "comfortable" || value === "wide" || value === "full")
1332
- updateSettings({ chatWidth: value });
1333
- }}
1334
- >
1335
- <SelectTrigger size="sm" className="w-full min-w-0" aria-label="Chat width">
1336
- <SelectValue>{CHAT_WIDTH_LABELS[settings.chatWidth]}</SelectValue>
1337
- </SelectTrigger>
1338
- <SelectPopup align="end" alignItemWithTrigger={false}>
1339
- <SelectItem value="comfortable">Comfortable (default)</SelectItem>
1340
- <SelectItem value="wide">Wide</SelectItem>
1341
- <SelectItem value="full">Full</SelectItem>
1342
- </SelectPopup>
1343
- </Select>
1344
- </div>
1345
- }
1346
- />
1347
- <SettingsRow
1348
- {...searchableSetting("math-rendering")}
1349
- description="Typeset LaTeX math, such as $x^2$ or \[x^2\], in messages and Markdown previews. The composer keeps TeX source editable."
1350
- resetAction={
1351
- settings.mathRenderingEnabled !== DEFAULT_UNIFIED_SETTINGS.mathRenderingEnabled ? (
1352
- <SettingResetButton
1353
- label="math rendering"
1354
- onClick={() =>
1355
- updateSettings({
1356
- mathRenderingEnabled: DEFAULT_UNIFIED_SETTINGS.mathRenderingEnabled,
1357
- })
1358
- }
1359
- />
1360
- ) : null
1361
- }
1362
- control={
1363
- <Switch
1364
- checked={settings.mathRenderingEnabled}
1365
- onCheckedChange={(checked) =>
1366
- updateSettings({ mathRenderingEnabled: Boolean(checked) })
1367
- }
1368
- aria-label="Render math"
1369
- />
1370
- }
1371
- />
1372
- </SettingsSection>
1373
-
1374
- <SettingsSection id="motion" title="Motion">
1375
- <SettingsRow
1376
- {...searchableSetting("panel-animations")}
1377
- description="Set how fast panels open and close."
1378
- control={
1379
- <div className="grid w-full grid-cols-[5rem_minmax(0,1fr)] items-center gap-3 sm:w-auto sm:grid-cols-[7rem_13rem] sm:gap-4">
1380
- <PanelAnimationsPreview durationMs={settings.panelAnimationDurationMs} />
1381
- <div className="flex w-full items-center gap-3">
1382
- <output
1383
- className="min-w-16 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
1384
- htmlFor="panel-animation-duration"
1385
- >
1386
- {settings.panelAnimationDurationMs} ms
1387
- </output>
1388
- <input
1389
- aria-label="Panel animation duration"
1390
- className="settings-slider min-w-0 flex-1"
1391
- id="panel-animation-duration"
1392
- max={MAX_PANEL_ANIMATION_DURATION_MS}
1393
- min={MIN_PANEL_ANIMATION_DURATION_MS}
1394
- onChange={(event) => {
1395
- const panelAnimationDurationMs = Number(event.currentTarget.value);
1396
- if (
1397
- Number.isInteger(panelAnimationDurationMs) &&
1398
- panelAnimationDurationMs >= MIN_PANEL_ANIMATION_DURATION_MS &&
1399
- panelAnimationDurationMs <= MAX_PANEL_ANIMATION_DURATION_MS
1400
- ) {
1401
- updateSettings({ panelAnimationDurationMs });
1402
- }
1403
- }}
1404
- step={25}
1405
- style={panelAnimationDurationSliderStyle}
1406
- type="range"
1407
- value={settings.panelAnimationDurationMs}
1408
- />
1409
- </div>
1410
- </div>
1411
- }
1412
- resetAction={
1413
- settings.panelAnimationDurationMs !==
1414
- DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs ? (
1415
- <SettingResetButton
1416
- label="panel animations"
1417
- onClick={() =>
1418
- updateSettings({
1419
- panelAnimationDurationMs: DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs,
1420
- })
1421
- }
1422
- />
1423
- ) : null
1424
- }
1425
- />
1426
- </SettingsSection>
1427
-
1428
- <TypographySection />
1429
- </SettingsPageContainer>
1430
- );
1431
-}
1432
-
1010
const AUTO_SETTLE_DEFAULT_DAYS = DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays ?? 3;
1011
1012
function AutoSettleDaysInput({
apps/web/src/routes/settings.appearance.tsx
+1
-1
@@ -1,6 +1,6 @@
1
import { createFileRoute } from "@tanstack/react-router";
2
3
-import { AppearanceSettingsPanel } from "../components/settings/SettingsPanels";
3
+import { AppearanceSettingsPanel } from "../components/settings/AppearanceSettingsPanel";
4
5
function SettingsAppearanceRoute() {
6
return <AppearanceSettingsPanel />;