upd: add corner roundness setting

This commit is contained in:
ShittyKopper 2023-10-31 21:21:29 +03:00
parent 5ab8dcf2be
commit e1844db11b
7 changed files with 34 additions and 0 deletions

View File

@ -507,6 +507,7 @@ createAccount: "Create account"
existingAccount: "Existing account" existingAccount: "Existing account"
regenerate: "Regenerate" regenerate: "Regenerate"
fontSize: "Font size" fontSize: "Font size"
cornerRadius: "Corner roundness"
mediaListWithOneImageAppearance: "Height of media lists with one image only" mediaListWithOneImageAppearance: "Height of media lists with one image only"
limitTo: "Limit to {x}" limitTo: "Limit to {x}"
noFollowRequests: "You don't have any pending follow requests" noFollowRequests: "You don't have any pending follow requests"

1
locales/index.d.ts vendored
View File

@ -510,6 +510,7 @@ export interface Locale {
"existingAccount": string; "existingAccount": string;
"regenerate": string; "regenerate": string;
"fontSize": string; "fontSize": string;
"cornerRadius": string;
"mediaListWithOneImageAppearance": string; "mediaListWithOneImageAppearance": string;
"limitTo": string; "limitTo": string;
"noFollowRequests": string; "noFollowRequests": string;

View File

@ -507,6 +507,7 @@ createAccount: "アカウントを作成"
existingAccount: "既存のアカウント" existingAccount: "既存のアカウント"
regenerate: "再生成" regenerate: "再生成"
fontSize: "フォントサイズ" fontSize: "フォントサイズ"
cornerRadius: "コーナーの丸み"
mediaListWithOneImageAppearance: "画像が1枚のみのメディアリストの高さ" mediaListWithOneImageAppearance: "画像が1枚のみのメディアリストの高さ"
limitTo: "{x}を上限に" limitTo: "{x}を上限に"
noFollowRequests: "フォロー申請はありません" noFollowRequests: "フォロー申請はありません"

View File

@ -132,6 +132,11 @@
document.documentElement.classList.add('f-' + fontSize); document.documentElement.classList.add('f-' + fontSize);
} }
const cornerRadius = localStorage.getItem('cornerRadius');
if (cornerRadius) {
document.documentElement.classList.add(`radius-${cornerRadius}`);
}
const useSystemFont = localStorage.getItem('useSystemFont'); const useSystemFont = localStorage.getItem('useSystemFont');
if (useSystemFont) { if (useSystemFont) {
document.documentElement.classList.add('useSystemFont'); document.documentElement.classList.add('useSystemFont');

View File

@ -21,6 +21,7 @@ type Keys =
'colorScheme' | 'colorScheme' |
'useSystemFont' | 'useSystemFont' |
'fontSize' | 'fontSize' |
'cornerRadius' |
'ui' | 'ui' |
'ui_temp' | 'ui_temp' |
'locale' | 'locale' |

View File

@ -142,6 +142,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="2"><span style="font-size: 16px;">Aa</span></option> <option value="2"><span style="font-size: 16px;">Aa</span></option>
<option value="3"><span style="font-size: 17px;">Aa</span></option> <option value="3"><span style="font-size: 17px;">Aa</span></option>
</MkRadios> </MkRadios>
<MkRadios v-model="cornerRadius">
<template #label>{{ i18n.ts.cornerRadius }}</template>
<option :value="null">Sharkey</option>
<option value="misskey">Misskey</option>
</MkRadios>
</div> </div>
</FormSection> </FormSection>
@ -212,6 +218,7 @@ import { claimAchievement } from '@/scripts/achievements.js';
const lang = ref(miLocalStorage.getItem('lang')); const lang = ref(miLocalStorage.getItem('lang'));
const fontSize = ref(miLocalStorage.getItem('fontSize')); const fontSize = ref(miLocalStorage.getItem('fontSize'));
const cornerRadius = ref(miLocalStorage.getItem('cornerRadius'));
const useSystemFont = ref(miLocalStorage.getItem('useSystemFont') != null); const useSystemFont = ref(miLocalStorage.getItem('useSystemFont') != null);
async function reloadAsk() { async function reloadAsk() {
@ -277,6 +284,14 @@ watch(fontSize, () => {
} }
}); });
watch(cornerRadius, () => {
if (cornerRadius.value == null) {
miLocalStorage.removeItem('cornerRadius');
} else {
miLocalStorage.setItem('cornerRadius', cornerRadius.value);
}
});
watch(useSystemFont, () => { watch(useSystemFont, () => {
if (useSystemFont.value) { if (useSystemFont.value) {
miLocalStorage.setItem('useSystemFont', 't'); miLocalStorage.setItem('useSystemFont', 't');
@ -288,6 +303,7 @@ watch(useSystemFont, () => {
watch([ watch([
lang, lang,
fontSize, fontSize,
cornerRadius,
useSystemFont, useSystemFont,
enableInfiniteScroll, enableInfiniteScroll,
squareAvatars, squareAvatars,

View File

@ -114,6 +114,7 @@ type Profile = {
hot: Record<keyof typeof defaultStoreSaveKeys, unknown>; hot: Record<keyof typeof defaultStoreSaveKeys, unknown>;
cold: Record<keyof typeof coldDeviceStorageSaveKeys, unknown>; cold: Record<keyof typeof coldDeviceStorageSaveKeys, unknown>;
fontSize: string | null; fontSize: string | null;
cornerRadius: string | null;
useSystemFont: 't' | null; useSystemFont: 't' | null;
wallpaper: string | null; wallpaper: string | null;
}; };
@ -171,6 +172,7 @@ function getSettings(): Profile['settings'] {
hot, hot,
cold, cold,
fontSize: miLocalStorage.getItem('fontSize'), fontSize: miLocalStorage.getItem('fontSize'),
cornerRadius: miLocalStorage.getItem('cornerRadius'),
useSystemFont: miLocalStorage.getItem('useSystemFont') as 't' | null, useSystemFont: miLocalStorage.getItem('useSystemFont') as 't' | null,
wallpaper: miLocalStorage.getItem('wallpaper'), wallpaper: miLocalStorage.getItem('wallpaper'),
}; };
@ -284,6 +286,13 @@ async function applyProfile(id: string): Promise<void> {
miLocalStorage.removeItem('fontSize'); miLocalStorage.removeItem('fontSize');
} }
// cornerRadius
if (settings.cornerRadius) {
miLocalStorage.setItem('cornerRadius', settings.cornerRadius);
} else {
miLocalStorage.removeItem('cornerRadius');
}
// useSystemFont // useSystemFont
if (settings.useSystemFont) { if (settings.useSystemFont) {
miLocalStorage.setItem('useSystemFont', settings.useSystemFont); miLocalStorage.setItem('useSystemFont', settings.useSystemFont);