Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(web): restore typography font sizes to defaults (#6172)
Wout Stiensac4780f451f9
diff --git a/apps/web/src/components/settings/SettingsPanels.logic.test.ts b/apps/web/src/components/settings/SettingsPanels.logic.test.tsindex d0bdb58db..ec4ad4ff5 100644--- a/apps/web/src/components/settings/SettingsPanels.logic.test.ts+++ b/apps/web/src/components/settings/SettingsPanels.logic.test.ts@@ -12,12 +12,26 @@ import {backgroundActivitySharedPolicySettings,buildProviderInstanceUpdatePatch,formatDiagnosticsDescription,+ getChangedTypographySettingLabels,hasChangedBackgroundActivitySettings,isProjectGroupingEnabled,projectGroupingModeFromToggle,resolveBackgroundActivityProfileOption,} from "./SettingsPanels.logic";+describe("typography settings restore", () => {+ it("detects family and size changes by font row", () => {+ expect(getChangedTypographySettingLabels(DEFAULT_UNIFIED_SETTINGS)).toEqual([]);+ expect(+ getChangedTypographySettingLabels({+ ...DEFAULT_UNIFIED_SETTINGS,+ fontSizeInterface: 18,+ fontFamilyCode: "Fira Code",+ }),+ ).toEqual(["Interface font", "Code font"]);+ });+});+describe("background activity settings restore", () => {it("detects legacy interval values even when the structured setting is at its default", () => {expect(diff --git a/apps/web/src/components/settings/SettingsPanels.logic.ts b/apps/web/src/components/settings/SettingsPanels.logic.tsindex efb5e12ff..39f4f3cda 100644--- a/apps/web/src/components/settings/SettingsPanels.logic.ts+++ b/apps/web/src/components/settings/SettingsPanels.logic.ts@@ -74,6 +74,40 @@ export function hasChangedBackgroundActivitySettings();}+type TypographySettings = Pick<+ UnifiedSettings,+ | "fontFamilySans"+ | "fontFamilyComposer"+ | "fontFamilyCode"+ | "fontFamilyTerminal"+ | "fontSizeInterface"+ | "fontSizePrompt"+ | "fontSizeCode"+ | "fontSizeTerminal"+>;++/** Labels the font rows whose family or size differs from the defaults. */+export function getChangedTypographySettingLabels(settings: TypographySettings): string[] {+ return [+ ...(settings.fontFamilySans !== DEFAULT_UNIFIED_SETTINGS.fontFamilySans ||+ settings.fontSizeInterface !== DEFAULT_UNIFIED_SETTINGS.fontSizeInterface+ ? ["Interface font"]+ : []),+ ...(settings.fontFamilyComposer !== DEFAULT_UNIFIED_SETTINGS.fontFamilyComposer ||+ settings.fontSizePrompt !== DEFAULT_UNIFIED_SETTINGS.fontSizePrompt+ ? ["Prompt font"]+ : []),+ ...(settings.fontFamilyCode !== DEFAULT_UNIFIED_SETTINGS.fontFamilyCode ||+ settings.fontSizeCode !== DEFAULT_UNIFIED_SETTINGS.fontSizeCode+ ? ["Code font"]+ : []),+ ...(settings.fontFamilyTerminal !== DEFAULT_UNIFIED_SETTINGS.fontFamilyTerminal ||+ settings.fontSizeTerminal !== DEFAULT_UNIFIED_SETTINGS.fontSizeTerminal+ ? ["Terminal font"]+ : []),+ ];+}+export function resolveBackgroundActivityProfileOption(settings: ServerSettings,): BackgroundActivityProfile | "advanced" {diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsxindex 6743952ae..e4cfbe9ac 100644--- a/apps/web/src/components/settings/SettingsPanels.tsx+++ b/apps/web/src/components/settings/SettingsPanels.tsx@@ -122,6 +122,7 @@ import {backgroundActivitySharedPolicySettings,durationToSeconds,formatDiagnosticsDescription,+ getChangedTypographySettingLabels,normalizeIntervalSeconds,PROVIDER_HEALTH_INTERVAL_STEP_SECONDS,hasChangedBackgroundActivitySettings,@@ -493,16 +494,7 @@ export function useSettingsRestore(onRestored?: () => void) {? ["Auto-settle inactive threads"]: []),...(settings.wordWrap !== DEFAULT_UNIFIED_SETTINGS.wordWrap ? ["Word wrap"] : []),- ...(settings.fontFamilySans !== DEFAULT_UNIFIED_SETTINGS.fontFamilySans- ? ["Interface font"]- : []),- ...(settings.fontFamilyComposer !== DEFAULT_UNIFIED_SETTINGS.fontFamilyComposer- ? ["Prompt font"]- : []),- ...(settings.fontFamilyCode !== DEFAULT_UNIFIED_SETTINGS.fontFamilyCode ? ["Code font"] : []),- ...(settings.fontFamilyTerminal !== DEFAULT_UNIFIED_SETTINGS.fontFamilyTerminal- ? ["Terminal font"]- : []),+ ...getChangedTypographySettingLabels(settings),...(settings.diffIgnoreWhitespace !== DEFAULT_UNIFIED_SETTINGS.diffIgnoreWhitespace? ["Diff whitespace changes"]: []),@@ -652,6 +644,10 @@ export function useSettingsRestore(onRestored?: () => void) {fontFamilyComposer: DEFAULT_UNIFIED_SETTINGS.fontFamilyComposer,fontFamilyCode: DEFAULT_UNIFIED_SETTINGS.fontFamilyCode,fontFamilyTerminal: DEFAULT_UNIFIED_SETTINGS.fontFamilyTerminal,+ fontSizeInterface: DEFAULT_UNIFIED_SETTINGS.fontSizeInterface,+ fontSizePrompt: DEFAULT_UNIFIED_SETTINGS.fontSizePrompt,+ fontSizeCode: DEFAULT_UNIFIED_SETTINGS.fontSizeCode,+ fontSizeTerminal: DEFAULT_UNIFIED_SETTINGS.fontSizeTerminal,});onRestored?.();}, [@@ -1105,13 +1101,21 @@ function InterfaceFontRow({ preview }: { preview?: ReactNode }) {{...searchableSetting("interface-font")}description="Everything outside code blocks and the terminal."defaultFamily={defaults.sans}+ defaultValue={DEFAULT_UNIFIED_SETTINGS.fontFamilySans}value={settings.fontFamilySans}onValueChange={(fontFamilySans) => updateSettings({ fontFamilySans })}+ onReset={() =>+ updateSettings({+ fontFamilySans: DEFAULT_UNIFIED_SETTINGS.fontFamilySans,+ fontSizeInterface: DEFAULT_UNIFIED_SETTINGS.fontSizeInterface,+ })+ }size={{label: "Interface font size",min: MIN_INTERFACE_FONT_SIZE,max: MAX_INTERFACE_FONT_SIZE,value: settings.fontSizeInterface,+ defaultValue: DEFAULT_UNIFIED_SETTINGS.fontSizeInterface,onChange: (fontSizeInterface) => updateSettings({ fontSizeInterface }),}}{...(preview !== undefined ? { preview } : {})}@@ -1128,13 +1132,21 @@ function PromptFontRow() {{...searchableSetting("prompt-font")}description="Only the box you write prompts in. Mono works well here."defaultFamily={defaults.interfaceFamily}+ defaultValue={DEFAULT_UNIFIED_SETTINGS.fontFamilyComposer}value={settings.fontFamilyComposer}onValueChange={(fontFamilyComposer) => updateSettings({ fontFamilyComposer })}+ onReset={() =>+ updateSettings({+ fontFamilyComposer: DEFAULT_UNIFIED_SETTINGS.fontFamilyComposer,+ fontSizePrompt: DEFAULT_UNIFIED_SETTINGS.fontSizePrompt,+ })+ }size={{label: "Prompt font size",min: MIN_PROMPT_FONT_SIZE,max: MAX_PROMPT_FONT_SIZE,value: settings.fontSizePrompt,+ defaultValue: DEFAULT_UNIFIED_SETTINGS.fontSizePrompt,onChange: (fontSizePrompt) => updateSettings({ fontSizePrompt }),}}preview={<PromptFontPreview />}@@ -1160,14 +1172,22 @@ function CodeFontRow({{...(title !== undefined ? { title } : {})}description={description}defaultFamily={defaults.code}+ defaultValue={DEFAULT_UNIFIED_SETTINGS.fontFamilyCode}value={settings.fontFamilyCode}onValueChange={(fontFamilyCode) => updateSettings({ fontFamilyCode })}+ onReset={() =>+ updateSettings({+ fontFamilyCode: DEFAULT_UNIFIED_SETTINGS.fontFamilyCode,+ fontSizeCode: DEFAULT_UNIFIED_SETTINGS.fontSizeCode,+ })+ }requireMonospacesize={{label: "Code font size",min: MIN_CODE_FONT_SIZE,max: MAX_CODE_FONT_SIZE,value: settings.fontSizeCode,+ defaultValue: DEFAULT_UNIFIED_SETTINGS.fontSizeCode,onChange: (fontSizeCode) => updateSettings({ fontSizeCode }),}}preview={preview ?? <CodeFontPreview />}@@ -1184,14 +1204,22 @@ function TerminalFontRow() {{...searchableSetting("terminal-font")}description="Terminal output, independent from code blocks and diffs."defaultFamily={defaults.code}+ defaultValue={DEFAULT_UNIFIED_SETTINGS.fontFamilyTerminal}value={settings.fontFamilyTerminal}onValueChange={(fontFamilyTerminal) => updateSettings({ fontFamilyTerminal })}+ onReset={() =>+ updateSettings({+ fontFamilyTerminal: DEFAULT_UNIFIED_SETTINGS.fontFamilyTerminal,+ fontSizeTerminal: DEFAULT_UNIFIED_SETTINGS.fontSizeTerminal,+ })+ }requireMonospacesize={{label: "Terminal font size",min: MIN_TERMINAL_FONT_SIZE,max: MAX_TERMINAL_FONT_SIZE,value: settings.fontSizeTerminal,+ defaultValue: DEFAULT_UNIFIED_SETTINGS.fontSizeTerminal,onChange: (fontSizeTerminal) => updateSettings({ fontSizeTerminal }),}}preview={@@ -1369,9 +1397,11 @@ function FontFamilySettingsRow({title,description,defaultFamily,+ defaultValue,preview,value,onValueChange,+ onReset,requireMonospace = false,size,}: {@@ -1380,11 +1410,21 @@ function FontFamilySettingsRow({description: string;/** What an unset preference renders as, e.g. "Menlo". */defaultFamily: string;+ /** The persisted family value supplied by the unified settings defaults. */+ defaultValue: string;preview?: ReactNode;value: string;onValueChange: (value: string) => void;+ onReset: () => void;requireMonospace?: boolean;- size: { label: string; min: number; max: number; value: number; onChange: (v: number) => void };+ size: {+ label: string;+ min: number;+ max: number;+ value: number;+ defaultValue: number;+ onChange: (v: number) => void;+ };}) {const trimmed = value.trim();// The fallback input edits a draft; the preference only commits once typing@@ -1431,12 +1471,18 @@ function FontFamilySettingsRow({// Flag an unknown name only once typing pauses, and never for an empty// field - that is the starting state, not a rejected entry.const draftPending = draftSettled && draftTrimmed.length > 0 && draftTrimmed !== trimmed;+ const resetToDefault = () => {+ if (commitTimerRef.current !== null) {+ window.clearTimeout(commitTimerRef.current);+ commitTimerRef.current = null;+ }+ setDraft(defaultValue);+ setDraftSettled(true);+ onReset();+ };const resetAction =- trimmed.length > 0 ? (- <SettingResetButton- label={`${title.toLowerCase()} family`}- onClick={() => onValueChange("")}- />+ value !== defaultValue || size.value !== size.defaultValue ? (+ <SettingResetButton label={title.toLowerCase()} onClick={resetToDefault} />) : null;const fontEnumeration = useFontEnumeration();// Everyone starts on the plain input; focusing it is the user gesture that