π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
:sparkles: Show banner when in edit mode
Alicia Sykes159748e3de16
diff --git a/src/App.vue b/src/App.vueindex d9619e04..578f67d9 100644--- a/src/App.vue+++ b/src/App.vue@@ -1,5 +1,6 @@<template><div id="dashy">+ <EditModeTopBanner v-if="isEditMode" /><LoadingScreen :isLoading="isLoading" v-if="shouldShowSplash" /><Header :pageInfo="pageInfo" /><router-view />@@ -10,6 +11,7 @@import Header from '@/components/PageStrcture/Header.vue';import Footer from '@/components/PageStrcture/Footer.vue';+import EditModeTopBanner from '@/components/InteractiveEditor/EditModeTopBanner.vue';import LoadingScreen from '@/components/PageStrcture/LoadingScreen.vue';import { welcomeMsg } from '@/utils/CoolConsole';import ErrorHandler from '@/utils/ErrorHandler';@@ -27,6 +29,7 @@ export default {Header,Footer,LoadingScreen,+ EditModeTopBanner,},data() {return {@@ -57,6 +60,9 @@ export default {visibleComponents() {return this.$store.getters.visibleComponents;},+ isEditMode() {+ return this.$store.state.editMode;+ },},created() {this.$store.dispatch('initializeConfig');diff --git a/src/components/InteractiveEditor/EditItem.vue b/src/components/InteractiveEditor/EditItem.vueindex ec1487b2..f997af1a 100644--- a/src/components/InteractiveEditor/EditItem.vue+++ b/src/components/InteractiveEditor/EditItem.vue@@ -152,10 +152,17 @@ export default {},/* Saves the updated item to VueX Store */saveItem() {+ // Convert form data back into section.item data structureconst structured = {};this.formData.forEach((row) => { structured[row.name] = row.value; });+ // Some attributes need a little extra formattingconst newItem = this.formatBeforeSave(structured);+ // Update the data store, with new item datathis.$store.commit(StoreKeys.UPDATE_ITEM, { newItem, itemId: this.itemId });+ // If we're not already in edit mode, enable it now+ this.$store.commit(StoreKeys.SET_EDIT_MODE, true);+ // Close edit menu+ this.$emit('closeEditMenu');},/* Adds filed from extras list to main form, then removes from extras list */appendNewField(fieldId) {diff --git a/src/components/InteractiveEditor/EditModeTopBanner.vue b/src/components/InteractiveEditor/EditModeTopBanner.vuenew file mode 100644index 00000000..77e72716--- /dev/null+++ b/src/components/InteractiveEditor/EditModeTopBanner.vue@@ -0,0 +1,20 @@+<template>+ <div class="edit-mode-top-banner">+ <span>Edit Mode Enabled</span>+ </div>+</template>++<style scoped lang="scss">+div.edit-mode-top-banner {+ width: 100%;+ text-align: center;+ padding: 0.2rem 0;+ background: var(--primary);+ opacity: var(--dimming-factor);+ span {+ font-size: 1rem;+ font-weight: bold;+ color: var(--background);+ }+}+</style>diff --git a/src/store.js b/src/store.jsindex dd05f8ef..0a893ef8 100644--- a/src/store.js+++ b/src/store.js@@ -13,12 +13,14 @@ const {SET_MODAL_OPEN,SET_LANGUAGE,UPDATE_ITEM,+ SET_EDIT_MODE,} = Keys;const store = new Vuex.Store({state: {config: {},lang: '', // The users language, auto-detected or read from local storage / config+ editMode: false, // While true, the user can drag and edit items + sectionsmodalOpen: false, // KB shortcut functionality will be disabled when modal is open},getters: {@@ -59,6 +61,9 @@ const store = new Vuex.Store({[SET_MODAL_OPEN](state, modalOpen) {state.modalOpen = modalOpen;},+ [SET_EDIT_MODE](state, editMode) {+ state.editMode = editMode;+ },[UPDATE_ITEM](state, payload) {const { itemId, newItem } = payload;const newConfig = state.config;diff --git a/src/utils/StoreMutations.js b/src/utils/StoreMutations.jsindex 4e742276..5841f177 100644--- a/src/utils/StoreMutations.js+++ b/src/utils/StoreMutations.js@@ -4,6 +4,7 @@ const KEY_NAMES = ['SET_MODAL_OPEN','SET_LANGUAGE','UPDATE_ITEM',+ 'SET_EDIT_MODE',];// Convert array of key names into an object, and export