Repository navigation
Transactions - Update Generic Receipts to use ReceiptBackground #34843
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
dangrous
merged 80 commits into
Expensify:main
from
FitseTLT:fix-update-to-use-of-ReceiptBackground
Mar 26, 2024
Merged
Changes from all commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
d99d92d
implemented receipt image component
FitseTLT a1f5f69
pass receipt name for non modal display
FitseTLT 7dfd885
minor fix
FitseTLT e9c7666
changed implementation
FitseTLT e88e1ce
fix styling
FitseTLT 26fa66b
fix borderRadius
FitseTLT d4abf53
type fix
FitseTLT 63b41f6
minor fix
FitseTLT 404fd8c
passed transaction prop
FitseTLT d6c274e
resolved conflict
FitseTLT 9d38d93
updated attachement modal to consider thumnail display
FitseTLT 796c340
minor fix
FitseTLT e9e2161
minor revert
FitseTLT dc760ca
small fix
FitseTLT 7e1fd22
fix on thumbnail display logic
FitseTLT 9a94024
minor type fix
FitseTLT 0cfb3cb
Added file type label support for eThumbnail
FitseTLT c059ed1
pass transactionID for confirmation
FitseTLT 7008a5d
minor fix
FitseTLT 6a05c03
fix unnecessary condition
FitseTLT 3f019a5
update to static icon layout
FitseTLT 7b55b72
resolved conflicts
FitseTLT 6d7481c
changed to isStaticIconLayout
FitseTLT e61a6c7
typescript fix
FitseTLT afbb639
set label text black
FitseTLT 7310663
removed inline styles
FitseTLT 21b5f5e
fix on comment
FitseTLT 73f6495
fixed pending waypoints thumbnail display
FitseTLT 10ff3ee
simplified condition
FitseTLT 1f1b3dc
changed to isReceiptThumbnail prop
FitseTLT 1fb6284
separated Ereceipt and thumbnail logic
FitseTLT 45238a6
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT bb10a48
resolve conflicts
FitseTLT 75ca883
minor lint fix
FitseTLT ee4d711
fix minor typescript issue
FitseTLT 63c88ec
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 5f07c39
fix type
FitseTLT 8f85721
fix based on comments
FitseTLT 7b14b86
fix type
FitseTLT 2a1ddf3
fix typescript
FitseTLT 660ac05
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 4b058fd
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 6dfc00b
minor change
FitseTLT 4a08601
pass iconSize prop
FitseTLT 60c0773
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 8a97cad
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT f721557
use fetching waypoint function
FitseTLT c31c4b4
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 0f157fc
fix type
FitseTLT 6db9480
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT c44b430
add fallbackIcon
FitseTLT 7025bfa
applied dynamic thumbnail icon size
FitseTLT 2b1c802
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 94174ba
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 9927c84
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 9eb1edd
use primary color for label text color
FitseTLT 04a5193
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT c90ce7e
add Pdf thumbnail
FitseTLT 9f38e25
updated to fixed color code depending on file extensions
FitseTLT 63dc6f6
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT e05df18
remove unnecessary condition
FitseTLT b6fd6f4
final refactor changes
FitseTLT 4d18121
minor fix
FitseTLT aa290ff
minor fix
FitseTLT b6a111a
minor
FitseTLT 8d38141
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 79a95ff
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 7c1cf62
fix typescript
FitseTLT 3fdef47
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 3a4760d
fix type
FitseTLT 02e8025
suppress eslint warning
FitseTLT d492e62
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT edd747f
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT c32c8fb
updated label font size and line heights
FitseTLT edf7677
type update
FitseTLT e3236a3
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 8a02896
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 1bd9230
made label unselectable
FitseTLT 3f2e1d3
fix lint
FitseTLT ab837e1
Merge branch 'main' into fix-update-to-use-of-ReceiptBackground
FitseTLT 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import type IconAsset from '@src/types/utils/IconAsset'; | ||
| import EReceiptThumbnail from './EReceiptThumbnail'; | ||
| import type {IconSize} from './EReceiptThumbnail'; | ||
| import Image from './Image'; | ||
| import PDFThumbnail from './PDFThumbnail'; | ||
| import ThumbnailImage from './ThumbnailImage'; | ||
|
|
||
| type Style = {height: number; borderRadius: number; margin: number}; | ||
|
|
||
| type ReceiptImageProps = ( | ||
| | { | ||
| /** Transaction ID of the transaction the receipt belongs to */ | ||
| transactionID: string; | ||
|
|
||
| /** Whether it is EReceipt */ | ||
| isEReceipt: boolean; | ||
|
|
||
| /** Whether it is receipt preview thumbnail we are displaying */ | ||
| isThumbnail?: boolean; | ||
|
|
||
| /** Url of the receipt image */ | ||
| source?: string; | ||
|
|
||
| /** Whether it is a pdf thumbnail we are displaying */ | ||
| isPDFThumbnail?: boolean; | ||
| } | ||
| | { | ||
| transactionID?: string; | ||
| isEReceipt?: boolean; | ||
| isThumbnail: boolean; | ||
| source?: string; | ||
| isPDFThumbnail?: boolean; | ||
| } | ||
| | { | ||
| transactionID?: string; | ||
| isEReceipt?: boolean; | ||
| isThumbnail?: boolean; | ||
| source: string; | ||
| isPDFThumbnail?: boolean; | ||
| } | ||
| | { | ||
| transactionID?: string; | ||
| isEReceipt?: boolean; | ||
| isThumbnail?: boolean; | ||
| source: string; | ||
| isPDFThumbnail: string; | ||
| } | ||
| ) & { | ||
| /** Whether we should display the receipt with ThumbnailImage component */ | ||
| shouldUseThumbnailImage?: boolean; | ||
|
|
||
| /** Whether the receipt image requires an authToken */ | ||
| isAuthTokenRequired?: boolean; | ||
|
|
||
| /** Any additional styles to apply */ | ||
| style?: Style; | ||
|
|
||
| /** The file extension of the receipt file */ | ||
| fileExtension?: string; | ||
|
|
||
| /** number of images displayed in the same parent container */ | ||
| iconSize?: IconSize; | ||
|
|
||
| /** If the image fails to load – show the provided fallback icon */ | ||
| fallbackIcon?: IconAsset; | ||
|
|
||
| /** The size of the fallback icon */ | ||
| fallbackIconSize?: number; | ||
| }; | ||
|
|
||
| function ReceiptImage({ | ||
| transactionID, | ||
| isPDFThumbnail = false, | ||
| isThumbnail = false, | ||
| shouldUseThumbnailImage = false, | ||
| isEReceipt = false, | ||
| source, | ||
| isAuthTokenRequired, | ||
| style, | ||
| fileExtension, | ||
| iconSize, | ||
| fallbackIcon, | ||
| fallbackIconSize, | ||
| }: ReceiptImageProps) { | ||
| const styles = useThemeStyles(); | ||
|
|
||
| if (isPDFThumbnail) { | ||
| return ( | ||
| <PDFThumbnail | ||
| previewSourceURL={source ?? ''} | ||
| style={[styles.w100, styles.h100]} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| if (isEReceipt || isThumbnail) { | ||
| const props = isThumbnail && {borderRadius: style?.borderRadius, fileExtension, isReceiptThumbnail: true}; | ||
| return ( | ||
| <View style={style ?? [styles.w100, styles.h100]}> | ||
| <EReceiptThumbnail | ||
| transactionID={transactionID ?? ''} | ||
| iconSize={iconSize} | ||
| // eslint-disable-next-line react/jsx-props-no-spreading | ||
| {...props} | ||
| /> | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| if (shouldUseThumbnailImage) { | ||
| return ( | ||
| <ThumbnailImage | ||
| previewSourceURL={source ?? ''} | ||
| style={[styles.w100, styles.h100]} | ||
| isAuthTokenRequired | ||
| shouldDynamicallyResize={false} | ||
| fallbackIcon={fallbackIcon} | ||
| fallbackIconSize={fallbackIconSize} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <Image | ||
| source={{uri: source}} | ||
| style={style ?? [styles.w100, styles.h100]} | ||
| isAuthTokenRequired={isAuthTokenRequired} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export type {ReceiptImageProps}; | ||
| export default ReceiptImage; |
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.
Uh oh!
There was an error while loading. Please reload this page.