Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:sparkles: Implements the checking if things should be visible, at component level

Alicia Sykes3f4b1575f9fe
diff --git a/src/components/PageStrcture/Header.vue b/src/components/PageStrcture/Header.vue
index b07ac0db..aa49d6c3 100644
--- a/src/components/PageStrcture/Header.vue
+++ b/src/components/PageStrcture/Header.vue
@@ -8,10 +8,11 @@
<script>
import PageTitle from '@/components/PageStrcture/PageTitle.vue';
import Nav from '@/components/PageStrcture/Nav.vue';
-import { visibleComponents } from '@/utils/defaults';
+import { visibleComponents as defaultVisibleComponents } from '@/utils/defaults';
export default {
name: 'Header',
+ inject: ['visibleComponents'],
components: {
PageTitle,
Nav,
@@ -21,9 +22,8 @@ export default {
},
data() {
return {
- hiddenComponents: this.pageInfo.hiddenComponents || {},
- titleVisible: visibleComponents.pageTitle,
- navVisible: visibleComponents.navigation,
+ titleVisible: (this.visibleComponents || defaultVisibleComponents).pageTitle,
+ navVisible: (this.visibleComponents || defaultVisibleComponents).navigation,
};
},
};
diff --git a/src/components/Settings/SettingsContainer.vue b/src/components/Settings/SettingsContainer.vue
index eec5583a..27c721fa 100644
--- a/src/components/Settings/SettingsContainer.vue
+++ b/src/components/Settings/SettingsContainer.vue
@@ -29,7 +29,6 @@
</template>
<script>
-import Defaults, { localStorageKeys } from '@/utils/defaults';
import SearchBar from '@/components/Settings/SearchBar';
import ConfigLauncher from '@/components/Settings/ConfigLauncher';
import ThemeSelector from '@/components/Settings/ThemeSelector';
@@ -41,6 +40,10 @@ import AppInfoModal from '@/components/Configuration/AppInfoModal';
import { logout as registerLogout } from '@/utils/Auth';
import IconOpen from '@/assets/interface-icons/config-open-settings.svg';
import IconClose from '@/assets/interface-icons/config-close.svg';
+import {
+ localStorageKeys,
+ visibleComponents as defaultVisibleComponents,
+} from '@/utils/defaults';
export default {
name: 'SettingsContainer',
@@ -65,6 +68,7 @@ export default {
IconOpen,
IconClose,
},
+ inject: ['visibleComponents'],
methods: {
userIsTypingSomething(something) {
this.$emit('user-is-searchin', something);
@@ -106,13 +110,13 @@ export default {
},
getSettingsVisibility() {
return JSON.parse(localStorage[localStorageKeys.HIDE_SETTINGS]
- || Defaults.visibleComponents.settings);
+ || (this.visibleComponents || defaultVisibleComponents).settings);
},
},
data() {
return {
- searchVisible: Defaults.visibleComponents.searchBar,
settingsVisible: this.getSettingsVisibility(),
+ searchVisible: (this.visibleComponents || defaultVisibleComponents).searchBar,
};
},
};