FitTrackee/fittrackee_client/src/App.vue

115 lines
2.3 KiB
Vue
Raw Normal View History

<template>
<NavBar @menuInteraction="updateHideScrollBar" />
<div v-if="appLoading" class="app-container">
<div class="app-loading">
<Loader />
</div>
</div>
<div v-else class="app-container" :class="{ 'hide-scroll': hideScrollBar }">
<router-view v-if="appConfig" />
<NoConfig v-else />
2021-08-15 09:24:10 +02:00
</div>
2021-07-25 17:10:55 +02:00
<Footer />
</template>
2021-07-25 13:03:34 +02:00
<script lang="ts">
2021-09-26 08:59:17 +02:00
import {
Chart,
BarElement,
LineElement,
PointElement,
Legend,
Title,
Tooltip,
Filler,
BarController,
CategoryScale,
LineController,
LinearScale,
} from 'chart.js'
import ChartDataLabels from 'chartjs-plugin-datalabels'
import {
ComputedRef,
computed,
defineComponent,
ref,
onBeforeMount,
} from 'vue'
2021-08-11 22:21:26 +02:00
import Loader from '@/components/Common/Loader.vue'
import Footer from '@/components/Footer.vue'
2021-07-25 13:23:25 +02:00
import NavBar from '@/components/NavBar.vue'
import NoConfig from '@/components/NoConfig.vue'
import { ROOT_STORE } from '@/store/constants'
2021-08-21 18:36:44 +02:00
import { IAppConfig } from '@/types/application'
import { useStore } from '@/use/useStore'
2021-07-25 13:03:34 +02:00
2021-09-26 08:59:17 +02:00
Chart.register(
BarElement,
LineElement,
PointElement,
Legend,
Title,
Tooltip,
Filler,
BarController,
CategoryScale,
LineController,
LinearScale,
ChartDataLabels
)
2021-07-25 13:23:25 +02:00
export default defineComponent({
name: 'App',
components: {
2021-07-25 17:10:55 +02:00
Footer,
Loader,
2021-07-25 13:23:25 +02:00
NavBar,
NoConfig,
2021-07-25 13:23:25 +02:00
},
2021-08-15 12:30:39 +02:00
setup() {
const store = useStore()
const appConfig: ComputedRef<IAppConfig> = computed(
() => store.getters[ROOT_STORE.GETTERS.APP_CONFIG]
)
const appLoading: ComputedRef<boolean> = computed(
() => store.getters[ROOT_STORE.GETTERS.APP_LOADING]
)
const hideScrollBar = ref(false)
function updateHideScrollBar(isMenuOpen: boolean) {
hideScrollBar.value = isMenuOpen
}
2021-08-15 12:30:39 +02:00
onBeforeMount(() =>
store.dispatch(ROOT_STORE.ACTIONS.GET_APPLICATION_CONFIG)
)
return {
appConfig,
appLoading,
hideScrollBar,
updateHideScrollBar,
}
2021-08-15 12:30:39 +02:00
},
2021-07-25 13:23:25 +02:00
})
2021-07-25 13:03:34 +02:00
</script>
2021-09-20 12:18:40 +02:00
<style lang="scss" scoped>
@import '~@/scss/base';
2021-08-15 09:24:10 +02:00
.app-container {
height: $app-height;
&.hide-scroll {
overflow: hidden;
}
.app-loading {
display: flex;
align-items: center;
height: 100%;
}
2021-08-15 09:24:10 +02:00
}
</style>