Skip to content
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

[VIP-Travel] Create Trip Room Preview #38808

Merged
merged 67 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
1279f0f
Initial config for TripRoomPreview
WojtekBoman Mar 11, 2024
370d8a8
Add template of ReservationRow component
WojtekBoman Mar 12, 2024
102ffb8
Add car to ReservationType, add utility functions for trip transactions
WojtekBoman Mar 12, 2024
489720b
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Mar 19, 2024
5d16a01
Refactor TripRoomPreview styles
WojtekBoman Mar 19, 2024
7036238
Get reservations from trip transactions
WojtekBoman Mar 19, 2024
20caa2f
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Mar 21, 2024
b8b20ee
Handle showing context menu in TripRoomPreview
WojtekBoman Mar 21, 2024
a9c5370
Add OriginalMessageTripRoomPreview type
WojtekBoman Mar 21, 2024
b4b3730
Add type TripDetails
WojtekBoman Mar 21, 2024
71419d4
Add getFormattedDateRange method to DateUtils
WojtekBoman Mar 22, 2024
8b25ebc
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Mar 22, 2024
18c8503
Handle new reservation types, add ui fixes, add docs
WojtekBoman Mar 22, 2024
9eb79a2
Add canUseSpotnanaTravel
WojtekBoman Mar 22, 2024
56e19f7
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Mar 25, 2024
993f684
Add TripReservationUtils
WojtekBoman Mar 25, 2024
f88bec0
Use MenuItemWithTopDescription to display reservations
WojtekBoman Mar 25, 2024
3cbb84c
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Mar 26, 2024
c53d977
Remove luggage with lines icon
WojtekBoman Mar 26, 2024
f8d3f34
Adjust MenuItem to display titleComponent
WojtekBoman Mar 26, 2024
e8390c5
Use translateLocal in getFormattedDateRange
WojtekBoman Mar 26, 2024
6eef035
Add fixes to TripRoomPreview
WojtekBoman Mar 29, 2024
01a7e2d
Refactor getDisplayAmount in TripRoomPreview
WojtekBoman Mar 29, 2024
3a85f3d
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Mar 29, 2024
05a7613
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Apr 25, 2024
fd6418c
Add template of SpotnanaPayload type
WojtekBoman Apr 26, 2024
8219de2
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Apr 30, 2024
3262a35
Merge branch 'main' into travel/trip-room-preview
WojtekBoman May 29, 2024
5e1d9b9
Fix trip types
WojtekBoman May 29, 2024
658d003
Refactor TripRoomPreview
WojtekBoman May 29, 2024
1776dcc
Add docs and fix ts
WojtekBoman May 29, 2024
70204a0
Add comment to TripRoomPreview
WojtekBoman May 29, 2024
4720a06
Refactor displaying total amount in TripRoomPreview
WojtekBoman May 29, 2024
cc1a8e3
Refactor displaying total amount in TripRoomPreview
WojtekBoman May 29, 2024
d753bb4
Refactor tripReservationIconContainer style
WojtekBoman Jun 3, 2024
faeadcc
Remove textSupportingSmallSize style
WojtekBoman Jun 3, 2024
ca0b2e7
Remove styles.lh14
WojtekBoman Jun 3, 2024
bfc8b82
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 5, 2024
19ce931
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 5, 2024
af036c8
Fix trip translations
WojtekBoman Jun 5, 2024
545b1d8
Adjust TripRoomPreview
WojtekBoman Jun 5, 2024
24e9d8f
Remove train.svg
WojtekBoman Jun 5, 2024
ad04386
Cleanup CONST.ts
WojtekBoman Jun 5, 2024
deeb5c1
Refactor export order in Transaction.ts
WojtekBoman Jun 5, 2024
7ea02b9
Remove duplicated OriginalMessageDismissedViolation
WojtekBoman Jun 5, 2024
9cbffe5
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 6, 2024
9b12b07
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 7, 2024
bc12893
Replace withOnyx with useOnyx in TripRoomPreview
WojtekBoman Jun 7, 2024
cddd0ae
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 7, 2024
6c6078b
Remove textSupportingNormalSize style
WojtekBoman Jun 7, 2024
109530a
Remove tripReservationTitleGap style
WojtekBoman Jun 7, 2024
6b81aa4
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 10, 2024
2ca5697
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 11, 2024
9259a3a
Hide copy to clipboard option for trip preview
WojtekBoman Jun 11, 2024
26230ca
Add missing docs to Report.ts
WojtekBoman Jun 11, 2024
d5c0016
Remove shouldUseNarrowLayout && styles.flex1 from flight text in Trip…
WojtekBoman Jun 11, 2024
89ed40b
Fix lint in TripDetailsView
WojtekBoman Jun 11, 2024
7f88ab2
Revert style changes in TripDetailsView
WojtekBoman Jun 11, 2024
d723732
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 13, 2024
fad5159
Remove isWhisper prop from TripRoomPreview
WojtekBoman Jun 13, 2024
7e89f2d
Move tripReservationIconContainer to StyleUtils
WojtekBoman Jun 13, 2024
6ed35e5
Fix lint
WojtekBoman Jun 13, 2024
89c4d18
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 13, 2024
7118a42
Remove checking beta to display TripRoomPreview
WojtekBoman Jun 13, 2024
4b60448
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 14, 2024
42b5f3f
Add isTripPreview check in shouldReportActionBeVisible
WojtekBoman Jun 14, 2024
46f7bbe
Merge branch 'main' into travel/trip-room-preview
WojtekBoman Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/images/bed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/car-with-key.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/plane.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/train.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ const CONST = {
TRACK_EXPENSE: 'trackExpense',
P2P_DISTANCE_REQUESTS: 'p2pDistanceRequests',
WORKFLOWS_DELAYED_SUBMISSION: 'workflowsDelayedSubmission',
SPOTNANA_TRAVEL: 'spotnanaTravel',
ACCOUNTING: 'accounting',
},
BUTTON_STATES: {
Expand Down Expand Up @@ -613,6 +614,7 @@ const CONST = {
LIMIT: 50,
// OldDot Actions render getMessage from Web-Expensify/lib/Report/Action PHP files via getMessageOfOldDotReportAction in ReportActionsUtils.ts
TYPE: {
ACTION_TRIPPREVIEW: 'ACTION_TRIPPREVIEW',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB

Suggested change
ACTION_TRIPPREVIEW: 'ACTION_TRIPPREVIEW',
ACTION_TRIP_PREVIEW: 'ACTION_TRIP_PREVIEW',

Copy link
Contributor Author

@WojtekBoman WojtekBoman Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll adjust it once the backend is ready to be sure that this value is correct

ACTIONABLEMENTIONWHISPER: 'ACTIONABLEMENTIONWHISPER',
ADDCOMMENT: 'ADDCOMMENT',
ACTIONABLEJOINREQUEST: 'ACTIONABLEJOINREQUEST',
Expand Down Expand Up @@ -4127,6 +4129,14 @@ const CONST = {
SESSION_STORAGE_KEYS: {
INITIAL_URL: 'INITIAL_URL',
},

RESERVATION_TYPE: {
CAR: 'car',
HOTEL: 'hotel',
FLIGHT: 'flight',
RAIL: 'rail',
MISC: 'misc',
},
DEFAULT_TAX: {
defaultExternalID: 'id_TAX_EXEMPT',
defaultValue: '0%',
Expand Down
8 changes: 8 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import NotificationsAvatar from '@assets/images/avatars/notifications-avatar.svg
import ActiveRoomAvatar from '@assets/images/avatars/room.svg';
import BackArrow from '@assets/images/back-left.svg';
import Bank from '@assets/images/bank.svg';
import Bed from '@assets/images/bed.svg';
import Bell from '@assets/images/bell.svg';
import BellSlash from '@assets/images/bellSlash.svg';
import Bill from '@assets/images/bill.svg';
Expand All @@ -25,6 +26,7 @@ import Bug from '@assets/images/bug.svg';
import Building from '@assets/images/building.svg';
import Calendar from '@assets/images/calendar.svg';
import Camera from '@assets/images/camera.svg';
import CarWithKey from '@assets/images/car-with-key.svg';
import Car from '@assets/images/car.svg';
import CardsAndDomains from '@assets/images/cards-and-domains.svg';
import Cash from '@assets/images/cash.svg';
Expand Down Expand Up @@ -113,6 +115,7 @@ import Paycheck from '@assets/images/paycheck.svg';
import Pencil from '@assets/images/pencil.svg';
import Phone from '@assets/images/phone.svg';
import Pin from '@assets/images/pin.svg';
import Plane from '@assets/images/plane.svg';
import Play from '@assets/images/play.svg';
import Plus from '@assets/images/plus.svg';
import Printer from '@assets/images/printer.svg';
Expand Down Expand Up @@ -142,6 +145,7 @@ import Task from '@assets/images/task.svg';
import Tax from '@assets/images/tax.svg';
import ThreeDots from '@assets/images/three-dots.svg';
import ThumbsUp from '@assets/images/thumbs-up.svg';
import Train from '@assets/images/train.svg';
import Transfer from '@assets/images/transfer.svg';
import Trashcan from '@assets/images/trashcan.svg';
import Unlock from '@assets/images/unlock.svg';
Expand Down Expand Up @@ -315,5 +319,9 @@ export {
ChatBubbleUnread,
ChatBubbleReply,
Lightbulb,
Plane,
Bed,
CarWithKey,
DocumentPlus,
Train,
};
13 changes: 11 additions & 2 deletions src/components/MenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import type {ImageContentFit} from 'expo-image';
import type {ForwardedRef, ReactNode} from 'react';
import type {ForwardedRef, ReactElement, ReactNode} from 'react';
import React, {forwardRef, useContext, useEffect, useMemo, useRef, useState} from 'react';
import type {GestureResponderEvent, StyleProp, TextStyle, ViewStyle} from 'react-native';
import {View} from 'react-native';
Expand Down Expand Up @@ -163,6 +163,12 @@ type MenuItemBaseProps = {
/** Text to display for the item */
title?: string;

/** Component to display as the title */
titleComponent?: ReactElement;

/** Any additional styles to apply to the container for title components */
titleContainerStyle?: StyleProp<ViewStyle>;

/** A right-aligned subtitle for this menu option */
subtitle?: string | number;

Expand Down Expand Up @@ -287,6 +293,8 @@ function MenuItem(
focused = false,
disabled = false,
title,
titleComponent,
titleContainerStyle,
subtitle,
shouldShowBasicTitle,
label,
Expand Down Expand Up @@ -524,7 +532,7 @@ function MenuItem(
/>
</View>
)}
<View style={[styles.justifyContentCenter, styles.flex1, StyleUtils.getMenuItemTextContainerStyle(isSmallAvatarSubscriptMenu)]}>
<View style={[styles.justifyContentCenter, styles.flex1, StyleUtils.getMenuItemTextContainerStyle(isSmallAvatarSubscriptMenu), titleContainerStyle]}>
{!!description && shouldShowDescriptionOnTop && (
<Text
style={descriptionTextStyles}
Expand Down Expand Up @@ -588,6 +596,7 @@ function MenuItem(
</Text>
</View>
)}
{titleComponent}
</View>
</View>
</View>
Expand Down
16 changes: 16 additions & 0 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ import type {Policy, Report, ReportAction, Transaction, TransactionViolations, U
import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage';
import ReportActionItemImages from './ReportActionItemImages';

// @TODO: Used for testing purposes only. Uncomment to test. Remove when real data is available for testing.
// import TripRoomPreview from './TripRoomPreview';

type ReportPreviewOnyxProps = {
/** The policy tied to the money request report */
policy: OnyxEntry<Policy>;
Expand Down Expand Up @@ -104,6 +107,19 @@ function ReportPreview({
const {translate} = useLocalize();
const {canUseViolations} = usePermissions();

// @TODO: Used for testing purposes only. Uncomment to test. Remove when real data is available for testing.
// return (
// <TripRoomPreview
// action={action}
// iouReportID={iouReportID}
// chatReportID={chatReportID}
// isHovered={isHovered}
// isWhisper={isWhisper}
// checkIfContextMenuActive={checkIfContextMenuActive}
// containerStyles={containerStyles}
// />
// );

const {hasMissingSmartscanFields, areAllRequestsBeingSmartScanned, hasOnlyTransactionsWithPendingRoutes, hasNonReimbursableTransactions} = useMemo(
() => ({
hasMissingSmartscanFields: ReportUtils.hasMissingSmartscanFields(iouReportID),
Expand Down
Loading
Loading