-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Search v1] Implement dynamic columns #41672
[Search v1] Implement dynamic columns #41672
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this and just use the values defined in SEARCH_TABLE_COLUMNS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good improvements 👍
@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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. We just need to add the tax column now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Text style={[styles.mutedNormalTextLabel]}>{translate('common.tag')}</Text> | ||
</View> | ||
)} | ||
{!shouldShowTaxColumn && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{!shouldShowTaxColumn && ( | |
{shouldShowTaxColumn && ( |
@@ -61,6 +62,7 @@ function TransactionListItem<TItem extends ListItem>({ | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
✋ 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 🚀
|
Details
This PR adds support for dynamic columns on SearchPage.
Fixed Issues
$ #39891
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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