🔧 Updates references to Defaults, all properties now individually imported

This commit is contained in:
Alicia Sykes 2021-07-04 19:38:06 +01:00
parent 9d43f013dc
commit b3dbc66b5f
6 changed files with 26 additions and 16 deletions

View File

@ -42,6 +42,7 @@ nav {
background: var(--nav-link-background-color);
border: 1px solid var(--nav-link-border-color);
text-decoration: none;
text-transform: capitalize;
&.router-link-active, &:hover {
color: var(--nav-link-text-color-hover);
background: var(--nav-link-background-color-hover);

View File

@ -29,7 +29,7 @@
</template>
<script>
import Defaults, { localStorageKeys } from '@/utils/defaults';
import { localStorageKeys, visibleComponents } from '@/utils/defaults';
import SearchBar from '@/components/Settings/SearchBar';
import ConfigLauncher from '@/components/Settings/ConfigLauncher';
import ThemeSelector from '@/components/Settings/ThemeSelector';
@ -106,12 +106,12 @@ export default {
},
getSettingsVisibility() {
return JSON.parse(localStorage[localStorageKeys.HIDE_SETTINGS]
|| Defaults.visibleComponents.settings);
|| visibleComponents.settings);
},
},
data() {
return {
searchVisible: Defaults.visibleComponents.searchBar,
searchVisible: visibleComponents.searchBar,
settingsVisible: this.getSettingsVisibility(),
};
},

View File

@ -13,7 +13,7 @@
<script>
import ThemeHelper from '@/utils/ThemeHelper';
import Defaults, { localStorageKeys } from '@/utils/defaults';
import { localStorageKeys, builtInThemes, theme as defaultTheme } from '@/utils/defaults';
export default {
name: 'ThemeSelector',
@ -30,7 +30,7 @@ export default {
selectedTheme: this.getInitialTheme(),
themeHelper: new ThemeHelper(),
loading: true,
builtInThemes: this.userThemes.concat(Defaults.builtInThemes),
builtInThemes: this.userThemes.concat(builtInThemes),
};
},
computed: {
@ -47,7 +47,7 @@ export default {
if (this.isThemeLocal(this.selectedTheme)) {
this.updateTheme(this.selectedTheme);
// If it's an external stylesheet, then wait for promise to resolve
} else if (this.selectedTheme !== Defaults.theme) {
} else if (this.selectedTheme !== defaultTheme) {
Promise.all(added).then(() => {
this.updateTheme(this.selectedTheme);
});
@ -62,7 +62,7 @@ export default {
},
/* Get default theme */
getInitialTheme() {
return localStorage[localStorageKeys.THEME] || this.confTheme || Defaults.theme;
return localStorage[localStorageKeys.THEME] || this.confTheme || defaultTheme;
},
isThemeLocal(themeToCheck) {
return this.builtInThemes.includes(themeToCheck);

View File

@ -43,7 +43,12 @@
import SettingsContainer from '@/components/Settings/SettingsContainer.vue';
import ItemGroup from '@/components/LinkItems/ItemGroup.vue';
import Defaults, { localStorageKeys } from '@/utils/defaults';
import {
localStorageKeys,
layout as defaultLayout,
iconSize as defaultIconSize,
fontAwesomeKey as defaultFontAwesomeKey,
} from '@/utils/defaults';
export default {
name: 'home',
@ -64,14 +69,14 @@ export default {
}),
computed: {
layoutOrientation: {
get() { return this.appConfig.layout || Defaults.layout; },
get() { return this.appConfig.layout || defaultLayout; },
set: function setLayout(layout) {
localStorage.setItem(localStorageKeys.LAYOUT_ORIENTATION, layout);
this.layout = layout;
},
},
iconSize: {
get() { return this.appConfig.iconSize || Defaults.iconSize; },
get() { return this.appConfig.iconSize || defaultIconSize; },
set: function setIconSize(iconSize) {
localStorage.setItem(localStorageKeys.ICON_SIZE, iconSize);
this.itemSizeBound = iconSize;
@ -176,7 +181,7 @@ export default {
initiateFontAwesome() {
if (this.appConfig.enableFontAwesome || this.checkIfFontAwesomeNeeded()) {
const fontAwesomeScript = document.createElement('script');
const faKey = this.appConfig.fontAwesomeKey || Defaults.fontAwesomeKey;
const faKey = this.appConfig.fontAwesomeKey || defaultFontAwesomeKey;
fontAwesomeScript.setAttribute('src', `https://kit.fontawesome.com/${faKey}.js`);
document.head.appendChild(fontAwesomeScript);
}

View File

@ -24,7 +24,7 @@
import router from '@/router';
import Button from '@/components/FormElements/Button';
import Input from '@/components/FormElements/Input';
import Defaults, { localStorageKeys } from '@/utils/defaults';
import { localStorageKeys, theme as defaultTheme } from '@/utils/defaults';
import { checkCredentials, login } from '@/utils/Auth';
export default {
@ -65,7 +65,7 @@ export default {
}
},
setTheme() {
const theme = localStorage[localStorageKeys.THEME] || Defaults.theme;
const theme = localStorage[localStorageKeys.THEME] || defaultTheme;
document.getElementsByTagName('html')[0].setAttribute('data-theme', theme);
},
},

View File

@ -9,7 +9,11 @@
import SideBar from '@/components/Workspace/SideBar';
import WebContent from '@/components/Workspace/WebContent';
import Defaults, { localStorageKeys } from '@/utils/defaults';
import {
localStorageKeys,
theme as defaultTheme,
fontAwesomeKey as defaultFontAwesomeKey,
} from '@/utils/defaults';
export default {
name: 'Workspace',
@ -29,14 +33,14 @@ export default {
this.url = url;
},
setTheme() {
const theme = localStorage[localStorageKeys.THEME] || this.confTheme || Defaults.theme;
const theme = localStorage[localStorageKeys.THEME] || this.confTheme || defaultTheme;
const htmlTag = document.getElementsByTagName('html')[0];
if (htmlTag.hasAttribute('data-theme')) htmlTag.removeAttribute('data-theme');
htmlTag.setAttribute('data-theme', theme);
},
initiateFontAwesome() {
const fontAwesomeScript = document.createElement('script');
const faKey = this.appConfig.fontAwesomeKey || Defaults.fontAwesomeKey;
const faKey = this.appConfig.fontAwesomeKey || defaultFontAwesomeKey;
fontAwesomeScript.setAttribute('src', `https://kit.fontawesome.com/${faKey}.js`);
document.head.appendChild(fontAwesomeScript);
},