-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Test Drive][Phase 1][FE] Show the Test Drive modal during onboarding and via task #60085
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
danieldoglas
merged 33 commits into
Expensify:main
from
callstack-internal:pac-guerreiro/feature/show-test-drive-modal-during-onboarding
Apr 24, 2025
Merged
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
c587096
feat(testdrive): show test drive modal after onboarding
pac-guerreiro 8604e26
feat(testdrive): replace self guided tour task with test drive
pac-guerreiro be7cfcb
feat(testdrive): implement test drive embedded ui
pac-guerreiro 8c0fc1b
Merge branch 'pac-guerreiro/feature/test-drive-admin-modal' into pac-…
pac-guerreiro 26c9e2a
Merge branch 'pac-guerreiro/feature/show-test-drive-modal-during-onbo…
pac-guerreiro a719d8b
fix(testdrive): test drive modal not shown after onboarding on mobile…
pac-guerreiro 941843e
chore(testdrive): update tests
pac-guerreiro caef117
Merge branch 'pac-guerreiro/feature/test-drive-admin-modal' into pac-…
pac-guerreiro 4c4328e
chore(testdrive): fix broken test
pac-guerreiro 8ba7ae9
Merge branch 'pac-guerreiro/feature/show-test-drive-modal-during-onbo…
pac-guerreiro 60af31b
Merge branch 'main' into pac-guerreiro/feature/show-test-drive-modal-…
pac-guerreiro fa72f5d
Merge branch 'pac-guerreiro/feature/show-test-drive-modal-during-onbo…
pac-guerreiro 431ff3f
chore: fix eslint issues
pac-guerreiro 44037e0
Merge branch 'pac-guerreiro/feature/implement-test-drive-embedded-ui'…
pac-guerreiro 75536c8
Merge branch 'main' into pac-guerreiro/feature/show-test-drive-modal-…
pac-guerreiro dad1cef
chore(testdrive): apply suggestions
pac-guerreiro 31294a5
chore(testdrive): add unit tests
pac-guerreiro ff881e5
Merge branch 'main' into pac-guerreiro/feature/show-test-drive-modal-…
pac-guerreiro b169f13
chore(testdrive): apply linter
pac-guerreiro 72fad8f
chore: fix broken test
pac-guerreiro 7960bf1
Merge branch 'main' into pac-guerreiro/feature/show-test-drive-modal-…
pac-guerreiro f6c578e
refactor(testdrive): apply suggestions
pac-guerreiro dd5dcee
Merge branch 'main' into pac-guerreiro/feature/show-test-drive-modal-…
pac-guerreiro 80d84b1
fix(testdrive): demo banner overlapped by desktop header
pac-guerreiro 86dde22
fix(testdrive): task not getting completed
pac-guerreiro 9c35f21
Merge branch 'main' into pac-guerreiro/feature/show-test-drive-modal-…
pac-guerreiro 30d7d5b
fix(testdrive): demo modal not showing
pac-guerreiro da7a4e5
refactor: apply prettier
pac-guerreiro 5fecc4b
refactor(testdrive): apply suggestion
pac-guerreiro 4e388ef
refactor: remove unused imports
pac-guerreiro 56ea4e6
refactor(testdrive): parse task name markdown to html to replicate re…
pac-guerreiro f3dd308
Merge branch 'main' into pac-guerreiro/feature/show-test-drive-modal-…
pac-guerreiro ad39571
Merge branch 'main' into pac-guerreiro/feature/show-test-drive-modal-…
pac-guerreiro 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,23 @@ | ||
import React from 'react'; | ||
import WebView from 'react-native-webview'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import CONST from '@src/CONST'; | ||
import type EmbeddedDemoProps from './types'; | ||
|
||
function EmbeddedDemo({url, webViewProps}: EmbeddedDemoProps) { | ||
const styles = useThemeStyles(); | ||
|
||
return ( | ||
<WebView | ||
source={{uri: url}} | ||
originWhitelist={CONST.TEST_DRIVE.EMBEDDED_DEMO_WHITELIST} | ||
style={styles.flex1} | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...webViewProps} | ||
/> | ||
); | ||
} | ||
|
||
EmbeddedDemo.displayName = 'EmbeddedDemo'; | ||
|
||
export default EmbeddedDemo; |
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,21 @@ | ||
import React from 'react'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import type EmbeddedDemoProps from './types'; | ||
|
||
function EmbeddedDemo({url, iframeTitle, iframeProps}: EmbeddedDemoProps) { | ||
const styles = useThemeStyles(); | ||
|
||
return ( | ||
<iframe | ||
title={iframeTitle} | ||
src={url} | ||
style={styles.embeddedDemoIframe} | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...iframeProps} | ||
/> | ||
); | ||
} | ||
|
||
EmbeddedDemo.displayName = 'EmbeddedDemo'; | ||
|
||
export default EmbeddedDemo; |
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,18 @@ | ||
import type {DetailedHTMLProps, IframeHTMLAttributes} from 'react'; | ||
import type {WebViewProps} from 'react-native-webview'; | ||
|
||
type EmbeddedDemoProps = { | ||
/** Embedded demo URL */ | ||
url: string; | ||
|
||
/** **(web/desktop)** Description for screenreaders */ | ||
iframeTitle?: string; | ||
|
||
/** **(web/desktop)** Additional iframe props */ | ||
iframeProps?: DetailedHTMLProps<IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement> & Record<string, unknown>; | ||
|
||
/** **(native)** Additional WebView props */ | ||
webViewProps?: WebViewProps; | ||
}; | ||
|
||
export default EmbeddedDemoProps; |
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,42 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import Button from '@components/Button'; | ||
import HeaderGap from '@components/HeaderGap'; | ||
import Text from '@components/Text'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
|
||
type TestDriveBannerProps = { | ||
/** Callback to finish the test drive */ | ||
onPress: () => void; | ||
pac-guerreiro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
function TestDriveBanner({onPress}: TestDriveBannerProps) { | ||
const styles = useThemeStyles(); | ||
const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
const {translate} = useLocalize(); | ||
|
||
return ( | ||
<View style={styles.highlightBG}> | ||
<HeaderGap styles={styles.testDriveBannerGap} /> | ||
<View style={[styles.gap2, styles.alignItemsCenter, styles.flexRow, styles.justifyContentCenter, styles.h10]}> | ||
<Text> | ||
{shouldUseNarrowLayout | ||
? translate('testDrive.banner.currentlyTestDrivingExpensify') | ||
: `${translate('testDrive.banner.currentlyTestDrivingExpensify')}. ${translate('testDrive.banner.readyForTheRealThing')}`} | ||
</Text> | ||
<Button | ||
text={translate('testDrive.banner.getStarted')} | ||
small | ||
success | ||
onPress={onPress} | ||
/> | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
TestDriveBanner.displayName = 'TestDriveBanner'; | ||
|
||
export default TestDriveBanner; |
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,61 @@ | ||
import React, {useCallback, useEffect, useState} from 'react'; | ||
import {InteractionManager} from 'react-native'; | ||
import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; | ||
import EmbeddedDemo from '@components/EmbeddedDemo'; | ||
import Modal from '@components/Modal'; | ||
import SafeAreaConsumer from '@components/SafeAreaConsumer'; | ||
import useEnvironment from '@hooks/useEnvironment'; | ||
import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import {completeTestDriveTask} from '@libs/actions/Task'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import {getTestDriveURL} from '@libs/TourUtils'; | ||
import CONST from '@src/CONST'; | ||
import TestDriveBanner from './TestDriveBanner'; | ||
|
||
function TestDriveDemo() { | ||
const {environment} = useEnvironment(); | ||
const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
const [isVisible, setIsVisible] = useState(false); | ||
const styles = useThemeStyles(); | ||
|
||
useEffect(() => { | ||
InteractionManager.runAfterInteractions(() => { | ||
setIsVisible(true); | ||
completeTestDriveTask(); | ||
}); | ||
}, []); | ||
|
||
const closeModal = useCallback(() => { | ||
setIsVisible(false); | ||
pac-guerreiro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
InteractionManager.runAfterInteractions(() => { | ||
Navigation.goBack(); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<SafeAreaConsumer> | ||
{({paddingTop, paddingBottom}) => ( | ||
<Modal | ||
isVisible={isVisible} | ||
onClose={closeModal} | ||
type={CONST.MODAL.MODAL_TYPE.FULLSCREEN} | ||
style={styles.backgroundWhite} | ||
innerContainerStyle={{...styles.flex1, marginTop: paddingTop, marginBottom: paddingBottom}} | ||
> | ||
<TestDriveBanner onPress={closeModal} /> | ||
<FullPageOfflineBlockingView> | ||
<EmbeddedDemo | ||
url={getTestDriveURL(environment, shouldUseNarrowLayout)} | ||
iframeTitle={CONST.TEST_DRIVE.EMBEDDED_DEMO_IFRAME_TITLE} | ||
/> | ||
</FullPageOfflineBlockingView> | ||
</Modal> | ||
)} | ||
</SafeAreaConsumer> | ||
); | ||
} | ||
|
||
TestDriveDemo.displayName = 'TestDriveDemo'; | ||
|
||
export default TestDriveDemo; |
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
29 changes: 29 additions & 0 deletions
29
src/libs/Navigation/AppNavigator/TestDriveDemoNavigator.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,29 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import NoDropZone from '@components/DragAndDrop/NoDropZone'; | ||
import TestDriveDemo from '@components/TestDrive/TestDriveDemo'; | ||
import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; | ||
import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; | ||
import type {TestDriveDemoNavigatorParamList} from '@libs/Navigation/types'; | ||
import SCREENS from '@src/SCREENS'; | ||
|
||
const Stack = createPlatformStackNavigator<TestDriveDemoNavigatorParamList>(); | ||
|
||
function TestDriveDemoNavigator() { | ||
return ( | ||
<NoDropZone> | ||
<View> | ||
<Stack.Navigator screenOptions={{headerShown: false, animation: Animations.SLIDE_FROM_RIGHT}}> | ||
<Stack.Screen | ||
name={SCREENS.TEST_DRIVE_DEMO.ROOT} | ||
component={TestDriveDemo} | ||
/> | ||
</Stack.Navigator> | ||
</View> | ||
</NoDropZone> | ||
); | ||
} | ||
|
||
TestDriveDemoNavigator.displayName = 'TestDriveDemoNavigator'; | ||
|
||
export default TestDriveDemoNavigator; |
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.