diff --git a/src/components/InteractiveEditor/PinInput.vue b/src/components/InteractiveEditor/PinInput.vue
new file mode 100644
index 00000000..4d425a64
--- /dev/null
+++ b/src/components/InteractiveEditor/PinInput.vue
@@ -0,0 +1,70 @@
+
+
+
+
+ Locked section
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/LinkItems/Section.vue b/src/components/LinkItems/Section.vue
index f1659ed5..4829f0cc 100644
--- a/src/components/LinkItems/Section.vue
+++ b/src/components/LinkItems/Section.vue
@@ -14,63 +14,70 @@
:id="sectionRef"
:ref="sectionRef"
>
-
-
- {{ $t('home.no-items-section') }}
-
-
-
-
-
-
+
+
+
+ {{ $t('home.no-items-section') }}
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
0;
+ const hasHits = Array.isArray(this.items) && this.items.length > 0;
+ return searchActive && hasHits;
+ },
+ showPinRequired() {
+ if (this.isEditMode) return false;
+ return this.displayData.secret === true && !this.isUnlocked;
+ },
+ },
+ watch: {
+ searchTerm: {
+ handler(newSeachTerm) {
+ // find if special code search is used
+ const showHidden = newSeachTerm.trim().toLowerCase() === '';
+ 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 */
@@ -300,6 +364,21 @@ export default {
const secElem = this.$refs[this.sectionRef];
if (secElem && secElem.$el.clientWidth) this.sectionWidth = secElem.$el.clientWidth;
},
+ saveUnlockPins({ pin, id }) {
+ const map = JSON.parse(localStorage.getItem(SECRET_UNLOCKED_KEY) || '{}');
+ map[id] = pin;
+ localStorage.setItem(SECRET_UNLOCKED_KEY, JSON.stringify(map));
+ this.updateUnlocked();
+ },
+ updateUnlocked() {
+ const unlockPins = JSON.parse(localStorage.getItem(SECRET_UNLOCKED_KEY) || '{}');
+ const sectionKey = this.sectionRef;
+ if (unlockPins[sectionKey] === this.pin) {
+ this.isUnlocked = true;
+ } else {
+ this.isUnlocked = false;
+ }
+ },
},
mounted() {
// Set the section width, and recalculate when section resized
@@ -307,6 +386,21 @@ export default {
this.resizeObserver = new ResizeObserver(this.calculateSectionWidth)
.observe(this.$refs[this.sectionRef].$el);
}
+ if (this.displayData?.collapsed) {
+ this.isCollapsed = this.displayData.collapsed;
+ }
+ if (this.displayData?.secret) {
+ if (this.displayData.secret) this.isUnlocked = false;
+
+ const secretPin = String(this.pin || '0000');
+ const sectionKey = this.sectionRef;
+
+ const pins = JSON.parse(localStorage.getItem(SECRET_PINS_KEY) || '{}');
+ if (pins[sectionKey] !== secretPin) {
+ pins[sectionKey] = secretPin;
+ localStorage.setItem(SECRET_PINS_KEY, JSON.stringify(pins));
+ }
+ }
},
beforeDestroy() {
// If resize observer set, and element still present, then de-register
diff --git a/src/views/Home.vue b/src/views/Home.vue
index 004b181a..0b7240b9 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -26,6 +26,7 @@
:index="index"
:title="section.name"
:icon="section.icon || undefined"
+ :pin="section.pin || undefined"
:displayData="getDisplayData(section)"
:groupId="makeSectionId(section)"
:items="section.filteredItems"
diff --git a/user-data/conf.yml b/user-data/conf.yml
index 5f0b012a..94d4bb6a 100644
--- a/user-data/conf.yml
+++ b/user-data/conf.yml
@@ -44,4 +44,19 @@ 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
-
\ No newline at end of file
+- name: Stuff
+ icon: fas fa-rocket
+ pin: "1111"
+ displayData:
+ secret: true
+ items:
+ - title: hidden tile 1
+ description: Development a project management links for Dashy
+ icon: https://i.ibb.co/qWWpD0v/astro-dab-128.png
+ url: https://live.dashy.to/
+ target: newtab
+ - title: hidden tile 2
+ description: Development a project management links for Dashy
+ icon: https://i.ibb.co/qWWpD0v/astro-dab-128.png
+ url: https://live.dashy.to/
+ target: newtab