forked from snapshot-labs/snapshot-v1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
64 lines (57 loc) · 1.82 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<script setup>
import { computed, onMounted, provide, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useModal } from '@/composables/useModal';
import { useI18n } from '@/composables/useI18n';
import { useDomain } from '@/composables/useDomain';
import { useUserSkin } from '@/composables/useUserSkin';
import { useApp } from '@/composables/useApp';
import { useWeb3 } from '@/composables/useWeb3';
import { useNotifications } from '@/composables/useNotifications';
import aliases from '@/../snapshot-spaces/spaces/aliases.json';
const { domain } = useDomain();
const { loadLocale } = useI18n();
const route = useRoute();
const { modalOpen } = useModal();
const { userSkin } = useUserSkin();
const { init, explore, app } = useApp();
const { web3 } = useWeb3();
const { notify } = useNotifications();
provide('web3', web3);
provide('notify', notify);
const space = computed(() => {
const key = aliases[domain] || domain || route.params.key;
return explore.value.spaces?.[key];
});
const skin = computed(() => {
if (domain && space.value?.skin) {
let skinClass = space.value.skin;
if (userSkin.value === 'dark-mode')
skinClass += ` ${space.value.skin}-dark-mode`;
return skinClass;
}
return userSkin.value;
});
onMounted(async () => {
await loadLocale();
init();
});
watch(modalOpen, val => {
const el = document.body;
el.classList[val ? 'add' : 'remove']('overflow-hidden');
});
</script>
<template>
<div :class="skin" id="app" class="overflow-hidden pb-4 font-serif text-base">
<UiLoading v-if="app.loading || !app.init" class="overlay big" />
<div v-else>
<Scroller />
<div :class="{ 'sm:ml-[68px]': !domain }">
<Topnav />
<router-view :key="$route.path" class="flex-auto" />
</div>
</div>
<div id="modal" />
<Notifications />
</div>
</template>