From 2a38907ebe6eb2d8db8291d39f8c9d9fa0fa991a Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 29 Mar 2020 20:42:24 +0300 Subject: [PATCH] Load emoji packs that are open in collapse --- src/store/modules/emojiPacks.js | 7 ++ .../emojiPacks/components/RemoteEmojiPack.vue | 119 +++++++++--------- src/views/emojiPacks/index.vue | 6 +- 3 files changed, 74 insertions(+), 58 deletions(-) diff --git a/src/store/modules/emojiPacks.js b/src/store/modules/emojiPacks.js index 282a069e..f92e0fa5 100644 --- a/src/store/modules/emojiPacks.js +++ b/src/store/modules/emojiPacks.js @@ -15,11 +15,15 @@ import Vue from 'vue' const packs = { state: { + activeCollapseItems: [], localPacks: {}, remoteInstance: '', remotePacks: {} }, mutations: { + SET_ACTIVE_COLLAPSE_ITEMS: (state, items) => { + state.activeCollapseItems = items + }, SET_LOCAL_PACKS: (state, packs) => { state.localPacks = packs }, @@ -99,6 +103,9 @@ const packs = { commit('UPDATE_LOCAL_PACK_PACK', { name: packName, pack: result.data }) } }, + SetActiveCollapseItems({ commit, state }, activeItems) { + commit('SET_ACTIVE_COLLAPSE_ITEMS', activeItems) + }, async SetLocalEmojiPacks({ commit, getters }) { const { data } = await listPacks(getters.authHost) commit('SET_LOCAL_PACKS', data) diff --git a/src/views/emojiPacks/components/RemoteEmojiPack.vue b/src/views/emojiPacks/components/RemoteEmojiPack.vue index cb63ec3d..0c9ecaf3 100644 --- a/src/views/emojiPacks/components/RemoteEmojiPack.vue +++ b/src/views/emojiPacks/components/RemoteEmojiPack.vue @@ -1,62 +1,64 @@ @@ -108,6 +110,9 @@ export default { return '120px' } }, + loadRemotePack() { + return this.$store.state.emojiPacks.activeCollapseItems.includes(this.name) + }, share: { get() { return this.pack.pack['share-files'] }, set(value) { diff --git a/src/views/emojiPacks/index.vue b/src/views/emojiPacks/index.vue index 28f964d8..8154f254 100644 --- a/src/views/emojiPacks/index.vue +++ b/src/views/emojiPacks/index.vue @@ -46,7 +46,7 @@ - + @@ -139,6 +139,10 @@ export default { type: 'success', message: i18n.t('emoji.reloaded') }) + }, + setActiveCollapseItems(activeItems) { + const items = Array.isArray(activeItems) ? activeItems : [activeItems] + this.$store.dispatch('SetActiveCollapseItems', items) } } }