diff --git a/desktop/src/app/useWebviewZoomShortcuts.ts b/desktop/src/app/useWebviewZoomShortcuts.ts index cda6c0f2ed..c664d68da7 100644 --- a/desktop/src/app/useWebviewZoomShortcuts.ts +++ b/desktop/src/app/useWebviewZoomShortcuts.ts @@ -1,13 +1,13 @@ import * as React from "react"; import { getCurrentWebview } from "@tauri-apps/api/webview"; +import { applyTextZoomFactor } from "@/shared/lib/fontSizePreference"; import { hasPrimaryShortcutModifier } from "@/shared/lib/platform"; const DEFAULT_ZOOM_FACTOR = 1; const MIN_ZOOM_FACTOR = 0.75; const MAX_ZOOM_FACTOR = 1.5; const ZOOM_STEP = 0.1; -const BASE_FONT_SIZE_PX = 16; const TEXT_SCALE_STORAGE_KEY = "buzz:text-scale"; type ZoomAction = "increase" | "decrease" | "reset"; @@ -76,13 +76,12 @@ function readStoredZoomFactor() { } function applyTextScale(zoomFactor: number) { + applyTextZoomFactor(zoomFactor); if (zoomFactor === DEFAULT_ZOOM_FACTOR) { - document.documentElement.style.fontSize = ""; window.localStorage.removeItem(TEXT_SCALE_STORAGE_KEY); return; } - document.documentElement.style.fontSize = `${BASE_FONT_SIZE_PX * zoomFactor}px`; window.localStorage.setItem(TEXT_SCALE_STORAGE_KEY, String(zoomFactor)); } diff --git a/desktop/src/features/settings/ui/AppearanceSettingsControls.tsx b/desktop/src/features/settings/ui/AppearanceSettingsControls.tsx index bd7113a461..0f171c5b51 100644 --- a/desktop/src/features/settings/ui/AppearanceSettingsControls.tsx +++ b/desktop/src/features/settings/ui/AppearanceSettingsControls.tsx @@ -21,11 +21,11 @@ import { type ConversationDensity, } from "@/shared/lib/conversationDensityPreference"; import { - previewConversationFontSize, - setConversationFontSize, - useConversationFontSize, - type ConversationFontSize, -} from "@/shared/lib/conversationFontSizePreference"; + previewFontSize, + setFontSize, + useFontSize, + type FontSize, +} from "@/shared/lib/fontSizePreference"; import { ACCENT_COLORS, DEFAULT_GLASS_OPACITY, @@ -111,8 +111,8 @@ const CONVERSATION_DENSITY_OPTIONS: readonly { }, ]; -const CONVERSATION_FONT_SIZE_OPTIONS: readonly { - value: ConversationFontSize; +const FONT_SIZE_OPTIONS: readonly { + value: FontSize; label: string; }[] = [ { @@ -167,10 +167,10 @@ function ConversationPreview() {