|
1 | 1 | import React from 'react'; |
2 | | -import BookTravelButton from '@components/BookTravelButton'; |
3 | | -import type {FeatureListItem} from '@components/FeatureList'; |
4 | | -import FeatureList from '@components/FeatureList'; |
5 | | -import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset'; |
| 2 | +import MenuItem from '@components/MenuItem'; |
| 3 | +import Section from '@components/Section'; |
| 4 | +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; |
6 | 5 | import useLocalize from '@hooks/useLocalize'; |
| 6 | +import usePermissions from '@hooks/usePermissions'; |
7 | 7 | import useThemeStyles from '@hooks/useThemeStyles'; |
8 | | -import colors from '@styles/theme/colors'; |
| 8 | +import {openTravelDotLink} from '@libs/openTravelDotLink'; |
| 9 | +import CONST from '@src/CONST'; |
| 10 | +import WorkspaceTravelInvoicingSection from './WorkspaceTravelInvoicingSection'; |
9 | 11 |
|
10 | 12 | type GetStartedTravelProps = { |
11 | 13 | policyID: string; |
12 | 14 | }; |
13 | 15 |
|
14 | 16 | function GetStartedTravel({policyID}: GetStartedTravelProps) { |
15 | | - const handleCtaPress = () => {}; |
16 | | - |
17 | 17 | const {translate} = useLocalize(); |
18 | 18 | const styles = useThemeStyles(); |
| 19 | + const icons = useMemoizedLazyExpensifyIcons(['LuggageWithLines', 'NewWindow'] as const); |
| 20 | + const {isBetaEnabled} = usePermissions(); |
| 21 | + const isTravelInvoicingEnabled = isBetaEnabled(CONST.BETAS.TRAVEL_INVOICING); |
| 22 | + const isPreventSpotnanaTravelEnabled = isBetaEnabled(CONST.BETAS.PREVENT_SPOTNANA_TRAVEL); |
19 | 23 |
|
20 | | - const illustrations = useMemoizedLazyIllustrations(['PiggyBank', 'TravelAlerts', 'EmptyStateTravel'] as const); |
| 24 | + const handleManageTravel = () => { |
| 25 | + // TODO: Show the prevention modal when the beta is enabled |
| 26 | + if (isPreventSpotnanaTravelEnabled) { |
| 27 | + return; |
| 28 | + } |
| 29 | + openTravelDotLink(policyID); |
| 30 | + }; |
21 | 31 |
|
22 | | - const tripsFeatures: FeatureListItem[] = [ |
23 | | - { |
24 | | - icon: illustrations.PiggyBank, |
25 | | - translationKey: 'travel.features.saveMoney', |
26 | | - }, |
27 | | - { |
28 | | - icon: illustrations.TravelAlerts, |
29 | | - translationKey: 'travel.features.alerts', |
30 | | - }, |
31 | | - ]; |
32 | 32 | return ( |
33 | | - <FeatureList |
34 | | - menuItems={tripsFeatures} |
35 | | - title={translate('workspace.moreFeatures.travel.bookOrManageYourTrip.title')} |
36 | | - subtitle={translate('workspace.moreFeatures.travel.bookOrManageYourTrip.subtitle')} |
37 | | - onCtaPress={handleCtaPress} |
38 | | - illustrationBackgroundColor={colors.blue600} |
39 | | - illustration={illustrations.EmptyStateTravel} |
40 | | - illustrationStyle={styles.travelCardIllustration} |
41 | | - illustrationContainerStyle={[styles.emptyStateCardIllustrationContainer, styles.justifyContentCenter]} |
42 | | - titleStyles={styles.textHeadlineH1} |
43 | | - footer={ |
44 | | - <BookTravelButton |
45 | | - text={translate('workspace.moreFeatures.travel.bookOrManageYourTrip.ctaText')} |
46 | | - activePolicyID={policyID} |
| 33 | + <> |
| 34 | + <Section |
| 35 | + title={translate('workspace.moreFeatures.travel.travelInvoicing.travelBookingSection.title')} |
| 36 | + subtitle={translate('workspace.moreFeatures.travel.travelInvoicing.travelBookingSection.subtitle')} |
| 37 | + titleStyles={[styles.accountSettingsSectionTitle]} |
| 38 | + subtitleMuted |
| 39 | + isCentralPane |
| 40 | + > |
| 41 | + <MenuItem |
| 42 | + title={translate('workspace.moreFeatures.travel.bookOrManageYourTrip.ctaText')} |
| 43 | + icon={icons.LuggageWithLines} |
| 44 | + onPress={handleManageTravel} |
| 45 | + shouldShowRightIcon |
| 46 | + iconRight={icons.NewWindow} |
| 47 | + wrapperStyle={[styles.sectionMenuItemTopDescription, styles.mt3]} |
47 | 48 | /> |
48 | | - } |
49 | | - /> |
| 49 | + </Section> |
| 50 | + {isTravelInvoicingEnabled && <WorkspaceTravelInvoicingSection policyID={policyID} />} |
| 51 | + </> |
50 | 52 | ); |
51 | 53 | } |
52 | 54 |
|
|
0 commit comments