2020-10-17 06:12:00 -05:00
|
|
|
<template>
|
2022-06-20 03:38:49 -05:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
|
|
|
<MkSpacer :content-max="900" :margin-min="20" :margin-max="32">
|
|
|
|
<div ref="el" class="vvcocwet" :class="{ wide: !narrow }">
|
|
|
|
<div class="body">
|
2022-07-20 05:59:27 -05:00
|
|
|
<div v-if="!narrow || currentPage?.route.name == null" class="nav">
|
2022-06-20 03:38:49 -05:00
|
|
|
<div class="baaadecd">
|
2022-07-20 08:24:26 -05:00
|
|
|
<MkInfo v-if="emailNotConfigured" warn class="info">{{ i18n.ts.emailNotConfiguredWarning }} <MkA to="/settings/email" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
|
2023-03-19 06:28:19 -05:00
|
|
|
<MkSuperMenu :def="menuDef" :grid="narrow"></MkSuperMenu>
|
2022-06-20 03:38:49 -05:00
|
|
|
</div>
|
2021-12-09 20:56:23 -06:00
|
|
|
</div>
|
2022-07-20 05:59:27 -05:00
|
|
|
<div v-if="!(narrow && currentPage?.route.name == null)" class="main">
|
2022-12-28 03:02:11 -06:00
|
|
|
<div class="bkzroven" style="container-type: inline-size;">
|
2022-07-20 05:59:27 -05:00
|
|
|
<RouterView/>
|
2022-06-20 03:38:49 -05:00
|
|
|
</div>
|
2021-12-09 20:56:23 -06:00
|
|
|
</div>
|
2021-11-28 05:07:37 -06:00
|
|
|
</div>
|
2021-12-09 20:56:23 -06:00
|
|
|
</div>
|
2022-06-20 03:38:49 -05:00
|
|
|
</MkSpacer>
|
|
|
|
</mkstickycontainer>
|
2020-10-17 06:12:00 -05:00
|
|
|
</template>
|
|
|
|
|
2022-03-06 04:17:43 -06:00
|
|
|
<script setup lang="ts">
|
2023-02-16 08:09:41 -06:00
|
|
|
import { computed, onActivated, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import { i18n } from '@/i18n';
|
2022-09-06 04:21:49 -05:00
|
|
|
import MkInfo from '@/components/MkInfo.vue';
|
|
|
|
import MkSuperMenu from '@/components/MkSuperMenu.vue';
|
2022-12-12 04:27:47 -06:00
|
|
|
import { signout, $i } from '@/account';
|
2021-11-11 11:02:25 -06:00
|
|
|
import { unisonReload } from '@/scripts/unison-reload';
|
|
|
|
import { instance } from '@/instance';
|
2022-06-20 03:38:49 -05:00
|
|
|
import { useRouter } from '@/router';
|
2023-02-16 08:09:41 -06:00
|
|
|
import { definePageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata';
|
2022-06-30 01:09:10 -05:00
|
|
|
import * as os from '@/os';
|
2023-01-06 19:13:02 -06:00
|
|
|
import { miLocalStorage } from '@/local-storage';
|
2023-01-26 20:28:51 -06:00
|
|
|
import { fetchCustomEmojis } from '@/custom-emojis';
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2022-03-06 04:17:43 -06:00
|
|
|
const indexInfo = {
|
|
|
|
title: i18n.ts.settings,
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-settings',
|
2022-03-06 04:17:43 -06:00
|
|
|
hideHeader: true,
|
|
|
|
};
|
|
|
|
const INFO = ref(indexInfo);
|
2023-01-02 19:12:37 -06:00
|
|
|
const el = shallowRef<HTMLElement | null>(null);
|
2022-03-06 04:17:43 -06:00
|
|
|
const childInfo = ref(null);
|
2022-04-23 05:17:15 -05:00
|
|
|
|
2022-06-20 03:38:49 -05:00
|
|
|
const router = useRouter();
|
2022-04-23 05:17:15 -05:00
|
|
|
|
2022-07-20 05:59:27 -05:00
|
|
|
let narrow = $ref(false);
|
2022-04-23 05:17:15 -05:00
|
|
|
const NARROW_THRESHOLD = 600;
|
|
|
|
|
2022-07-20 05:59:27 -05:00
|
|
|
let currentPage = $computed(() => router.currentRef.value.child);
|
|
|
|
|
2022-04-23 05:17:15 -05:00
|
|
|
const ro = new ResizeObserver((entries, observer) => {
|
|
|
|
if (entries.length === 0) return;
|
2022-07-20 05:59:27 -05:00
|
|
|
narrow = entries[0].borderBoxSize[0].inlineSize < NARROW_THRESHOLD;
|
2022-04-23 05:17:15 -05:00
|
|
|
});
|
|
|
|
|
2022-03-06 04:17:43 -06:00
|
|
|
const menuDef = computed(() => [{
|
|
|
|
title: i18n.ts.basicSettings,
|
|
|
|
items: [{
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-user',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.profile,
|
|
|
|
to: '/settings/profile',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'profile',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-lock-open',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.privacy,
|
|
|
|
to: '/settings/privacy',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'privacy',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-mood-happy',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.reaction,
|
|
|
|
to: '/settings/reaction',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'reaction',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-cloud',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.drive,
|
|
|
|
to: '/settings/drive',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'drive',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-bell',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.notifications,
|
|
|
|
to: '/settings/notifications',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'notifications',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-mail',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.email,
|
|
|
|
to: '/settings/email',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'email',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-lock',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.security,
|
|
|
|
to: '/settings/security',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'security',
|
2022-03-06 04:17:43 -06:00
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
title: i18n.ts.clientSettings,
|
|
|
|
items: [{
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-adjustments',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.general,
|
|
|
|
to: '/settings/general',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'general',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-palette',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.theme,
|
|
|
|
to: '/settings/theme',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'theme',
|
2022-07-03 00:40:02 -05:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-menu-2',
|
2022-07-14 03:42:12 -05:00
|
|
|
text: i18n.ts.navbar,
|
|
|
|
to: '/settings/navbar',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'navbar',
|
2022-07-14 03:42:12 -05:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-equal-double',
|
2022-07-03 00:40:02 -05:00
|
|
|
text: i18n.ts.statusbar,
|
2022-07-20 05:59:27 -05:00
|
|
|
to: '/settings/statusbar',
|
|
|
|
active: currentPage?.route.name === 'statusbar',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-music',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.sounds,
|
|
|
|
to: '/settings/sounds',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'sounds',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-plug',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.plugins,
|
|
|
|
to: '/settings/plugin',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'plugin',
|
2022-03-06 04:17:43 -06:00
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
title: i18n.ts.otherSettings,
|
|
|
|
items: [{
|
2023-03-12 01:39:16 -06:00
|
|
|
icon: 'ti ti-badges',
|
|
|
|
text: i18n.ts.roles,
|
|
|
|
to: '/settings/roles',
|
|
|
|
active: currentPage?.route.name === 'roles',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-planet-off',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.instanceMute,
|
|
|
|
to: '/settings/instance-mute',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'instance-mute',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-ban',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.muteAndBlock,
|
|
|
|
to: '/settings/mute-block',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'mute-block',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-message-off',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.wordMute,
|
|
|
|
to: '/settings/word-mute',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'word-mute',
|
2022-03-06 04:17:43 -06:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-api',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: 'API',
|
|
|
|
to: '/settings/api',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'api',
|
2022-04-02 01:28:49 -05:00
|
|
|
}, {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-webhook',
|
2022-04-02 01:28:49 -05:00
|
|
|
text: 'Webhook',
|
|
|
|
to: '/settings/webhook',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'webhook',
|
2023-04-08 00:31:09 -05:00
|
|
|
}, {
|
|
|
|
icon: 'ti ti-package',
|
|
|
|
text: i18n.ts.importAndExport,
|
|
|
|
to: '/settings/import-export',
|
|
|
|
active: currentPage?.route.name === 'import-export',
|
2023-04-08 06:51:36 -05:00
|
|
|
}, /*{
|
2023-04-08 00:31:09 -05:00
|
|
|
icon: 'ti ti-plane',
|
2023-04-08 02:06:08 -05:00
|
|
|
text: i18n.ts.accountMigration,
|
2023-04-08 00:31:09 -05:00
|
|
|
to: '/settings/migration',
|
|
|
|
active: currentPage?.route.name === 'migration',
|
2023-04-08 06:51:36 -05:00
|
|
|
},*/ {
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-dots',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.other,
|
|
|
|
to: '/settings/other',
|
2022-07-20 05:59:27 -05:00
|
|
|
active: currentPage?.route.name === 'other',
|
2022-03-06 04:17:43 -06:00
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
items: [{
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-device-floppy',
|
2022-07-31 07:55:20 -05:00
|
|
|
text: i18n.ts.preferencesBackups,
|
|
|
|
to: '/settings/preferences-backups',
|
|
|
|
active: currentPage?.route.name === 'preferences-backups',
|
|
|
|
}, {
|
2022-03-06 04:17:43 -06:00
|
|
|
type: 'button',
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-trash',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.clearCache,
|
2023-01-26 20:28:51 -06:00
|
|
|
action: async () => {
|
|
|
|
os.waiting();
|
2023-01-06 19:13:02 -06:00
|
|
|
miLocalStorage.removeItem('locale');
|
|
|
|
miLocalStorage.removeItem('theme');
|
2023-01-09 00:50:25 -06:00
|
|
|
miLocalStorage.removeItem('emojis');
|
|
|
|
miLocalStorage.removeItem('lastEmojisFetchedAt');
|
2023-02-23 04:29:20 -06:00
|
|
|
await fetchCustomEmojis(true);
|
2022-03-06 04:17:43 -06:00
|
|
|
unisonReload();
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
type: 'button',
|
2022-12-20 17:39:28 -06:00
|
|
|
icon: 'ti ti-power',
|
2022-03-06 04:17:43 -06:00
|
|
|
text: i18n.ts.logout,
|
2022-06-30 01:09:10 -05:00
|
|
|
action: async () => {
|
|
|
|
const { canceled } = await os.confirm({
|
|
|
|
type: 'warning',
|
|
|
|
text: i18n.ts.logoutConfirm,
|
|
|
|
});
|
|
|
|
if (canceled) return;
|
2022-03-06 04:17:43 -06:00
|
|
|
signout();
|
|
|
|
},
|
|
|
|
danger: true,
|
2022-06-20 03:38:49 -05:00
|
|
|
}],
|
2022-03-06 04:17:43 -06:00
|
|
|
}]);
|
2021-10-08 22:33:08 -05:00
|
|
|
|
2022-07-20 05:59:27 -05:00
|
|
|
watch($$(narrow), () => {
|
2022-03-06 04:17:43 -06:00
|
|
|
});
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2022-07-20 05:59:27 -05:00
|
|
|
onMounted(() => {
|
|
|
|
ro.observe(el.value);
|
2021-01-11 05:38:34 -06:00
|
|
|
|
2022-07-20 05:59:27 -05:00
|
|
|
narrow = el.value.offsetWidth < NARROW_THRESHOLD;
|
2020-11-25 06:31:34 -06:00
|
|
|
|
2022-07-20 05:59:27 -05:00
|
|
|
if (!narrow && currentPage?.route.name == null) {
|
|
|
|
router.replace('/settings/profile');
|
2022-04-23 05:17:15 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-07-20 05:59:27 -05:00
|
|
|
onActivated(() => {
|
|
|
|
narrow = el.value.offsetWidth < NARROW_THRESHOLD;
|
2022-04-23 05:17:15 -05:00
|
|
|
|
2022-07-20 05:59:27 -05:00
|
|
|
if (!narrow && currentPage?.route.name == null) {
|
|
|
|
router.replace('/settings/profile');
|
2022-03-06 04:17:43 -06:00
|
|
|
}
|
|
|
|
});
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2022-04-23 05:17:15 -05:00
|
|
|
onUnmounted(() => {
|
|
|
|
ro.disconnect();
|
|
|
|
});
|
|
|
|
|
2023-03-19 06:28:19 -05:00
|
|
|
watch(router.currentRef, (to) => {
|
2023-04-08 00:31:09 -05:00
|
|
|
if (to.route.name === 'settings' && to.child?.route.name == null && !narrow) {
|
2023-03-19 06:28:19 -05:00
|
|
|
router.replace('/settings/profile');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-03-06 04:17:43 -06:00
|
|
|
const emailNotConfigured = computed(() => instance.enableEmail && ($i.email == null || !$i.emailVerified));
|
2021-05-04 03:09:57 -05:00
|
|
|
|
2022-06-20 03:38:49 -05:00
|
|
|
provideMetadataReceiver((info) => {
|
|
|
|
if (info == null) {
|
2022-04-23 05:17:15 -05:00
|
|
|
childInfo.value = null;
|
|
|
|
} else {
|
2022-06-20 03:38:49 -05:00
|
|
|
childInfo.value = info;
|
2022-04-23 05:17:15 -05:00
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
});
|
|
|
|
|
2022-06-20 03:38:49 -05:00
|
|
|
const headerActions = $computed(() => []);
|
2021-10-02 09:11:21 -05:00
|
|
|
|
2022-06-20 03:38:49 -05:00
|
|
|
const headerTabs = $computed(() => []);
|
2021-10-01 10:51:37 -05:00
|
|
|
|
2022-06-20 03:38:49 -05:00
|
|
|
definePageMetadata(INFO);
|
2022-07-14 03:42:12 -05:00
|
|
|
// w 890
|
|
|
|
// h 700
|
2022-06-20 03:38:49 -05:00
|
|
|
</script>
|
2021-11-28 05:07:37 -06:00
|
|
|
|
2022-12-27 03:29:39 -06:00
|
|
|
<style lang="scss" scoped>
|
2022-06-20 03:38:49 -05:00
|
|
|
.vvcocwet {
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
2021-11-28 05:07:37 -06:00
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|