Files
habitica/website/client/components/achievements/death.vue
negue 4108a22d78 [WIP] bootstrap-vue upgrade (#9178)
* update bootstrap-vue to 1.0.0-beta.9 - remove all individual bootstrap components and use BootstrapVue into Vue

* change modal action names from show::modal to bv::show::modal

* check if drops are undefined

* fix modal widths - sellModal now using input instead of dropbox

* upgrade to bootstrap 4.0beta

* include package-lock changes

* fix app menu dropdown position

* upgrade bootstrap to beta2 (was missing grid offset and other fixes) - refix header menu position

* fix tags popup (auto width to max not working) - fix filter panel width (adding width: 100% works until max-width)

* show hide logo on different screensize (new css breakpoints - http://getbootstrap.com/docs/4.0/utilities/display/ )

* fix package-lock?

* fix active button style / app header toggle button

* fix package-lock !

* update package lock after merge - new mixin "openedItemRows" to save the "show more/show less" in stable

* mixin naming style

* fix buyQuestModal marginTop

* fix customMenuDropdown position

* fix userDropdown items
2017-11-08 18:40:37 +01:00

70 lines
1.8 KiB
Vue

<template lang="pug">
b-modal#death(:title="$t('lostAllHealth')", size='md', :hide-footer="true")
.row
.col-12
.hero-stats
.meter-label(:tooltip="$t('health')")
span.glyphicon.glyphicon-heart
.meter.health(:tooltip='Math.round(user.stats.hp * 100) / 100')
.bar(:style='barStyle')
// span.meter-text.value
| {{Math.ceil(user.stats.hp)}} / {{maxHealth}}
avatar(:member='user', :sleep='true', :avatarOnly='true', :withBackground='true')
// @TOOD: Sleep +generatedAvatar({sleep:true})
span(class='knockout')
.col-6.offset-3
h4.dont-despair {{ $t('dontDespair') }}
p.death-penalty {{ $t('deathPenaltyDetails') }}
.modal-footer
.col-12.text-center
button.btn.btn-danger(@click='revive()') {{ $t('refillHealthTryAgain') }}
h4.text-center(v-html="$t('dyingOftenTips')")
</template>
<style scoped>
.avatar {
width: 140px;
margin: 0 auto;
margin-bottom: 1.5em;
margin-top: 1.5em;
}
</style>
<script>
import axios from 'axios';
import Avatar from '../avatar';
import { mapState } from 'client/libs/store';
import revive from '../../../common/script/ops/revive';
import percent from '../../../common/script/libs/percent';
import {maxHealth} from '../../../common/script/index';
export default {
components: {
Avatar,
},
data () {
return {
maxHealth,
};
},
computed: {
...mapState({user: 'user.data'}),
barStyle () {
return {
width: `${percent(this.user.stats.hp, maxHealth)}%`,
};
},
},
methods: {
close () {
this.$root.$emit('bv::hide::modal', 'death');
},
async revive () {
await axios.post('/api/v3/user/revive');
revive(this.user);
this.close();
},
},
};
</script>