dashy/src/App.vue

88 lines
2.0 KiB
Vue
Raw Normal View History

2019-07-19 16:07:26 +02:00
<template>
<div id="dashy">
<LoadingScreen :isLoading="isLoading" v-if="shouldShowSplash()" />
<Header :pageInfo="pageInfo" />
<router-view />
<Footer v-if="showFooter" :text="getFooterText()" />
2019-07-19 16:07:26 +02:00
</div>
</template>
2019-07-20 22:50:29 +02:00
<script>
2021-04-13 13:36:31 +02:00
import Header from '@/components/PageStrcture/Header.vue';
import Footer from '@/components/PageStrcture/Footer.vue';
import LoadingScreen from '@/components/PageStrcture/LoadingScreen.vue';
import Defaults, { localStorageKeys, splashScreenTime } from '@/utils/defaults';
import { config, appConfig, pageInfo } from '@/utils/ConfigAccumalator';
2019-07-20 22:50:29 +02:00
export default {
name: 'app',
components: {
Header,
2019-09-01 14:38:13 +02:00
Footer,
LoadingScreen,
},
provide: {
config,
},
data() {
return {
showFooter: Defaults.visibleComponents.footer,
isLoading: true,
appConfig,
pageInfo,
};
2019-09-01 14:38:13 +02:00
},
methods: {
getFooterText() {
if (this.pageInfo && this.pageInfo.footerText) {
return this.pageInfo.footerText;
}
return '';
},
2021-05-31 16:17:54 +02:00
injectCustomStyles(usersCss) {
const style = document.createElement('style');
style.textContent = usersCss;
document.head.append(style);
},
shouldShowSplash() {
return this.appConfig.showSplashScreen || !localStorage[localStorageKeys.HIDE_WELCOME_BANNER];
},
hideSplash() {
if (this.shouldShowSplash()) {
setTimeout(() => { this.isLoading = false; }, splashScreenTime || 2000);
} else {
this.isLoading = false;
}
},
2021-05-31 16:17:54 +02:00
},
mounted() {
this.hideSplash();
2021-05-31 16:17:54 +02:00
if (this.appConfig.customCss) {
const cleanedCss = this.appConfig.customCss.replace(/<\/?[^>]+(>|$)/g, '');
this.injectCustomStyles(cleanedCss);
}
},
2019-09-01 14:38:13 +02:00
};
2019-07-20 22:50:29 +02:00
</script>
2019-07-19 16:07:26 +02:00
<style lang="scss">
2021-04-15 20:30:30 +02:00
@import '@/styles/global-styles.scss';
@import '@/styles/color-palette.scss';
2021-06-17 23:59:56 +02:00
@import '@/styles/dimensions.scss';
2021-04-15 20:30:30 +02:00
@import '@/styles/color-themes.scss';
@import '@/styles/typography.scss';
2019-07-20 22:50:29 +02:00
body {
background: var(--background);
margin: 0;
padding: 0;
}
2019-07-19 16:07:26 +02:00
#app {
2019-07-20 22:50:29 +02:00
.footer {
text-align: center;
2019-07-19 16:07:26 +02:00
}
}
2019-07-20 22:50:29 +02:00
2019-07-19 16:07:26 +02:00
</style>