diff --git a/packages/backend/src/server/web/boot.js b/packages/backend/src/server/web/boot.js index 96896cfe2..197246e21 100644 --- a/packages/backend/src/server/web/boot.js +++ b/packages/backend/src/server/web/boot.js @@ -117,7 +117,7 @@ } //#endregion - const fontSize = localStorage.getItem('fontSize'); + const fontSize = localStorage.getItem('fontSize') || 2; if (fontSize) { document.documentElement.classList.add('f-' + fontSize); } diff --git a/packages/frontend/src/_dev_boot_.ts b/packages/frontend/src/_dev_boot_.ts index f312765dc..08a64b4b4 100644 --- a/packages/frontend/src/_dev_boot_.ts +++ b/packages/frontend/src/_dev_boot_.ts @@ -62,7 +62,7 @@ async function main() { } //#endregion - const fontSize = localStorage.getItem('fontSize'); + const fontSize = localStorage.getItem('fontSize') || 2; if (fontSize) { document.documentElement.classList.add('f-' + fontSize); } diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue index 4cfc99186..2d06f4e82 100644 --- a/packages/frontend/src/pages/settings/general.vue +++ b/packages/frontend/src/pages/settings/general.vue @@ -147,12 +147,24 @@ SPDX-License-Identifier: AGPL-3.0-only
- + - - - - + + + + + + + @@ -273,10 +285,31 @@ import { globalEvents } from '@/events.js'; import { claimAchievement } from '@/scripts/achievements.js'; const lang = ref(miLocalStorage.getItem('lang')); -const fontSize = ref(miLocalStorage.getItem('fontSize')); +const fontSizeNumber = ref(Number(miLocalStorage.getItem('fontSize') || 2)); +const fontSizeNumberOld = ref(fontSizeNumber.value); +const cornerRadius = ref(miLocalStorage.getItem('cornerRadius')); const useSystemFont = ref(miLocalStorage.getItem('useSystemFont') != null); const dataSaver = ref(defaultStore.state.dataSaver); +const fontSizePx = computed(() => fontSizeNumber.value + 14); + +function saveFontSize() { + miLocalStorage.setItem('fontSize', fontSizeNumber.value.toString()); + window.document.documentElement.classList.remove('f-' + fontSizeNumberOld.value); + window.document.documentElement.classList.add('f-' + fontSizeNumber.value); + fontSizeNumberOld.value = fontSizeNumber.value; +} + +async function reloadAsk() { + const { canceled } = await os.confirm({ + type: 'info', + text: i18n.ts.reloadToApplySetting, + }); + if (canceled) return; + + unisonReload(); +} + const hemisphere = computed(defaultStore.makeGetterSetter('hemisphere')); const overridedDeviceKind = computed(defaultStore.makeGetterSetter('overridedDeviceKind')); const serverDisconnectedBehavior = computed(defaultStore.makeGetterSetter('serverDisconnectedBehavior')); @@ -328,11 +361,11 @@ watch(lang, () => { miLocalStorage.removeItem('localeVersion'); }); -watch(fontSize, () => { - if (fontSize.value == null) { - miLocalStorage.removeItem('fontSize'); +watch(cornerRadius, () => { + if (cornerRadius.value == null) { + miLocalStorage.removeItem('cornerRadius'); } else { - miLocalStorage.setItem('fontSize', fontSize.value); + miLocalStorage.setItem('cornerRadius', cornerRadius.value); } }); @@ -347,7 +380,7 @@ watch(useSystemFont, () => { watch([ hemisphere, lang, - fontSize, + cornerRadius, useSystemFont, enableInfiniteScroll, squareAvatars, diff --git a/packages/frontend/src/style.scss b/packages/frontend/src/style.scss index 2dcca1fe6..c686b058c 100644 --- a/packages/frontend/src/style.scss +++ b/packages/frontend/src/style.scss @@ -74,17 +74,39 @@ html { } } + &.f-0 { + font-size: 14px; + } &.f-1 { font-size: 15px; } - &.f-2 { font-size: 16px; } - &.f-3 { font-size: 17px; } + &.f-4 { + font-size: 18px; + } + &.f-5 { + font-size: 19px; + } + &.f-6 { + font-size: 20px; + } + &.f-7 { + font-size: 21px; + } + &.f-8 { + font-size: 22px; + } + &.f-9 { + font-size: 23px; + } + &.f-10 { + font-size: 24px; + } &.useSystemFont { font-family: system-ui;