Skip to content

Commit ae0b966

Browse files
fix: update currency display in setting for change class (#15391)
* fix: add neededCurrencyOnly prop * fix: worked on logic for displaying only gems * fix: removed gold & hourglasses if neededCurrencyOnly is true * fix: aligned gem count properly * fix: updates based on some comments (all comments answered) * fix: working on displaying only required currency in a new array * chore: trying to figure out currency logic * trying to use .find() now * remove unneeded line of code * still working on finding/filtering the currency * trying to move requiredCurrency into a new function (?!) * fix: added logic to filter for a single currency and fixed CSS * fix: clean up code * fix: really clean up code, sheesh * fix: updated per comments on PR * fix(style): vertically align elements in your-balance --------- Co-authored-by: Kalista Payne <[email protected]>
1 parent cef8a34 commit ae0b966

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

website/client/src/components/shops/balanceInfo.vue

+15-11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<div
44
v-for="currency of currencies"
55
:key="currency.key"
6+
:needed-currency-only="neededCurrencyOnly"
67
class="d-flex align-items-center"
78
>
89
<div
@@ -54,6 +55,9 @@ export default {
5455
amountNeeded: {
5556
type: Number,
5657
},
58+
neededCurrencyOnly: {
59+
type: Boolean,
60+
},
5761
},
5862
data () {
5963
return {
@@ -66,34 +70,34 @@ export default {
6670
},
6771
computed: {
6872
currencies () {
69-
const currencies = [];
70-
currencies.push({
73+
const currencies = [{
7174
type: 'hourglasses',
7275
icon: this.icons.hourglasses,
7376
value: this.userHourglasses,
74-
});
77+
},
7578
76-
currencies.push({
79+
{
7780
type: 'gems',
7881
icon: this.icons.gem,
7982
value: this.userGems,
80-
});
83+
},
8184
82-
currencies.push({
85+
{
8386
type: 'gold',
8487
icon: this.icons.gold,
8588
value: this.userGold,
86-
});
89+
}];
8790
8891
for (const currency of currencies) {
89-
if (
90-
currency.type === this.currencyNeeded
91-
&& !this.enoughCurrency(this.currencyNeeded, this.amountNeeded)
92+
if (currency.type === this.currencyNeeded
93+
&& !this.enoughCurrency(this.currencyNeeded, this.amountNeeded)
9294
) {
9395
currency.notEnough = true;
9496
}
9597
}
96-
98+
if (this.neededCurrencyOnly) {
99+
return currencies.filter(curr => curr.type === this.currencyNeeded);
100+
}
97101
return currencies;
98102
},
99103
},

website/client/src/pages/settings/components/yourBalance.vue

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
class="balance-info"
1212
:currency-needed="currencyNeeded"
1313
:amount-needed="amountNeeded"
14+
:neededCurrencyOnly="true"
1415
/>
1516
</div>
1617
</template>

website/client/src/pages/settings/settingRows/classSetting.vue

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
<your-balance
6767
:amount-needed="amountNeeded"
6868
currency-needed="gems"
69+
class="d-flex align-items-center"
6970
/>
7071
</div>
7172
</td>

0 commit comments

Comments
 (0)