diff --git a/src/CONST.ts b/src/CONST.ts index 58df3370be82..de4e3305eddc 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2094,7 +2094,6 @@ const CONST = { INFO: 'info', }, REPORT_DETAILS_MENU_ITEM: { - SHARE_CODE: 'shareCode', MEMBERS: 'member', INVITE: 'invite', SETTINGS: 'settings', diff --git a/src/components/PromotedActionsBar.tsx b/src/components/PromotedActionsBar.tsx index 0a83a9b94d5f..a5f52d3f7e99 100644 --- a/src/components/PromotedActionsBar.tsx +++ b/src/components/PromotedActionsBar.tsx @@ -1,56 +1,41 @@ -import React, {useState} from 'react'; +import React from 'react'; import type {StyleProp, ViewStyle} from 'react-native'; import {View} from 'react-native'; -import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as HeaderUtils from '@libs/HeaderUtils'; -import * as ReportActions from '@userActions/Report'; import type OnyxReport from '@src/types/onyx/Report'; import Button from './Button'; -import ConfirmModal from './ConfirmModal'; import type {ThreeDotsMenuItem} from './HeaderWithBackButton/types'; -import * as Expensicons from './Icon/Expensicons'; type PromotedAction = { key: string; } & ThreeDotsMenuItem; -type ReportPromotedAction = (report: OnyxReport) => PromotedAction; - -type PromotedActionsType = { - pin: ReportPromotedAction; -}; +type PromotedActionsType = Record<'pin' | 'share', (report: OnyxReport) => PromotedAction>; const PromotedActions = { pin: (report) => ({ key: 'pin', ...HeaderUtils.getPinMenuItem(report), }), + share: (report) => ({ + key: 'share', + ...HeaderUtils.getShareMenuItem(report), + }), } satisfies PromotedActionsType; type PromotedActionsBarProps = { - /** The report of actions */ - report?: OnyxReport; - /** The list of actions to show */ promotedActions: PromotedAction[]; /** The style of the container */ containerStyle?: StyleProp; - - /** - * Whether to show the `Leave` button. - * @deprecated Remove this prop when @src/pages/ReportDetailsPage.tsx is updated - */ - shouldShowLeaveButton?: boolean; }; -function PromotedActionsBar({report, promotedActions, containerStyle, shouldShowLeaveButton}: PromotedActionsBarProps) { +function PromotedActionsBar({promotedActions, containerStyle}: PromotedActionsBarProps) { const theme = useTheme(); const styles = useThemeStyles(); - const [isLastMemberLeavingGroupModalVisible, setIsLastMemberLeavingGroupModalVisible] = useState(false); - const {translate} = useLocalize(); if (promotedActions.length === 0) { return null; @@ -58,40 +43,6 @@ function PromotedActionsBar({report, promotedActions, containerStyle, shouldShow return ( - {/* TODO: Remove the `Leave` button when @src/pages/ReportDetailsPage.tsx is updated */} - {shouldShowLeaveButton && report && ( - // The `Leave` button is left to make the component backward compatible with the existing code. - // After the `Leave` button is moved to the `MenuItem` list, this block can be removed. - - { - setIsLastMemberLeavingGroupModalVisible(false); - ReportActions.leaveGroupChat(report.reportID); - }} - onCancel={() => setIsLastMemberLeavingGroupModalVisible(false)} - prompt={translate('groupChat.lastMemberWarning')} - confirmText={translate('common.leave')} - cancelText={translate('common.cancel')} - /> -