Refactor settings/other to use Composition API (#8589)
* refactor(client): refactor settings/other to use Composition API * fix(client): fix 'show featured notes' checkbox
This commit is contained in:
parent
81e5ff7dce
commit
8489afa3d7
1 changed files with 22 additions and 44 deletions
|
@ -1,66 +1,44 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="_formRoot">
|
<div class="_formRoot">
|
||||||
<FormSwitch :value="$i.injectFeaturedNote" class="_formBlock" @update:modelValue="onChangeInjectFeaturedNote">
|
<FormSwitch v-model="$i.injectFeaturedNote" class="_formBlock" @update:modelValue="onChangeInjectFeaturedNote">
|
||||||
{{ $ts.showFeaturedNotesInTimeline }}
|
{{ i18n.ts.showFeaturedNotesInTimeline }}
|
||||||
</FormSwitch>
|
</FormSwitch>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<FormSwitch v-model="reportError" class="_formBlock">{{ $ts.sendErrorReports }}<template #caption>{{ $ts.sendErrorReportsDescription }}</template></FormSwitch>
|
<FormSwitch v-model="reportError" class="_formBlock">{{ i18n.ts.sendErrorReports }}<template #caption>{{ i18n.ts.sendErrorReportsDescription }}</template></FormSwitch>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<FormLink to="/settings/account-info" class="_formBlock">{{ $ts.accountInfo }}</FormLink>
|
<FormLink to="/settings/account-info" class="_formBlock">{{ i18n.ts.accountInfo }}</FormLink>
|
||||||
|
|
||||||
<FormLink to="/settings/delete-account" class="_formBlock"><template #icon><i class="fas fa-exclamation-triangle"></i></template>{{ $ts.closeAccount }}</FormLink>
|
<FormLink to="/settings/delete-account" class="_formBlock"><template #icon><i class="fas fa-exclamation-triangle"></i></template>{{ i18n.ts.closeAccount }}</FormLink>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent, defineComponent } from 'vue';
|
import { computed, defineExpose } from 'vue';
|
||||||
import FormSwitch from '@/components/form/switch.vue';
|
import FormSwitch from '@/components/form/switch.vue';
|
||||||
import FormSection from '@/components/form/section.vue';
|
|
||||||
import FormLink from '@/components/form/link.vue';
|
import FormLink from '@/components/form/link.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { debug } from '@/config';
|
|
||||||
import { defaultStore } from '@/store';
|
import { defaultStore } from '@/store';
|
||||||
import { unisonReload } from '@/scripts/unison-reload';
|
|
||||||
import * as symbols from '@/symbols';
|
import * as symbols from '@/symbols';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
|
||||||
export default defineComponent({
|
const reportError = computed(defaultStore.makeGetterSetter('reportError'));
|
||||||
components: {
|
|
||||||
FormSection,
|
|
||||||
FormSwitch,
|
|
||||||
FormLink,
|
|
||||||
},
|
|
||||||
|
|
||||||
emits: ['info'],
|
function onChangeInjectFeaturedNote(v) {
|
||||||
|
os.api('i/update', {
|
||||||
|
injectFeaturedNote: v
|
||||||
|
}).then((i) => {
|
||||||
|
$i!.injectFeaturedNote = i.injectFeaturedNote;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
data() {
|
defineExpose({
|
||||||
return {
|
[symbols.PAGE_INFO]: {
|
||||||
[symbols.PAGE_INFO]: {
|
title: i18n.ts.other,
|
||||||
title: this.$ts.other,
|
icon: 'fas fa-ellipsis-h',
|
||||||
icon: 'fas fa-ellipsis-h',
|
bg: 'var(--bg)',
|
||||||
bg: 'var(--bg)',
|
|
||||||
},
|
|
||||||
debug,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
reportError: defaultStore.makeGetterSetter('reportError'),
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
changeDebug(v) {
|
|
||||||
console.log(v);
|
|
||||||
localStorage.setItem('debug', v.toString());
|
|
||||||
unisonReload();
|
|
||||||
},
|
|
||||||
|
|
||||||
onChangeInjectFeaturedNote(v) {
|
|
||||||
os.api('i/update', {
|
|
||||||
injectFeaturedNote: v
|
|
||||||
});
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue