From 17ede8a48f33aac5ec27d58e858b281940824d19 Mon Sep 17 00:00:00 2001 From: Jakub Szymczak Date: Fri, 14 Mar 2025 17:09:29 +0100 Subject: [PATCH 01/21] fix logic for showing Create report button --- .../sidebar/FloatingActionButtonAndPopover.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx b/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx index b574bdd076883..99edaae45d2d2 100644 --- a/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx +++ b/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx @@ -36,13 +36,7 @@ import interceptAnonymousUser from '@libs/interceptAnonymousUser'; import navigateAfterInteraction from '@libs/Navigation/navigateAfterInteraction'; import Navigation from '@libs/Navigation/Navigation'; import {hasSeenTourSelector} from '@libs/onboardingSelectors'; -import { - areAllGroupPoliciesExpenseChatDisabled, - canSendInvoice as canSendInvoicePolicyUtils, - getGroupPaidPoliciesWithExpenseChatEnabled, - isPaidGroupPolicy, - shouldShowPolicy, -} from '@libs/PolicyUtils'; +import {areAllGroupPoliciesExpenseChatDisabled, canSendInvoice as canSendInvoicePolicyUtils, isPaidGroupPolicy, shouldShowPolicy} from '@libs/PolicyUtils'; import {canCreateRequest, generateReportID, getDisplayNameForParticipant, getIcons, getReportName, getWorkspaceChats, isArchivedReport, isPolicyExpenseChat} from '@libs/ReportUtils'; import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils'; import {getNavatticURL} from '@libs/TourUtils'; @@ -218,7 +212,9 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT isCreateMenuActive && (!shouldUseNarrowLayout || isFocused), ); - const groupPoliciesWithChatEnabled = useMemo(() => getGroupPaidPoliciesWithExpenseChatEnabled(allPolicies as OnyxCollection), [allPolicies]); + const paidGroupPolicies = useMemo(() => Object.values((allPolicies as OnyxCollection) ?? {}).filter((policy) => isPaidGroupPolicy(policy)), [allPolicies]); + const groupPoliciesWithChatEnabled = useMemo(() => paidGroupPolicies.filter((policy) => policy?.isPolicyExpenseChatEnabled), [paidGroupPolicies]); + const canCreateReport = canUseTableReportView && paidGroupPolicies.length > 0; /** * There are scenarios where users who have not yet had their group workspace-chats in NewDot (isPolicyExpenseChatEnabled). In those scenarios, things can get confusing if they try to submit/track expenses. To address this, we block them from Creating, Tracking, Submitting expenses from NewDot if they are: @@ -478,14 +474,14 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT const menuItems = [ ...expenseMenuItems, - ...(canUseTableReportView + ...(canCreateReport ? [ { icon: Expensicons.Document, text: translate('report.newReport.createReport'), onSelected: () => { interceptAnonymousUser(() => { - if (groupPoliciesWithChatEnabled.length === 0) { + if (shouldRedirectToExpensifyClassic) { setModalVisible(true); return; } From b701d06a0650f151a3b4a2b8b8fbaa97d001fba3 Mon Sep 17 00:00:00 2001 From: Jakub Szymczak Date: Fri, 14 Mar 2025 17:11:24 +0100 Subject: [PATCH 02/21] modify EmptyStateComponent to accept new styles --- src/components/EmptyStateComponent/index.tsx | 58 +++++++++++--------- src/components/EmptyStateComponent/types.ts | 4 +- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/components/EmptyStateComponent/index.tsx b/src/components/EmptyStateComponent/index.tsx index d3a715ad87487..92fd059a214ad 100644 --- a/src/components/EmptyStateComponent/index.tsx +++ b/src/components/EmptyStateComponent/index.tsx @@ -25,6 +25,8 @@ function EmptyStateComponent({ subtitle, children, headerStyles, + cardStyles, + cardContentStyles, headerContentStyles, lottieWebViewStyles, showsVerticalScrollIndicator, @@ -91,37 +93,41 @@ function EmptyStateComponent({ style={styles.flex1} addBottomSafeAreaPadding={addBottomSafeAreaPadding} > - - - + {!!SkeletonComponent && ( + + + + )} - + {HeaderComponent} - + {title} {subtitle} {children} - - {buttons?.map(({buttonText, buttonAction, success, icon, isDisabled}, index) => ( - -