-
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
Show year as well in date column #43413
Conversation
@dukenv0307 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Adding images. |
Is there a clean way to do this where we only increase the date column width if we know we have dates from a prior year? cc @luacmartins |
Do we have to skip the year if it's from the ongoing year? |
CC: @JmillsExpensify |
Yea, that should be possible by comparing all dates we have and if any is from a previous year, we'd increase the column width. That being said, pagination could make the layout shift if a new expense from a previous year is returned |
@shawnborton Can you confirm if that is what we expect? |
We don't need to show the year if all expenses shown are from the current year. And if we don't show the year, then I like the idea of using the smaller column width to save space. Let me know if that makes sense! |
@shawnborton Just to confirm: What would happen when few expenses are from 2024 and few from 2023? Should we show 2024 in the expenses that belong to 2024 since the width is anyways going to be larger? |
We would have an increased column width, but the expenses from 2024 would not have the year in the column. This is how it works on OldDot, so I think we'd want to keep it the same for now. |
Lets use this thread to agree on the plan ahead. @ShridharGoel let us know if you have some issues with the proposed logic |
Waiting for @ShridharGoel's update |
Let me know when we have some updated screenshots to review! |
src/libs/SearchUtils.ts
Outdated
// If the item is a ReportListItemType, iterate over its transactions and check them | ||
return item.transactions.some((transaction) => { | ||
const transactionYear = new Date(transaction?.modifiedCreated ? transaction.modifiedCreated : transaction?.created || '').getFullYear(); | ||
return transactionYear !== new Date().getFullYear(); |
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.
we can define the currentYear = new Date().getFullYear() out of this block
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.
+1
src/libs/SearchUtils.ts
Outdated
} | ||
|
||
const createdYear = new Date(item?.modifiedCreated ? item.modifiedCreated : item?.created || '').getFullYear(); | ||
return createdYear !== new Date().getFullYear(); |
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.
use currentYear ^
It's done, though I'm not sure how it is feasible to use sortedData in this.
|
@dukenv0307 @ShridharGoel if anything is unclear please use the slack thread to discuss. Lets try to get this one merged today |
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.
changes look good to me now, I hope it wont be too slow in large list of transactions
@@ -168,6 +168,9 @@ type TransactionListItemType = ListItem & | |||
|
|||
/** Whether we should show the tax column */ | |||
shouldShowTax: boolean; | |||
|
|||
/** Info about whether there's atleast one transaction that doesn't belong to the present year */ |
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.
/** Info about whether there's atleast one transaction that doesn't belong to the present year */ | |
/** Info about whether there's at least one transaction that doesn't belong to the present year */ |
src/libs/TransactionUtils.ts
Outdated
function getCreatedDate(transaction: OnyxEntry<Transaction>): string { | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
return transaction?.modifiedCreated ? transaction.modifiedCreated : transaction?.created || ''; | ||
} | ||
|
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.
NAB: Could we reuse it here
App/src/libs/TransactionUtils.ts
Line 467 in b12556b
const created = transaction?.modifiedCreated ? transaction.modifiedCreated : transaction?.created || ''; |
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.
+1
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.
TBH I think we should rename getCreatedDate
to getCreated
and the current getCreated
to getFormattedCreated
, but that's a NAB
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.
@mountiny Isn't this already there in my changes? Can you check line 471 in this file?
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 a few comments
src/components/Search.tsx
Outdated
@@ -122,6 +122,8 @@ function Search({query, policyIDs, sortBy, sortOrder}: SearchProps) { | |||
|
|||
const isSortingAllowed = sortableSearchTabs.includes(query); | |||
|
|||
const doesAtleastOneExpenseBelongToAPastYear = SearchUtils.doesAtleastOneExpenseBelongToAPastYear(searchResults?.data); |
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.
const doesAtleastOneExpenseBelongToAPastYear = SearchUtils.doesAtleastOneExpenseBelongToAPastYear(searchResults?.data); | |
const shouldShowYear = SearchUtils.shouldShowYear(searchResults?.data); |
src/components/Search.tsx
Outdated
@@ -122,6 +122,8 @@ function Search({query, policyIDs, sortBy, sortOrder}: SearchProps) { | |||
|
|||
const isSortingAllowed = sortableSearchTabs.includes(query); | |||
|
|||
const doesAtleastOneExpenseBelongToAPastYear = SearchUtils.doesAtleastOneExpenseBelongToAPastYear(searchResults?.data); |
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.
+1
src/libs/TransactionUtils.ts
Outdated
function getCreatedDate(transaction: OnyxEntry<Transaction>): string { | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
return transaction?.modifiedCreated ? transaction.modifiedCreated : transaction?.created || ''; | ||
} | ||
|
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.
+1
src/libs/TransactionUtils.ts
Outdated
function getCreatedDate(transaction: OnyxEntry<Transaction>): string { | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
return transaction?.modifiedCreated ? transaction.modifiedCreated : transaction?.created || ''; | ||
} | ||
|
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.
TBH I think we should rename getCreatedDate
to getCreated
and the current getCreated
to getFormattedCreated
, but that's a NAB
We also have conflicts now |
@ShridharGoel we have lint and ts errors 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.
One small commnet
code looks good now |
Reviewer Checklist
Screenshots/Videos |
@ShridharGoel Can you update the test steps please? |
Co-authored-by: Vit Horacek <36083550+mountiny@users.noreply.github.com>
Updated. |
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.
Thanks everyone!
✋ 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/mountiny in version: 1.4.84-0 🚀
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 1.4.84-3 🚀
|
Details
Show year as well in date column.
Fixed Issues
$ #43209
PROPOSAL: #43209 (comment)
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
MacOS: Desktop