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 functionality to NFTs #1039

Merged
merged 9 commits into from
May 7, 2024

Conversation

shawnbusuttil
Copy link
Contributor

Checklist

  • JIRA - <LW-10023>
  • Proper tests implemented
  • Screenshots added.

Proposed solution

Added search functionality to NFTs (when user has 10+).
Logging events to PostHog when user is searching.
Breadcrumbs added for NFT directory path.

Testing

Note: Enable the Post Hog environment variable when testing events unless you are using an account that is opted in. Use an account with 10 or more NFTs.

Screenshots

image

image

image

@shawnbusuttil shawnbusuttil added the browser Changes to the browser application. label Apr 8, 2024
@shawnbusuttil shawnbusuttil self-assigned this Apr 8, 2024
@shawnbusuttil shawnbusuttil requested a review from a team as a code owner April 8, 2024 11:15
@github-actions github-actions bot removed the browser Changes to the browser application. label Apr 8, 2024
Copy link

github-actions bot commented Apr 8, 2024

Allure Report

allure-report-publisher generated test report!

smokeTests: ✅ test report for 8294dd25

passed failed skipped flaky total result
Total 30 0 0 0 30

Copy link
Contributor

@szymonmaslowski szymonmaslowski left a comment

Choose a reason for hiding this comment

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

GJ! I left a few comments.

apps/browser-extension-wallet/src/hooks/useNftSearch.ts Outdated Show resolved Hide resolved
@@ -219,7 +239,31 @@ export const NftsLayout = withNftsFoldersContext((): React.ReactElement => {
</div>
<div className={styles.content} data-testid="nft-list-container">
{items.length > 0 ? (
<NftList items={items} rows={4} />
<>
Copy link
Contributor

Choose a reason for hiding this comment

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

The search-related code is repeated twice. Consider creating a component handling the search and use in both places.
This component could render the search box, handle the case of empty results and have a children prop of a function type that accepts nft items for rendering so you could do the folowing:

<NftFilter nfts={nfts} {...otherRequiredData}>
  {(filteredNfts) => <NftList items={filteredNfts} rows={4} />}
</NftFilter>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are already grouping the duplicated logic in a hook. The right approach here would be to unify the Nft screens into a responsive one but it falls out of scope. I don't think filters should be components.

Copy link
Contributor

Choose a reason for hiding this comment

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

The handleNftSearch functions are identical and it is the same for the markup here. It increases the duplication rate which was here before your changes. IMO the correct approach is to at least not increase the duplication.

apps/browser-extension-wallet/src/hooks/useNftSearch.ts Outdated Show resolved Hide resolved
@greatertomi greatertomi removed their request for review April 17, 2024 15:46
Copy link

sonarcloud bot commented May 3, 2024

@shawnbusuttil shawnbusuttil merged commit 4046387 into main May 7, 2024
12 checks passed
@shawnbusuttil shawnbusuttil deleted the feat/lw-10023-search-box-nfts branch May 7, 2024 09:49
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