From 796e69dfc594aeeae6e8607b614436f514025e2b Mon Sep 17 00:00:00 2001 From: nkdengineer <161821005+nkdengineer@users.noreply.github.com> Date: Fri, 7 Nov 2025 14:00:02 +0700 Subject: [PATCH 01/20] Revert "[CP Staging] Revert "Remove Review button from Inbox and Reports page"" --- src/CONST/index.ts | 2 - src/components/AnimatedCollapsible/index.tsx | 35 +- src/components/MoneyReportHeader.tsx | 2 +- .../MoneyRequestReportPreviewContent.tsx | 32 +- .../MoneyRequestReportPreview/index.tsx | 3 +- .../MoneyRequestReportPreview/types.ts | 3 +- .../Search/ActionCell.tsx | 6 +- .../Search/TransactionGroupListItem.tsx | 30 +- src/languages/de.ts | 1 + src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/languages/fr.ts | 1 + src/languages/it.ts | 1 + src/languages/ja.ts | 1 + src/languages/nl.ts | 1 + src/languages/pl.ts | 1 + src/languages/pt-BR.ts | 1 + src/languages/zh-hans.ts | 1 + src/libs/ReportPreviewActionUtils.ts | 98 +----- src/libs/SearchUIUtils.ts | 44 +-- tests/actions/ReportPreviewActionUtilsTest.ts | 315 +----------------- tests/ui/MoneyRequestReportPreview.test.tsx | 89 ----- .../MoneyRequestReportButtonUtils.test.ts | 1 - tests/unit/Search/SearchUIUtilsTest.ts | 80 +---- 24 files changed, 120 insertions(+), 630 deletions(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 5b64e0a6f311..60a799d99397 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -1147,7 +1147,6 @@ const CONST = { REPORT_PREVIEW_ACTIONS: { VIEW: 'view', ADD_EXPENSE: 'addExpense', - REVIEW: 'review', SUBMIT: 'submit', APPROVE: 'approve', PAY: 'pay', @@ -6517,7 +6516,6 @@ const CONST = { }, ACTION_TYPES: { VIEW: 'view', - REVIEW: 'review', SUBMIT: 'submit', APPROVE: 'approve', PAY: 'pay', diff --git a/src/components/AnimatedCollapsible/index.tsx b/src/components/AnimatedCollapsible/index.tsx index d2b5930ebf2a..d4a9b9fca09f 100644 --- a/src/components/AnimatedCollapsible/index.tsx +++ b/src/components/AnimatedCollapsible/index.tsx @@ -21,6 +21,9 @@ type AnimatedCollapsibleProps = { /** Header content to display above the collapsible content */ header: ReactNode; + /** Description content to display below the header */ + description?: ReactNode; + /** Duration of expansion animation */ duration?: number; @@ -53,6 +56,7 @@ function AnimatedCollapsible({ isExpanded, children, header, + description, duration = 300, style, headerStyle, @@ -66,9 +70,9 @@ function AnimatedCollapsible({ const theme = useTheme(); const styles = useThemeStyles(); const contentHeight = useSharedValue(0); + const descriptionHeight = useSharedValue(0); const hasExpanded = useSharedValue(isExpanded); const [isRendered, setIsRendered] = React.useState(isExpanded); - useEffect(() => { hasExpanded.set(isExpanded); if (isExpanded) { @@ -99,6 +103,21 @@ function AnimatedCollapsible({ return withTiming(hasExpanded.get() ? 1 : 0, {duration, easing}); }); + const descriptionOpacity = useDerivedValue(() => { + return withTiming(!hasExpanded.get() ? 1 : 0, {duration, easing}); + }); + + const descriptionAnimatedHeight = useDerivedValue(() => { + return withTiming(!isExpanded ? descriptionHeight.get() : 0, {duration, easing}); + }); + + const descriptionAnimatedStyle = useAnimatedStyle(() => { + return { + opacity: descriptionOpacity.get(), + height: descriptionAnimatedHeight.get(), + }; + }, []); + const contentAnimatedStyle = useAnimatedStyle(() => { return { height: animatedHeight.get(), @@ -129,6 +148,20 @@ function AnimatedCollapsible({ )} + {!!description && ( + + { + const height = e.nativeEvent.layout.height; + if (height) { + descriptionHeight.set(height); + } + }} + > + {description} + + + )} {isExpanded || isRendered ? ( { return getReportPreviewAction( - violations, isIouReportArchived || isChatReportArchived, - currentUserDetails.email ?? '', iouReport, policy, transactions, @@ -491,22 +486,8 @@ function MoneyRequestReportPreviewContent({ isPaidAnimationRunning, isApprovedAnimationRunning, isSubmittingAnimationRunning, - areStrictPolicyRulesEnabled, ); - }, [ - isPaidAnimationRunning, - isApprovedAnimationRunning, - isSubmittingAnimationRunning, - violations, - iouReport, - policy, - transactions, - isIouReportArchived, - invoiceReceiverPolicy, - isChatReportArchived, - areStrictPolicyRulesEnabled, - currentUserDetails.email, - ]); + }, [isPaidAnimationRunning, isApprovedAnimationRunning, isSubmittingAnimationRunning, iouReport, policy, transactions, isIouReportArchived, invoiceReceiverPolicy, isChatReportArchived]); const addExpenseDropdownOptions = useMemo( () => getAddExpenseDropdownOptions(iouReport?.reportID, policy, chatReportID, iouReport?.parentReportID, lastDistanceExpenseType), @@ -583,15 +564,6 @@ function MoneyRequestReportPreviewContent({ }} /> ) : null, - [CONST.REPORT.REPORT_PREVIEW_ACTIONS.REVIEW]: ( -