🔥 Refactor and removes less-important stuff

This commit is contained in:
Alicia Sykes 2021-07-05 21:09:17 +01:00
parent 0c0177927c
commit a82a4c7103
3 changed files with 19 additions and 25 deletions

View File

@ -1,9 +1,9 @@
<template> <template>
<div id="dashy"> <div id="dashy">
<LoadingScreen :isLoading="isLoading" v-if="shouldShowSplash()" /> <LoadingScreen :isLoading="isLoading" v-if="shouldShowSplash()" />
<Header :pageInfo="pageInfo" v-if="!shouldHidePageComponents()" /> <Header :pageInfo="pageInfo" />
<router-view /> <router-view />
<Footer v-if="showFooter && !shouldHidePageComponents()" :text="getFooterText()" /> <Footer :text="getFooterText()" v-if="visibleComponents.footer" />
</div> </div>
</template> </template>
<script> <script>
@ -36,29 +36,33 @@ export default {
}, },
data() { data() {
return { return {
isLoading: true, // Set to false after mount complete
showFooter: visibleComponents.footer, showFooter: visibleComponents.footer,
isLoading: true,
appConfig: Accumulator.appConfig(), appConfig: Accumulator.appConfig(),
pageInfo: Accumulator.pageInfo(), pageInfo: Accumulator.pageInfo(),
visibleComponents, visibleComponents,
}; };
}, },
methods: { methods: {
/* If the user has specified custom text for footer - get it */
getFooterText() { getFooterText() {
if (this.pageInfo && this.pageInfo.footerText) { if (this.pageInfo && this.pageInfo.footerText) {
return this.pageInfo.footerText; return this.pageInfo.footerText;
} }
return ''; return '';
}, },
/* Injects the users custom CSS as a style tag */
injectCustomStyles(usersCss) { injectCustomStyles(usersCss) {
const style = document.createElement('style'); const style = document.createElement('style');
style.textContent = usersCss; style.textContent = usersCss;
document.head.append(style); document.head.append(style);
}, },
/* Determine if splash screen should be shown */
shouldShowSplash() { shouldShowSplash() {
return (this.visibleComponents || defaultVisibleComponents).splashScreen return (this.visibleComponents || defaultVisibleComponents).splashScreen
|| !localStorage[localStorageKeys.HIDE_WELCOME_BANNER]; || !localStorage[localStorageKeys.HIDE_WELCOME_BANNER];
}, },
/* Hide splash screen, either after 2 seconds, or immediately based on user preference */
hideSplash() { hideSplash() {
if (this.shouldShowSplash() && !this.shouldHidePageComponents()) { if (this.shouldShowSplash() && !this.shouldHidePageComponents()) {
setTimeout(() => { this.isLoading = false; }, splashScreenTime || 2000); setTimeout(() => { this.isLoading = false; }, splashScreenTime || 2000);
@ -66,15 +70,8 @@ export default {
this.isLoading = false; this.isLoading = false;
} }
}, },
shouldHidePageComponents() {
return (['download'].includes(this.$route.name));
},
},
computed: {
currentRouteName() {
return this.$route.name;
},
}, },
/* When component mounted, hide splash and initiate the injection of custom styles */
mounted() { mounted() {
this.hideSplash(); this.hideSplash();
if (this.appConfig.customCss) { if (this.appConfig.customCss) {
@ -86,22 +83,11 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
/* Import styles used globally throughout the app */
@import '@/styles/global-styles.scss'; @import '@/styles/global-styles.scss';
@import '@/styles/color-palette.scss'; @import '@/styles/color-palette.scss';
@import '@/styles/dimensions.scss'; @import '@/styles/dimensions.scss';
@import '@/styles/color-themes.scss'; @import '@/styles/color-themes.scss';
@import '@/styles/typography.scss'; @import '@/styles/typography.scss';
body {
background: var(--background);
margin: 0;
padding: 0;
}
#app {
.footer {
text-align: center;
}
}
</style> </style>

View File

@ -1,14 +1,21 @@
@import '@/styles/style-helpers.scss'; @import '@/styles/style-helpers.scss';
/* Essential global page layout styles */
html { html {
margin: 0;
padding: 0; padding: 0;
margin: -3px 0 0 0;
transition: all 1s; transition: all 1s;
margin-top: -3px;
@extend .scroll-bar; @extend .scroll-bar;
@extend .highlight; @extend .highlight;
box-sizing: border-box; box-sizing: border-box;
/* Essential body styles */
body {
background: var(--background);
margin: 0;
padding: 0;
}
/* Make links have pointy cursor */
input[type=button], button, a { input[type=button], button, a {
cursor: pointer; cursor: pointer;
} }

View File

@ -151,6 +151,7 @@ export default {
.vs__dropdown-toggle { .vs__dropdown-toggle {
border-color: var(--login-form-color); border-color: var(--login-form-color);
background: var(--login-form-background); background: var(--login-form-background);
cursor: pointer;
span.vs__selected { span.vs__selected {
color: var(--login-form-color); color: var(--login-form-color);
} }