-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[CP Staging] Improve 'Split by date' to the split expense table for new splits #78027
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
Merged
lakchote
merged 8 commits into
Expensify:main
from
ZhenjaHorbach:improve-date-tabs-for-splits
Dec 19, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f843b5f
Fix few issues
ZhenjaHorbach f24a9f2
Fix some issues
ZhenjaHorbach 0ad761d
Revert some changes
ZhenjaHorbach 911f817
Update route for spli_create_date_range
ZhenjaHorbach 1449c7d
Fix issue with double navigation
ZhenjaHorbach 27386ce
Fix conflicts
ZhenjaHorbach ff38fc6
Remove SPLIT_SELECTED_TAB
ZhenjaHorbach 751b5f6
Fix ts issues
ZhenjaHorbach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,7 +71,7 @@ function SplitExpensePage({route}: SplitExpensePageProps) { | |
|
|
||
| const searchContext = useSearchContext(); | ||
|
|
||
| const [selectedTab] = useOnyx(`${ONYXKEYS.COLLECTION.SPLIT_SELECTED_TAB}${CONST.TAB.SPLIT_EXPENSE_TAB_TYPE}`, {canBeMissing: true}); | ||
| const [selectedTab] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.SPLIT_EXPENSE_TAB_TYPE}`, {canBeMissing: true}); | ||
| const [draftTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transactionID}`, {canBeMissing: false}); | ||
| const transactionReport = getReportOrDraftReport(draftTransaction?.reportID); | ||
| const parentTransactionReport = getReportOrDraftReport(transactionReport?.parentReportID); | ||
|
|
@@ -111,8 +111,8 @@ function SplitExpensePage({route}: SplitExpensePageProps) { | |
| const iouActions = getIOUActionForTransactions([originalTransactionID], expenseReport?.reportID); | ||
| const {iouReport} = useGetIOUReportFromReportAction(iouActions.at(0)); | ||
|
|
||
| const isPercentageMode = selectedTab === CONST.IOU.SPLIT_TYPE.PERCENTAGE; | ||
| const isDateMode = selectedTab === CONST.IOU.SPLIT_TYPE.DATE; | ||
| const isPercentageMode = (selectedTab as string) === CONST.TAB.SPLIT.PERCENTAGE; | ||
| const isDateMode = (selectedTab as string) === CONST.TAB.SPLIT.DATE; | ||
| const childTransactions = useMemo(() => getChildTransactions(allTransactions, allReports, transactionID), [allReports, allTransactions, transactionID]); | ||
| const splitFieldDataFromChildTransactions = useMemo(() => childTransactions.map((currentTransaction) => initSplitExpenseItemData(currentTransaction)), [childTransactions]); | ||
| const splitFieldDataFromOriginalTransaction = useMemo(() => initSplitExpenseItemData(transaction), [transaction]); | ||
|
|
@@ -242,8 +242,8 @@ function SplitExpensePage({route}: SplitExpensePageProps) { | |
| ]); | ||
|
|
||
| const onSplitExpenseValueChange = useCallback( | ||
| (id: string, value: number, mode: ValueOf<typeof CONST.IOU.SPLIT_TYPE>) => { | ||
| if (mode === CONST.IOU.SPLIT_TYPE.AMOUNT || mode === CONST.IOU.SPLIT_TYPE.DATE) { | ||
| (id: string, value: number, mode: ValueOf<typeof CONST.TAB.SPLIT>) => { | ||
| if (mode === CONST.TAB.SPLIT.AMOUNT || mode === CONST.TAB.SPLIT.DATE) { | ||
| const amountInCents = convertToBackendAmount(value); | ||
| updateSplitExpenseAmountField(draftTransaction, id, amountInCents); | ||
| } else { | ||
|
|
@@ -301,7 +301,7 @@ function SplitExpensePage({route}: SplitExpensePageProps) { | |
| currency: draftTransaction?.currency ?? CONST.CURRENCY.USD, | ||
| transactionID: item?.transactionID ?? CONST.IOU.OPTIMISTIC_TRANSACTION_ID, | ||
| currencySymbol, | ||
| mode: CONST.IOU.SPLIT_TYPE.AMOUNT, | ||
| mode: CONST.TAB.SPLIT.AMOUNT, | ||
| percentage, | ||
| onSplitExpenseValueChange, | ||
| isSelected: splitExpenseTransactionID === item.transactionID, | ||
|
|
@@ -436,7 +436,7 @@ function SplitExpensePage({route}: SplitExpensePageProps) { | |
| ); | ||
|
|
||
| const headerTitle = useMemo(() => { | ||
| if (splitExpenseTransactionID) { | ||
| if (Number(splitExpenseTransactionID)) { | ||
| return translate('iou.editSplits'); | ||
| } | ||
| if (isPercentageMode) { | ||
|
|
@@ -485,10 +485,10 @@ function SplitExpensePage({route}: SplitExpensePageProps) { | |
| <View style={styles.flex1}> | ||
| <OnyxTabNavigator | ||
| id={CONST.TAB.SPLIT_EXPENSE_TAB_TYPE} | ||
| defaultSelectedTab={CONST.IOU.SPLIT_TYPE.AMOUNT} | ||
| defaultSelectedTab={CONST.TAB.SPLIT.AMOUNT} | ||
| tabBar={TabSelector} | ||
| > | ||
| <TopTab.Screen name={CONST.IOU.SPLIT_TYPE.AMOUNT}> | ||
| <TopTab.Screen name={CONST.TAB.SPLIT.AMOUNT}> | ||
| {() => ( | ||
| <TabScreenWithFocusTrapWrapper> | ||
| <View style={styles.flex1}> | ||
|
|
@@ -503,7 +503,7 @@ function SplitExpensePage({route}: SplitExpensePageProps) { | |
| </TabScreenWithFocusTrapWrapper> | ||
| )} | ||
| </TopTab.Screen> | ||
| <TopTab.Screen name={CONST.IOU.SPLIT_TYPE.PERCENTAGE}> | ||
| <TopTab.Screen name={CONST.TAB.SPLIT.PERCENTAGE}> | ||
| {() => ( | ||
| <TabScreenWithFocusTrapWrapper> | ||
| <View style={styles.flex1}> | ||
|
|
@@ -518,7 +518,7 @@ function SplitExpensePage({route}: SplitExpensePageProps) { | |
| </TabScreenWithFocusTrapWrapper> | ||
| )} | ||
| </TopTab.Screen> | ||
| <TopTab.Screen name={CONST.IOU.SPLIT_TYPE.DATE}> | ||
| <TopTab.Screen name={CONST.TAB.SPLIT.DATE}> | ||
| {() => ( | ||
| <TabScreenWithFocusTrapWrapper> | ||
| <View style={styles.flex1}> | ||
|
|
@@ -527,6 +527,7 @@ function SplitExpensePage({route}: SplitExpensePageProps) { | |
| sections={sections} | ||
| initiallyFocusedOptionKey={initiallyFocusedOptionKey ?? undefined} | ||
| onSelectRow={onSelectRow} | ||
| listFooterContent={<View style={[shouldUseNarrowLayout && styles.mb3]} />} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coming from #78844, we should use listFooterContent={listFooterContent} to make it consistent with other pages |
||
| /> | ||
| {footerContent} | ||
| </View> | ||
|
|
||
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
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.
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.
what is the use of backTo param here? it is not a good design.
Uh oh!
There was an error while loading. Please reload this page.
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.
Agree
But since it's hot fixes, and the navigation team from SWM and I haven't come up with a perfect fix yet
But for now, I think this fix will be enough
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.
did you discuss this already somewhere?
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.
For example here
https://expensify.slack.com/archives/C01GTK53T8Q/p1766113442493649
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.
And actually, this bug is also from the percentages PR
Because we had the same issue with edit split screen( not only with split date range)
Uh oh!
There was an error while loading. Please reload this page.
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. Looks approved. Can you please add a todo here for future refactor?