forked from ets-berkeley-edu/nessie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
68 lines (60 loc) · 1.81 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
65
66
67
68
<template>
<v-container id="app" class="h-100 px-0" fluid>
<Header />
<v-row v-if="currentUser">
<v-tabs v-model="tabIndex" align-tabs="center" class="w-100">
<v-tab
v-for="item in selectablePaths"
:key="item.title"
:value="item.path"
@click="go(item.path)"
>
{{ item.title }}
</v-tab>
</v-tabs>
<v-card-text>
<LargeSpinner v-if="contextStore.isLoading || isToggling" />
<div v-show="!contextStore.isLoading && !isToggling" class="mt-3 mx-4">
<router-view />
</div>
</v-card-text>
</v-row>
<v-row v-if="!currentUser">
<LochNess />
</v-row>
<v-row v-if="!isToggling && !contextStore.isLoading" class="mx-4 pb-3">
<v-col>
<img src="@/assets/uc-berkeley-logo.svg" />
</v-col>
<v-col class="text-right">
© 2025 The Regents of the University of California
</v-col>
</v-row>
</v-container>
</template>
<script setup>
import {ref, watch} from 'vue'
import Header from '@/components/Header.vue'
import LargeSpinner from '@/components/widgets/LargeSpinner.vue'
import LochNess from '@/components/LochNess.vue'
import router from '@/router'
import {useContextStore} from '@/stores/context'
const contextStore = useContextStore()
const currentUser = contextStore.currentUser
const isToggling = ref(false)
const tabIndex = ref(undefined)
const selectablePaths = [
{title: 'Jobs', path: '/'},
{title: 'Schedule', path: '/schedule'},
{title: 'configs', path: '/configs'},
{title: '🎱', path: '/8ball'}
]
const go = (path) => {
isToggling.value = true
router.push({path: path}).then(() => {
isToggling.value = false
tabIndex.value = path
})
}
watch(router.currentRoute, route => { tabIndex.value = route.path})
</script>