🔥 Implementation of VueX, delete all emit events

This commit is contained in:
Alicia Sykes
2021-10-10 14:32:54 +01:00
parent 8d111a1623
commit fddb77dec9
12 changed files with 47 additions and 58 deletions

View File

@@ -9,6 +9,8 @@
</template>
<script>
import Keys from '@/utils/StoreMutations';
export default {
name: 'IframeModal',
props: {
@@ -21,13 +23,13 @@ export default {
show(url) {
this.url = url;
this.$modal.show(this.name);
this.$emit('modalChanged', true);
this.$store.commit(Keys.SET_MODAL_OPEN, true);
},
hide() {
this.$modal.hide(this.name);
},
modalClosed() {
this.$emit('modalChanged', false);
this.$store.commit(Keys.SET_MODAL_OPEN, false);
},
},
};

View File

@@ -44,7 +44,6 @@
:ref="`iframeModal-${groupId}`"
:name="`iframeModal-${groupId}`"
@closed="$emit('itemClicked')"
@modalChanged="modalChanged"
/>
</Collapsable>
</template>
@@ -65,7 +64,6 @@ export default {
displayData: Object,
items: Array,
itemSize: String,
modalOpen: Boolean,
},
components: {
Collapsable,
@@ -124,10 +122,6 @@ export default {
triggerModal(url) {
this.$refs[`iframeModal-${this.groupId}`].show(url);
},
/* Emmit value upwards when iframe modal opened/ closed */
modalChanged(changedTo) {
this.$emit('change-modal-visibility', changedTo);
},
/* Determines if user has enabled online status checks */
shouldEnableStatusCheck(itemPreference) {
const globalPreference = this.appConfig.statusCheck || false;

View File

@@ -26,7 +26,6 @@
:ref="`iframeModal-${groupId}`"
:name="`iframeModal-${groupId}`"
@closed="$emit('itemClicked')"
@modalChanged="modalChanged"
/>
</div>
</template>
@@ -70,9 +69,6 @@ export default {
triggerModal(url) {
this.$refs[`iframeModal-${this.groupId}`].show(url);
},
modalChanged(changedTo) {
this.$emit('change-modal-visibility', changedTo);
},
shouldEnableStatusCheck(itemPreference) {
const globalPreference = this.appConfig.statusCheck || false;
return itemPreference !== undefined ? itemPreference : globalPreference;

View File

@@ -11,7 +11,7 @@
<!-- Modal containing all the configuration options -->
<modal :name="modalNames.CONF_EDITOR" :resizable="true" width="60%" height="85%"
@closed="$emit('modalChanged', false)" classes="dashy-modal">
@closed="editorClosed" classes="dashy-modal">
<ConfigContainer :config="combineConfig()" />
</modal>
@@ -48,6 +48,7 @@
import ConfigContainer from '@/components/Configuration/ConfigContainer';
import LanguageSwitcher from '@/components/Settings/LanguageSwitcher';
import { topLevelConfKeys, localStorageKeys, modalNames } from '@/utils/defaults';
import Keys from '@/utils/StoreMutations';
import IconSpanner from '@/assets/interface-icons/config-editor.svg';
import IconViewMode from '@/assets/interface-icons/application-change-view.svg';
import IconHome from '@/assets/interface-icons/application-home.svg';
@@ -85,7 +86,10 @@ export default {
methods: {
showEditor: function show() {
this.$modal.show(modalNames.CONF_EDITOR);
this.$emit('modalChanged', true);
this.$store.commit(Keys.SET_MODAL_OPEN, true);
},
editorClosed: function show() {
this.$store.commit(Keys.SET_MODAL_OPEN, false);
},
combineConfig() {
const conf = {};

View File

@@ -35,9 +35,6 @@ import {
export default {
name: 'FilterTile',
props: {
active: Boolean,
},
data() {
return {
input: '', // Users current search term
@@ -46,6 +43,9 @@ export default {
};
},
computed: {
active() {
return !this.$store.state.modalOpen;
},
searchPrefs() {
return this.$store.getters.webSearch || {};
},

View File

@@ -3,15 +3,14 @@
<SearchBar ref="SearchBar"
@user-is-searchin="userIsTypingSomething"
v-if="searchVisible"
:active="!modalOpen"
/>
<div class="options-outer">
<div :class="`options-container ${!settingsVisible ? 'hide' : ''}`">
<ThemeSelector :externalThemes="externalThemes" @modalChanged="modalChanged"
<ThemeSelector :externalThemes="externalThemes"
:confTheme="getInitialTheme()" :userThemes="getUserThemes()" />
<LayoutSelector :displayLayout="displayLayout" @layoutUpdated="updateDisplayLayout"/>
<ItemSizeSelector :iconSize="iconSize" @iconSizeUpdated="updateIconSize" />
<ConfigLauncher @modalChanged="modalChanged" />
<ConfigLauncher />
<AuthButtons v-if="userState != 'noone'" :userType="userState" />
</div>
<div :class="`show-hide-container ${settingsVisible? 'hide-btn' : 'show-btn'}`">
@@ -51,7 +50,6 @@ export default {
displayLayout: String,
iconSize: String,
externalThemes: Object,
modalOpen: Boolean,
},
components: {
SearchBar,
@@ -110,9 +108,6 @@ export default {
updateIconSize(iconSize) {
this.$emit('change-icon-size', iconSize);
},
modalChanged(changedTo) {
this.$emit('change-modal-visibility', changedTo);
},
getInitialTheme() {
return this.appConfig.theme || '';
},

View File

@@ -31,6 +31,7 @@ import {
ApplyCustomVariables,
} from '@/utils/ThemeHelper';
import Defaults, { localStorageKeys } from '@/utils/defaults';
import Keys from '@/utils/StoreMutations';
import IconPalette from '@/assets/interface-icons/config-color-palette.svg';
export default {
@@ -94,12 +95,12 @@ export default {
},
/* Opens the theme color configurator popup */
openThemeConfigurator() {
this.$emit('modalChanged', true);
this.$store.commit(Keys.SET_MODAL_OPEN, true);
this.themeConfiguratorOpen = true;
},
/* Closes the theme color configurator popup */
closeThemeConfigurator() {
// this.$emit('modalChanged', false);
this.$store.commit(Keys.SET_MODAL_OPEN, false);
this.themeConfiguratorOpen = false;
},
/* Updates theme. Checks if the new theme is local or external,