mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Fix shop item popover staying open after click (#12921)
* don't refocus shopItem popover on click * fix webpack compile error * manually disable and enable popover * clean up old changes
This commit is contained in:
@@ -261,6 +261,12 @@ export default {
|
|||||||
this.$root.$emit('bv::show::modal', 'buy-modal');
|
this.$root.$emit('bv::show::modal', 'buy-modal');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.$root.$on('bv::modal::hidden', event => {
|
||||||
|
if (event.componentId === 'buy-modal') {
|
||||||
|
this.$root.$emit('buyModal::hidden', this.selectedItemToBuy.key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.$root.$on('selectMembersModal::showItem', item => {
|
this.$root.$on('selectMembersModal::showItem', item => {
|
||||||
this.selectedSpellToBuy = item;
|
this.selectedSpellToBuy = item;
|
||||||
this.$root.$emit('bv::show::modal', 'select-member-modal');
|
this.$root.$emit('bv::show::modal', 'select-member-modal');
|
||||||
|
|||||||
@@ -513,6 +513,12 @@ export default {
|
|||||||
section: this.$t('shops'),
|
section: this.$t('shops'),
|
||||||
});
|
});
|
||||||
await this.$store.dispatch('worldState:getWorldState');
|
await this.$store.dispatch('worldState:getWorldState');
|
||||||
|
|
||||||
|
this.$root.$on('bv::modal::hidden', event => {
|
||||||
|
if (event.componentId === 'buy-quest-modal') {
|
||||||
|
this.$root.$emit('buyModal::hidden', this.selectedItemToBuy.key);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
questItems (category, sortBy, searchBy, hideLocked, hidePinned) {
|
questItems (category, sortBy, searchBy, hideLocked, hidePinned) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
tabindex="0"
|
tabindex="0"
|
||||||
@click="click()"
|
@click="click()"
|
||||||
@keypress.enter="click()"
|
@keypress.enter="click()"
|
||||||
|
@blur="blur"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="item"
|
class="item"
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<b-popover
|
<b-popover
|
||||||
v-if="showPopover"
|
v-if="showPopover"
|
||||||
|
ref="popover"
|
||||||
:target="itemId"
|
:target="itemId"
|
||||||
triggers="hover focus"
|
triggers="hover focus"
|
||||||
:placement="popoverPosition"
|
:placement="popoverPosition"
|
||||||
@@ -319,10 +321,21 @@ export default {
|
|||||||
this.countdownString();
|
this.countdownString();
|
||||||
this.timer = setInterval(this.countdownString, 1000);
|
this.timer = setInterval(this.countdownString, 1000);
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
this.$root.$on('buyModal::hidden', itemKey => {
|
||||||
|
if (this.$refs && this.$refs.popover && itemKey === this.item.key) {
|
||||||
|
this.$refs.popover.$emit('close');
|
||||||
|
this.$refs.popover.$emit('disable');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
click () {
|
click () {
|
||||||
this.$emit('click', {});
|
this.$emit('click', {});
|
||||||
},
|
},
|
||||||
|
blur () {
|
||||||
|
this.$refs.popover.$emit('enable');
|
||||||
|
},
|
||||||
getPrice () {
|
getPrice () {
|
||||||
if (this.item.unlockCondition && this.item.unlockCondition.condition === 'party invite' && !this.owned) return this.item.unlockCondition.text();
|
if (this.item.unlockCondition && this.item.unlockCondition.condition === 'party invite' && !this.owned) return this.item.unlockCondition.text();
|
||||||
if (this.price === -1) {
|
if (this.price === -1) {
|
||||||
|
|||||||
@@ -417,6 +417,11 @@ export default {
|
|||||||
this.$root.$on('buyModal::boughtItem', () => {
|
this.$root.$on('buyModal::boughtItem', () => {
|
||||||
this.backgroundUpdate = new Date();
|
this.backgroundUpdate = new Date();
|
||||||
});
|
});
|
||||||
|
this.$root.$on('bv::modal::hidden', event => {
|
||||||
|
if (event.componentId === 'buy-quest-modal') {
|
||||||
|
this.$root.$emit('buyModal::hidden', this.selectedItemToBuy.key);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
this.$root.$off('buyModal::boughtItem');
|
this.$root.$off('buyModal::boughtItem');
|
||||||
|
|||||||
Reference in New Issue
Block a user