-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Better Expense Report View] Expense Report Preview #58479
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
mountiny
merged 97 commits into
Expensify:main
from
software-mansion-labs:Guccio163/MoneyRequestReportPreview
Apr 1, 2025
Merged
Changes from 48 commits
Commits
Show all changes
97 commits
Select commit
Hold shift + click to select a range
7edff68
Carousel skeleton with wrapper for data retrieval
Guccio163 3899dc3
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 1fe85e8
commit before draft
Guccio163 2958145
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 6f7e998
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 251968c
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 c777eae
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 a69fc64
working carousel overflow
Guccio163 0bc0fca
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 87ec465
styling and mock data cleanup
Guccio163 c86e5ce
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 6f474e6
styling arrowComponent
Guccio163 da9fba7
styles cleanup, extracting types.ts
Guccio163 41f6ad6
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 0f27338
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 33f1550
Replace placeholder in story with TransactionPreview
JakubKorytko fb96c6f
eslint fixes
Guccio163 f3e43a9
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 0760812
MoneyRequestReportPreview behind beta flag
Guccio163 3ef1a8f
canUseAllBetas fix
Guccio163 ac86266
prettier
Guccio163 18af44d
ESlint fix
Guccio163 9383792
eslint fixes 2
Guccio163 d9ffde3
eslinf fixes 3
Guccio163 9240625
eslint fixes 4
Guccio163 9e15fb0
Insert MoneyRequestReportPreview to app
JakubKorytko dc87b00
Merge branch 'Guccio163/MoneyRequestReportPreview' into korytko/chain…
JakubKorytko d876cca
beta flag change
Guccio163 e1114e2
Add wrapperStyles to TransactionPreview
JakubKorytko 5f9ea66
Merge branch 'Guccio163/MoneyRequestReportPreview' of github.com:soft…
Guccio163 b5ca427
Merge branch 'korytko/chain-transaction-preview-with-carousel' of git…
Guccio163 7ab89f9
Chaining TransactionPreview
Guccio163 4f7e459
eslint fix import
Guccio163 b58941c
prettier
Guccio163 137b7eb
working arrow buttons
Guccio163 ecbc500
arrow styles fix
Guccio163 8117819
Do not update submodule
Guccio163 fb9f8e6
fix arrows logic
Guccio163 94292fe
Merge branch 'Guccio163/MoneyRequestReportPreview' into korytko/chain…
JakubKorytko b619000
Fix styling and story
JakubKorytko c57ce4d
Fix pagination & icon placement
JakubKorytko 018df3f
Add ReviewRequiredButton
JakubKorytko 7abb156
Merge branch 'main' into korytko/chain-transaction-preview-with-carousel
JakubKorytko d445076
left arrow bug fix
Guccio163 7ca7039
prettier run
Guccio163 555f7df
Add tests to MoneyRequestReportPreview
JakubKorytko e16909a
Merge branch 'Guccio163/MoneyRequestReportPreview' into korytko/chain…
JakubKorytko 001c314
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 13ac199
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 d06327c
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 a8579df
fix refs and code via ReportPreview
Guccio163 4b49222
renderItem fix
Guccio163 ee14f4a
conditional fix
Guccio163 7e09953
Update src/styles/index.ts
Guccio163 84a3125
Fix styling (again)
JakubKorytko beb2c39
github comments addressed
Guccio163 1cd0b74
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 42577b4
Update MoneyRequestReportPreview tests
JakubKorytko df47cb9
Minor style fixes
JakubKorytko 3155030
Merge branch 'Guccio163/MoneyRequestReportPreview' into korytko/chain…
JakubKorytko e6d91df
Update src/components/ReportActionItem/MoneyRequestReportPreview/Mone…
Guccio163 1a9b344
Update src/components/ReportActionItem/MoneyRequestReportPreview/Mone…
Guccio163 d88aa4e
Update src/components/ReportActionItem/MoneyRequestReportPreview/Mone…
Guccio163 14c8e7b
Update src/components/ReportActionItem/MoneyRequestReportPreview/Mone…
Guccio163 cd1973b
Pass TransactionID to TransactionPreview
JakubKorytko 4e12c20
Fix split-share rendering
JakubKorytko 4efd413
Fix code according to PR comments
JakubKorytko 3166661
Merge branch 'main' into Guccio163/MoneyRequestReportPreview
JakubKorytko f1f8224
Fix new issues mentioned in PR comments
JakubKorytko 97fd782
Add proper skeleton for TransactionPreview
JakubKorytko 864180a
Position ApproveOrSettled icon correctly
JakubKorytko 901cd73
Merge branch 'main' into Guccio163/MoneyRequestReportPreview
JakubKorytko a94df03
Fix padding in carousel on mobile devices
JakubKorytko 23be292
snapping with padding included fix
Guccio163 99c68db
prettier
Guccio163 2d17026
scaling mobile width styles
Guccio163 876c3d9
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 17628bf
padding horizontal 16 fix
Guccio163 19c7144
extract isWaitingForSubmissionFromCurrentUser
Guccio163 0d29400
Update src/components/ReportActionItem/MoneyRequestReportPreview/Mone…
Guccio163 2700068
review styles fix
Guccio163 6803c2f
Merge branch 'main' into Guccio163/MoneyRequestReportPreview
JakubKorytko e823cdc
Fix icon alignment in MoneyRequestReportPreview Text
JakubKorytko 0c99efd
translate review with amount
Guccio163 bc41f6f
Merge branch 'Guccio163/MoneyRequestReportPreview' of github.com:soft…
Guccio163 503c704
Fix test & eslint errors
JakubKorytko 247f0c4
review comments fixes
Guccio163 1b8015d
Merge branch 'Guccio163/MoneyRequestReportPreview' of github.com:soft…
Guccio163 4cfdf61
Fix font & margin in Carousel
JakubKorytko d645518
disabled button when on the end of list
Guccio163 d9d72ca
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 4bbde94
disabled arrow buttons styles
Guccio163 dc94f5f
tests fix
Guccio163 d7befcc
don't change Mobile-Expensify
Guccio163 46c2ba6
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 b74e7a9
+X visible and last dot reachable
Guccio163 248692d
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 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
666 changes: 666 additions & 0 deletions
666
...omponents/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
98 changes: 98 additions & 0 deletions
98
src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx
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 |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import React from 'react'; | ||
import type {ListRenderItem} from 'react-native'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import TransactionPreview from '@components/ReportActionItem/TransactionPreview'; | ||
import useDelegateUserDetails from '@hooks/useDelegateUserDetails'; | ||
import usePolicy from '@hooks/usePolicy'; | ||
import useReportWithTransactionsAndViolations from '@hooks/useReportWithTransactionsAndViolations'; | ||
import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
import useStyleUtils from '@hooks/useStyleUtils'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import useTransactionViolations from '@hooks/useTransactionViolations'; | ||
import {getIOUActionForReportID, isSplitBillAction as isSplitBillActionReportActionsUtils, isTrackExpenseAction as isTrackExpenseActionReportActionsUtils} from '@libs/ReportActionsUtils'; | ||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import type {Transaction} from '@src/types/onyx'; | ||
import MoneyRequestReportPreviewContent from './MoneyRequestReportPreviewContent'; | ||
import type {MoneyRequestReportPreviewProps} from './types'; | ||
|
||
function MoneyRequestReportPreview({ | ||
iouReportID, | ||
policyID, | ||
chatReportID, | ||
action, | ||
containerStyles, | ||
contextMenuAnchor, | ||
isHovered = false, | ||
isWhisper = false, | ||
checkIfContextMenuActive = () => {}, | ||
onPaymentOptionsShow, | ||
onPaymentOptionsHide, | ||
}: MoneyRequestReportPreviewProps) { | ||
const styles = useThemeStyles(); | ||
const StyleUtils = useStyleUtils(); | ||
const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`); | ||
const [invoiceReceiverPolicy] = useOnyx( | ||
`${ONYXKEYS.COLLECTION.POLICY}${chatReport?.invoiceReceiver && 'policyID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.policyID : CONST.DEFAULT_NUMBER_ID}`, | ||
); | ||
const [invoiceReceiverPersonalDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, { | ||
selector: (personalDetails) => | ||
personalDetails?.[chatReport?.invoiceReceiver && 'accountID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.accountID : CONST.DEFAULT_NUMBER_ID], | ||
}); | ||
const [iouReport, transactions, violations] = useReportWithTransactionsAndViolations(iouReportID); | ||
const policy = usePolicy(policyID); | ||
const lastTransaction = transactions?.at(0); | ||
const lastTransactionViolations = useTransactionViolations(lastTransaction?.transactionID); | ||
const {isDelegateAccessRestricted} = useDelegateUserDetails(); | ||
const isTrackExpenseAction = isTrackExpenseActionReportActionsUtils(action); | ||
const isSplitBillAction = isSplitBillActionReportActionsUtils(action); | ||
const style = StyleUtils.getMoneyRequestReportPreviewStyle(transactions.length, shouldUseNarrowLayout); | ||
|
||
const renderItem: ListRenderItem<Transaction> = ({item}) => ( | ||
<TransactionPreview | ||
chatReportID={chatReportID} | ||
action={getIOUActionForReportID(item.reportID, item.transactionID)} | ||
reportID={item.reportID} | ||
isBillSplit={isSplitBillAction} | ||
isTrackExpense={isTrackExpenseAction} | ||
contextMenuAnchor={contextMenuAnchor} | ||
isWhisper={isWhisper} | ||
isHovered={isHovered} | ||
iouReportID={iouReportID} | ||
onPreviewPressed={() => {}} | ||
wrapperStyles={style.transaction} | ||
containerStyles={[styles.h100, containerStyles]} | ||
/> | ||
); | ||
|
||
return ( | ||
<MoneyRequestReportPreviewContent | ||
containerStyles={[style.preview, containerStyles]} | ||
contextMenuAnchor={contextMenuAnchor} | ||
isHovered={isHovered} | ||
isWhisper={isWhisper} | ||
checkIfContextMenuActive={checkIfContextMenuActive} | ||
onPaymentOptionsShow={onPaymentOptionsShow} | ||
onPaymentOptionsHide={onPaymentOptionsHide} | ||
action={action} | ||
chatReportID={chatReportID} | ||
iouReportID={iouReportID} | ||
policyID={undefined} | ||
iouReport={iouReport} | ||
transactions={transactions} | ||
violations={violations} | ||
chatReport={chatReport} | ||
policy={policy} | ||
invoiceReceiverPersonalDetail={invoiceReceiverPersonalDetail} | ||
invoiceReceiverPolicy={invoiceReceiverPolicy} | ||
lastTransactionViolations={lastTransactionViolations} | ||
isDelegateAccessRestricted={isDelegateAccessRestricted} | ||
renderItem={renderItem} | ||
/> | ||
); | ||
} | ||
|
||
MoneyRequestReportPreview.displayName = 'MoneyRequestReportPreview'; | ||
|
||
export default MoneyRequestReportPreview; |
55 changes: 55 additions & 0 deletions
55
src/components/ReportActionItem/MoneyRequestReportPreview/types.ts
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import type {ListRenderItem, StyleProp, ViewStyle} from 'react-native'; | ||
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; | ||
import type {ContextMenuAnchor} from '@pages/home/report/ContextMenu/ReportActionContextMenu'; | ||
import type {PersonalDetails, Policy, Report, ReportAction, Transaction, TransactionViolation, TransactionViolations} from '@src/types/onyx'; | ||
|
||
type MoneyRequestReportPreviewProps = { | ||
/** The report's policyID, used for Onyx subscription */ | ||
policyID: string | undefined; | ||
|
||
/** All the data of the action */ | ||
action: ReportAction; | ||
|
||
/** The associated chatReport */ | ||
chatReportID: string | undefined; | ||
|
||
/** The active IOUReport, used for Onyx subscription */ | ||
iouReportID: string | undefined; | ||
|
||
/** Extra styles to pass to View wrapper */ | ||
containerStyles?: StyleProp<ViewStyle>; | ||
|
||
/** Popover context menu anchor, used for showing context menu */ | ||
contextMenuAnchor?: ContextMenuAnchor; | ||
|
||
/** Callback for updating context menu active state, used for showing context menu */ | ||
checkIfContextMenuActive?: () => void; | ||
|
||
/** Callback when the payment options popover is shown */ | ||
onPaymentOptionsShow?: () => void; | ||
|
||
/** Callback when the payment options popover is closed */ | ||
onPaymentOptionsHide?: () => void; | ||
|
||
/** Whether a message is a whisper */ | ||
isWhisper?: boolean; | ||
|
||
/** Whether the corresponding report action item is hovered */ | ||
isHovered?: boolean; | ||
}; | ||
|
||
type MoneyRequestReportPreviewContentOnyxProps = { | ||
chatReport: OnyxEntry<Report>; | ||
invoiceReceiverPolicy: OnyxEntry<Policy>; | ||
iouReport: OnyxEntry<Report>; | ||
transactions: Transaction[]; | ||
violations: OnyxCollection<TransactionViolation[]>; | ||
policy: OnyxEntry<Policy>; | ||
invoiceReceiverPersonalDetail: OnyxEntry<PersonalDetails>; | ||
lastTransactionViolations: TransactionViolations; | ||
isDelegateAccessRestricted: boolean; | ||
}; | ||
|
||
type MoneyRequestReportPreviewContentProps = MoneyRequestReportPreviewContentOnyxProps & MoneyRequestReportPreviewProps & {renderItem: ListRenderItem<Transaction> | null | undefined}; | ||
|
||
export type {MoneyRequestReportPreviewContentProps, MoneyRequestReportPreviewProps}; |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.