-
Notifications
You must be signed in to change notification settings - Fork 2
Notrab/sc 26147/nameai fix ux of unnormalized label submissions #575
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
Notrab/sc 26147/nameai fix ux of unnormalized label submissions #575
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…d-label-submissions
lightwalker-eth
left a comment
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.
@notrab Hey good to see these enhancements. Approving this PR now to help unblock merging it in. Also shared some suggestions with feedback that are fine to action in a separate future PR 👍
| } | ||
|
|
||
| try { | ||
| const normalizedLabel = ens_normalize(label); |
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.
We also need to check if label includes any "." characters. If it does, that should be another error case, because the input is more than 1 label.
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.
So I added this as client side validation for MVP as waiting for a network response for the validation seemed overkill for something that can be detected on the client.
| if (inputValue) { | ||
| let error = null; | ||
|
|
||
| if (inputValue.includes(" ")) { |
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.
Suggest some refactoring such that you define just a single function in the whole app that takes as input a string (let's call it unvalidatedLabel). This function should then either return a validatedLabel that is guaranteed to not be an empty string, not to contain more than 1 label, and to be ENS normalized. If this function identifies any problems with unvalidatedLabel it should throw an exception with the appropriate error message. Callers of this function can then manage their own logic for how to take action if an exception is thrown by this function.
| return ( | ||
| <form onSubmit={handleSubmit} className="mb-6"> | ||
| <div className="flex items-start justify-center space-x-2 flex-1"> | ||
| <Input |
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.
Perhaps there's an opportunity to define just a single "LabelInput" UI component / full "LabelInput" form and then reuse it across both of our example apps? The logic should be exactly the same. All that changes is dynamic behaviour for what happens when a valid label is submitted.
* feat: [SC-26223] ✨ Migrate NFTAvatar to namekit-react * feat: [sc-26178] Create readme for NameAI SDK (#578) * create readme for nameai-sdk; add license * extend response example * Fix links in NameAI API readme (#579) * fix links in readme * Update README.md --------- Co-authored-by: kwrobel.eth <djstrong@gmail.com> * feat: [sc-26164] Finish Transition of alpha.namekit.io landing page to namekit.io (#563) * add ExploreNameGraphForm to Namegraph services section * Add namekit react Button to ExploreNameGraphForm * support empty input on ExploreNameGraphForm * use namekit react Input on explore-namegraph-form * improve button and text placement --------- Co-authored-by: lightwalker.eth <126201998+lightwalker-eth@users.noreply.github.com> * feat: [sc-26169] Refine namekit.io landing page (#564) * use namekit-react for X button * add Try the Alpha to mobile navigation link * avoid just 1 word wrapping to the next line on get-your-web3-name section * add "try now" button on hero section * fix button placement * fix text placement on hero section * fix screen limit * fix balancer generated layout shifts * add IconButton to mobile version of namekit.io --------- Co-authored-by: lightwalker.eth <126201998+lightwalker-eth@users.noreply.github.com> * Notrab/sc 26147/nameai fix ux of unnormalized label submissions (#575) * feat(nameai): turn off autoComplete * add data-1p-ignore * rename field * add client side validation and loading states * fix type issues * fix rank form errors * update tsconfig * fix type * sort page ux * feat: [SC-26223] ✨ Migrate NFTAvatar to namegraph.dev based on next/image dependency * feat: [SC-26223] 💄 Make NFTAvatar look shiny in the Ui * fix: [SC-26223] 🐛 Update DisplayedName to fix labels displaying for subdomains * fix: [SC-26223] 🐛 Clean unnecessary code and make it possible to switch suffixes and recharge avatars right away * fix: [SC-26223] 🐛 Fix atropos react typescript alignment * feat: [SC-26223] ✨ Remove file and optimize code syntax --------- Co-authored-by: Piotr Zawiślan <59446552+Byczong@users.noreply.github.com> Co-authored-by: kwrobel.eth <djstrong@gmail.com> Co-authored-by: Eduardo <eduramme@gmail.com> Co-authored-by: lightwalker.eth <126201998+lightwalker-eth@users.noreply.github.com> Co-authored-by: Jamie Barton <jamie@notrab.dev>
…#570) * feat: [SC-26202] ✨ Build Name Details Page draft and most important features * feat: [SC-26202] ✨ Make name details page beautiful * feat: [SC-26202] ✨ Other name ideas in Name Details page * feat: [SC-26202] 🐛 Fix build errors * feat: [SC-26202] 💄 Improve visualization in Name Details page * feat: [SC-26202] ✨ Add Skeletons to Name Details page * feat: [SC-26202] ✨ Add possibility of not loading related collection from suggestionsByCategory NameGraph SDK endpoint * feat: [SC-26202] 🐛 Fix Ui bug in Collection page * fix: [SC-26202] 🐛 Align Ui type usage with API type * feat: [SC-26202] ✨ Normalizing query name input * feat: [SC-26202] ✨ Appending TLD usage from namegraph.dev in the URL * [SC-26223] ✨ Migrate NFTAvatar (#583) * feat: [SC-26223] ✨ Migrate NFTAvatar to namekit-react * feat: [sc-26178] Create readme for NameAI SDK (#578) * create readme for nameai-sdk; add license * extend response example * Fix links in NameAI API readme (#579) * fix links in readme * Update README.md --------- Co-authored-by: kwrobel.eth <djstrong@gmail.com> * feat: [sc-26164] Finish Transition of alpha.namekit.io landing page to namekit.io (#563) * add ExploreNameGraphForm to Namegraph services section * Add namekit react Button to ExploreNameGraphForm * support empty input on ExploreNameGraphForm * use namekit react Input on explore-namegraph-form * improve button and text placement --------- Co-authored-by: lightwalker.eth <126201998+lightwalker-eth@users.noreply.github.com> * feat: [sc-26169] Refine namekit.io landing page (#564) * use namekit-react for X button * add Try the Alpha to mobile navigation link * avoid just 1 word wrapping to the next line on get-your-web3-name section * add "try now" button on hero section * fix button placement * fix text placement on hero section * fix screen limit * fix balancer generated layout shifts * add IconButton to mobile version of namekit.io --------- Co-authored-by: lightwalker.eth <126201998+lightwalker-eth@users.noreply.github.com> * Notrab/sc 26147/nameai fix ux of unnormalized label submissions (#575) * feat(nameai): turn off autoComplete * add data-1p-ignore * rename field * add client side validation and loading states * fix type issues * fix rank form errors * update tsconfig * fix type * sort page ux * feat: [SC-26223] ✨ Migrate NFTAvatar to namegraph.dev based on next/image dependency * feat: [SC-26223] 💄 Make NFTAvatar look shiny in the Ui * fix: [SC-26223] 🐛 Update DisplayedName to fix labels displaying for subdomains * fix: [SC-26223] 🐛 Clean unnecessary code and make it possible to switch suffixes and recharge avatars right away * fix: [SC-26223] 🐛 Fix atropos react typescript alignment * feat: [SC-26223] ✨ Remove file and optimize code syntax --------- Co-authored-by: Piotr Zawiślan <59446552+Byczong@users.noreply.github.com> Co-authored-by: kwrobel.eth <djstrong@gmail.com> Co-authored-by: Eduardo <eduramme@gmail.com> Co-authored-by: lightwalker.eth <126201998+lightwalker-eth@users.noreply.github.com> Co-authored-by: Jamie Barton <jamie@notrab.dev> * feat: [SC-26202] ✨ Align namegraph.dev "search" URL query param to Debounced Input in collections page * feat: [SC-26202] ⚙️ Adjust query params provider in namegraph.dev * feat: [SC-26202] ⚙️ Enhance namegraph.dev URLs and code reusing --------- Co-authored-by: lightwalker.eth <126201998+lightwalker-eth@users.noreply.github.com> Co-authored-by: Piotr Zawiślan <59446552+Byczong@users.noreply.github.com> Co-authored-by: kwrobel.eth <djstrong@gmail.com> Co-authored-by: Eduardo <eduramme@gmail.com> Co-authored-by: Jamie Barton <jamie@notrab.dev>
Uh oh!
There was an error while loading. Please reload this page.