-
Notifications
You must be signed in to change notification settings - Fork 120
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
Issue 13: trait values inline editing #58
Issue 13: trait values inline editing #58
Conversation
Thanks so much @KitanGarcia! We'll take a look at this asap. |
9ab2c39
to
c24214f
Compare
hi @KitanGarcia - apologies that im only getting back to this now. It looks great but i ran into an issue that could be improved: If you use "Add a List of Values" to add many trait values at once, they are initialized to a value of "-1". When i try to make changes to the -1 later with your inline editing, it throws an error that the value must be between 0 and 1, even if I am changing it to something in that range. I get this as soon as I try to type a character: |
style-wise, it would also be great if we could introduce a small amount of inner padding on the text fields |
models/traitValue.tsx
Outdated
@@ -18,7 +18,7 @@ import { Traits } from "./trait"; | |||
export default interface TraitValue { | |||
id: string; | |||
name: string; | |||
rarity: number; | |||
rarity: number | string; // string to allow . or trailing 0s in inline editing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we convert to number before storing in the model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, can we revert the change here then?
@skeletoncrewrip Thanks for taking a look at this and for the feedback! Apologies for not catching this. I rewrote a lot of the code in a way that handles things much more nicely, in my opinion, to solve this, and also added the ability to update values by pressing enter.
|
…n on pressing enter
@KitanGarcia this is looking great - should have time to test tomorrow. Only thing i would like to see is removing the change to the traitValue model if it's unnecessary. I'd like to know that we can guarantee that value is always a number and not a string. Thanks! |
…fault -1 vals for rarity
@skeletoncrewrip I was able to restore the traitValue model to its previous state, so rarity will once again always be a Number. I also added protection against another edge case that resulted in buggy behavior if the user added a list of traits and updated rarity by either pressing enter or focusing to another rarity without changing either of them from the default of -1. Let me know if there's anything else you find in testing! |
awesome work, thanks @KitanGarcia! Drop your wallet address (here or DM me: https://twitter.com/cosimo_rip) so that I can send you a contributor NFT :) |
@KitanGarcia also, bonus points if you're interested: immediately updating the Total Rarity and calculated "None" rarity anytime there is an update to the individual rows. |
Oh, awesome! Thanks a ton, I didn't even expect that! @skeletoncrewrip my wallet address is: EZ7sSyRmS9jQPMnjvwRVtBDhqtE1euDeqenAsiKa5ajK And sounds good! I'll definitely see if I can implement updating rarity in the coming days! |
This is addressing issue #13:
I added the ability to edit trait values inline. Each time the user edits and takes their focus off the input element, the values are saved. I also added error checking and surfaced issues to the user via alert messages.
A couple important things to note:
I'm happy to go back and tweak some things if need be!