Skip to content

Commit

Permalink
Merge branch 'settings-currency' of https://github.com/CuriousMagpie/…
Browse files Browse the repository at this point in the history
…habitica into develop
  • Loading branch information
CuriousMagpie committed Feb 14, 2025
2 parents 3f2b1d3 + e36dde7 commit d509671
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
36 changes: 24 additions & 12 deletions website/client/src/components/shops/balanceInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div
v-for="currency of currencies"
:key="currency.key"
:needed-currency-only="neededCurrencyOnly"
class="d-flex align-items-center"
>
<div
Expand Down Expand Up @@ -54,6 +55,9 @@ export default {
amountNeeded: {
type: Number,
},
neededCurrencyOnly: {
type: Boolean,
},
},
data () {
return {
Expand All @@ -66,34 +70,42 @@ export default {
},
computed: {
currencies () {
const currencies = [];
currencies.push({
const currencies = [{
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 (const currency of currencies) {
if (
currency.type === this.currencyNeeded
&& !this.enoughCurrency(this.currencyNeeded, this.amountNeeded)
) {
if (this.neededCurrencyOnly) {
const neededCurrency = [
// need to figure out how to abstract this so any currency can be called, not just gems
{
type: 'gems',
icon: this.icons.gem,
value: this.userGems,
},
];
return neededCurrency;
}
if (currency.type === this.currencyNeeded
&& !this.enoughCurrency(this.currencyNeeded, this.amountNeeded)) {
currency.notEnough = true;
}
}
return currencies;
},
},
Expand Down
4 changes: 4 additions & 0 deletions website/client/src/pages/settings/components/yourBalance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class="balance-info"
:currency-needed="currencyNeeded"
:amount-needed="amountNeeded"
neededCurrencyOnly=""
/>
</div>
</template>
Expand All @@ -28,6 +29,9 @@ export default {
amountNeeded: {
type: Number,
},
neededCurrencyOnly: {
type: Boolean,
},
},
};
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<your-balance
:amount-needed="amountNeeded"
currency-needed="gems"
:neededCurrencyOnly="true"
/>
</div>
</td>
Expand Down

0 comments on commit d509671

Please sign in to comment.