This commit is contained in:
Timothy Jaeryang Baek committed 2026-07-11 00:42:50 -05:00
1 parent 4aab53a924
commit 2196739b10
13 files changed
+49 -8

No files matched your search

@@ -2,7 +2,8 @@
import { toast } from 'svelte-sonner';
import Icon from '../Icon.svelte';
import { t } from '$lib/i18n';
import { textScale, theme, themeConfig } from '$lib/stores';
import { textScale, theme, themeConfig, widescreenMode } from '$lib/stores';
import ToggleSwitch from '$lib/components/common/ToggleSwitch.svelte';
import type { Theme, ThemeConfig } from '$lib/stores';
import {
normalizeHexColor,
@@ -21,7 +22,9 @@
const resolvedTheme = $derived(resolveThemeMode($theme));
const resolvedConfig = $derived(resolveThemeConfig($theme, $themeConfig));
const hasCustomAppearance = $derived(Boolean($themeConfig || $textScale !== null));
const hasCustomAppearance = $derived(
Boolean($themeConfig || $textScale !== null || $widescreenMode)
);
$effect(() => {
colorDrafts = {
@@ -102,13 +105,15 @@
scaleEnabled = false;
scaleDraft = 1;
textScale.set(null);
widescreenMode.set(false);
}
function exportTheme() {
const payload = {
theme: $theme,
themeConfig: sanitizeThemeConfig($themeConfig),
textScale: $textScale
textScale: $textScale,
widescreenMode: $widescreenMode
};
try {
@@ -155,13 +160,21 @@
typeof parsed?.textScale === 'number' && Number.isFinite(parsed.textScale)
? normalizeTextScale(parsed.textScale)
: undefined;
const importedWidescreenMode =
typeof parsed?.widescreenMode === 'boolean' ? parsed.widescreenMode : undefined;
if (!importedConfig && !importedTheme && importedScale === undefined) {
if (
!importedConfig &&
!importedTheme &&
importedScale === undefined &&
importedWidescreenMode === undefined
) {
throw new Error('empty theme');
}
if (importedTheme) theme.set(importedTheme);
if (importedConfig) themeConfig.set(importedConfig);
if (importedScale !== undefined) textScale.set(importedScale === 1 ? null : importedScale);
if (importedWidescreenMode !== undefined) widescreenMode.set(importedWidescreenMode);
toast.success($t('appearance.imported'));
} catch {
toast.error($t('appearance.importFailed'));
@@ -262,6 +275,12 @@
/>
</label>
<label class="flex items-center justify-between gap-3 mt-3">
<span class="text-xs text-gray-600 dark:text-gray-400">{$t('appearance.widescreenMode')}</span
>
<ToggleSwitch value={$widescreenMode} onchange={(value) => widescreenMode.set(value)} />
</label>
<h3 class="text-xs text-gray-400 dark:text-gray-600 mb-2 mt-5">
{$t('general.uiScale')}
</h3>
@@ -37,7 +37,8 @@
planMode,
streamingBehavior,
selectedModelId,
requestParams
requestParams,
widescreenMode
} from '$lib/stores';
import { getPathDisplayName } from '$lib/utils/paths';
import {
@@ -1609,7 +1610,11 @@
style="background: var(--app-bg); color: var(--app-fg);"
onscroll={handleMessagesScroll}
>
<div class="max-w-2xl mx-auto px-4 pt-4 pb-16 flex flex-col gap-4">
<div
class="{$widescreenMode
? 'max-w-full'
: 'max-w-2xl'} mx-auto w-full px-4 pt-4 pb-16 flex flex-col gap-4"
>
{#if hasHiddenMessages}
<div bind:this={loadSentinelEl} class="h-1 w-full" aria-hidden="true"></div>
{/if}
@@ -1651,7 +1656,7 @@
<!-- Input area -->
<div class="px-4 py-3" style="background: var(--app-bg);">
<div class="max-w-2xl mx-auto relative">
<div class="{$widescreenMode ? 'max-w-full' : 'max-w-2xl'} mx-auto w-full relative">
{#if !autoScroll && activePath.length > 0}
<div
class="absolute -top-10 left-0 right-0 pr-2 flex justify-end z-30 pointer-events-none"
@@ -942,6 +942,7 @@
"appearance.background": "Hintergrund",
"appearance.foreground": "Vordergrund",
"appearance.uiFont": "Oberflächenschrift",
"appearance.widescreenMode": "Breitbildmodus",
"appearance.exported": "Design exportiert",
"appearance.exportFailed": "Design konnte nicht exportiert werden",
"appearance.imported": "Design importiert",
@@ -954,6 +954,7 @@
"appearance.background": "Background",
"appearance.foreground": "Foreground",
"appearance.uiFont": "UI font",
"appearance.widescreenMode": "Widescreen Mode",
"appearance.exported": "Theme exported",
"appearance.exportFailed": "Failed to export theme",
"appearance.imported": "Theme imported",
@@ -942,6 +942,7 @@
"appearance.background": "Fondo",
"appearance.foreground": "Primer plano",
"appearance.uiFont": "Fuente de interfaz",
"appearance.widescreenMode": "Modo panorámico",
"appearance.exported": "Tema exportado",
"appearance.exportFailed": "Error al exportar el tema",
"appearance.imported": "Tema importado",
@@ -942,6 +942,7 @@
"appearance.background": "Arrière-plan",
"appearance.foreground": "Premier plan",
"appearance.uiFont": "Police de l’interface",
"appearance.widescreenMode": "Mode grand écran",
"appearance.exported": "Thème exporté",
"appearance.exportFailed": "Échec de l’export du thème",
"appearance.imported": "Thème importé",
@@ -942,6 +942,7 @@
"appearance.background": "背景",
"appearance.foreground": "前景",
"appearance.uiFont": "UIフォント",
"appearance.widescreenMode": "ワイドスクリーンモード",
"appearance.exported": "テーマをエクスポートしました",
"appearance.exportFailed": "テーマのエクスポートに失敗しました",
"appearance.imported": "テーマをインポートしました",
@@ -942,6 +942,7 @@
"appearance.background": "배경",
"appearance.foreground": "전경",
"appearance.uiFont": "UI 글꼴",
"appearance.widescreenMode": "와이드스크린 모드",
"appearance.exported": "테마를 내보냈습니다",
"appearance.exportFailed": "테마 내보내기에 실패했습니다",
"appearance.imported": "테마를 가져왔습니다",
@@ -942,6 +942,7 @@
"appearance.background": "Plano de fundo",
"appearance.foreground": "Primeiro plano",
"appearance.uiFont": "Fonte da interface",
"appearance.widescreenMode": "Modo tela ampla",
"appearance.exported": "Tema exportado",
"appearance.exportFailed": "Falha ao exportar o tema",
"appearance.imported": "Tema importado",
@@ -942,6 +942,7 @@
"appearance.background": "Фон",
"appearance.foreground": "Передний план",
"appearance.uiFont": "Шрифт интерфейса",
"appearance.widescreenMode": "Широкоэкранный режим",
"appearance.exported": "Тема экспортирована",
"appearance.exportFailed": "Не удалось экспортировать тему",
"appearance.imported": "Тема импортирована",
@@ -942,6 +942,7 @@
"appearance.background": "背景",
"appearance.foreground": "前景",
"appearance.uiFont": "界面字体",
"appearance.widescreenMode": "宽屏模式",
"appearance.exported": "主题已导出",
"appearance.exportFailed": "主题导出失败",
"appearance.imported": "主题已导入",
@@ -942,6 +942,7 @@
"appearance.background": "背景",
"appearance.foreground": "前景",
"appearance.uiFont": "介面字體",
"appearance.widescreenMode": "寬螢幕模式",
"appearance.exported": "主題已匯出",
"appearance.exportFailed": "主題匯出失敗",
"appearance.imported": "主題已匯入",
+8 -1
View File
@@ -112,6 +112,7 @@ export interface UserPreferences {
showUpdateToast?: boolean; // show version update notifications (default true)
pwa?: PwaPreferences;
textScale?: number | null;
widescreenMode?: boolean;
}
// ── ID generation ───────────────────────────────────────────────
@@ -307,6 +308,7 @@ export const selectedModelId = writable<string>('');
export const pwaPreferences = writable<PwaPreferences>(defaultPwaPreferences);
export const themeConfig = writable<ThemeConfig | null>(null);
export const textScale = writable<number | null>(null);
export const widescreenMode = writable(false);
/** Saved workspace path order for sidebar drag-reorder. */
export const workspaceOrder = writable<string[]>([]);
@@ -405,7 +407,8 @@ function persistPreferences(): void {
requestParams: Object.keys(get(requestParams)).length ? get(requestParams) : undefined,
showUpdateToast: get(showUpdateToastPref),
pwa: get(pwaPreferences),
textScale: get(textScale) ?? undefined
textScale: get(textScale) ?? undefined,
widescreenMode: get(widescreenMode)
};
savePreferences(prefs as unknown as Record<string, unknown>).catch(() => {});
}, 300);
@@ -460,6 +463,9 @@ function subscribeForPersistence() {
textScale.subscribe(() => {
if (get(stateLoaded)) persistPreferences();
});
widescreenMode.subscribe(() => {
if (get(stateLoaded)) persistPreferences();
});
i18next.on('languageChanged', () => {
if (get(stateLoaded)) persistPreferences();
});
@@ -500,6 +506,7 @@ export async function loadPreferences(): Promise<void> {
? (prefs.textScale as number)
: null
);
if (prefs.widescreenMode !== undefined) widescreenMode.set(prefs.widescreenMode as boolean);
const pwaPrefs = prefs.pwa;
if (pwaPrefs)
pwaPreferences.set({