2020-10-17 06:12:00 -05:00
|
|
|
<template>
|
|
|
|
<div class="vvcocwet" :class="{ wide: !narrow }" ref="el">
|
2021-04-11 07:09:35 -05:00
|
|
|
<div class="nav" v-if="!narrow || page == null">
|
2021-10-02 09:11:21 -05:00
|
|
|
<div class="group accounts">
|
2021-10-01 10:51:37 -05:00
|
|
|
<MkAvatar :user="$i" class="avatar"/>
|
2021-09-29 10:50:45 -05:00
|
|
|
<XLink :active="page === 'accounts'" replace to="/settings/accounts"><template #icon><i class="fas fa-users"></i></template>{{ $ts.accounts }}</XLink>
|
2021-10-01 10:51:37 -05:00
|
|
|
</div>
|
2021-10-02 22:25:59 -05:00
|
|
|
<MkInfo v-if="emailNotConfigured" warn class="info">{{ $ts.emailNotConfiguredWarning }} <MkA to="/settings/email" class="_link">{{ $ts.configure }}</MkA></MkInfo>
|
2021-10-01 10:51:37 -05:00
|
|
|
<div class="group">
|
|
|
|
<div class="label">{{ $ts.basicSettings }}</div>
|
2021-09-29 10:50:45 -05:00
|
|
|
<XLink :active="page === 'profile'" replace to="/settings/profile"><template #icon><i class="fas fa-user"></i></template>{{ $ts.profile }}</XLink>
|
|
|
|
<XLink :active="page === 'privacy'" replace to="/settings/privacy"><template #icon><i class="fas fa-lock-open"></i></template>{{ $ts.privacy }}</XLink>
|
|
|
|
<XLink :active="page === 'reaction'" replace to="/settings/reaction"><template #icon><i class="fas fa-laugh"></i></template>{{ $ts.reaction }}</XLink>
|
|
|
|
<XLink :active="page === 'drive'" replace to="/settings/drive"><template #icon><i class="fas fa-cloud"></i></template>{{ $ts.drive }}</XLink>
|
|
|
|
<XLink :active="page === 'notifications'" replace to="/settings/notifications"><template #icon><i class="fas fa-bell"></i></template>{{ $ts.notifications }}</XLink>
|
|
|
|
<XLink :active="page === 'email'" replace to="/settings/email"><template #icon><i class="fas fa-envelope"></i></template>{{ $ts.email }}</XLink>
|
|
|
|
<XLink :active="page === 'integration'" replace to="/settings/integration"><template #icon><i class="fas fa-share-alt"></i></template>{{ $ts.integration }}</XLink>
|
|
|
|
<XLink :active="page === 'security'" replace to="/settings/security"><template #icon><i class="fas fa-lock"></i></template>{{ $ts.security }}</XLink>
|
2021-10-01 10:51:37 -05:00
|
|
|
</div>
|
|
|
|
<div class="group">
|
|
|
|
<div class="label">{{ $ts.clientSettings }}</div>
|
2021-09-29 10:50:45 -05:00
|
|
|
<XLink :active="page === 'general'" replace to="/settings/general"><template #icon><i class="fas fa-cogs"></i></template>{{ $ts.general }}</XLink>
|
|
|
|
<XLink :active="page === 'theme'" replace to="/settings/theme"><template #icon><i class="fas fa-palette"></i></template>{{ $ts.theme }}</XLink>
|
|
|
|
<XLink :active="page === 'menu'" replace to="/settings/menu"><template #icon><i class="fas fa-list-ul"></i></template>{{ $ts.menu }}</XLink>
|
|
|
|
<XLink :active="page === 'sounds'" replace to="/settings/sounds"><template #icon><i class="fas fa-music"></i></template>{{ $ts.sounds }}</XLink>
|
|
|
|
<XLink :active="page === 'plugin'" replace to="/settings/plugin"><template #icon><i class="fas fa-plug"></i></template>{{ $ts.plugins }}</XLink>
|
2021-10-01 10:51:37 -05:00
|
|
|
</div>
|
|
|
|
<div class="group">
|
|
|
|
<div class="label">{{ $ts.otherSettings }}</div>
|
2021-09-29 10:50:45 -05:00
|
|
|
<XLink :active="page === 'import-export'" replace to="/settings/import-export"><template #icon><i class="fas fa-boxes"></i></template>{{ $ts.importAndExport }}</XLink>
|
|
|
|
<XLink :active="page === 'mute-block'" replace to="/settings/mute-block"><template #icon><i class="fas fa-ban"></i></template>{{ $ts.muteAndBlock }}</XLink>
|
|
|
|
<XLink :active="page === 'word-mute'" replace to="/settings/word-mute"><template #icon><i class="fas fa-comment-slash"></i></template>{{ $ts.wordMute }}</XLink>
|
|
|
|
<XLink :active="page === 'api'" replace to="/settings/api"><template #icon><i class="fas fa-key"></i></template>API</XLink>
|
|
|
|
<XLink :active="page === 'other'" replace to="/settings/other"><template #icon><i class="fas fa-ellipsis-h"></i></template>{{ $ts.other }}</XLink>
|
2021-10-01 10:51:37 -05:00
|
|
|
</div>
|
2021-10-02 12:46:58 -05:00
|
|
|
<div class="group">
|
|
|
|
<XLink @click="clear"><template #icon><i class="fas fa-trash"></i></template>{{ $ts.clearCache }}</XLink>
|
|
|
|
<XLink @click="logout" danger><template #icon><i class="fas fa-sign-in-alt fa-flip-horizontal"></i></template>{{ $ts.logout }}</XLink>
|
|
|
|
</div>
|
2021-04-11 07:09:35 -05:00
|
|
|
</div>
|
2020-10-17 06:12:00 -05:00
|
|
|
<div class="main">
|
2021-01-11 05:38:34 -06:00
|
|
|
<component :is="component" :key="page" @info="onInfo" v-bind="pageProps"/>
|
2020-10-17 06:12:00 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-01-11 05:38:34 -06:00
|
|
|
import { computed, defineAsyncComponent, defineComponent, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
2021-03-23 03:30:14 -05:00
|
|
|
import { i18n } from '@client/i18n';
|
2021-09-29 10:50:45 -05:00
|
|
|
import XLink from './index.link.vue';
|
2021-10-01 10:51:37 -05:00
|
|
|
import MkInfo from '@client/components/ui/info.vue';
|
2021-03-23 03:30:14 -05:00
|
|
|
import { scroll } from '@client/scripts/scroll';
|
|
|
|
import { signout } from '@client/account';
|
|
|
|
import { unisonReload } from '@client/scripts/unison-reload';
|
2021-04-09 22:54:12 -05:00
|
|
|
import * as symbols from '@client/symbols';
|
2021-05-04 03:09:57 -05:00
|
|
|
import { instance } from '@client/instance';
|
|
|
|
import { $i } from '@client/account';
|
2020-10-17 06:12:00 -05:00
|
|
|
|
|
|
|
export default defineComponent({
|
2020-11-25 06:31:34 -06:00
|
|
|
components: {
|
2021-09-29 10:50:45 -05:00
|
|
|
XLink,
|
2021-10-01 10:51:37 -05:00
|
|
|
MkInfo,
|
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 = {
|
2020-12-25 19:51:00 -06:00
|
|
|
title: i18n.locale.settings,
|
2021-09-17 08:39:15 -05:00
|
|
|
icon: 'fas fa-cog',
|
|
|
|
bg: 'var(--bg)',
|
2021-10-08 08:03:06 -05:00
|
|
|
hide: 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);
|
|
|
|
const onInfo = (viewInfo) => {
|
|
|
|
INFO.value = viewInfo;
|
|
|
|
};
|
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'));
|
|
|
|
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'));
|
|
|
|
case 'email/address': return defineAsyncComponent(() => import('./email-address.vue'));
|
2021-02-12 21:28:26 -06:00
|
|
|
case 'email/notification': return defineAsyncComponent(() => import('./email-notification.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'));
|
|
|
|
case 'plugin/manage': return defineAsyncComponent(() => import('./plugin.manage.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-01-23 01:52:45 -06:00
|
|
|
case 'update': return defineAsyncComponent(() => import('./update.vue'));
|
2021-01-11 05:38:34 -06:00
|
|
|
case 'registry': return defineAsyncComponent(() => import('./registry.vue'));
|
2021-08-20 22:48:50 -05:00
|
|
|
case 'delete-account': return defineAsyncComponent(() => import('./delete-account.vue'));
|
2020-11-29 03:06:35 -06:00
|
|
|
case 'experimental-features': return defineAsyncComponent(() => import('./experimental-features.vue'));
|
2021-01-11 05:38:34 -06:00
|
|
|
}
|
2021-04-11 07:09:35 -05:00
|
|
|
if (page.value.startsWith('registry/keys/system/')) {
|
2021-01-11 05:38:34 -06:00
|
|
|
return defineAsyncComponent(() => import('./registry.keys.vue'));
|
|
|
|
}
|
2021-04-11 07:09:35 -05:00
|
|
|
if (page.value.startsWith('registry/value/system/')) {
|
2021-01-11 05:38:34 -06:00
|
|
|
return defineAsyncComponent(() => import('./registry.value.vue'));
|
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 = {};
|
|
|
|
|
2021-04-11 07:09:35 -05:00
|
|
|
if (page.value) {
|
|
|
|
if (page.value.startsWith('registry/keys/system/')) {
|
|
|
|
pageProps.value.scope = page.value.replace('registry/keys/system/', '').split('/');
|
2021-01-11 05:38:34 -06:00
|
|
|
}
|
2021-04-11 07:09:35 -05:00
|
|
|
if (page.value.startsWith('registry/value/system/')) {
|
|
|
|
const path = page.value.replace('registry/value/system/', '').split('/');
|
2021-01-11 05:38:34 -06:00
|
|
|
pageProps.value.xKey = path.pop();
|
|
|
|
pageProps.value.scope = path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-25 06:31:34 -06:00
|
|
|
nextTick(() => {
|
|
|
|
scroll(el.value, 0);
|
|
|
|
});
|
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));
|
|
|
|
|
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,
|
2020-10-17 06:12:00 -05:00
|
|
|
narrow,
|
|
|
|
view,
|
|
|
|
el,
|
|
|
|
onInfo,
|
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,
|
2020-10-17 06:12:00 -05:00
|
|
|
logout: () => {
|
2020-12-18 19:55:52 -06:00
|
|
|
signout();
|
2020-10-17 06:12:00 -05:00
|
|
|
},
|
2020-12-29 19:15:16 -06:00
|
|
|
clear: () => {
|
|
|
|
localStorage.removeItem('locale');
|
|
|
|
localStorage.removeItem('theme');
|
2021-02-17 06:36:56 -06:00
|
|
|
unisonReload();
|
2020-12-29 19:15:16 -06:00
|
|
|
},
|
2020-10-17 06:12:00 -05:00
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.vvcocwet {
|
2021-10-01 10:51:37 -05:00
|
|
|
> .nav {
|
|
|
|
> .group {
|
|
|
|
padding: 16px;
|
|
|
|
|
|
|
|
> .label {
|
|
|
|
font-size: 0.9em;
|
|
|
|
opacity: 0.7;
|
2021-10-02 09:11:21 -05:00
|
|
|
margin: 0 0 8px 12px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .info {
|
|
|
|
margin: 0 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .accounts {
|
|
|
|
> .avatar {
|
|
|
|
display: block;
|
|
|
|
width: 50px;
|
|
|
|
height: 50px;
|
2021-10-02 12:46:58 -05:00
|
|
|
margin: 8px auto 16px auto;
|
2021-10-01 10:51:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
&.wide {
|
|
|
|
display: flex;
|
2021-09-29 10:50:45 -05:00
|
|
|
max-width: 1000px;
|
2020-11-25 06:31:34 -06:00
|
|
|
margin: 0 auto;
|
2021-04-11 07:09:35 -05:00
|
|
|
height: 100%;
|
2020-10-17 06:12:00 -05:00
|
|
|
|
|
|
|
> .nav {
|
2020-11-25 06:31:34 -06:00
|
|
|
width: 32%;
|
|
|
|
box-sizing: border-box;
|
2021-04-11 07:09:35 -05:00
|
|
|
overflow: auto;
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
flex: 1;
|
2020-12-11 21:12:01 -06:00
|
|
|
min-width: 0;
|
2021-04-11 07:09:35 -05:00
|
|
|
overflow: auto;
|
2020-11-13 21:16:28 -06:00
|
|
|
--baseContentWidth: 100%;
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|