habitica/website/client/src/components/inventory/stable/hatchedPetDialog.vue
Matteo Pagliazzi 08f1e2b273
Client: remove unnecessary API calls + members fixes (#12179)
* wip

* refactor world state

* allow resource to be reloaded when the server is updated

* fix #9242

* fix event listeners

* remove un-needed code

* add tests for  asyncResourceFactory reloadOnAppVersionChange

* fix double cron notifications and party members showing up in the header after a party invitation is accepted

* remove console.log

* do not send vm info to loggly due to circular dependency + fix typo

* fix #12181

* do not load invites multiple times in members modal

* add hover to challenge member count

* groups: load members only on demand

* minor ui fixes

* choose class: fix vue duplicate key warning

* minor ui fixes

* challanges: load members on demand

* add loading spinner

* change loading mechanism

* fix loading gryphon issues

* reduce code duplication
2020-05-25 17:02:29 +02:00

142 lines
2.6 KiB
Vue

<template>
<b-modal
id="hatchedPet-modal"
:hide-header="true"
>
<span
class="close-icon svg-icon inline icon-10"
@click="close()"
v-html="icons.close"
></span>
<div
v-if="pet != null"
class="content"
>
<div
v-once
class="dialog-header title"
>
{{ $t('hatchedPetGeneric') }}
</div>
<div class="inner-content">
<div class="pet-background d-flex align-items-center">
<div :class="pet.class"></div>
</div>
<h4 class="title">
{{ pet.name }}
</h4>
<div
v-if="!hideText"
v-markdown="$t('hatchedPetHowToUse', { stableUrl: '/inventory/stable' })"
class="text"
></div>
<button
class="btn btn-primary"
@click="close()"
>
{{ $t('onward') }}
</button>
</div>
</div>
<div
slot="modal-footer"
class="clearfix"
></div>
</b-modal>
</template>
<style lang="scss">
@import '~@/assets/scss/colors.scss';
@import '~@/assets/scss/modal.scss';
#hatchedPet-modal {
@include centeredModal();
.modal-dialog {
width: 330px;
}
.modal-footer {
padding-top: 0px;
}
.content {
text-align: center;
}
.inner-content {
margin: 24px auto auto;
display: flex;
flex-direction: column;
align-items: center;
}
.pet-background {
width: 112px;
height: 112px;
border-radius: 4px;
background-color: $gray-700;
}
.Pet {
margin: auto;
}
.dialog-header {
color: $purple-200;
margin-top: 16px;
}
.text {
margin-bottom: 24px;
min-height: 0;
&.markdown {
p {
margin-bottom: 0px;
}
}
}
}
</style>
<script>
import markdownDirective from '@/directives/markdown';
import svgClose from '@/assets/svg/close.svg';
export default {
directives: {
markdown: markdownDirective,
},
props: {
hideText: {
type: Boolean,
},
},
data () {
return {
pet: null,
icons: Object.freeze({
close: svgClose,
}),
};
},
mounted () {
this.$root.$on('hatchedPet::open', this.openDialog);
},
beforeDestroy () {
this.$root.$off('hatchedPet::open', this.openDialog);
},
methods: {
openDialog (item) {
this.pet = item;
this.$root.$emit('bv::show::modal', 'hatchedPet-modal');
},
close () {
this.$emit('closed', this.item);
this.$root.$emit('bv::hide::modal', 'hatchedPet-modal');
this.pet = null;
},
},
};
</script>