-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(IT Wallet): [SIW-1937] Improve wallet category filters (#6570)
## Short description This PR fixes a bug in the wallet screen where users were unable to see any screen content if the category filters were in the wrong state. This PR also improves the debug data overlay and the wallet redux selectors. ### Steps to reproduce the addressed bug - Navigate to the Wallet screen, ensure you have *Documenti su IO* enabled and at least one payment method saved - Select the "Other" category filter - Remove everything but ITW from the wallet, keeping the "Other" filter selected - Once you removed everything you should see a blank screen - Restarting the app should not fix the issue ## List of changes proposed in this pull request - Added `isWalletCategoryFilteringEnabledSelector` selector to check if the category filtering is available: filtering is available only if there is more than one category in the wallet. - Added `shouldRenderWalletCategorySelector` selector to check if a wallet category section should be rendered, based on the currently selected filter and the number of categories available in the wallet - Added `withWalletCategoryFilter` HOC, which display a component based on the given category filter - Added `selectWalletCardsByCategory` and `selectWalletCardsByType` to select cards based on category or type, removing the need to have dedicated selectors - Removed `selectWalletCgnCard` and `selectBonusCards` selectors - Improved debug data in `DebugInfoOverlay` - Added the ability to display `Set` objects - Added the ability to add data from different components at the same time by merging data using the same key - Improved wallet category filtering - Refactored `WalletCardsContainer` with new selectors - Added useful/missing debug data - Added tests - Removed `categoryFilter` preference persistence from the `wallet.preferences` feature reducer ## How to test - Static checks should pass - Navigate to the wallet screen and check that everything works fine, especially the category filters - Try to reproduce the bug, you should now see the wallet content.
- Loading branch information
Showing
17 changed files
with
469 additions
and
199 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { truncateObjectStrings } from "../utils"; | ||
|
||
describe("truncateObjectStrings", () => { | ||
it.each` | ||
input | maxLength | expected | ||
${"Long string"} | ${4} | ${"Long..."} | ||
${{ outer: { inner: "Long string" }, bool: true }} | ${4} | ${{ outer: { inner: "Long..." }, bool: true }} | ||
${["Long string", "Very long string"]} | ${4} | ${["Long...", "Very..."]} | ||
${new Set(["Long string", "Very long string"])} | ${4} | ${["Long...", "Very..."]} | ||
`( | ||
"$input should be truncated to $expected", | ||
({ input, maxLength, expected }) => { | ||
const result = truncateObjectStrings(input, maxLength); | ||
expect(result).toEqual(expected); | ||
} | ||
); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.