diff --git a/docs/configuring.md b/docs/configuring.md index 47bc101ab3..c735695cd2 100644 --- a/docs/configuring.md +++ b/docs/configuring.md @@ -68,7 +68,7 @@ All fields are optional, unless otherwise stated. **`cssThemes`** | `string[]` | _Optional_ | An array of custom theme names which can be used in the theme switcher dropdown **`externalStyleSheet`** | `string` or `string[]` | _Optional_ | Either a URL to an external stylesheet or an array or URLs, which can be applied as themes within the UI **`customCss`** | `string` | _Optional_ | Raw CSS that will be applied to the page. This can also be set from the UI. Please minify it first. -**`showSplashScreen`** | `boolean` | _Optional_ | Should display a splash screen while the app is loading. Defaults to false, except on first load +**`hideComponents`** | `object` | _Optional_ | A list of key page components (header, footer, search, settings, etc) that are present by default, but can be removed using this option. See [`appConfig.hideComponents`](#appconfighideComponents-optional) **`allowConfigEdit`** | `boolean` | _Optional_ | Should prevent / allow the user to write configuration changes to the conf.yml from the UI. When set to `false`, the user can only apply changes locally using the config editor within the app, whereas if set to `true` then changes can be written to disk directly through the UI. Defaults to `true`. Note that if authentication is enabled, the user must be of type `admin` in order to apply changes globally. **`disableServiceWorker`** | `boolean` | _Optional_ | Service workers cache web applications to improve load times and offer basic offline functionality, and are enabled by default in Dashy. The service worker can sometimes cause older content to be cached, requiring the app to be hard-refreshed. If you do not want SW functionality, or are having issues with caching, set this property to `true` to disable all service workers. **`disableContextMenu`** | `boolean` | _Optional_ | If set to `true`, the custom right-click context menu will be disabled. Defaults to `false`. @@ -85,6 +85,19 @@ All fields are optional, unless otherwise stated. **[⬆️ Back to Top](#configuring)** +### `appConfig.hideComponents` _(optional)_ + +**Field** | **Type** | **Required**| **Description** +--- | --- | --- | --- +**`hideHeading`** | `boolean` | _Optional_ | If set to `true`, the page title & sub-title will not be visible. Defaults to `false` +**`hideNav`** | `boolean` | _Optional_ | If set to `true`, the navigation menu will not be visible. Defaults to `false` +**`hideSearch`** | `boolean` | _Optional_ | If set to `true`, the search bar will not be visible. Defaults to `false` +**`hideSettings`** | `boolean` | _Optional_ | If set to `true`, the settings menu will not be visible. Defaults to `false` +**`hideFooter`** | `boolean` | _Optional_ | If set to `true`, the footer will not be visible. Defaults to `false` +**`hideSplashScreen`** | `boolean` | _Optional_ | If set to `true`, splash screen will not be visible while the app loads. Defaults to `true` (except on first load, when the loading screen is always shown) + +**[⬆️ Back to Top](#configuring)** + ### `section` **Field** | **Type** | **Required**| **Description** diff --git a/src/App.vue b/src/App.vue index dff0e3558e..38d992b92d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,8 +11,17 @@ 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'; +import { componentVisibility } from '@/utils/ConfigHelpers'; +import ConfigAccumulator from '@/utils/ConfigAccumalator'; +import { + localStorageKeys, + splashScreenTime, + visibleComponents as defaultVisibleComponents, +} from '@/utils/defaults'; + +const Accumulator = new ConfigAccumulator(); +const config = Accumulator.config(); +const visibleComponents = componentVisibility(config.appConfig) || defaultVisibleComponents; export default { name: 'app', @@ -23,13 +32,15 @@ export default { }, provide: { config, + visibleComponents, }, data() { return { - showFooter: Defaults.visibleComponents.footer, + showFooter: visibleComponents.footer, isLoading: true, - appConfig, - pageInfo, + appConfig: Accumulator.appConfig(), + pageInfo: Accumulator.pageInfo(), + visibleComponents, }; }, methods: { @@ -45,7 +56,8 @@ export default { document.head.append(style); }, shouldShowSplash() { - return this.appConfig.showSplashScreen || !localStorage[localStorageKeys.HIDE_WELCOME_BANNER]; + return (this.visibleComponents || defaultVisibleComponents).splashScreen + || !localStorage[localStorageKeys.HIDE_WELCOME_BANNER]; }, hideSplash() { if (this.shouldShowSplash() && !this.shouldHidePageComponents()) { diff --git a/src/components/PageStrcture/Header.vue b/src/components/PageStrcture/Header.vue index b07ac0dbfa..aa49d6c377 100644 --- a/src/components/PageStrcture/Header.vue +++ b/src/components/PageStrcture/Header.vue @@ -8,10 +8,11 @@