Conversation
…fers pages - Added useMultiSelect hook for managing multi-selection state. - Created tests for useMultiSelect to ensure correct functionality. - Refactored NftList component to utilize useMultiSelect for NFT selection. - Updated Offers component to incorporate multi-select actions and state management. - Introduced useOfferData and useOfferParams hooks for better offer data handling. - Added tests for useOfferData to validate API interactions and state management. - Implemented fetchOfferRecords function to handle offer fetching with error management. - Enhanced Offers page with pagination and improved user experience for offer management.
…rStatusBadge component
…ce OfferTileCard tests, and improve Offers layout
Collaborator
Author
|
@judeallred i extended you multi-select addition to the offers page into a general update. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reworks the Offers page so it scales to wallets with many offers. Paging, filtering, search and sort now happen in the database instead of loading every offer. The page also gets the same toolbar, multi-select and card-size options as the NFT list.
Backend
get_offersis paged and filterable.GetOffersgains optionaloffset,limit,status,find_value,find_side(any/offered/requested),sort_mode(created/expiration) andascending.GetOffersResponsegainstotal, the match count before paging.offers_pagequery insage-database:LIKE, with%and_escaped). It also matches an exact id: offer id, asset id (hex,0xoptional), or annft1/did:chia:/ option address.COUNT(*) OVER()in the same query.offers_page(in-memory SQLite with migrations) andparse_find_id.sage-databasegainstokio/sqlxmigrate as dev-dependencies for these.Frontend
OfferOptions): debounced search with a side selector (any / offered / requested), a status filter, a sort-by menu with asc/desc, a small/large card toggle, and a multi-select toggle.useOfferParamsanduseOfferDatafetch one page at a time. Responses that arrive after newer params have been requested are dropped.OfferTileCard): a compact grid tile with status, one icon per side (extra assets as a+Npill) and a single time.<0.001; the exact value is in the tooltip.auto-fillcolumns with an 11rem minimum.OfferStatusBadgegives each status its own icon and color.NftOptionsandNftList, which now use them too:DebouncedSearchInputMultiSelectToggleuseMultiSelectformatCompactNumber(1.5K,1.23M, 3 significant digits below 1) and narrowformatRelativeTime(in 3d,2h ago) helpers.Notes for reviewers
GetOffersis no longerCopy, andGetOffersResponsehas a new requiredtotalfield.Test plan
pnpm run test:unit: 46 passing, including new tests for the tile card, search input, multi-select hook and actions, offer data hook,fetchOfferRecordsand the i18n helperstsc, eslint and prettier are cleancargo test -p sage-database -p sage🤖 Generated with Claude Code