Repository navigation
104405 trips table #104562
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
Merged
104405 trips table #104562
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
36367f0
Add Trips table to Spend behind the TravelApproval beta
suneox 2ee46cb
Keep trip rows out of Search selection and fix lint
suneox d1d46c3
Address review: trip sort keys, drop casts and manual memoization
suneox 7442c4c
Merge remote-tracking branch 'upstream/main' into 104405-trips-table
suneox d6e441a
fix typecheck
suneox a24dcb4
Merge branch 'main' into 104405-trips-table
suneox 055bb2b
Explain why trip rows use the expense report header layout
suneox 9a984ba
Keep trip rooms on Search refreshes and in-flight re-fires, and allow…
suneox 1dd7281
Merge branch 'main' into 104405-trips-table
suneox 8869a4d
fix typecheck
suneox 1fa8051
Merge branch 'main' into 104405-trips-table
suneox ac58178
Merge branch 'main' into 104405-trips-table
suneox 4db74e4
Merge remote-tracking branch 'upstream/main' into 104405-trips-table
suneox 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
70 changes: 70 additions & 0 deletions
70
src/components/Search/SearchList/ListItem/TripListItem.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,70 @@ | ||
| import useIsSearchRowFocused from '@components/Search/hooks/useIsSearchRowFocused'; | ||
| import ListItemComposed from '@components/SelectionList/ListItemComposed'; | ||
|
|
||
| import useLayoutSpacing from '@hooks/useLayoutSpacing'; | ||
| import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
| import useStyleUtils from '@hooks/useStyleUtils'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
|
|
||
| import variables from '@styles/variables'; | ||
|
|
||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
|
|
||
| import type {TripListItemProps} from './types'; | ||
|
|
||
| import TripListItemRow from './TripListItemRow'; | ||
|
|
||
| /** | ||
| * A trip row in search results. Tapping the row or its View action opens the trip room. | ||
| */ | ||
| function TripListItem({item, columns = [], showTooltip, isDisabled, onSelectRow, onFocus, shouldSyncFocus, isLastItem}: TripListItemProps) { | ||
| const styles = useThemeStyles(); | ||
| const isFocused = useIsSearchRowFocused(item.keyForList); | ||
| const StyleUtils = useStyleUtils(); | ||
| const {pageGutterMargin} = useLayoutSpacing(); | ||
| const {isLargeScreenWidth} = useResponsiveLayout(); | ||
|
|
||
| const listItemPressableStyle = [ | ||
| styles.selectionListPressableItemWrapper, | ||
| styles.pv3, | ||
| styles.ph3, | ||
| // Background is applied on the parent wrapper, so keep this transparent | ||
| styles.bgTransparent, | ||
| styles.mh0, | ||
| isLargeScreenWidth && StyleUtils.getSearchTableRowPressableStyle(!!isLastItem, false, {vertical: variables.tableRowPaddingVertical}), | ||
| ]; | ||
|
|
||
| return ( | ||
| <ListItemComposed | ||
| item={item} | ||
| shouldAllowTextSelection | ||
| pressableStyle={listItemPressableStyle} | ||
| containerStyle={!isLargeScreenWidth && styles.mb2} | ||
| isFocused={isFocused} | ||
| isDisabled={isDisabled} | ||
| shouldShowTooltip={showTooltip} | ||
| canSelectMultiple={false} | ||
| onSelectRow={onSelectRow} | ||
| onFocus={onFocus} | ||
| shouldSyncFocus={shouldSyncFocus} | ||
| pressableWrapperStyle={[ | ||
| pageGutterMargin, | ||
| StyleUtils.getSearchRowBackgroundStyle(false), | ||
| !isLargeScreenWidth && styles.br2, | ||
| isLargeScreenWidth && isLastItem && [styles.tableBottomRadius, styles.overflowHidden], | ||
| ]} | ||
| > | ||
| <View style={[styles.flex1, styles.userSelectNone]}> | ||
| <TripListItemRow | ||
| item={item} | ||
| columns={columns} | ||
| showTooltip={!!showTooltip} | ||
| onViewPress={() => onSelectRow(item)} | ||
| /> | ||
| </View> | ||
| </ListItemComposed> | ||
| ); | ||
| } | ||
|
|
||
| export default TripListItem; |
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.