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

fix: Update Wallet and Generic Folder empty state to use lottie animations. #48040

Merged
merged 27 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c49cd8f
fix: Update Wallet and Generic Folder empty state to use lottie anima…
Krishna2323 Aug 27, 2024
8708b2e
fix IOURequestStepCategory empty state.
Krishna2323 Aug 27, 2024
795eb09
Merge branch 'Expensify:main' into krishna2323/issue/48013
Krishna2323 Aug 29, 2024
38a4e54
remove redundant code.
Krishna2323 Aug 29, 2024
6616c56
update GenericEmptyState.lottie file.
Krishna2323 Aug 29, 2024
168fb04
Merge branch 'Expensify:main' into krishna2323/issue/48013
Krishna2323 Sep 1, 2024
c1aef41
styling fixes.
Krishna2323 Sep 1, 2024
4741b8c
minor fix.
Krishna2323 Sep 4, 2024
624fe06
Merge branch 'main' into krishna2323/issue/48013
Krishna2323 Sep 4, 2024
d37d786
revert changes in IOURequestStepCategory.
Krishna2323 Sep 9, 2024
a1a507f
Merge branch 'Expensify:main' into krishna2323/issue/48013
Krishna2323 Sep 9, 2024
038c6e8
Merge branch 'Expensify:main' into krishna2323/issue/48013
Krishna2323 Sep 10, 2024
71003f4
update empty state illustration categories page.
Krishna2323 Sep 10, 2024
d8aa227
fix stylings on native.
Krishna2323 Sep 10, 2024
229b8e3
Merge branch 'Expensify:main' into krishna2323/issue/48013
Krishna2323 Sep 13, 2024
33dd33b
fix: empty folder animation size.
Krishna2323 Sep 13, 2024
5c13a44
fix alignments.
Krishna2323 Sep 13, 2024
36fb0b4
update lottie file.
Krishna2323 Sep 13, 2024
26bf428
Merge branch 'main' into krishna2323/issue/48013
Krishna2323 Sep 18, 2024
76e7cbb
align animation centre.
Krishna2323 Sep 18, 2024
b9f96d3
add minWidth for empty folder animation.
Krishna2323 Sep 18, 2024
46ca8c7
fix folder animation on other pages.
Krishna2323 Sep 18, 2024
975164b
fix animation width.
Krishna2323 Sep 19, 2024
857a8c5
Merge branch 'Expensify:main' into krishna2323/issue/48013
Krishna2323 Sep 19, 2024
7bf97fa
minor update.
Krishna2323 Sep 19, 2024
3dda855
fix animation width for native devices.
Krishna2323 Sep 19, 2024
115b2fc
minor changes & cleanup.
Krishna2323 Sep 19, 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
Binary file added assets/animations/BankVault.lottie
Binary file not shown.
Binary file added assets/animations/GenericEmptyState.lottie
Binary file not shown.
Binary file added assets/animations/TripsEmptyState.lottie
Binary file not shown.
8 changes: 6 additions & 2 deletions src/components/EmptyStateComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Lottie from '@components/Lottie';
import ScrollView from '@components/ScrollView';
import Text from '@components/Text';
import VideoPlayer from '@components/VideoPlayer';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import CONST from '@src/CONST';
import type {EmptyStateComponentProps, VideoLoadedEventType} from './types';
Expand All @@ -24,10 +25,12 @@ function EmptyStateComponent({
subtitle,
headerStyles,
headerContentStyles,
lottieWebViewStyles,
minModalHeight = 400,
}: EmptyStateComponentProps) {
const styles = useThemeStyles();
const [videoAspectRatio, setVideoAspectRatio] = useState(VIDEO_ASPECT_RATIO);
const {isSmallScreenWidth} = useResponsiveLayout();
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB because it seems like all the styles are right in the screen recordings, but I think we might be able to use shouldUseNarrowLayout here, and generally that should be the default go-to instead of isSmallScreenWidth


const setAspectRatio = (event: VideoReadyForDisplayEvent | VideoLoadedEventType | undefined) => {
if (!event) {
Expand Down Expand Up @@ -63,6 +66,7 @@ function EmptyStateComponent({
autoPlay
loop
style={headerContentStyles}
webStyle={lottieWebViewStyles}
/>
);
case CONST.EMPTY_STATE_MEDIA.ILLUSTRATION:
Expand All @@ -75,7 +79,7 @@ function EmptyStateComponent({
default:
return null;
}
}, [headerMedia, headerMediaType, headerContentStyles, videoAspectRatio, styles.emptyStateVideo]);
}, [headerMedia, headerMediaType, headerContentStyles, videoAspectRatio, styles.emptyStateVideo, lottieWebViewStyles]);

return (
<ScrollView contentContainerStyle={[styles.emptyStateScrollView, {minHeight: minModalHeight}, containerStyles]}>
Expand All @@ -88,7 +92,7 @@ function EmptyStateComponent({
<View style={styles.emptyStateForeground}>
<View style={styles.emptyStateContent}>
<View style={[styles.emptyStateHeader(headerMediaType === CONST.EMPTY_STATE_MEDIA.ILLUSTRATION), headerStyles]}>{HeaderComponent}</View>
<View style={styles.p8}>
<View style={isSmallScreenWidth ? styles.p5 : styles.p8}>
<Text style={[styles.textAlignCenter, styles.textHeadlineH1, styles.mb2]}>{title}</Text>
<Text style={[styles.textAlignCenter, styles.textSupporting, styles.textNormal]}>{subtitle}</Text>
{!!buttonText && !!buttonAction && (
Expand Down
1 change: 1 addition & 0 deletions src/components/EmptyStateComponent/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type SharedProps<T> = {
headerStyles?: StyleProp<ViewStyle>;
headerMediaType: T;
headerContentStyles?: StyleProp<ViewStyle & ImageStyle>;
lottieWebViewStyles?: React.CSSProperties | undefined;
minModalHeight?: number;
};

Expand Down
15 changes: 15 additions & 0 deletions src/components/LottieAnimations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ const DotLottieAnimations = {
w: 180,
h: 200,
},
GenericEmptyState: {
file: require<LottieViewProps['source']>('@assets/animations/GenericEmptyState.lottie'),
w: 375,
h: 240,
},
TripsEmptyState: {
file: require<LottieViewProps['source']>('@assets/animations/TripsEmptyState.lottie'),
w: 375,
h: 240,
},
BankVault: {
file: require<LottieViewProps['source']>('@assets/animations/BankVault.lottie'),
w: 375,
h: 240,
},
} satisfies Record<string, DotLottieAnimation>;

export default DotLottieAnimations;
25 changes: 13 additions & 12 deletions src/pages/Search/EmptySearchView.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, {useMemo} from 'react';
import EmptyStateComponent from '@components/EmptyStateComponent';
import * as Illustrations from '@components/Icon/Illustrations';
import LottieAnimations from '@components/LottieAnimations';
import SearchRowSkeleton from '@components/Skeletons/SearchRowSkeleton';
import useLocalize from '@hooks/useLocalize';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import type {SearchDataTypes} from '@src/types/onyx/SearchResults';
Expand All @@ -19,14 +19,14 @@ function EmptySearchView({type}: EmptySearchViewProps) {
const theme = useTheme();
const StyleUtils = useStyleUtils();
const {translate} = useLocalize();
const styles = useThemeStyles();

const content = useMemo(() => {
switch (type) {
case CONST.SEARCH.DATA_TYPES.TRIP:
return {
headerMedia: Illustrations.EmptyStateTravel,
headerStyles: StyleUtils.getBackgroundColorStyle(theme.travelBG),
headerContentStyles: StyleUtils.getWidthAndHeightStyle(variables.w191, variables.h172),
headerMedia: LottieAnimations.TripsEmptyState,
headerStyles: [StyleUtils.getBackgroundColorStyle(theme.travelBG), styles.w100],
title: translate('search.searchResults.emptyTripResults.title'),
subtitle: translate('search.searchResults.emptyTripResults.subtitle'),
buttonText: translate('search.searchResults.emptyTripResults.buttonText'),
Expand All @@ -37,28 +37,29 @@ function EmptySearchView({type}: EmptySearchViewProps) {
case CONST.SEARCH.DATA_TYPES.INVOICE:
default:
return {
headerMedia: Illustrations.EmptyState,
headerStyles: StyleUtils.getBackgroundColorStyle(theme.emptyFolderBG),
headerContentStyles: StyleUtils.getWidthAndHeightStyle(variables.w184, variables.h112),
headerMedia: LottieAnimations.GenericEmptyState,
headerStyles: [StyleUtils.getBackgroundColorStyle(theme.emptyFolderBG)],
title: translate('search.searchResults.emptyResults.title'),
subtitle: translate('search.searchResults.emptyResults.subtitle'),
buttonText: undefined,
buttonAction: undefined,
headerContentStyles: styles.emptyStateFolderWebStyles,
};
}
}, [type, StyleUtils, translate, theme]);
}, [type, StyleUtils, translate, theme, styles.w100, styles.emptyStateFolderWebStyles]);

return (
<EmptyStateComponent
SkeletonComponent={SearchRowSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ILLUSTRATION}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ANIMATION}
headerMedia={content.headerMedia}
headerStyles={content.headerStyles}
headerContentStyles={content.headerContentStyles}
headerStyles={[content.headerStyles, styles.emptyStateCardIllustrationContainer]}
title={content.title}
subtitle={content.subtitle}
buttonText={content.buttonText}
buttonAction={content.buttonAction}
headerContentStyles={[styles.h100, styles.w100, content.headerContentStyles]}
lottieWebViewStyles={styles.emptyStateFolderWebStyles}
/>
);
}
Expand Down
5 changes: 3 additions & 2 deletions src/pages/Travel/ManageTrips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {FeatureListItem} from '@components/FeatureList';
import FeatureList from '@components/FeatureList';
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import * as Illustrations from '@components/Icon/Illustrations';
import LottieAnimations from '@components/LottieAnimations';
import ScrollView from '@components/ScrollView';
import useLocalize from '@hooks/useLocalize';
import usePolicy from '@hooks/usePolicy';
Expand Down Expand Up @@ -82,8 +83,8 @@ function ManageTrips() {
});
}}
ctaErrorMessage={ctaErrorMessage}
illustration={Illustrations.EmptyStateTravel}
illustrationStyle={[styles.mv4, styles.tripIllustrationSize]}
illustration={LottieAnimations.TripsEmptyState}
illustrationStyle={[styles.mv4]}
secondaryButtonText={translate('travel.bookDemo')}
secondaryButtonAccessibilityLabel={translate('travel.bookDemo')}
onSecondaryButtonPress={navigateToBookTravelDemo}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/settings/Wallet/WalletPage/WalletPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import * as Expensicons from '@components/Icon/Expensicons';
import * as Illustrations from '@components/Icon/Illustrations';
import KYCWall from '@components/KYCWall';
import type {PaymentMethodType, Source} from '@components/KYCWall/types';
import LottieAnimations from '@components/LottieAnimations';
import MenuItem from '@components/MenuItem';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
Expand Down Expand Up @@ -381,7 +382,7 @@ function WalletPage({shouldListenForResize = false}: WalletPageProps) {
title={translate('walletPage.bankAccounts')}
isCentralPane
titleStyles={styles.accountSettingsSectionTitle}
illustration={Illustrations.BigVault}
illustration={LottieAnimations.BankVault}
illustrationStyle={styles.walletIllustration}
illustrationContainerStyle={{height: 220}}
illustrationBackgroundColor="#411103"
Expand Down
10 changes: 6 additions & 4 deletions src/pages/workspace/categories/WorkspaceCategoriesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import EmptyStateComponent from '@components/EmptyStateComponent';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Expensicons from '@components/Icon/Expensicons';
import * as Illustrations from '@components/Icon/Illustrations';
import LottieAnimations from '@components/LottieAnimations';
import ScreenWrapper from '@components/ScreenWrapper';
import ListItemRightCaretWithLabel from '@components/SelectionList/ListItemRightCaretWithLabel';
import TableListItem from '@components/SelectionList/TableListItem';
Expand Down Expand Up @@ -391,12 +392,13 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) {
{!hasVisibleCategories && !isLoading && (
<EmptyStateComponent
SkeletonComponent={TableListItemSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ILLUSTRATION}
headerMedia={Illustrations.EmptyState}
headerStyles={styles.emptyFolderBG}
headerContentStyles={styles.emptyStateFolderIconSize}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ANIMATION}
headerMedia={LottieAnimations.GenericEmptyState}
title={translate('workspace.categories.emptyCategories.title')}
subtitle={translate('workspace.categories.emptyCategories.subtitle')}
headerStyles={[styles.emptyStateCardIllustrationContainer, styles.emptyFolderBG]}
lottieWebViewStyles={styles.emptyStateFolderWebStyles}
headerContentStyles={styles.emptyStateFolderWebStyles}
/>
)}
{hasVisibleCategories && !isLoading && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ function ReportFieldsListValuesPage({
subtitle={translate('workspace.reportFields.emptyReportFieldsValues.subtitle')}
SkeletonComponent={TableListItemSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ILLUSTRATION}
headerMedia={Illustrations.EmptyStateExpenses}
headerStyles={styles.emptyFolderBG}
headerContentStyles={styles.emptyStateFolderIconSize}
headerMedia={Illustrations.FolderWithPapers}
headerStyles={styles.emptyFolderDarkBG}
headerContentStyles={styles.emptyStateFolderWithPaperIconSize}
/>
)}
{!shouldShowEmptyState && (
Expand Down
10 changes: 6 additions & 4 deletions src/pages/workspace/reportFields/WorkspaceReportFieldsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import EmptyStateComponent from '@components/EmptyStateComponent';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Expensicons from '@components/Icon/Expensicons';
import * as Illustrations from '@components/Icon/Illustrations';
import LottieAnimations from '@components/LottieAnimations';
import ScreenWrapper from '@components/ScreenWrapper';
import ListItemRightCaretWithLabel from '@components/SelectionList/ListItemRightCaretWithLabel';
import TableListItem from '@components/SelectionList/TableListItem';
Expand Down Expand Up @@ -289,10 +290,11 @@ function WorkspaceReportFieldsPage({
title={translate('workspace.reportFields.emptyReportFields.title')}
subtitle={translate('workspace.reportFields.emptyReportFields.subtitle')}
SkeletonComponent={TableListItemSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ILLUSTRATION}
headerMedia={Illustrations.EmptyStateExpenses}
headerStyles={styles.emptyFolderBG}
headerContentStyles={styles.emptyStateFolderIconSize}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ANIMATION}
headerMedia={LottieAnimations.GenericEmptyState}
headerStyles={[styles.emptyStateCardIllustrationContainer, styles.emptyFolderBG]}
lottieWebViewStyles={styles.emptyStateFolderWebStyles}
headerContentStyles={styles.emptyStateFolderWebStyles}
/>
)}
{!shouldShowEmptyState && !isLoading && (
Expand Down
10 changes: 6 additions & 4 deletions src/pages/workspace/tags/WorkspaceTagsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import EmptyStateComponent from '@components/EmptyStateComponent';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Expensicons from '@components/Icon/Expensicons';
import * as Illustrations from '@components/Icon/Illustrations';
import LottieAnimations from '@components/LottieAnimations';
import type {PopoverMenuItem} from '@components/PopoverMenu';
import ScreenWrapper from '@components/ScreenWrapper';
import ListItemRightCaretWithLabel from '@components/SelectionList/ListItemRightCaretWithLabel';
Expand Down Expand Up @@ -397,12 +398,13 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) {
{!hasVisibleTags && !isLoading && (
<EmptyStateComponent
SkeletonComponent={TableListItemSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ILLUSTRATION}
headerMedia={Illustrations.EmptyState}
headerStyles={styles.emptyFolderBG}
headerContentStyles={styles.emptyStateFolderIconSize}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ANIMATION}
headerMedia={LottieAnimations.GenericEmptyState}
title={translate('workspace.tags.emptyTags.title')}
subtitle={translate('workspace.tags.emptyTags.subtitle')}
headerStyles={[styles.emptyStateCardIllustrationContainer, styles.emptyFolderBG]}
lottieWebViewStyles={styles.emptyStateFolderWebStyles}
headerContentStyles={styles.emptyStateFolderWebStyles}
/>
)}
{hasVisibleTags && !isLoading && (
Expand Down
29 changes: 19 additions & 10 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4727,8 +4727,7 @@ const styles = (theme: ThemeColors) =>
},

walletIllustration: {
width: 262,
height: 152,
height: 180,
Copy link
Contributor

Choose a reason for hiding this comment

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

May I know why do you remove the width here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess the animation wasn't displayed correctly with the width, so I had to remove that.

},

walletCardLimit: {
Expand Down Expand Up @@ -5076,6 +5075,8 @@ const styles = (theme: ThemeColors) =>

emptyStateCardIllustrationContainer: {
height: 220,
...flex.alignItemsCenter,
...flex.justifyContentCenter,
},

emptyStateCardIllustration: {
Expand Down Expand Up @@ -5113,11 +5114,6 @@ const styles = (theme: ThemeColors) =>
textDecorationLine: 'line-through',
},

tripIllustrationSize: {
width: 190,
height: 172,
},

reportListItemTitle: {
color: theme.text,
fontSize: variables.fontSizeNormal,
Expand Down Expand Up @@ -5163,14 +5159,27 @@ const styles = (theme: ThemeColors) =>
backgroundColor: theme.emptyFolderBG,
},

emptyFolderDarkBG: {
backgroundColor: '#782c04',
height: 220,
},

emptyStateVideo: {
borderTopLeftRadius: variables.componentBorderRadiusLarge,
borderTopRightRadius: variables.componentBorderRadiusLarge,
},

emptyStateFolderIconSize: {
width: 184,
height: 112,
emptyStateFolderWithPaperIconSize: {
width: 160,
height: 100,
},

emptyStateFolderWebStyles: {
...sizing.w100,
minWidth: 400,
Copy link
Contributor

@hungvu193 hungvu193 Sep 19, 2024

Choose a reason for hiding this comment

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

@Krishna2323 Friendly reminder that you need to make sure you test this one on smaller device like iPhone8 or iPhoneSE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, thanks for the reminder. I tested on the web by resizing, but I still need to test on all platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hungvu193, tested on all platforms. I think you start reviewing now.

Monosnap.screencast.2024-09-20.04-45-12.mp4

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks man! Appreciate it, I'll give it a final review today!

...flex.alignItemsCenter,
...flex.justifyContentCenter,
...display.dFlex,
},

workflowApprovalVerticalLine: {
Expand Down
4 changes: 4 additions & 0 deletions src/styles/utils/spacing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export default {
marginVertical: 24,
},

mvAuto: {
marginVertical: 'auto',
},

mhv5: {
marginVertical: -20,
},
Expand Down
Loading