mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-23 21:55:30 +02:00
✨ Builds single-section view
This commit is contained in:
parent
ff47cd237e
commit
9270b85203
@ -200,7 +200,7 @@ export default {
|
|||||||
grid-template-columns: repeat(var(--item-col-count, 2), minmax(0, 1fr));
|
grid-template-columns: repeat(var(--item-col-count, 2), minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.orientation-horizontal {
|
.orientation-horizontal:not(.single-section-view) {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
.there-are-items {
|
.there-are-items {
|
||||||
|
@ -84,6 +84,12 @@ const router = new Router({
|
|||||||
component: Home,
|
component: Home,
|
||||||
meta: makeMetaTags('Home Page'),
|
meta: makeMetaTags('Home Page'),
|
||||||
},
|
},
|
||||||
|
{ // View only single section
|
||||||
|
path: `${routePaths.home}/:section`,
|
||||||
|
name: 'home-section',
|
||||||
|
component: Home,
|
||||||
|
meta: makeMetaTags('Home Page'),
|
||||||
|
},
|
||||||
{ // Workspace view page
|
{ // Workspace view page
|
||||||
path: routePaths.workspace,
|
path: routePaths.workspace,
|
||||||
name: 'workspace',
|
name: 'workspace',
|
||||||
|
@ -13,11 +13,19 @@
|
|||||||
:modalOpen="modalOpen"
|
:modalOpen="modalOpen"
|
||||||
class="settings-outer"
|
class="settings-outer"
|
||||||
/>
|
/>
|
||||||
|
<!-- Show back button, when on single-section view -->
|
||||||
|
<div v-if="singleSectionView">
|
||||||
|
<router-link to="/home" class="back-to-all-link">
|
||||||
|
<BackIcon />
|
||||||
|
<span>Back to All</span>
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
<!-- Main content, section for each group of items -->
|
<!-- Main content, section for each group of items -->
|
||||||
<div v-if="checkTheresData(sections)"
|
<div v-if="checkTheresData(sections)"
|
||||||
:class="`item-group-container `
|
:class="`item-group-container `
|
||||||
+ `orientation-${layout} `
|
+ `orientation-${layout} `
|
||||||
+ `item-size-${itemSizeBound} `
|
+ `item-size-${itemSizeBound} `
|
||||||
|
+ (singleSectionView ? 'single-section-view ' : '')
|
||||||
+ (this.colCount ? `col-count-${this.colCount} ` : '')"
|
+ (this.colCount ? `col-count-${this.colCount} ` : '')"
|
||||||
>
|
>
|
||||||
<Section
|
<Section
|
||||||
@ -49,12 +57,15 @@ import SettingsContainer from '@/components/Settings/SettingsContainer.vue';
|
|||||||
import Section from '@/components/LinkItems/Section.vue';
|
import Section from '@/components/LinkItems/Section.vue';
|
||||||
import { searchTiles } from '@/utils/Search';
|
import { searchTiles } from '@/utils/Search';
|
||||||
import Defaults, { localStorageKeys, iconCdns } from '@/utils/defaults';
|
import Defaults, { localStorageKeys, iconCdns } from '@/utils/defaults';
|
||||||
|
import ErrorHandler from '@/utils/ErrorHandler';
|
||||||
|
import BackIcon from '@/assets/interface-icons/back-arrow.svg';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'home',
|
name: 'home',
|
||||||
components: {
|
components: {
|
||||||
SettingsContainer,
|
SettingsContainer,
|
||||||
Section,
|
Section,
|
||||||
|
BackIcon,
|
||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
searchValue: '',
|
searchValue: '',
|
||||||
@ -74,6 +85,9 @@ export default {
|
|||||||
modalOpen() {
|
modalOpen() {
|
||||||
return this.$store.state.modalOpen;
|
return this.$store.state.modalOpen;
|
||||||
},
|
},
|
||||||
|
singleSectionView() {
|
||||||
|
return this.findSingleSection(this.$store.getters.sections, this.$route.params.section);
|
||||||
|
},
|
||||||
/* Get class for num columns, if specified by user */
|
/* Get class for num columns, if specified by user */
|
||||||
colCount() {
|
colCount() {
|
||||||
let { colCount } = this.appConfig;
|
let { colCount } = this.appConfig;
|
||||||
@ -94,7 +108,7 @@ export default {
|
|||||||
return this.sections;
|
return this.sections;
|
||||||
},
|
},
|
||||||
filteredTiles() {
|
filteredTiles() {
|
||||||
const sections = this.allSections;
|
const sections = this.singleSectionView || this.allSections;
|
||||||
return sections.filter((section) => this.filterTiles(section.items, this.searchValue));
|
return sections.filter((section) => this.filterTiles(section.items, this.searchValue));
|
||||||
},
|
},
|
||||||
/* Updates layout (when button clicked), and saves in local storage */
|
/* Updates layout (when button clicked), and saves in local storage */
|
||||||
@ -148,6 +162,19 @@ export default {
|
|||||||
updateModalVisibility(modalState) {
|
updateModalVisibility(modalState) {
|
||||||
this.$store.commit('SET_MODAL_OPEN', modalState);
|
this.$store.commit('SET_MODAL_OPEN', modalState);
|
||||||
},
|
},
|
||||||
|
/* If on sub-route, and section exists, then return only that section */
|
||||||
|
findSingleSection: (allSectios, sectionTitle) => {
|
||||||
|
if (!sectionTitle) return undefined;
|
||||||
|
let sectionToReturn;
|
||||||
|
const parse = (section) => section.replace(' ', '-').toLowerCase().trim();
|
||||||
|
allSectios.forEach((section) => {
|
||||||
|
if (parse(sectionTitle) === parse(section.name)) {
|
||||||
|
sectionToReturn = [section];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!sectionToReturn) ErrorHandler(`No section named '${sectionTitle}' was found`);
|
||||||
|
return sectionToReturn;
|
||||||
|
},
|
||||||
/* Returns an array of links to external CSS from the Config */
|
/* Returns an array of links to external CSS from the Config */
|
||||||
getExternalCSSLinks() {
|
getExternalCSSLinks() {
|
||||||
const availibleThemes = {};
|
const availibleThemes = {};
|
||||||
@ -245,6 +272,16 @@ export default {
|
|||||||
min-height: calc(99.9vh - var(--footer-height));
|
min-height: calc(99.9vh - var(--footer-height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.back-to-all-link {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0.25rem;
|
||||||
|
margin: 0.25rem;
|
||||||
|
@extend .svg-button;
|
||||||
|
svg { margin-right: 0.5rem; }
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* Outside container wrapping the item groups*/
|
/* Outside container wrapping the item groups*/
|
||||||
.item-group-container {
|
.item-group-container {
|
||||||
display: grid;
|
display: grid;
|
||||||
@ -269,7 +306,7 @@ export default {
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&.orientation-horizontal, &.orientation-vertical {
|
&.orientation-horizontal, &.orientation-vertical, &.single-section-view {
|
||||||
@include phone { --content-max-width: 100%; }
|
@include phone { --content-max-width: 100%; }
|
||||||
@include tablet { --content-max-width: 98%; }
|
@include tablet { --content-max-width: 98%; }
|
||||||
@include laptop { --content-max-width: 90%; }
|
@include laptop { --content-max-width: 90%; }
|
||||||
@ -302,6 +339,11 @@ export default {
|
|||||||
|
|
||||||
/* Hide when search term returns nothing */
|
/* Hide when search term returns nothing */
|
||||||
.no-results { display: none; }
|
.no-results { display: none; }
|
||||||
|
|
||||||
|
/* When in single-section view mode */
|
||||||
|
&.single-section-view {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Custom styles only applied when there is no sections in config */
|
/* Custom styles only applied when there is no sections in config */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user