2020-10-17 05:12:00 -06:00
|
|
|
<template>
|
|
|
|
<div class="vvcocwet" :class="{ wide: !narrow }" ref="el">
|
2020-11-25 05:31:34 -07:00
|
|
|
<FormBase class="nav" v-if="!narrow || page == null" :force-wide="!narrow">
|
|
|
|
<FormGroup>
|
2020-12-25 18:47:36 -07:00
|
|
|
<template #label>{{ $ts.basicSettings }}</template>
|
|
|
|
<FormLink :active="page === 'profile'" replace to="/settings/profile"><template #icon><Fa :icon="faUser"/></template>{{ $ts.profile }}</FormLink>
|
|
|
|
<FormLink :active="page === 'privacy'" replace to="/settings/privacy"><template #icon><Fa :icon="faLockOpen"/></template>{{ $ts.privacy }}</FormLink>
|
|
|
|
<FormLink :active="page === 'reaction'" replace to="/settings/reaction"><template #icon><Fa :icon="faLaugh"/></template>{{ $ts.reaction }}</FormLink>
|
2021-01-23 02:14:57 -07:00
|
|
|
<FormLink :active="page === 'drive'" replace to="/settings/drive"><template #icon><Fa :icon="faCloud"/></template>{{ $ts.drive }}</FormLink>
|
2020-12-25 18:47:36 -07:00
|
|
|
<FormLink :active="page === 'notifications'" replace to="/settings/notifications"><template #icon><Fa :icon="faBell"/></template>{{ $ts.notifications }}</FormLink>
|
|
|
|
<FormLink :active="page === 'email'" replace to="/settings/email"><template #icon><Fa :icon="faEnvelope"/></template>{{ $ts.email }}</FormLink>
|
|
|
|
<FormLink :active="page === 'integration'" replace to="/settings/integration"><template #icon><Fa :icon="faShareAlt"/></template>{{ $ts.integration }}</FormLink>
|
|
|
|
<FormLink :active="page === 'security'" replace to="/settings/security"><template #icon><Fa :icon="faLock"/></template>{{ $ts.security }}</FormLink>
|
2020-11-25 05:31:34 -07:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
2020-12-25 18:47:36 -07:00
|
|
|
<template #label>{{ $ts.clientSettings }}</template>
|
|
|
|
<FormLink :active="page === 'general'" replace to="/settings/general"><template #icon><Fa :icon="faCogs"/></template>{{ $ts.general }}</FormLink>
|
|
|
|
<FormLink :active="page === 'theme'" replace to="/settings/theme"><template #icon><Fa :icon="faPalette"/></template>{{ $ts.theme }}</FormLink>
|
|
|
|
<FormLink :active="page === 'sidebar'" replace to="/settings/sidebar"><template #icon><Fa :icon="faListUl"/></template>{{ $ts.sidebar }}</FormLink>
|
|
|
|
<FormLink :active="page === 'sounds'" replace to="/settings/sounds"><template #icon><Fa :icon="faMusic"/></template>{{ $ts.sounds }}</FormLink>
|
2021-02-06 05:05:00 -07:00
|
|
|
<FormLink :active="page === 'plugin'" replace to="/settings/plugin"><template #icon><Fa :icon="faPlug"/></template>{{ $ts.plugins }}</FormLink>
|
2020-11-25 05:31:34 -07:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
2020-12-25 18:47:36 -07:00
|
|
|
<template #label>{{ $ts.otherSettings }}</template>
|
|
|
|
<FormLink :active="page === 'import-export'" replace to="/settings/import-export"><template #icon><Fa :icon="faBoxes"/></template>{{ $ts.importAndExport }}</FormLink>
|
|
|
|
<FormLink :active="page === 'mute-block'" replace to="/settings/mute-block"><template #icon><Fa :icon="faBan"/></template>{{ $ts.muteAndBlock }}</FormLink>
|
|
|
|
<FormLink :active="page === 'word-mute'" replace to="/settings/word-mute"><template #icon><Fa :icon="faCommentSlash"/></template>{{ $ts.wordMute }}</FormLink>
|
2020-11-25 05:31:34 -07:00
|
|
|
<FormLink :active="page === 'api'" replace to="/settings/api"><template #icon><Fa :icon="faKey"/></template>API</FormLink>
|
2020-12-25 18:47:36 -07:00
|
|
|
<FormLink :active="page === 'other'" replace to="/settings/other"><template #icon><Fa :icon="faEllipsisH"/></template>{{ $ts.other }}</FormLink>
|
2020-11-25 05:31:34 -07:00
|
|
|
</FormGroup>
|
2020-12-29 18:15:16 -07:00
|
|
|
<FormGroup>
|
|
|
|
<FormButton @click="clear">{{ $ts.clearCache }}</FormButton>
|
|
|
|
</FormGroup>
|
2020-11-25 05:31:34 -07:00
|
|
|
<FormGroup>
|
2020-12-25 18:47:36 -07:00
|
|
|
<FormButton @click="logout" danger>{{ $ts.logout }}</FormButton>
|
2020-11-25 05:31:34 -07:00
|
|
|
</FormGroup>
|
|
|
|
</FormBase>
|
2020-10-17 05:12:00 -06:00
|
|
|
<div class="main">
|
2021-01-11 04:38:34 -07:00
|
|
|
<component :is="component" :key="page" @info="onInfo" v-bind="pageProps"/>
|
2020-10-17 05:12:00 -06:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-01-11 04:38:34 -07:00
|
|
|
import { computed, defineAsyncComponent, defineComponent, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
2021-01-23 02:14:57 -07:00
|
|
|
import { faCog, faPalette, faPlug, faUser, faListUl, faLock, faCommentSlash, faMusic, faCogs, faEllipsisH, faBan, faShareAlt, faLockOpen, faKey, faBoxes, faCloud } from '@fortawesome/free-solid-svg-icons';
|
2020-11-25 05:31:34 -07:00
|
|
|
import { faLaugh, faBell, faEnvelope } from '@fortawesome/free-regular-svg-icons';
|
2021-03-23 02:30:14 -06:00
|
|
|
import { i18n } from '@client/i18n';
|
|
|
|
import FormLink from '@client/components/form/link.vue';
|
|
|
|
import FormGroup from '@client/components/form/group.vue';
|
|
|
|
import FormBase from '@client/components/form/base.vue';
|
|
|
|
import FormButton from '@client/components/form/button.vue';
|
|
|
|
import { scroll } from '@client/scripts/scroll';
|
|
|
|
import { signout } from '@client/account';
|
|
|
|
import { unisonReload } from '@client/scripts/unison-reload';
|
2021-04-09 21:54:12 -06:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-10-17 05:12:00 -06:00
|
|
|
|
|
|
|
export default defineComponent({
|
2020-11-25 05:31:34 -07:00
|
|
|
components: {
|
|
|
|
FormBase,
|
|
|
|
FormLink,
|
|
|
|
FormGroup,
|
|
|
|
FormButton,
|
|
|
|
},
|
|
|
|
|
2020-10-24 10:21:41 -06:00
|
|
|
props: {
|
|
|
|
page: {
|
|
|
|
type: String,
|
|
|
|
required: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-17 05:12:00 -06:00
|
|
|
setup(props, context) {
|
|
|
|
const INFO = ref({
|
2020-12-25 18:51:00 -07:00
|
|
|
title: i18n.locale.settings,
|
2020-11-03 04:36:12 -07:00
|
|
|
icon: faCog
|
2020-10-17 05:12:00 -06:00
|
|
|
});
|
|
|
|
const narrow = ref(false);
|
|
|
|
const view = ref(null);
|
|
|
|
const el = ref(null);
|
|
|
|
const onInfo = (viewInfo) => {
|
|
|
|
INFO.value = viewInfo;
|
|
|
|
};
|
2021-01-11 04:38:34 -07:00
|
|
|
const pageProps = ref({});
|
2020-10-24 10:21:41 -06:00
|
|
|
const component = computed(() => {
|
2021-01-11 04:38:34 -07:00
|
|
|
if (props.page == null) return null;
|
2020-10-24 10:21:41 -06:00
|
|
|
switch (props.page) {
|
|
|
|
case 'profile': return defineAsyncComponent(() => import('./profile.vue'));
|
|
|
|
case 'privacy': return defineAsyncComponent(() => import('./privacy.vue'));
|
|
|
|
case 'reaction': return defineAsyncComponent(() => import('./reaction.vue'));
|
2021-01-23 02:14:57 -07:00
|
|
|
case 'drive': return defineAsyncComponent(() => import('./drive.vue'));
|
2020-10-24 10:21:41 -06: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 05:31:34 -07:00
|
|
|
case '2fa': return defineAsyncComponent(() => import('./2fa.vue'));
|
2020-10-24 10:21:41 -06:00
|
|
|
case 'api': return defineAsyncComponent(() => import('./api.vue'));
|
2020-11-25 05:31:34 -07:00
|
|
|
case 'apps': return defineAsyncComponent(() => import('./apps.vue'));
|
2020-10-24 10:21:41 -06:00
|
|
|
case 'other': return defineAsyncComponent(() => import('./other.vue'));
|
|
|
|
case 'general': return defineAsyncComponent(() => import('./general.vue'));
|
2020-11-25 05:31:34 -07:00
|
|
|
case 'email': return defineAsyncComponent(() => import('./email.vue'));
|
|
|
|
case 'email/address': return defineAsyncComponent(() => import('./email-address.vue'));
|
2021-02-12 20:28:26 -07:00
|
|
|
case 'email/notification': return defineAsyncComponent(() => import('./email-notification.vue'));
|
2020-10-24 10:21:41 -06:00
|
|
|
case 'theme': return defineAsyncComponent(() => import('./theme.vue'));
|
2020-11-25 05:31:34 -07:00
|
|
|
case 'theme/install': return defineAsyncComponent(() => import('./theme.install.vue'));
|
|
|
|
case 'theme/manage': return defineAsyncComponent(() => import('./theme.manage.vue'));
|
2020-10-24 10:21:41 -06:00
|
|
|
case 'sidebar': return defineAsyncComponent(() => import('./sidebar.vue'));
|
|
|
|
case 'sounds': return defineAsyncComponent(() => import('./sounds.vue'));
|
2020-11-25 05:31:34 -07:00
|
|
|
case 'deck': return defineAsyncComponent(() => import('./deck.vue'));
|
2021-02-06 05:05:00 -07: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 10:21:41 -06:00
|
|
|
case 'import-export': return defineAsyncComponent(() => import('./import-export.vue'));
|
2020-11-25 05:31:34 -07:00
|
|
|
case 'account-info': return defineAsyncComponent(() => import('./account-info.vue'));
|
2021-01-23 00:52:45 -07:00
|
|
|
case 'update': return defineAsyncComponent(() => import('./update.vue'));
|
2021-01-11 04:38:34 -07:00
|
|
|
case 'registry': return defineAsyncComponent(() => import('./registry.vue'));
|
2020-11-29 02:06:35 -07:00
|
|
|
case 'experimental-features': return defineAsyncComponent(() => import('./experimental-features.vue'));
|
2021-01-11 04:38:34 -07:00
|
|
|
}
|
|
|
|
if (props.page.startsWith('registry/keys/system/')) {
|
|
|
|
return defineAsyncComponent(() => import('./registry.keys.vue'));
|
|
|
|
}
|
|
|
|
if (props.page.startsWith('registry/value/system/')) {
|
|
|
|
return defineAsyncComponent(() => import('./registry.value.vue'));
|
2020-10-24 10:21:41 -06:00
|
|
|
}
|
|
|
|
});
|
2020-10-17 05:12:00 -06:00
|
|
|
|
2020-11-25 05:31:34 -07:00
|
|
|
watch(component, () => {
|
2021-01-11 04:38:34 -07:00
|
|
|
pageProps.value = {};
|
|
|
|
|
|
|
|
if (props.page) {
|
|
|
|
if (props.page.startsWith('registry/keys/system/')) {
|
|
|
|
pageProps.value.scope = props.page.replace('registry/keys/system/', '').split('/');
|
|
|
|
}
|
|
|
|
if (props.page.startsWith('registry/value/system/')) {
|
|
|
|
const path = props.page.replace('registry/value/system/', '').split('/');
|
|
|
|
pageProps.value.xKey = path.pop();
|
|
|
|
pageProps.value.scope = path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-25 05:31:34 -07:00
|
|
|
nextTick(() => {
|
|
|
|
scroll(el.value, 0);
|
|
|
|
});
|
2021-01-11 04:38:34 -07:00
|
|
|
}, { immediate: true });
|
2020-11-25 05:31:34 -07:00
|
|
|
|
2020-10-17 05:12:00 -06:00
|
|
|
onMounted(() => {
|
2020-11-25 05:31:34 -07:00
|
|
|
narrow.value = el.value.offsetWidth < 1025;
|
2020-10-17 05:12:00 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
2021-04-09 21:54:12 -06:00
|
|
|
[symbols.PAGE_INFO]: INFO,
|
2020-10-17 05:12:00 -06:00
|
|
|
narrow,
|
|
|
|
view,
|
|
|
|
el,
|
|
|
|
onInfo,
|
2021-01-11 04:38:34 -07:00
|
|
|
pageProps,
|
2020-10-24 10:21:41 -06:00
|
|
|
component,
|
2020-10-17 05:12:00 -06:00
|
|
|
logout: () => {
|
2020-12-18 18:55:52 -07:00
|
|
|
signout();
|
2020-10-17 05:12:00 -06:00
|
|
|
},
|
2020-12-29 18:15:16 -07:00
|
|
|
clear: () => {
|
|
|
|
localStorage.removeItem('locale');
|
|
|
|
localStorage.removeItem('theme');
|
2021-02-17 05:36:56 -07:00
|
|
|
unisonReload();
|
2020-12-29 18:15:16 -07:00
|
|
|
},
|
2021-01-23 02:14:57 -07:00
|
|
|
faPalette, faPlug, faUser, faListUl, faLock, faLaugh, faCommentSlash, faMusic, faBell, faCogs, faEllipsisH, faBan, faShareAlt, faLockOpen, faKey, faBoxes, faEnvelope, faCloud,
|
2020-10-17 05:12:00 -06:00
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.vvcocwet {
|
|
|
|
&.wide {
|
|
|
|
display: flex;
|
2020-11-25 05:31:34 -07:00
|
|
|
max-width: 1100px;
|
|
|
|
margin: 0 auto;
|
2020-10-17 05:12:00 -06:00
|
|
|
|
|
|
|
> .nav {
|
2020-11-25 05:31:34 -07:00
|
|
|
width: 32%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
border-right: solid 0.5px var(--divider);
|
2020-10-17 05:12:00 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
flex: 1;
|
2020-12-11 20:12:01 -07:00
|
|
|
min-width: 0;
|
2020-11-13 20:16:28 -07:00
|
|
|
--baseContentWidth: 100%;
|
|
|
|
|
|
|
|
::v-deep(._section) {
|
|
|
|
padding: 0 0 32px 0;
|
|
|
|
|
|
|
|
& + ._section {
|
|
|
|
padding-top: 32px;
|
|
|
|
}
|
|
|
|
}
|
2020-10-17 05:12:00 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|