Skip to content
TypeScript

refactor(web): the appearance settings page lives in its own file (#22668)

Julius Marminge501f5c5757c6
diff --git a/apps/web/src/components/settings/AppearanceSettingsPanel.tsx b/apps/web/src/components/settings/AppearanceSettingsPanel.tsx
new file mode 100644
index 00000000000..a13bc93bb9c
--- /dev/null
+++ b/apps/web/src/components/settings/AppearanceSettingsPanel.tsx
@@ -0,0 +1,438 @@
+import type { CSSProperties } from "react";
+import { useState } from "react";
+import {
+ DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE,
+ DEFAULT_UNIFIED_SETTINGS,
+ type ChatWidth,
+ type EnvironmentIdentificationMode,
+ MAX_APPEARANCE_CONTRAST,
+ MAX_GLASS_OPACITY,
+ MAX_PANEL_ANIMATION_DURATION_MS,
+ MIN_APPEARANCE_CONTRAST,
+ MIN_GLASS_OPACITY,
+ MIN_PANEL_ANIMATION_DURATION_MS,
+} from "@t3tools/contracts/settings";
+import {
+ resolveEnvironmentIdentificationPillLabel,
+ useEnvironmentStageLabel,
+} from "../SidebarStageBackdrop";
+import { useCustomThemes } from "../../hooks/useCustomThemes";
+import { useTheme } from "../../hooks/useTheme";
+import { useScopedSettings, useUpdateScopedSettings } from "./useScopedSettings";
+import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select";
+import { Switch } from "../ui/switch";
+import { ThemeLibrary } from "./ThemeSettings";
+import {
+ SettingResetButton,
+ SettingsPageContainer,
+ SettingsRow,
+ SettingsSection,
+} from "./settingsLayout";
+import { searchableSetting } from "./settingsSearch";
+import { PanelAnimationsPreview } from "./PanelAnimationsPreview";
+import { TypographySection } from "./TypographySettings";
+
+const ENVIRONMENT_IDENTIFICATION_LABELS: Record<EnvironmentIdentificationMode, string> = {
+ artwork: "Artwork",
+ pill: "Version pill",
+ none: "None",
+};
+
+const CHAT_WIDTH_LABELS: Record<ChatWidth, string> = {
+ comfortable: "Comfortable",
+ wide: "Wide",
+ full: "Full",
+};
+
+export function AppearanceSettingsPanel() {
+ const {
+ appearanceMode,
+ refreshTheme,
+ resolvedTheme,
+ setAppearanceMode,
+ setTheme,
+ setThemeHalf,
+ theme,
+ themeHalves,
+ } = useTheme();
+ const customThemes = useCustomThemes();
+ const [isImportThemeOpen, setIsImportThemeOpen] = useState(false);
+ const settings = useScopedSettings();
+ const updateSettings = useUpdateScopedSettings();
+ const environmentStageLabel = useEnvironmentStageLabel();
+ const showEnvironmentIdentification =
+ resolveEnvironmentIdentificationPillLabel(environmentStageLabel) !== null;
+ const glassOpacityRatio =
+ (settings.glassOpacity - MIN_GLASS_OPACITY) / (MAX_GLASS_OPACITY - MIN_GLASS_OPACITY);
+ const glassOpacitySliderStyle = {
+ "--settings-slider-progress": `${glassOpacityRatio * 100}%`,
+ "--settings-slider-fill-offset": `${0.5 - glassOpacityRatio}rem`,
+ } as CSSProperties;
+ const appearanceContrastRatio =
+ (settings.appearanceContrast - MIN_APPEARANCE_CONTRAST) /
+ (MAX_APPEARANCE_CONTRAST - MIN_APPEARANCE_CONTRAST);
+ const appearanceContrastSliderStyle = {
+ "--settings-slider-progress": `${appearanceContrastRatio * 100}%`,
+ "--settings-slider-fill-offset": `${0.5 - appearanceContrastRatio}rem`,
+ } as CSSProperties;
+ const panelAnimationDurationRatio =
+ (settings.panelAnimationDurationMs - MIN_PANEL_ANIMATION_DURATION_MS) /
+ (MAX_PANEL_ANIMATION_DURATION_MS - MIN_PANEL_ANIMATION_DURATION_MS);
+ const panelAnimationDurationSliderStyle = {
+ "--settings-slider-progress": `${panelAnimationDurationRatio * 100}%`,
+ "--settings-slider-fill-offset": `${0.5 - panelAnimationDurationRatio}rem`,
+ } as CSSProperties;
+
+ return (
+ <SettingsPageContainer>
+ <SettingsSection id="appearance" title="Colors & themes" variant="plain" hideTitle>
+ <div id={searchableSetting("theme").id}>
+ <ThemeLibrary
+ appearanceMode={appearanceMode}
+ customThemes={customThemes}
+ initialAppearance={resolvedTheme}
+ refreshTheme={refreshTheme}
+ isImportOpen={isImportThemeOpen}
+ setAppearanceMode={setAppearanceMode}
+ setTheme={setTheme}
+ setThemeHalf={setThemeHalf}
+ theme={theme}
+ themeHalves={themeHalves}
+ onImportOpenChange={setIsImportThemeOpen}
+ />
+ </div>
+ </SettingsSection>
+
+ <SettingsSection id="appearance-interface" title="Interface">
+ <SettingsRow
+ {...searchableSetting("setting-appearance-contrast")}
+ description="Adjust the contrast of colors and borders across the interface."
+ resetAction={
+ settings.appearanceContrast !== DEFAULT_UNIFIED_SETTINGS.appearanceContrast ? (
+ <SettingResetButton
+ label="contrast"
+ onClick={() =>
+ updateSettings({
+ appearanceContrast: DEFAULT_UNIFIED_SETTINGS.appearanceContrast,
+ })
+ }
+ />
+ ) : null
+ }
+ control={
+ <div className="flex w-full items-center gap-3 sm:w-52">
+ <output
+ className="min-w-12 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
+ htmlFor="appearance-contrast"
+ >
+ {settings.appearanceContrast}%
+ </output>
+ <input
+ aria-label="Contrast"
+ className="settings-slider min-w-0 flex-1"
+ id="appearance-contrast"
+ max={MAX_APPEARANCE_CONTRAST}
+ min={MIN_APPEARANCE_CONTRAST}
+ onChange={(event) => {
+ const appearanceContrast = Number(event.currentTarget.value);
+ if (
+ Number.isInteger(appearanceContrast) &&
+ appearanceContrast >= MIN_APPEARANCE_CONTRAST &&
+ appearanceContrast <= MAX_APPEARANCE_CONTRAST
+ ) {
+ updateSettings({ appearanceContrast });
+ }
+ }}
+ step={5}
+ style={appearanceContrastSliderStyle}
+ type="range"
+ value={settings.appearanceContrast}
+ />
+ </div>
+ }
+ />
+
+ <SettingsRow
+ {...searchableSetting("setting-glass-opacity")}
+ description="Higher values make menus, dialogs, and the composer more solid."
+ resetAction={
+ settings.glassOpacity !== DEFAULT_UNIFIED_SETTINGS.glassOpacity ? (
+ <SettingResetButton
+ label="glass opacity"
+ onClick={() =>
+ updateSettings({ glassOpacity: DEFAULT_UNIFIED_SETTINGS.glassOpacity })
+ }
+ />
+ ) : null
+ }
+ control={
+ <div className="flex w-full items-center gap-3 sm:w-52">
+ <output
+ className="min-w-12 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
+ htmlFor="glass-opacity"
+ >
+ {settings.glassOpacity}%
+ </output>
+ <input
+ aria-label="Glass opacity"
+ className="settings-slider min-w-0 flex-1"
+ id="glass-opacity"
+ max={MAX_GLASS_OPACITY}
+ min={MIN_GLASS_OPACITY}
+ onChange={(event) => {
+ const glassOpacity = Number(event.currentTarget.value);
+ if (
+ Number.isInteger(glassOpacity) &&
+ glassOpacity >= MIN_GLASS_OPACITY &&
+ glassOpacity <= MAX_GLASS_OPACITY
+ ) {
+ updateSettings({ glassOpacity });
+ }
+ }}
+ step={5}
+ style={glassOpacitySliderStyle}
+ type="range"
+ value={settings.glassOpacity}
+ />
+ </div>
+ }
+ />
+
+ {showEnvironmentIdentification ? (
+ <SettingsRow
+ {...searchableSetting("environment-identification")}
+ description="Choose how Dev and Nightly environments are identified."
+ resetAction={
+ settings.environmentIdentificationMode !== DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE ? (
+ <SettingResetButton
+ label="environment identification"
+ onClick={() =>
+ updateSettings({
+ environmentIdentificationMode: DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE,
+ })
+ }
+ />
+ ) : null
+ }
+ control={
+ <Select
+ value={settings.environmentIdentificationMode}
+ onValueChange={(value) => {
+ if (value === "artwork" || value === "pill" || value === "none") {
+ updateSettings({ environmentIdentificationMode: value });
+ }
+ }}
+ >
+ <SelectTrigger
+ size="sm"
+ className="w-full sm:w-40"
+ aria-label="Environment identification"
+ >
+ <SelectValue>
+ {ENVIRONMENT_IDENTIFICATION_LABELS[settings.environmentIdentificationMode]}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectPopup align="end" alignItemWithTrigger={false}>
+ {Object.entries(ENVIRONMENT_IDENTIFICATION_LABELS).map(([value, label]) => (
+ <SelectItem hideIndicator key={value} value={value}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectPopup>
+ </Select>
+ }
+ />
+ ) : null}
+
+ <SettingsRow
+ {...searchableSetting("diff-color-scheme")}
+ description="Choose colors for additions and deletions, including change counts."
+ resetAction={
+ settings.diffColorScheme !== DEFAULT_UNIFIED_SETTINGS.diffColorScheme ? (
+ <SettingResetButton
+ label="diff colors"
+ onClick={() =>
+ updateSettings({ diffColorScheme: DEFAULT_UNIFIED_SETTINGS.diffColorScheme })
+ }
+ />
+ ) : null
+ }
+ control={
+ <div className="w-full sm:w-40">
+ <Select
+ value={settings.diffColorScheme}
+ onValueChange={(value) => {
+ if (value === "red-green" || value === "blue-orange")
+ updateSettings({ diffColorScheme: value });
+ }}
+ >
+ <SelectTrigger size="sm" className="w-full min-w-0" aria-label="Diff colors">
+ <span
+ aria-hidden="true"
+ className={
+ settings.diffColorScheme === "blue-orange"
+ ? "flex shrink-0 flex-row-reverse gap-1"
+ : "flex shrink-0 gap-1"
+ }
+ >
+ <span className="size-2 rounded-full bg-diff-deletion" />
+ <span className="size-2 rounded-full bg-diff-addition" />
+ </span>
+ <SelectValue>
+ {settings.diffColorScheme === "blue-orange" ? "Blue & orange" : "Red & green"}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectPopup align="end" alignItemWithTrigger={false}>
+ <SelectItem value="red-green">Red & green (default)</SelectItem>
+ <SelectItem value="blue-orange">Blue & orange</SelectItem>
+ </SelectPopup>
+ </Select>
+ </div>
+ }
+ />
+
+ <SettingsRow
+ {...searchableSetting("composer-context")}
+ description="Keep branch and worktree controls below the composer after a thread starts."
+ resetAction={
+ settings.persistComposerContextStrip !==
+ DEFAULT_UNIFIED_SETTINGS.persistComposerContextStrip ? (
+ <SettingResetButton
+ label="composer context"
+ onClick={() =>
+ updateSettings({
+ persistComposerContextStrip:
+ DEFAULT_UNIFIED_SETTINGS.persistComposerContextStrip,
+ })
+ }
+ />
+ ) : null
+ }
+ control={
+ <Switch
+ checked={settings.persistComposerContextStrip}
+ onCheckedChange={(checked) =>
+ updateSettings({ persistComposerContextStrip: Boolean(checked) })
+ }
+ aria-label="Keep composer context visible in active threads"
+ />
+ }
+ />
+
+ <SettingsRow
+ {...searchableSetting("chat-width")}
+ description="Set how wide messages and the composer can grow on large screens."
+ resetAction={
+ settings.chatWidth !== DEFAULT_UNIFIED_SETTINGS.chatWidth ? (
+ <SettingResetButton
+ label="chat width"
+ onClick={() => updateSettings({ chatWidth: DEFAULT_UNIFIED_SETTINGS.chatWidth })}
+ />
+ ) : null
+ }
+ control={
+ <div className="w-full sm:w-40">
+ <Select
+ value={settings.chatWidth}
+ onValueChange={(value) => {
+ if (value === "comfortable" || value === "wide" || value === "full")
+ updateSettings({ chatWidth: value });
+ }}
+ >
+ <SelectTrigger size="sm" className="w-full min-w-0" aria-label="Chat width">
+ <SelectValue>{CHAT_WIDTH_LABELS[settings.chatWidth]}</SelectValue>
+ </SelectTrigger>
+ <SelectPopup align="end" alignItemWithTrigger={false}>
+ <SelectItem value="comfortable">Comfortable (default)</SelectItem>
+ <SelectItem value="wide">Wide</SelectItem>
+ <SelectItem value="full">Full</SelectItem>
+ </SelectPopup>
+ </Select>
+ </div>
+ }
+ />
+ <SettingsRow
+ {...searchableSetting("math-rendering")}
+ description="Typeset LaTeX math, such as $x^2$ or \[x^2\], in messages and Markdown previews. The composer keeps TeX source editable."
+ resetAction={
+ settings.mathRenderingEnabled !== DEFAULT_UNIFIED_SETTINGS.mathRenderingEnabled ? (
+ <SettingResetButton
+ label="math rendering"
+ onClick={() =>
+ updateSettings({
+ mathRenderingEnabled: DEFAULT_UNIFIED_SETTINGS.mathRenderingEnabled,
+ })
+ }
+ />
+ ) : null
+ }
+ control={
+ <Switch
+ checked={settings.mathRenderingEnabled}
+ onCheckedChange={(checked) =>
+ updateSettings({ mathRenderingEnabled: Boolean(checked) })
+ }
+ aria-label="Render math"
+ />
+ }
+ />
+ </SettingsSection>
+
+ <SettingsSection id="motion" title="Motion">
+ <SettingsRow
+ {...searchableSetting("panel-animations")}
+ description="Set how fast panels open and close."
+ control={
+ <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">
+ <PanelAnimationsPreview durationMs={settings.panelAnimationDurationMs} />
+ <div className="flex w-full items-center gap-3">
+ <output
+ className="min-w-16 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
+ htmlFor="panel-animation-duration"
+ >
+ {settings.panelAnimationDurationMs} ms
+ </output>
+ <input
+ aria-label="Panel animation duration"
+ className="settings-slider min-w-0 flex-1"
+ id="panel-animation-duration"
+ max={MAX_PANEL_ANIMATION_DURATION_MS}
+ min={MIN_PANEL_ANIMATION_DURATION_MS}
+ onChange={(event) => {
+ const panelAnimationDurationMs = Number(event.currentTarget.value);
+ if (
+ Number.isInteger(panelAnimationDurationMs) &&
+ panelAnimationDurationMs >= MIN_PANEL_ANIMATION_DURATION_MS &&
+ panelAnimationDurationMs <= MAX_PANEL_ANIMATION_DURATION_MS
+ ) {
+ updateSettings({ panelAnimationDurationMs });
+ }
+ }}
+ step={25}
+ style={panelAnimationDurationSliderStyle}
+ type="range"
+ value={settings.panelAnimationDurationMs}
+ />
+ </div>
+ </div>
+ }
+ resetAction={
+ settings.panelAnimationDurationMs !==
+ DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs ? (
+ <SettingResetButton
+ label="panel animations"
+ onClick={() =>
+ updateSettings({
+ panelAnimationDurationMs: DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs,
+ })
+ }
+ />
+ ) : null
+ }
+ />
+ </SettingsSection>
+
+ <TypographySection />
+ </SettingsPageContainer>
+ );
+}
diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx
index 4d4cccab93d..fdae7b1853e 100644
--- a/apps/web/src/components/settings/SettingsPanels.tsx
+++ b/apps/web/src/components/settings/SettingsPanels.tsx
@@ -4,7 +4,6 @@ import { NotificationSettings } from "./NotificationSettings";
import { PRIVACY_POLICY_URL } from "../../legalLinks";
import { CheckIcon, ChevronRightIcon, SettingsIcon } from "lucide-react";
import { Link, useNavigate } from "@tanstack/react-router";
-import type { CSSProperties } from "react";
import { useEffect, useRef, useState } from "react";
import {
type BackgroundActivityProfile,
@@ -14,18 +13,9 @@ import {
type SidebarProjectGroupingMode,
} from "@t3tools/contracts";
import {
- DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE,
DEFAULT_UNIFIED_SETTINGS,
- type ChatWidth,
type DiffLayout,
- type EnvironmentIdentificationMode,
- MAX_APPEARANCE_CONTRAST,
- MAX_GLASS_OPACITY,
- MAX_PANEL_ANIMATION_DURATION_MS,
MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
- MIN_APPEARANCE_CONTRAST,
- MIN_GLASS_OPACITY,
- MIN_PANEL_ANIMATION_DURATION_MS,
MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
type ResponseStreamingMode,
type QuitConfirmationMode,
@@ -49,13 +39,8 @@ import {
} from "../../components/desktopUpdate.logic";
import { ProviderModelPicker } from "../chat/ProviderModelPicker";
import { TraitsPicker } from "../chat/TraitsPicker";
-import {
- resolveEnvironmentIdentificationPillLabel,
- useEnvironmentStageLabel,
-} from "../SidebarStageBackdrop";
import { isElectron } from "../../env";
import { buildHostedChannelSelectionUrl, type HostedAppChannel } from "../../hostedPairing";
-import { useCustomThemes } from "../../hooks/useCustomThemes";
import {
readAppearanceModePreference,
readThemeHalves,
@@ -110,7 +95,6 @@ import { Switch } from "../ui/switch";
import { ScopedSwitch } from "./ScopedSwitch";
import { stackedThreadToast, toastManager } from "../ui/toast";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
-import { ThemeLibrary } from "./ThemeSettings";
import {
backgroundActivityOverrideSettings,
backgroundActivitySharedPolicySettings,
@@ -137,14 +121,6 @@ import {
useSettingsSearchTargetId,
} from "./settingsLayout";
import { searchableSetting } from "./settingsSearch";
-import { PanelAnimationsPreview } from "./PanelAnimationsPreview";
-import { TypographySection } from "./TypographySettings";
-
-const ENVIRONMENT_IDENTIFICATION_LABELS: Record<EnvironmentIdentificationMode, string> = {
- artwork: "Artwork",
- pill: "Version pill",
- none: "None",
-};
const RESPONSE_STREAMING_MODE_LABELS: Record<ResponseStreamingMode, string> = {
turn: "Wait for the full response",
@@ -169,12 +145,6 @@ const TIMESTAMP_FORMAT_LABELS = {
"24-hour": "24-hour",
} as const;
-const CHAT_WIDTH_LABELS: Record<ChatWidth, string> = {
- comfortable: "Comfortable",
- wide: "Wide",
- full: "Full",
-};
-
const DIFF_LAYOUT_LABELS: Record<DiffLayout, string> = {
stacked: "Stacked",
split: "Split",
@@ -1037,399 +1007,6 @@ function BackgroundActivityAdvancedDialog({
);
}
-export function AppearanceSettingsPanel() {
- const {
- appearanceMode,
- refreshTheme,
- resolvedTheme,
- setAppearanceMode,
- setTheme,
- setThemeHalf,
- theme,
- themeHalves,
- } = useTheme();
- const customThemes = useCustomThemes();
- const [isImportThemeOpen, setIsImportThemeOpen] = useState(false);
- const settings = useScopedSettings();
- const updateSettings = useUpdateScopedSettings();
- const environmentStageLabel = useEnvironmentStageLabel();
- const showEnvironmentIdentification =
- resolveEnvironmentIdentificationPillLabel(environmentStageLabel) !== null;
- const glassOpacityRatio =
- (settings.glassOpacity - MIN_GLASS_OPACITY) / (MAX_GLASS_OPACITY - MIN_GLASS_OPACITY);
- const glassOpacitySliderStyle = {
- "--settings-slider-progress": `${glassOpacityRatio * 100}%`,
- "--settings-slider-fill-offset": `${0.5 - glassOpacityRatio}rem`,
- } as CSSProperties;
- const appearanceContrastRatio =
- (settings.appearanceContrast - MIN_APPEARANCE_CONTRAST) /
- (MAX_APPEARANCE_CONTRAST - MIN_APPEARANCE_CONTRAST);
- const appearanceContrastSliderStyle = {
- "--settings-slider-progress": `${appearanceContrastRatio * 100}%`,
- "--settings-slider-fill-offset": `${0.5 - appearanceContrastRatio}rem`,
- } as CSSProperties;
- const panelAnimationDurationRatio =
- (settings.panelAnimationDurationMs - MIN_PANEL_ANIMATION_DURATION_MS) /
- (MAX_PANEL_ANIMATION_DURATION_MS - MIN_PANEL_ANIMATION_DURATION_MS);
- const panelAnimationDurationSliderStyle = {
- "--settings-slider-progress": `${panelAnimationDurationRatio * 100}%`,
- "--settings-slider-fill-offset": `${0.5 - panelAnimationDurationRatio}rem`,
- } as CSSProperties;
-
- return (
- <SettingsPageContainer>
- <SettingsSection id="appearance" title="Colors & themes" variant="plain" hideTitle>
- <div id={searchableSetting("theme").id}>
- <ThemeLibrary
- appearanceMode={appearanceMode}
- customThemes={customThemes}
- initialAppearance={resolvedTheme}
- refreshTheme={refreshTheme}
- isImportOpen={isImportThemeOpen}
- setAppearanceMode={setAppearanceMode}
- setTheme={setTheme}
- setThemeHalf={setThemeHalf}
- theme={theme}
- themeHalves={themeHalves}
- onImportOpenChange={setIsImportThemeOpen}
- />
- </div>
- </SettingsSection>
-
- <SettingsSection id="appearance-interface" title="Interface">
- <SettingsRow
- {...searchableSetting("setting-appearance-contrast")}
- description="Adjust the contrast of colors and borders across the interface."
- resetAction={
- settings.appearanceContrast !== DEFAULT_UNIFIED_SETTINGS.appearanceContrast ? (
- <SettingResetButton
- label="contrast"
- onClick={() =>
- updateSettings({
- appearanceContrast: DEFAULT_UNIFIED_SETTINGS.appearanceContrast,
- })
- }
- />
- ) : null
- }
- control={
- <div className="flex w-full items-center gap-3 sm:w-52">
- <output
- className="min-w-12 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
- htmlFor="appearance-contrast"
- >
- {settings.appearanceContrast}%
- </output>
- <input
- aria-label="Contrast"
- className="settings-slider min-w-0 flex-1"
- id="appearance-contrast"
- max={MAX_APPEARANCE_CONTRAST}
- min={MIN_APPEARANCE_CONTRAST}
- onChange={(event) => {
- const appearanceContrast = Number(event.currentTarget.value);
- if (
- Number.isInteger(appearanceContrast) &&
- appearanceContrast >= MIN_APPEARANCE_CONTRAST &&
- appearanceContrast <= MAX_APPEARANCE_CONTRAST
- ) {
- updateSettings({ appearanceContrast });
- }
- }}
- step={5}
- style={appearanceContrastSliderStyle}
- type="range"
- value={settings.appearanceContrast}
- />
- </div>
- }
- />
-
- <SettingsRow
- {...searchableSetting("setting-glass-opacity")}
- description="Higher values make menus, dialogs, and the composer more solid."
- resetAction={
- settings.glassOpacity !== DEFAULT_UNIFIED_SETTINGS.glassOpacity ? (
- <SettingResetButton
- label="glass opacity"
- onClick={() =>
- updateSettings({ glassOpacity: DEFAULT_UNIFIED_SETTINGS.glassOpacity })
- }
- />
- ) : null
- }
- control={
- <div className="flex w-full items-center gap-3 sm:w-52">
- <output
- className="min-w-12 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
- htmlFor="glass-opacity"
- >
- {settings.glassOpacity}%
- </output>
- <input
- aria-label="Glass opacity"
- className="settings-slider min-w-0 flex-1"
- id="glass-opacity"
- max={MAX_GLASS_OPACITY}
- min={MIN_GLASS_OPACITY}
- onChange={(event) => {
- const glassOpacity = Number(event.currentTarget.value);
- if (
- Number.isInteger(glassOpacity) &&
- glassOpacity >= MIN_GLASS_OPACITY &&
- glassOpacity <= MAX_GLASS_OPACITY
- ) {
- updateSettings({ glassOpacity });
- }
- }}
- step={5}
- style={glassOpacitySliderStyle}
- type="range"
- value={settings.glassOpacity}
- />
- </div>
- }
- />
-
- {showEnvironmentIdentification ? (
- <SettingsRow
- {...searchableSetting("environment-identification")}
- description="Choose how Dev and Nightly environments are identified."
- resetAction={
- settings.environmentIdentificationMode !== DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE ? (
- <SettingResetButton
- label="environment identification"
- onClick={() =>
- updateSettings({
- environmentIdentificationMode: DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE,
- })
- }
- />
- ) : null
- }
- control={
- <Select
- value={settings.environmentIdentificationMode}
- onValueChange={(value) => {
- if (value === "artwork" || value === "pill" || value === "none") {
- updateSettings({ environmentIdentificationMode: value });
- }
- }}
- >
- <SelectTrigger
- size="sm"
- className="w-full sm:w-40"
- aria-label="Environment identification"
- >
- <SelectValue>
- {ENVIRONMENT_IDENTIFICATION_LABELS[settings.environmentIdentificationMode]}
- </SelectValue>
- </SelectTrigger>
- <SelectPopup align="end" alignItemWithTrigger={false}>
- {Object.entries(ENVIRONMENT_IDENTIFICATION_LABELS).map(([value, label]) => (
- <SelectItem hideIndicator key={value} value={value}>
- {label}
- </SelectItem>
- ))}
- </SelectPopup>
- </Select>
- }
- />
- ) : null}
-
- <SettingsRow
- {...searchableSetting("diff-color-scheme")}
- description="Choose colors for additions and deletions, including change counts."
- resetAction={
- settings.diffColorScheme !== DEFAULT_UNIFIED_SETTINGS.diffColorScheme ? (
- <SettingResetButton
- label="diff colors"
- onClick={() =>
- updateSettings({ diffColorScheme: DEFAULT_UNIFIED_SETTINGS.diffColorScheme })
- }
- />
- ) : null
- }
- control={
- <div className="w-full sm:w-40">
- <Select
- value={settings.diffColorScheme}
- onValueChange={(value) => {
- if (value === "red-green" || value === "blue-orange")
- updateSettings({ diffColorScheme: value });
- }}
- >
- <SelectTrigger size="sm" className="w-full min-w-0" aria-label="Diff colors">
- <span
- aria-hidden="true"
- className={
- settings.diffColorScheme === "blue-orange"
- ? "flex shrink-0 flex-row-reverse gap-1"
- : "flex shrink-0 gap-1"
- }
- >
- <span className="size-2 rounded-full bg-diff-deletion" />
- <span className="size-2 rounded-full bg-diff-addition" />
- </span>
- <SelectValue>
- {settings.diffColorScheme === "blue-orange" ? "Blue & orange" : "Red & green"}
- </SelectValue>
- </SelectTrigger>
- <SelectPopup align="end" alignItemWithTrigger={false}>
- <SelectItem value="red-green">Red & green (default)</SelectItem>
- <SelectItem value="blue-orange">Blue & orange</SelectItem>
- </SelectPopup>
- </Select>
- </div>
- }
- />
-
- <SettingsRow
- {...searchableSetting("composer-context")}
- description="Keep branch and worktree controls below the composer after a thread starts."
- resetAction={
- settings.persistComposerContextStrip !==
- DEFAULT_UNIFIED_SETTINGS.persistComposerContextStrip ? (
- <SettingResetButton
- label="composer context"
- onClick={() =>
- updateSettings({
- persistComposerContextStrip:
- DEFAULT_UNIFIED_SETTINGS.persistComposerContextStrip,
- })
- }
- />
- ) : null
- }
- control={
- <Switch
- checked={settings.persistComposerContextStrip}
- onCheckedChange={(checked) =>
- updateSettings({ persistComposerContextStrip: Boolean(checked) })
- }
- aria-label="Keep composer context visible in active threads"
- />
- }
- />
-
- <SettingsRow
- {...searchableSetting("chat-width")}
- description="Set how wide messages and the composer can grow on large screens."
- resetAction={
- settings.chatWidth !== DEFAULT_UNIFIED_SETTINGS.chatWidth ? (
- <SettingResetButton
- label="chat width"
- onClick={() => updateSettings({ chatWidth: DEFAULT_UNIFIED_SETTINGS.chatWidth })}
- />
- ) : null
- }
- control={
- <div className="w-full sm:w-40">
- <Select
- value={settings.chatWidth}
- onValueChange={(value) => {
- if (value === "comfortable" || value === "wide" || value === "full")
- updateSettings({ chatWidth: value });
- }}
- >
- <SelectTrigger size="sm" className="w-full min-w-0" aria-label="Chat width">
- <SelectValue>{CHAT_WIDTH_LABELS[settings.chatWidth]}</SelectValue>
- </SelectTrigger>
- <SelectPopup align="end" alignItemWithTrigger={false}>
- <SelectItem value="comfortable">Comfortable (default)</SelectItem>
- <SelectItem value="wide">Wide</SelectItem>
- <SelectItem value="full">Full</SelectItem>
- </SelectPopup>
- </Select>
- </div>
- }
- />
- <SettingsRow
- {...searchableSetting("math-rendering")}
- description="Typeset LaTeX math, such as $x^2$ or \[x^2\], in messages and Markdown previews. The composer keeps TeX source editable."
- resetAction={
- settings.mathRenderingEnabled !== DEFAULT_UNIFIED_SETTINGS.mathRenderingEnabled ? (
- <SettingResetButton
- label="math rendering"
- onClick={() =>
- updateSettings({
- mathRenderingEnabled: DEFAULT_UNIFIED_SETTINGS.mathRenderingEnabled,
- })
- }
- />
- ) : null
- }
- control={
- <Switch
- checked={settings.mathRenderingEnabled}
- onCheckedChange={(checked) =>
- updateSettings({ mathRenderingEnabled: Boolean(checked) })
- }
- aria-label="Render math"
- />
- }
- />
- </SettingsSection>
-
- <SettingsSection id="motion" title="Motion">
- <SettingsRow
- {...searchableSetting("panel-animations")}
- description="Set how fast panels open and close."
- control={
- <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">
- <PanelAnimationsPreview durationMs={settings.panelAnimationDurationMs} />
- <div className="flex w-full items-center gap-3">
- <output
- className="min-w-16 rounded-md bg-muted px-2 py-1 text-center font-mono text-xs font-medium tabular-nums text-foreground"
- htmlFor="panel-animation-duration"
- >
- {settings.panelAnimationDurationMs} ms
- </output>
- <input
- aria-label="Panel animation duration"
- className="settings-slider min-w-0 flex-1"
- id="panel-animation-duration"
- max={MAX_PANEL_ANIMATION_DURATION_MS}
- min={MIN_PANEL_ANIMATION_DURATION_MS}
- onChange={(event) => {
- const panelAnimationDurationMs = Number(event.currentTarget.value);
- if (
- Number.isInteger(panelAnimationDurationMs) &&
- panelAnimationDurationMs >= MIN_PANEL_ANIMATION_DURATION_MS &&
- panelAnimationDurationMs <= MAX_PANEL_ANIMATION_DURATION_MS
- ) {
- updateSettings({ panelAnimationDurationMs });
- }
- }}
- step={25}
- style={panelAnimationDurationSliderStyle}
- type="range"
- value={settings.panelAnimationDurationMs}
- />
- </div>
- </div>
- }
- resetAction={
- settings.panelAnimationDurationMs !==
- DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs ? (
- <SettingResetButton
- label="panel animations"
- onClick={() =>
- updateSettings({
- panelAnimationDurationMs: DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs,
- })
- }
- />
- ) : null
- }
- />
- </SettingsSection>
-
- <TypographySection />
- </SettingsPageContainer>
- );
-}
-
const AUTO_SETTLE_DEFAULT_DAYS = DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays ?? 3;
function AutoSettleDaysInput({
diff --git a/apps/web/src/routes/settings.appearance.tsx b/apps/web/src/routes/settings.appearance.tsx
index 60c33fff307..30e53d0b9be 100644
--- a/apps/web/src/routes/settings.appearance.tsx
+++ b/apps/web/src/routes/settings.appearance.tsx
@@ -1,6 +1,6 @@
import { createFileRoute } from "@tanstack/react-router";
-import { AppearanceSettingsPanel } from "../components/settings/SettingsPanels";
+import { AppearanceSettingsPanel } from "../components/settings/AppearanceSettingsPanel";
function SettingsAppearanceRoute() {
return <AppearanceSettingsPanel />;