Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update currency display in setting for change class #15391

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

CuriousMagpie
Copy link
Member

@CuriousMagpie CuriousMagpie commented Feb 7, 2025

Currently, when a user wishes to change their class on the Settings page, it shows hourglasses, gems, and gold. Since the currency used to change class is gems, this fix to add extra logic and a new prop was required. A small CSS change was required as well.

@CuriousMagpie CuriousMagpie changed the title Settings currency Update Class Change User Currency Display Feb 7, 2025
@CuriousMagpie CuriousMagpie changed the title Update Class Change User Currency Display fix: update currency display in setting for change class Feb 7, 2025
});
if (this.neededCurrencyOnly === true) {
currencies.push({
type: 'gems',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be hard-coded. We might want to display Hourglasses only, or Gold only, in other places.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I know. Need to figure it out!

@@ -67,33 +71,40 @@ export default {
computed: {
currencies () {
const currencies = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is so weird, why do we make an array and push stuff into it instead of just defining the array in the const declaration? or one better, defining the possible currencies in the common code... 🤔 You don't necessarily need to refactor it, just .. huh

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote it so the array is defined within the const declaration instead using .push()

@@ -11,6 +11,7 @@
class="balance-info"
:currency-needed="currencyNeeded"
:amount-needed="amountNeeded"
neededCurrencyOnly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, does this work as a destructured syntax? Do we set up props like this anywhere else? I'd lean toward keeping the style consistent for readability, tbh, given you've used our more common format even within this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, which is weird. I have, however, rewritten it so it matches our more common format.

@@ -80,6 +82,11 @@ input {
margin-right: 2rem;
}

.currency-align {
display: flex;
align-items: center;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are helper classes for these. You don't need to add more CSS.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, but still figuring it out

icon: this.icons.hourglasses,
value: this.userHourglasses,
});
if (this.neededCurrencyOnly === true) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the equivalency operator, if (this.neededCurrencyOnly) { is sufficient

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, derp!

&& !this.enoughCurrency(this.currencyNeeded, this.amountNeeded)
) {
currency.notEnough = true;
for (const currency of currencies) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're skipping this code block in the needed-only case. Don't we still want the component to notice when the user doesn't have enough of the needed currency, even if we're only showing one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still thinking this one through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants