enhance(frontend): make deck profiles syncable

This commit is contained in:
syuilo 2025-03-12 21:12:08 +09:00
parent a06b9eefaa
commit 4a73feb041
4 changed files with 41 additions and 11 deletions

4
locales/index.d.ts vendored
View File

@ -9848,6 +9848,10 @@ export interface Locale extends ILocale {
* 調 * 調
*/ */
"flexible": string; "flexible": string;
/**
*
*/
"enableSyncBetweenDevicesForProfiles": string;
"_columns": { "_columns": {
/** /**
* *

View File

@ -2603,6 +2603,7 @@ _deck:
useSimpleUiForNonRootPages: "非ルートページは簡易UIで表示" useSimpleUiForNonRootPages: "非ルートページは簡易UIで表示"
usedAsMinWidthWhenFlexible: "「幅を自動調整」が有効の場合、これが幅の最小値となります" usedAsMinWidthWhenFlexible: "「幅を自動調整」が有効の場合、これが幅の最小値となります"
flexible: "幅を自動調整" flexible: "幅を自動調整"
enableSyncBetweenDevicesForProfiles: "プロファイル情報のデバイス間同期を有効にする"
_columns: _columns:
main: "メイン" main: "メイン"

View File

@ -4,7 +4,10 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<SearchMarker path="/settings/deck" :label="i18n.ts.deck" :keywords="['deck', 'ui']" icon="ti ti-columns">
<div class="_gaps_m"> <div class="_gaps_m">
<MkSwitch :modelValue="profilesSyncEnabled" @update:modelValue="changeProfilesSyncEnabled">{{ i18n.ts._deck.enableSyncBetweenDevicesForProfiles }}</MkSwitch>
<MkSwitch v-model="useSimpleUiForNonRootPages">{{ i18n.ts._deck.useSimpleUiForNonRootPages }}</MkSwitch> <MkSwitch v-model="useSimpleUiForNonRootPages">{{ i18n.ts._deck.useSimpleUiForNonRootPages }}</MkSwitch>
<MkSwitch v-model="navWindow">{{ i18n.ts.defaultNavigationBehaviour }}: {{ i18n.ts.openInWindow }}</MkSwitch> <MkSwitch v-model="navWindow">{{ i18n.ts.defaultNavigationBehaviour }}: {{ i18n.ts.openInWindow }}</MkSwitch>
@ -17,10 +20,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="center">{{ i18n.ts.center }}</option> <option value="center">{{ i18n.ts.center }}</option>
</MkRadios> </MkRadios>
</div> </div>
</SearchMarker>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue'; import { computed, ref } from 'vue';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
import MkRadios from '@/components/MkRadios.vue'; import MkRadios from '@/components/MkRadios.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -32,6 +36,20 @@ const useSimpleUiForNonRootPages = prefer.model('deck.useSimpleUiForNonRootPages
const alwaysShowMainColumn = prefer.model('deck.alwaysShowMainColumn'); const alwaysShowMainColumn = prefer.model('deck.alwaysShowMainColumn');
const columnAlign = prefer.model('deck.columnAlign'); const columnAlign = prefer.model('deck.columnAlign');
const profilesSyncEnabled = ref(prefer.isSyncEnabled('deck.profiles'));
function changeProfilesSyncEnabled(value: boolean) {
if (value) {
prefer.enableSync('deck.profiles').then((res) => {
if (res == null) return;
if (res.enabled) profilesSyncEnabled.value = true;
});
} else {
prefer.disableSync('deck.profiles');
profilesSyncEnabled.value = false;
}
}
const headerActions = computed(() => []); const headerActions = computed(() => []);
const headerTabs = computed(() => []); const headerTabs = computed(() => []);

View File

@ -604,6 +604,13 @@ export const searchIndexes: SearchIndexItem[] = [
path: '/settings/drive', path: '/settings/drive',
icon: 'ti ti-cloud', icon: 'ti ti-cloud',
}, },
{
id: 'FfZdOs8y',
label: i18n.ts.deck,
keywords: ['deck', 'ui'],
path: '/settings/deck',
icon: 'ti ti-columns',
},
{ {
id: 'BlJ2rsw9h', id: 'BlJ2rsw9h',
children: [ children: [