2017-07-27 17:41:23 +00:00
|
|
|
<template lang="pug">
|
|
|
|
|
div
|
2017-08-16 22:34:25 +00:00
|
|
|
span(
|
|
|
|
|
v-for="currency of currencies",
|
|
|
|
|
:key="currency.key"
|
|
|
|
|
)
|
|
|
|
|
.svg-icon(v-html="currency.icon")
|
|
|
|
|
span(:class="{'notEnough': currency.notEnough}") {{ currency.value | roundBigNumber}}
|
2017-07-27 17:41:23 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
@import '~client/assets/scss/colors.scss';
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
font-weight: normal;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
line-height: 1.33;
|
|
|
|
|
color: $gray-200;
|
|
|
|
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.svg-icon {
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
width: 16px;
|
|
|
|
|
height: 16px;
|
|
|
|
|
margin-right: 8px;
|
|
|
|
|
margin-left: 4px;
|
|
|
|
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-16 22:34:25 +00:00
|
|
|
.notEnough {
|
|
|
|
|
color: #f23035 !important;
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-27 17:41:23 +00:00
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
2017-07-31 23:04:40 +00:00
|
|
|
import svgGem from 'assets/svg/gem.svg';
|
|
|
|
|
import svgGold from 'assets/svg/gold.svg';
|
|
|
|
|
import svgHourglasses from 'assets/svg/hourglass.svg';
|
2017-07-27 17:41:23 +00:00
|
|
|
|
2017-08-16 22:34:25 +00:00
|
|
|
import currencyMixin from './_currencyMixin';
|
|
|
|
|
|
2017-07-27 17:41:23 +00:00
|
|
|
export default {
|
2017-08-16 22:34:25 +00:00
|
|
|
mixins: [currencyMixin],
|
2017-07-27 17:41:23 +00:00
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
icons: Object.freeze({
|
2017-07-31 23:04:40 +00:00
|
|
|
gem: svgGem,
|
|
|
|
|
gold: svgGold,
|
|
|
|
|
hourglasses: svgHourglasses,
|
2017-07-27 17:41:23 +00:00
|
|
|
}),
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
2017-08-16 22:34:25 +00:00
|
|
|
currencies () {
|
|
|
|
|
let currencies = [];
|
|
|
|
|
|
|
|
|
|
if (this.withHourglass) {
|
|
|
|
|
currencies.push({
|
|
|
|
|
type: 'hourglasses',
|
|
|
|
|
icon: this.icons.hourglasses,
|
|
|
|
|
value: this.userHourglasses,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currencies.push({
|
|
|
|
|
type: 'gems',
|
|
|
|
|
icon: this.icons.gem,
|
|
|
|
|
value: this.userGems,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
currencies.push({
|
|
|
|
|
type: 'gold',
|
|
|
|
|
icon: this.icons.gold,
|
|
|
|
|
value: this.userGold,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
for (let currency of currencies) {
|
|
|
|
|
if (currency.type === this.currencyNeeded && !this.enoughCurrency(this.currencyNeeded, this.amountNeeded)) {
|
|
|
|
|
currency.notEnough = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return currencies;
|
|
|
|
|
},
|
2017-07-27 17:41:23 +00:00
|
|
|
},
|
2017-07-31 23:04:40 +00:00
|
|
|
props: {
|
|
|
|
|
withHourglass: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
},
|
2017-08-16 22:34:25 +00:00
|
|
|
currencyNeeded: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
amountNeeded: {
|
|
|
|
|
type: Number,
|
|
|
|
|
},
|
2017-07-31 23:04:40 +00:00
|
|
|
},
|
2017-07-27 17:41:23 +00:00
|
|
|
};
|
|
|
|
|
</script>
|