-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapp.vue
More file actions
66 lines (58 loc) · 1.34 KB
/
app.vue
File metadata and controls
66 lines (58 loc) · 1.34 KB
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
65
66
<script setup lang="ts">
import MainLoader from '@/components/Atoms/MainLoader.vue';
import ModalWindow from '@/components/Molecules/ModalWindow.vue';
import SnackBar from '@/components/Molecules/SnackBar.vue';
const { $pwa, hook } = useNuxtApp();
const { closeModal, openModal } = useModal();
const { isDarkTheme } = useTheme();
const { width } = useSidebar();
const { showMediaPlayer } = useAudioPlayer();
const loading = ref(true);
hook('page:finish', () => {
loading.value = false;
});
watch(
() => $pwa?.needRefresh,
(needRefresh) => {
if (needRefresh) {
openModal(MODAL_TYPE.appUpdateModal, {
onDismiss() {
closeModal();
},
onModalClose() {
$pwa?.cancelPrompt();
},
onUpdate() {
$pwa?.updateServiceWorker(true);
},
});
}
},
);
useHead({
bodyAttrs: {
style: {
'--sidebar-bottom': () =>
showMediaPlayer.value ? 'var(--media-player-height)' : '0px',
'--sidebar-width': width,
'--theme-color': THEME_COLOUR,
},
},
htmlAttrs: {
class: {
dark: () => isDarkTheme.value,
},
},
});
</script>
<template>
<NuxtPwaAssets />
<NuxtLayout>
<div v-if="loading" class="fullscreen centerAll">
<MainLoader />
</div>
<NuxtPage />
<ModalWindow />
<SnackBar />
</NuxtLayout>
</template>