2020-10-17 06:12:00 -05:00
|
|
|
<template>
|
2021-12-09 20:56:23 -06:00
|
|
|
<MkSpacer :content-max="900" :margin-min="20" :margin-max="32">
|
|
|
|
<div ref="el" class="vvcocwet" :class="{ wide: !narrow }">
|
|
|
|
<div class="header">
|
|
|
|
<div class="title">{{ $ts.settings }}</div>
|
|
|
|
<div v-if="childInfo" class="subtitle">{{ childInfo.title }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="body">
|
|
|
|
<div v-if="!narrow || page == null" class="nav">
|
|
|
|
<div class="baaadecd">
|
|
|
|
<MkInfo v-if="emailNotConfigured" warn class="info">{{ $ts.emailNotConfiguredWarning }} <MkA to="/settings/email" class="_link">{{ $ts.configure }}</MkA></MkInfo>
|
|
|
|
<MkSuperMenu :def="menuDef" :grid="page == null"></MkSuperMenu>
|
|
|
|
</div>
|
2021-10-24 06:16:55 -05:00
|
|
|
</div>
|
2021-12-09 20:56:23 -06:00
|
|
|
<div class="main">
|
|
|
|
<div class="bkzroven">
|
|
|
|
<component :is="component" :key="page" v-bind="pageProps" @info="onInfo"/>
|
|
|
|
</div>
|
2021-11-28 05:07:37 -06:00
|
|
|
</div>
|
2021-12-09 20:56:23 -06:00
|
|
|
</div>
|
2020-10-17 06:12:00 -05:00
|
|
|
</div>
|
2021-12-09 20:56:23 -06:00
|
|
|
</MkSpacer>
|
2020-10-17 06:12:00 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-01-11 05:38:34 -06:00
|
|
|
import { computed, defineAsyncComponent, defineComponent, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import MkInfo from '@/components/ui/info.vue';
|
|
|
|
import MkSuperMenu from '@/components/ui/super-menu.vue';
|
|
|
|
import { scroll } from '@/scripts/scroll';
|
|
|
|
import { signout } from '@/account';
|
|
|
|
import { unisonReload } from '@/scripts/unison-reload';
|
|
|
|
import * as symbols from '@/symbols';
|
|
|
|
import { instance } from '@/instance';
|
|
|
|
import { $i } from '@/account';
|
2020-10-17 06:12:00 -05:00
|
|
|
|
|
|
|
export default defineComponent({
|
2020-11-25 06:31:34 -06:00
|
|
|
components: {
|
2021-10-01 10:51:37 -05:00
|
|
|
MkInfo,
|
2021-10-10 01:19:16 -05:00
|
|
|
MkSuperMenu,
|
2020-11-25 06:31:34 -06:00
|
|
|
},
|
|
|
|
|
2020-10-24 11:21:41 -05:00
|
|
|
props: {
|
2021-04-11 07:09:35 -05:00
|
|
|
initialPage: {
|
2020-10-24 11:21:41 -05:00
|
|
|
type: String,
|
|
|
|
required: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
setup(props, context) {
|
2021-04-11 09:49:13 -05:00
|
|
|
const indexInfo = {
|
2021-10-12 07:41:27 -05:00
|
|
|
title: i18n.locale.settings,
|
2021-09-17 08:39:15 -05:00
|
|
|
icon: 'fas fa-cog',
|
|
|
|
bg: 'var(--bg)',
|
2021-10-23 14:03:07 -05:00
|
|
|
hideHeader: true,
|
2021-04-11 09:49:13 -05:00
|
|
|
};
|
|
|
|
const INFO = ref(indexInfo);
|
2021-04-11 07:09:35 -05:00
|
|
|
const page = ref(props.initialPage);
|
2020-10-17 06:12:00 -05:00
|
|
|
const narrow = ref(false);
|
|
|
|
const view = ref(null);
|
|
|
|
const el = ref(null);
|
2021-11-28 05:07:37 -06:00
|
|
|
const childInfo = ref(null);
|
2021-10-10 01:19:16 -05:00
|
|
|
const menuDef = computed(() => [{
|
|
|
|
title: i18n.locale.basicSettings,
|
|
|
|
items: [{
|
|
|
|
icon: 'fas fa-user',
|
|
|
|
text: i18n.locale.profile,
|
|
|
|
to: '/settings/profile',
|
|
|
|
active: page.value === 'profile',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-lock-open',
|
|
|
|
text: i18n.locale.privacy,
|
|
|
|
to: '/settings/privacy',
|
|
|
|
active: page.value === 'privacy',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-laugh',
|
|
|
|
text: i18n.locale.reaction,
|
|
|
|
to: '/settings/reaction',
|
|
|
|
active: page.value === 'reaction',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-cloud',
|
|
|
|
text: i18n.locale.drive,
|
|
|
|
to: '/settings/drive',
|
|
|
|
active: page.value === 'drive',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-bell',
|
|
|
|
text: i18n.locale.notifications,
|
|
|
|
to: '/settings/notifications',
|
|
|
|
active: page.value === 'notifications',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-envelope',
|
|
|
|
text: i18n.locale.email,
|
|
|
|
to: '/settings/email',
|
|
|
|
active: page.value === 'email',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-share-alt',
|
|
|
|
text: i18n.locale.integration,
|
|
|
|
to: '/settings/integration',
|
|
|
|
active: page.value === 'integration',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-lock',
|
|
|
|
text: i18n.locale.security,
|
|
|
|
to: '/settings/security',
|
|
|
|
active: page.value === 'security',
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
title: i18n.locale.clientSettings,
|
|
|
|
items: [{
|
|
|
|
icon: 'fas fa-cogs',
|
|
|
|
text: i18n.locale.general,
|
|
|
|
to: '/settings/general',
|
|
|
|
active: page.value === 'general',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-palette',
|
|
|
|
text: i18n.locale.theme,
|
|
|
|
to: '/settings/theme',
|
|
|
|
active: page.value === 'theme',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-list-ul',
|
|
|
|
text: i18n.locale.menu,
|
|
|
|
to: '/settings/menu',
|
|
|
|
active: page.value === 'menu',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-music',
|
|
|
|
text: i18n.locale.sounds,
|
|
|
|
to: '/settings/sounds',
|
|
|
|
active: page.value === 'sounds',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-plug',
|
|
|
|
text: i18n.locale.plugins,
|
|
|
|
to: '/settings/plugin',
|
|
|
|
active: page.value === 'plugin',
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
title: i18n.locale.otherSettings,
|
|
|
|
items: [{
|
|
|
|
icon: 'fas fa-boxes',
|
|
|
|
text: i18n.locale.importAndExport,
|
|
|
|
to: '/settings/import-export',
|
|
|
|
active: page.value === 'import-export',
|
2021-12-09 06:38:56 -06:00
|
|
|
}, {
|
|
|
|
icon: 'fas fa-volume-mute',
|
|
|
|
text: i18n.locale.instanceMute,
|
|
|
|
to: '/settings/instance-mute',
|
|
|
|
active: page.value === 'instance-mute',
|
2021-10-10 01:19:16 -05:00
|
|
|
}, {
|
|
|
|
icon: 'fas fa-ban',
|
|
|
|
text: i18n.locale.muteAndBlock,
|
|
|
|
to: '/settings/mute-block',
|
|
|
|
active: page.value === 'mute-block',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-comment-slash',
|
|
|
|
text: i18n.locale.wordMute,
|
|
|
|
to: '/settings/word-mute',
|
|
|
|
active: page.value === 'word-mute',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-key',
|
|
|
|
text: 'API',
|
|
|
|
to: '/settings/api',
|
|
|
|
active: page.value === 'api',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-ellipsis-h',
|
|
|
|
text: i18n.locale.other,
|
|
|
|
to: '/settings/other',
|
|
|
|
active: page.value === 'other',
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
items: [{
|
|
|
|
type: 'button',
|
|
|
|
icon: 'fas fa-trash',
|
|
|
|
text: i18n.locale.clearCache,
|
|
|
|
action: () => {
|
|
|
|
localStorage.removeItem('locale');
|
|
|
|
localStorage.removeItem('theme');
|
|
|
|
unisonReload();
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
type: 'button',
|
|
|
|
icon: 'fas fa-sign-in-alt fa-flip-horizontal',
|
|
|
|
text: i18n.locale.logout,
|
|
|
|
action: () => {
|
|
|
|
signout();
|
|
|
|
},
|
|
|
|
danger: true,
|
|
|
|
},],
|
|
|
|
}]);
|
2021-10-08 22:33:08 -05:00
|
|
|
|
2021-01-11 05:38:34 -06:00
|
|
|
const pageProps = ref({});
|
2020-10-24 11:21:41 -05:00
|
|
|
const component = computed(() => {
|
2021-04-11 07:09:35 -05:00
|
|
|
if (page.value == null) return null;
|
|
|
|
switch (page.value) {
|
2021-04-22 23:01:52 -05:00
|
|
|
case 'accounts': return defineAsyncComponent(() => import('./accounts.vue'));
|
2020-10-24 11:21:41 -05:00
|
|
|
case 'profile': return defineAsyncComponent(() => import('./profile.vue'));
|
|
|
|
case 'privacy': return defineAsyncComponent(() => import('./privacy.vue'));
|
|
|
|
case 'reaction': return defineAsyncComponent(() => import('./reaction.vue'));
|
2021-01-23 03:14:57 -06:00
|
|
|
case 'drive': return defineAsyncComponent(() => import('./drive.vue'));
|
2020-10-24 11:21:41 -05:00
|
|
|
case 'notifications': return defineAsyncComponent(() => import('./notifications.vue'));
|
|
|
|
case 'mute-block': return defineAsyncComponent(() => import('./mute-block.vue'));
|
|
|
|
case 'word-mute': return defineAsyncComponent(() => import('./word-mute.vue'));
|
2021-12-09 06:38:56 -06:00
|
|
|
case 'instance-mute': return defineAsyncComponent(() => import('./instance-mute.vue'));
|
2020-10-24 11:21:41 -05:00
|
|
|
case 'integration': return defineAsyncComponent(() => import('./integration.vue'));
|
|
|
|
case 'security': return defineAsyncComponent(() => import('./security.vue'));
|
2020-11-25 06:31:34 -06:00
|
|
|
case '2fa': return defineAsyncComponent(() => import('./2fa.vue'));
|
2020-10-24 11:21:41 -05:00
|
|
|
case 'api': return defineAsyncComponent(() => import('./api.vue'));
|
2020-11-25 06:31:34 -06:00
|
|
|
case 'apps': return defineAsyncComponent(() => import('./apps.vue'));
|
2020-10-24 11:21:41 -05:00
|
|
|
case 'other': return defineAsyncComponent(() => import('./other.vue'));
|
|
|
|
case 'general': return defineAsyncComponent(() => import('./general.vue'));
|
2020-11-25 06:31:34 -06:00
|
|
|
case 'email': return defineAsyncComponent(() => import('./email.vue'));
|
2020-10-24 11:21:41 -05:00
|
|
|
case 'theme': return defineAsyncComponent(() => import('./theme.vue'));
|
2020-11-25 06:31:34 -06:00
|
|
|
case 'theme/install': return defineAsyncComponent(() => import('./theme.install.vue'));
|
|
|
|
case 'theme/manage': return defineAsyncComponent(() => import('./theme.manage.vue'));
|
2021-07-18 21:36:35 -05:00
|
|
|
case 'menu': return defineAsyncComponent(() => import('./menu.vue'));
|
2020-10-24 11:21:41 -05:00
|
|
|
case 'sounds': return defineAsyncComponent(() => import('./sounds.vue'));
|
2021-07-13 10:11:05 -05:00
|
|
|
case 'custom-css': return defineAsyncComponent(() => import('./custom-css.vue'));
|
2020-11-25 06:31:34 -06:00
|
|
|
case 'deck': return defineAsyncComponent(() => import('./deck.vue'));
|
2021-02-06 06:05:00 -06:00
|
|
|
case 'plugin': return defineAsyncComponent(() => import('./plugin.vue'));
|
|
|
|
case 'plugin/install': return defineAsyncComponent(() => import('./plugin.install.vue'));
|
2020-10-24 11:21:41 -05:00
|
|
|
case 'import-export': return defineAsyncComponent(() => import('./import-export.vue'));
|
2020-11-25 06:31:34 -06:00
|
|
|
case 'account-info': return defineAsyncComponent(() => import('./account-info.vue'));
|
2021-08-20 22:48:50 -05:00
|
|
|
case 'delete-account': return defineAsyncComponent(() => import('./delete-account.vue'));
|
2021-01-11 05:38:34 -06:00
|
|
|
}
|
2021-11-18 08:32:43 -06:00
|
|
|
return null;
|
2020-10-24 11:21:41 -05:00
|
|
|
});
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2020-11-25 06:31:34 -06:00
|
|
|
watch(component, () => {
|
2021-01-11 05:38:34 -06:00
|
|
|
pageProps.value = {};
|
|
|
|
|
2020-11-25 06:31:34 -06:00
|
|
|
nextTick(() => {
|
2021-10-08 22:33:08 -05:00
|
|
|
scroll(el.value, { top: 0 });
|
2020-11-25 06:31:34 -06:00
|
|
|
});
|
2021-01-11 05:38:34 -06:00
|
|
|
}, { immediate: true });
|
2020-11-25 06:31:34 -06:00
|
|
|
|
2021-04-11 07:09:35 -05:00
|
|
|
watch(() => props.initialPage, () => {
|
2021-04-11 07:31:38 -05:00
|
|
|
if (props.initialPage == null && !narrow.value) {
|
|
|
|
page.value = 'profile';
|
|
|
|
} else {
|
|
|
|
page.value = props.initialPage;
|
2021-04-11 09:49:13 -05:00
|
|
|
if (props.initialPage == null) {
|
|
|
|
INFO.value = indexInfo;
|
|
|
|
}
|
2021-04-11 07:31:38 -05:00
|
|
|
}
|
2021-04-11 07:09:35 -05:00
|
|
|
});
|
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
onMounted(() => {
|
2021-04-11 07:09:35 -05:00
|
|
|
narrow.value = el.value.offsetWidth < 800;
|
|
|
|
if (!narrow.value) {
|
|
|
|
page.value = 'profile';
|
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
});
|
|
|
|
|
2021-05-04 03:09:57 -05:00
|
|
|
const emailNotConfigured = computed(() => instance.enableEmail && ($i.email == null || !$i.emailVerified));
|
|
|
|
|
2021-11-28 05:07:37 -06:00
|
|
|
const onInfo = (info) => {
|
|
|
|
childInfo.value = info;
|
|
|
|
};
|
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
return {
|
2021-04-09 22:54:12 -05:00
|
|
|
[symbols.PAGE_INFO]: INFO,
|
2021-04-11 07:09:35 -05:00
|
|
|
page,
|
2021-10-10 01:19:16 -05:00
|
|
|
menuDef,
|
2020-10-17 06:12:00 -05:00
|
|
|
narrow,
|
|
|
|
view,
|
|
|
|
el,
|
2021-01-11 05:38:34 -06:00
|
|
|
pageProps,
|
2020-10-24 11:21:41 -05:00
|
|
|
component,
|
2021-05-04 03:09:57 -05:00
|
|
|
emailNotConfigured,
|
2021-11-28 05:07:37 -06:00
|
|
|
onInfo,
|
|
|
|
childInfo,
|
2020-10-17 06:12:00 -05:00
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.vvcocwet {
|
2021-12-09 20:56:23 -06:00
|
|
|
> .header {
|
|
|
|
display: flex;
|
|
|
|
margin-bottom: 24px;
|
2021-12-10 00:33:01 -06:00
|
|
|
font-size: 1.3em;
|
2021-12-09 20:56:23 -06:00
|
|
|
font-weight: bold;
|
2021-10-02 09:11:21 -05:00
|
|
|
|
2021-12-09 20:56:23 -06:00
|
|
|
> .title {
|
|
|
|
width: 34%;
|
2021-10-01 10:51:37 -05:00
|
|
|
}
|
|
|
|
|
2021-12-09 20:56:23 -06:00
|
|
|
> .subtitle {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
2021-11-28 05:07:37 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-09 20:56:23 -06:00
|
|
|
> .body {
|
2020-10-17 06:12:00 -05:00
|
|
|
> .nav {
|
2021-10-24 06:16:55 -05:00
|
|
|
.baaadecd {
|
2021-12-09 20:56:23 -06:00
|
|
|
> .info {
|
|
|
|
margin: 16px 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .accounts {
|
|
|
|
> .avatar {
|
|
|
|
display: block;
|
|
|
|
width: 50px;
|
|
|
|
height: 50px;
|
|
|
|
margin: 8px auto 16px auto;
|
|
|
|
}
|
2021-10-24 06:16:55 -05:00
|
|
|
}
|
2021-10-16 01:00:55 -05:00
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
2021-11-28 05:07:37 -06:00
|
|
|
.bkzroven {
|
2021-12-09 20:56:23 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.wide {
|
|
|
|
> .body {
|
|
|
|
display: flex;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
> .nav {
|
|
|
|
width: 34%;
|
|
|
|
padding-right: 32px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
|
|
|
overflow: auto;
|
2021-11-28 05:07:37 -06:00
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|