[Search v1] Implement dynamic columns#41672
Conversation
Kicu
left a comment
There was a problem hiding this comment.
Left you some comments that I think you can improve
|
Hey a general comment @WojtekBoman @luacmartins Why do we repeat all the fields for search transaction in this file: https://github.com/Expensify/App/blob/main/src/components/SelectionList/types.ts#L131 when we have already defined the object in here: https://github.com/Expensify/App/blob/main/src/types/onyx/SearchResults.ts#L24 That is unnecessary redundancy IMO and makes the types more complex than they should be. The types for the list item should import+consume the types for search to make sure everything in TransactionListItem is the same as in the item returned from api and saved to Onyx. A side problem is that we are lying in types - we say that |
luacmartins
left a comment
There was a problem hiding this comment.
Looking good. Left a few comments.
src/CONST.ts
Outdated
| SEARCH_TABLE_OPTIONAL_COLUMNS: { | ||
| CATEGORY: 'category', | ||
| TAG: 'tag', | ||
| }, |
There was a problem hiding this comment.
I think we can remove this and just use the values defined in SEARCH_TABLE_COLUMNS
|
@luacmartins I haven't added yet a column for taxes, do we have a field for that in data structure that we obtain from the API? I think that we can go ahead with this PR and add this column in another PR once we receive this data from the backend. |
We do send that data from the API already if tax tracking is enabled on the policy, so we should add that here. |
luacmartins
left a comment
There was a problem hiding this comment.
Looks good. We just need to add the tax column now
| <Text style={[styles.mutedNormalTextLabel]}>{translate('common.tag')}</Text> | ||
| </View> | ||
| )} | ||
| {!shouldShowTaxColumn && ( |
There was a problem hiding this comment.
| {!shouldShowTaxColumn && ( | |
| {shouldShowTaxColumn && ( |
| const isFromExpenseReport = transactionItem.reportType === CONST.REPORT.TYPE.EXPENSE; | ||
| const date = TransactionUtils.getCreated(transactionItem as OnyxEntry<Transaction>, CONST.DATE.MONTH_DAY_ABBR_FORMAT); | ||
| const amount = TransactionUtils.getAmount(transactionItem as OnyxEntry<Transaction>, isFromExpenseReport); | ||
| const taxAmount = TransactionUtils.getAmount(transactionItem as OnyxEntry<Transaction>); |
There was a problem hiding this comment.
This is not correct as it'll get the full transaction amount, we should use getTaxAmount
| const taxAmount = TransactionUtils.getAmount(transactionItem as OnyxEntry<Transaction>); | |
| const taxAmount = TransactionUtils.getTaxAmount(transactionItem as OnyxEntry<Transaction>); |
luacmartins
left a comment
There was a problem hiding this comment.
LGTM. @akinwale all yours. Let's get this merged soon.
|
I'll review later today. |
Reviewer Checklist
Screenshots/VideosAndroid: Native41672-android-native.mp4Android: mWeb Chrome41672-android-chrome.mp4iOS: Native41672-ios-native.mp4iOS: mWeb Safari41672-ios-safari.mp4MacOS: Chrome / Safari41672-web.mp4MacOS: Desktop41672-desktop.mp4 |
|
@WojtekBoman The tax amount is not displayed on small screen widths, both mWeb and native. |
|
That's expected. I don't think the current design displays tax amount on narrow screens |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.4.74-0 🚀
|
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.4.74-6 🚀
|
| <Tooltip | ||
| shouldRender={showTooltip} | ||
| text={text} | ||
| > | ||
| <View style={[styles.flexRow, styles.flexShrink1, styles.gap1]}> |




Details
This PR adds support for dynamic columns on SearchPage.
Fixed Issues
$ #39891
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2024-05-07.at.12.43.32.mov
MacOS: Desktop
Screen.Recording.2024-05-07.at.12.41.10.mov