Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Dashy",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-24-bookworm",
"image": "mcr.microsoft.com/devcontainers/javascript-node:latest",
"customizations": {
"vscode": {
"extensions": [
Expand Down
1 change: 1 addition & 0 deletions src/components/LinkItems/Collapsable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export default {
checkboxState(newState) {
this.isExpanded = newState;
this.updateLocalStorage(); // Save every change immediately
this.$emit('collapse-change', this.checkboxState);
},
uniqueKey(newVal, oldVal) {
if (newVal !== oldVal) {
Expand Down
58 changes: 58 additions & 0 deletions src/components/LinkItems/Section.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<Collapsable
v-if="shouldRenderSection"
:title="title"
:icon="icon"
:uniqueKey="groupId"
Expand All @@ -11,6 +12,7 @@
:cutToHeight="displayData.cutToHeight"
@openEditSection="openEditSection"
@openContextMenu="openContextMenu"
@collapse-change="onCollapseChange"
:id="sectionRef"
:ref="sectionRef"
>
Expand Down Expand Up @@ -130,6 +132,7 @@ export default {
index: Number,
isWide: Boolean,
activeColCount: Number,
searchTerm: String,
},
components: {
Collapsable,
Expand All @@ -150,6 +153,9 @@ export default {
},
sectionWidth: 0,
resizeObserver: null,
isCollapsed: false,
autoOpenedBySearch: false,
showHiddenMode: false,
};
},
computed: {
Expand Down Expand Up @@ -216,6 +222,51 @@ export default {
if (!cols) return cols;
return Math.min(this.activeColCount, cols);
},
shouldRenderSection() {
const hidden = this.displayData?.hiddenOnPurpose === true;

// Always show in Edit Mode so the user can unhide it
if (this.isEditMode) return true;

// If not hidden, render as usual
if (!hidden || this.showHiddenMode) return true;

// If hidden, only show when search is active AND this section has hits
const searchActive = (this.searchTerm || '').trim().length > 0;
const hasHits = Array.isArray(this.items) && this.items.length > 0;
return searchActive && hasHits;
},
},
watch: {
searchTerm: {
handler(newSeachTerm) {
// find if special code search is used
const showHidden = newSeachTerm.trim().toLowerCase() === '<hidden>';
this.showHiddenMode = showHidden;

// check if search is active
let searchIsActive = false;
if (newSeachTerm && newSeachTerm.trim().length > 0) {
searchIsActive = true;
}

// check if search is hit
const hasHits = this.items.length > 0;

// action if search is active and search hits and it was collapsed
if (searchIsActive && hasHits && this.isCollapsed) {
this.expandCollapseSection();
this.autoOpenedBySearch = true;
}

// action if that search is not a hit anymore
if (this.autoOpenedBySearch && (!searchIsActive || !hasHits)) {
this.expandCollapseSection();
this.autoOpenedBySearch = false;
}
},
immediate: true,
},
},
methods: {
/* Opens the iframe modal */
Expand Down Expand Up @@ -262,6 +313,10 @@ export default {
if (secElem) secElem.toggle();
this.closeContextMenu();
},
/* Toggle sections collapse state tracking */
onCollapseChange(childExpanded) {
this.isCollapsed = !childExpanded;
},
/* Open the Section Edit Menu */
openEditSection() {
this.editMenuOpen = true;
Expand Down Expand Up @@ -312,6 +367,9 @@ export default {
this.resizeObserver = new ResizeObserver(this.calculateSectionWidth)
.observe(this.$refs[this.sectionRef].$el);
}
if (this.displayData.collapsed) {
this.isCollapsed = this.displayData.collapsed;
}
},
beforeDestroy() {
// If resize observer set, and element still present, then de-register
Expand Down
6 changes: 6 additions & 0 deletions src/utils/ConfigSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,12 @@
"type": "boolean",
"default": false,
"description": "If set to true, section will be visible in the default view but not in the Workspace view sidebar"
},
"hiddenOnPurpose": {
"title": "Hidden On Purpose",
"type": "boolean",
"default": false,
"description": "If true, this section is intentionally hidden"
}
}
},
Expand Down
16 changes: 14 additions & 2 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
@itemClicked="finishedSearching()"
@change-modal-visibility="updateModalVisibility"
:isWide="!!singleSectionView || layoutOrientation === 'horizontal'"
:class="(searchValue && section.filteredItems.length === 0) ? 'no-results' : ''"
:class="(searchValue &&
!isCodeSearch && section.filteredItems.length === 0) ? 'no-results' : ''"
:activeColCount="activeColCount"
/>
</template>
Expand Down Expand Up @@ -89,6 +90,11 @@ export default {
activeColCount: 1,
}),
computed: {
isCodeSearch() {
const term = (this.searchTerm || this.searchValue || '').trim();
// true if it starts with "<" and ends with ">", with at least one char inside
return /^<[^>]+>$/.test(term);
},
singleSectionView() {
return this.findSingleSection(this.$store.getters.sections, this.$route.params.section);
},
Expand All @@ -103,9 +109,15 @@ export default {
/* Return sections with filtered items, that match users search term */
filteredSections() {
const sections = this.singleSectionView || this.sections;
const codeMode = this.isCodeSearch;

return sections.map((_section) => {
const section = _section;
section.filteredItems = this.filterTiles(section.items, this.searchValue);
if (codeMode) {
section.filteredItems = section.items;
} else {
section.filteredItems = this.filterTiles(section.items, this.searchValue);
}
return section;
});
},
Expand Down
11 changes: 11 additions & 0 deletions user-data/conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,14 @@ sections:
description: Get help with Dashy, raise a bug, or get in contact
url: https://github.com/Lissy93/dashy/blob/master/.github/SUPPORT.md
icon: far fa-hands-helping
- name: Stuff
icon: fas fa-rocket
displayData:
hiddenOnPurpose: true
items:
- title: hiddentile
description: This is a hidden tile
icon: https://i.ibb.co/qWWpD0v/astro-dab-128.png
url: https://live.dashy.to/
target: newtab