π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
β¨ Adds config option for contentMaxWidth (#1518)
Alicia Sykese5b03ec91e9d
diff --git a/docs/configuring.md b/docs/configuring.mdindex a46463a4..c80adfbe 100644--- a/docs/configuring.md+++ b/docs/configuring.md@@ -119,6 +119,7 @@ For more info, see the[Multi-Page docs](/docs/pages-and-sections.md#multi-page-s**`layout`** | `enum` | _Optional_ | Layout for homepage, either `horizontal`, `vertical` or `auto`. Defaults to `auto`. This specifies the layout and direction of how sections are positioned on the home screen. This can also be modified and overridden from the UI.**`iconSize`** | `enum` | _Optional_ | The size of link items / icons. Can be either `small`, `medium,` or `large`. Defaults to `medium`. This can also be set directly from the UI.**`colCount`** | `number` | _Optional_ | The number of columns of sections displayed on the homepage, using the default view. Should be in integer between `1` and `8`. Note that by default this is applied responsively, based on current screen size, and specifying a value here will override this behavior, which may not be desirable.+**`contentMaxWidth`** | `string` or `number` | _Optional_ | Sets the max width of the main sections area on the homepage, overriding the responsive default. Can be a percentage, or any CSS unit**`theme`** | `string` | _Optional_ | The default theme for first load (you can change this later from the UI)**`cssThemes`** | `string[]` | _Optional_ | An array of custom theme names which can be used in the theme switcher dropdown**`customColors`** | `object`| _Optional_ | Enables you to apply a custom color palette to any given theme. Use the theme name (lowercase) as the key, for an object including key-value-pairs, with the color variable name as keys, and 6-digit hex code as value. See [Theming](/docs/theming.md#modifying-theme-colors) for more infodiff --git a/src/App.vue b/src/App.vueindex 7de45353..9ed5f0be 100644--- a/src/App.vue+++ b/src/App.vue@@ -84,17 +84,29 @@ export default {},topLevelStyleModifications() {const vc = this.visibleComponents;- if (!vc.footer && !vc.pageTitle) {- return '--footer-height: 1rem;';- } else if (!vc.footer) {- return '--footer-height: 5rem;';- } else if (!vc.pageTitle) {- return '--footer-height: 4rem;';+ let styles = '';+ if (!vc.footer && !vc.pageTitle) styles += '--footer-height: 1rem;';+ else if (!vc.footer) styles += '--footer-height: 5rem;';+ else if (!vc.pageTitle) styles += '--footer-height: 4rem;';+ const maxWidth = this.parseContentMaxWidth(this.appConfig.contentMaxWidth);+ if (maxWidth) {+ styles += `--content-max-width: ${maxWidth};`;}- return '';+ return styles;},},methods: {+ /* Parse appConfig.contentMaxWidth into valid CSS unit */+ parseContentMaxWidth(usersCmw) {+ if (usersCmw === undefined || usersCmw === null || usersCmw === '') return null;+ const maxWidthStr = String(usersCmw).trim();+ if (/^\d+(\.\d+)?$/.test(maxWidthStr)) {+ return Number(maxWidthStr) <= 100 ? `${maxWidthStr}%` : `${maxWidthStr}px`;+ }+ if (/^\d+(\.\d+)?(%|px|rem|em|vw|vh)$/.test(maxWidthStr)) return maxWidthStr;+ ErrorHandler(`Invalid contentMaxWidth value: '${usersCmw}'`);+ return null;+ },/* Injects the users custom CSS as a style tag */injectCustomStyles(usersCss) {const style = document.createElement('style');diff --git a/src/utils/ConfigSchema.json b/src/utils/ConfigSchema.jsonindex 48033943..87d27092 100644--- a/src/utils/ConfigSchema.json+++ b/src/utils/ConfigSchema.json@@ -315,6 +315,16 @@"maximum": 8,"description": "Number of section columns for homepage. Leave blank for column count to be responsively calculated based on screen size"},+ "contentMaxWidth": {+ "title": "Content Max Width",+ "type": ["string", "number"],+ "description": "Max width of the main sections area on the homepage. Pass as a percentage or CSS unit. Leave blank for the responsive default",+ "examples": [+ "98%",+ "1400px",+ 95+ ]+ },"routingMode": {"title": "Routing Mode","type": "string",diff --git a/src/views/Home.vue b/src/views/Home.vueindex 5ca8987f..dea38eab 100644--- a/src/views/Home.vue+++ b/src/views/Home.vue@@ -220,11 +220,11 @@ export default {display: grid;gap: 0.5rem;margin: 0 auto;- max-width: 90%;+ max-width: var(--content-max-width, 90%);overflow: auto;@extend .scroll-bar;@include monitor-up {- max-width: 85%;+ max-width: var(--content-max-width, 85%);}/* Options for alternate layouts, triggered by buttons */