From 93de73f6245df4a1a65297c2b9bd729694a4d4b6 Mon Sep 17 00:00:00 2001 From: Nabi Ebrahimi Date: Wed, 14 May 2025 11:50:54 +0430 Subject: [PATCH 1/8] fix: resize Trips empty state illustration to maintain aspect ratio and visual balance --- src/pages/Search/EmptySearchView.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index 462bb507c04a..9b5fcb30317f 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -144,11 +144,11 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { case CONST.SEARCH.DATA_TYPES.TRIP: return { headerMedia: LottieAnimations.TripsEmptyState, - headerContentStyles: [StyleUtils.getWidthAndHeightStyle(375, 240), StyleUtils.getBackgroundColorStyle(theme.travelBG)], + headerContentStyles: [StyleUtils.getWidthAndHeightStyle(400, 256), StyleUtils.getBackgroundColorStyle(theme.travelBG)], title: translate('travel.title'), titleStyles: {...styles.textAlignLeft}, children: tripViewChildren, - lottieWebViewStyles: {backgroundColor: theme.travelBG, ...styles.emptyStateFolderWebStyles}, + lottieWebViewStyles: {backgroundColor: theme.travelBG, ...styles.emptyStateFolderWebStyles, ...styles.h100}, }; case CONST.SEARCH.DATA_TYPES.EXPENSE: if (!hasResults) { @@ -247,6 +247,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { translate, styles.textAlignLeft, styles.emptyStateFolderWebStyles, + styles.h100, tripViewChildren, hasSeenTour, navatticURL, From 361cf0d0bc3ab7ecb568d5b664b1fc17e2c6a32d Mon Sep 17 00:00:00 2001 From: Nabi Ebrahimi Date: Wed, 14 May 2025 15:55:39 +0430 Subject: [PATCH 2/8] Set Lottie container width and height to 100% for consistent sizing across screen sizes on native and web --- src/pages/Search/EmptySearchView.tsx | 2 +- src/styles/utils/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index 9b5fcb30317f..67fa462df8db 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -144,7 +144,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { case CONST.SEARCH.DATA_TYPES.TRIP: return { headerMedia: LottieAnimations.TripsEmptyState, - headerContentStyles: [StyleUtils.getWidthAndHeightStyle(400, 256), StyleUtils.getBackgroundColorStyle(theme.travelBG)], + headerContentStyles: [StyleUtils.getWidthAndHeightStyle('100%', '100%'), StyleUtils.getBackgroundColorStyle(theme.travelBG)], title: translate('travel.title'), titleStyles: {...styles.textAlignLeft}, children: tripViewChildren, diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index 8797316d95bb..4fed6e87768b 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -509,7 +509,7 @@ function getBackgroundColorWithOpacityStyle(backgroundColor: string, opacity: nu return {}; } -function getWidthAndHeightStyle(width: number, height?: number): Pick { +function getWidthAndHeightStyle(width: number | string, height?: number | string): Pick { return { width, height: height ?? width, From 9d3c650aaa9b72242cf21d9c96d7096301b004b8 Mon Sep 17 00:00:00 2001 From: Nabi Ebrahimi Date: Thu, 15 May 2025 01:21:55 +0430 Subject: [PATCH 3/8] Use fixed width and height for Lottie container on small screens, and '100%' on larger screens --- src/pages/Search/EmptySearchView.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index 67fa462df8db..7c92ed74e1c0 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -20,6 +20,7 @@ import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' import useEnvironment from '@hooks/useEnvironment'; import useLocalize from '@hooks/useLocalize'; import useReportIsArchived from '@hooks/useReportIsArchived'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -58,6 +59,7 @@ const tripsFeatures: FeatureListItem[] = [ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { const theme = useTheme(); const StyleUtils = useStyleUtils(); + const {isSmallScreen} = useResponsiveLayout(); const {translate} = useLocalize(); const styles = useThemeStyles(); const [modalVisible, setModalVisible] = useState(false); @@ -144,7 +146,10 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { case CONST.SEARCH.DATA_TYPES.TRIP: return { headerMedia: LottieAnimations.TripsEmptyState, - headerContentStyles: [StyleUtils.getWidthAndHeightStyle('100%', '100%'), StyleUtils.getBackgroundColorStyle(theme.travelBG)], + headerContentStyles: [ + isSmallScreen ? StyleUtils.getWidthAndHeightStyle(375, 240) : StyleUtils.getWidthAndHeightStyle('100%', '100%'), + StyleUtils.getBackgroundColorStyle(theme.travelBG), + ], title: translate('travel.title'), titleStyles: {...styles.textAlignLeft}, children: tripViewChildren, From 1235fcfe02b0bdcfda332d06efa4589d929250fc Mon Sep 17 00:00:00 2001 From: Nabi Ebrahimi Date: Thu, 15 May 2025 01:30:03 +0430 Subject: [PATCH 4/8] Add isSmallScreen to useMemo dependency array in EmptySearchView component --- src/pages/Search/EmptySearchView.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index 7c92ed74e1c0..4d7d7980a6c1 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -261,6 +261,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { viewTourTaskReport, canModifyTheTask, canActionTheTask, + isSmallScreen, ]); return ( From a2e547272b6e288d677d41d884cd473464f562de Mon Sep 17 00:00:00 2001 From: Nabi Ebrahimi Date: Thu, 15 May 2025 12:04:27 +0430 Subject: [PATCH 5/8] Set min-width to container as well to keep border-radius on native platforms --- src/pages/Search/EmptySearchView.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index 4d7d7980a6c1..f9615efde5b0 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -20,7 +20,6 @@ import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' import useEnvironment from '@hooks/useEnvironment'; import useLocalize from '@hooks/useLocalize'; import useReportIsArchived from '@hooks/useReportIsArchived'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -59,7 +58,6 @@ const tripsFeatures: FeatureListItem[] = [ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { const theme = useTheme(); const StyleUtils = useStyleUtils(); - const {isSmallScreen} = useResponsiveLayout(); const {translate} = useLocalize(); const styles = useThemeStyles(); const [modalVisible, setModalVisible] = useState(false); @@ -146,10 +144,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { case CONST.SEARCH.DATA_TYPES.TRIP: return { headerMedia: LottieAnimations.TripsEmptyState, - headerContentStyles: [ - isSmallScreen ? StyleUtils.getWidthAndHeightStyle(375, 240) : StyleUtils.getWidthAndHeightStyle('100%', '100%'), - StyleUtils.getBackgroundColorStyle(theme.travelBG), - ], + headerContentStyles: [StyleUtils.getWidthAndHeightStyle('100%', '100%'), StyleUtils.getBackgroundColorStyle(theme.travelBG), {minWidth: 400}], title: translate('travel.title'), titleStyles: {...styles.textAlignLeft}, children: tripViewChildren, @@ -261,7 +256,6 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { viewTourTaskReport, canModifyTheTask, canActionTheTask, - isSmallScreen, ]); return ( From 80b8d5bbcfb0a8be2935d894b18ab93a37ee012e Mon Sep 17 00:00:00 2001 From: Nabi Ebrahimi Date: Thu, 15 May 2025 19:02:23 +0430 Subject: [PATCH 6/8] Set fixed width and height to lottie view and '100%' to container --- src/pages/Search/EmptySearchView.tsx | 9 ++++----- src/styles/utils/index.ts | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index f9615efde5b0..7bbccb174084 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -1,6 +1,6 @@ import React, {useMemo, useRef, useState} from 'react'; // eslint-disable-next-line no-restricted-imports -import type {GestureResponderEvent, Text as RNText} from 'react-native'; +import type {GestureResponderEvent, ImageStyle, Text as RNText, ViewStyle} from 'react-native'; import {Linking, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import type {OnyxCollection} from 'react-native-onyx'; @@ -144,11 +144,11 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { case CONST.SEARCH.DATA_TYPES.TRIP: return { headerMedia: LottieAnimations.TripsEmptyState, - headerContentStyles: [StyleUtils.getWidthAndHeightStyle('100%', '100%'), StyleUtils.getBackgroundColorStyle(theme.travelBG), {minWidth: 400}], + headerContentStyles: [styles.emptyStateFolderWebStyles, StyleUtils.getBackgroundColorStyle(theme.travelBG)], title: translate('travel.title'), titleStyles: {...styles.textAlignLeft}, children: tripViewChildren, - lottieWebViewStyles: {backgroundColor: theme.travelBG, ...styles.emptyStateFolderWebStyles, ...styles.h100}, + lottieWebViewStyles: {backgroundColor: theme.travelBG, ...styles.emptyStateFolderWebStyles, width: 335, height: 220}, }; case CONST.SEARCH.DATA_TYPES.EXPENSE: if (!hasResults) { @@ -247,7 +247,6 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { translate, styles.textAlignLeft, styles.emptyStateFolderWebStyles, - styles.h100, tripViewChildren, hasSeenTour, navatticURL, @@ -273,7 +272,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { titleStyles={content.titleStyles} subtitle={content.subtitle} buttons={content.buttons} - headerContentStyles={[styles.h100, styles.w100, ...content.headerContentStyles]} + headerContentStyles={[styles.h100, styles.w100, ...content.headerContentStyles] as Array} lottieWebViewStyles={content.lottieWebViewStyles} > {content.children} diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index 4fed6e87768b..8797316d95bb 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -509,7 +509,7 @@ function getBackgroundColorWithOpacityStyle(backgroundColor: string, opacity: nu return {}; } -function getWidthAndHeightStyle(width: number | string, height?: number | string): Pick { +function getWidthAndHeightStyle(width: number, height?: number): Pick { return { width, height: height ?? width, From cbfa944cf5055922c628e5ce4ff4d19f8560c3a0 Mon Sep 17 00:00:00 2001 From: Nabi Ebrahimi Date: Thu, 15 May 2025 22:26:38 +0430 Subject: [PATCH 7/8] moved styles into styles file --- src/pages/Search/EmptySearchView.tsx | 2 +- src/styles/index.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index 7bbccb174084..0a5bf237b4b2 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -148,7 +148,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { title: translate('travel.title'), titleStyles: {...styles.textAlignLeft}, children: tripViewChildren, - lottieWebViewStyles: {backgroundColor: theme.travelBG, ...styles.emptyStateFolderWebStyles, width: 335, height: 220}, + lottieWebViewStyles: {backgroundColor: theme.travelBG, ...styles.emptyStateFolderWebStyles, ...styles.tripEmptyStateLottieWebView}, }; case CONST.SEARCH.DATA_TYPES.EXPENSE: if (!hasResults) { diff --git a/src/styles/index.ts b/src/styles/index.ts index ec484c200df4..cd50aadb119a 100644 --- a/src/styles/index.ts +++ b/src/styles/index.ts @@ -5628,6 +5628,11 @@ const styles = (theme: ThemeColors) => ...display.dFlex, }, + tripEmptyStateLottieWebView: { + width: 335, + height: 220, + }, + workflowApprovalVerticalLine: { height: 16, width: 1, From dc70591a27a70d9e06d42c9317b5611503bc2a1a Mon Sep 17 00:00:00 2001 From: Nabi Ebrahimi Date: Thu, 15 May 2025 22:30:35 +0430 Subject: [PATCH 8/8] updated useMemo dependencies --- src/pages/Search/EmptySearchView.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index 0a5bf237b4b2..3bd9a243af13 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -247,6 +247,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { translate, styles.textAlignLeft, styles.emptyStateFolderWebStyles, + styles.tripEmptyStateLottieWebView, tripViewChildren, hasSeenTour, navatticURL,