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

feat: Add search to from and to fields in swap form #2532

Merged
merged 4 commits into from
Feb 20, 2025

Conversation

jeetparikh
Copy link
Contributor

@jeetparikh jeetparikh commented Feb 20, 2025

Hi👋, please prefix this PR's title with:

  • breaking-change: if you have introduced modification that necessitates immediate adjustments by this SDK's users to their applications, clients, or integrations to avert disruptions to existing features or functionalities.
  • [ ✅ ] feat:, fix:, refactor:, docs:, or chore:.

Summary

Allows filtering tokens in from and to list in the swap form - can search by name, symbol or contract address

Screen.sharing.-.2025-02-20.1_43_13.PM.mp4

@jeetparikh jeetparikh requested a review from a team as a code owner February 20, 2025 02:26
keithbro-imx
keithbro-imx previously approved these changes Feb 20, 2025
Comment on lines 34 to 43
const filterOptions = useCallback((filterBy: string) => {
const filterByLower = filterBy.toLowerCase();
return options.filter((option) => option.name.toLowerCase().includes(filterByLower)
|| option.symbol.toLowerCase().includes(filterByLower)
|| option.id.toLowerCase().endsWith(filterByLower));
}, [options]);

const filteredOptions = !searchValue
? options
: filterOptions(searchValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this just be one thing in a useMemo? Otherwise it filter on every render

Copy link

nx-cloud bot commented Feb 20, 2025

View your CI Pipeline Execution ↗ for commit 1e36d2c.

Command Status Duration Result
nx affected -t build,lint,test ✅ Succeeded 2m 51s View ↗
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 1m 54s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-20 04:58:16 UTC

return options;
}
return filterOptions(searchValue, options);
}, [options, searchValue, filterOptions]);
Copy link
Contributor

Choose a reason for hiding this comment

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

filterOptions doesn't need to be a dep now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure if linter would complain or not

Copy link
Contributor

@pano-skylakis pano-skylakis left a comment

Choose a reason for hiding this comment

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

Test? :trollface:

@jeetparikh jeetparikh added this pull request to the merge queue Feb 20, 2025
Merged via the queue into main with commit 861caf1 Feb 20, 2025
7 checks passed
@jeetparikh jeetparikh deleted the feat/gfi-50-search-buy-token branch February 20, 2025 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants