From e76adc4f330b7392f00b243acf8b930d06d24a93 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 1 Dec 2023 17:06:20 +0100 Subject: [PATCH 01/18] redesign page --- src/pages/ReferralDetailsPage.js | 115 ++++++++++++++----------------- 1 file changed, 52 insertions(+), 63 deletions(-) diff --git a/src/pages/ReferralDetailsPage.js b/src/pages/ReferralDetailsPage.js index 60b5d23b39da..117092763a91 100644 --- a/src/pages/ReferralDetailsPage.js +++ b/src/pages/ReferralDetailsPage.js @@ -1,23 +1,25 @@ import PropTypes from 'prop-types'; -import React from 'react'; -import {View} from 'react-native'; +import React, {useRef} from 'react'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; -import Button from '@components/Button'; -import CopyTextToClipboard from '@components/CopyTextToClipboard'; -import FixedFooter from '@components/FixedFooter'; -import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ContextMenuItem from '@components/ContextMenuItem'; +import HeaderPageLayout from '@components/HeaderPageLayout'; import Icon from '@components/Icon'; +import * as Expensicons from '@components/Icon/Expensicons'; import {PaymentHands} from '@components/Icon/Illustrations'; -import ScreenWrapper from '@components/ScreenWrapper'; +import MenuItem from '@components/MenuItem'; import Text from '@components/Text'; -import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; -import Navigation from '@libs/Navigation/Navigation'; +import useSingleExecution from '@hooks/useSingleExecution'; +import Clipboard from '@libs/Clipboard'; +import useTheme from '@styles/themes/useTheme'; import useThemeStyles from '@styles/useThemeStyles'; +import * as Link from '@userActions/Link'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; +import SCREENS from '@src/SCREENS'; +import {CONTEXT_MENU_TYPES} from './home/report/ContextMenu/ContextMenuActions'; +import * as ReportActionContextMenu from './home/report/ContextMenu/ReportActionContextMenu'; const propTypes = { /** Navigation route context info provided by react navigation */ @@ -40,8 +42,11 @@ const defaultProps = { }; function ReferralDetailsPage({route, account}) { + const theme = useTheme(); const styles = useThemeStyles(); const {translate} = useLocalize(); + const popoverAnchor = useRef(null); + const {isExecuting, singleExecution} = useSingleExecution(); let {contentType} = route.params; if (!_.includes(_.values(CONST.REFERRAL_PROGRAM.CONTENT_TYPES), contentType)) { @@ -53,67 +58,51 @@ function ReferralDetailsPage({route, account}) { const isShareCode = contentType === CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SHARE_CODE; const shouldShowBody2 = isShareCode; const shouldShowClipboard = contentType === CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND || isShareCode; - - function generateReferralURL(email) { - return `${CONST.REFERRAL_PROGRAM.LINK}/?thanks=${encodeURIComponent(email)}`; - } - - function getFallbackRoute() { - const fallbackRoutes = { - [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.MONEY_REQUEST]: ROUTES.MONEY_REQUEST_PARTICIPANTS.getRoute(CONST.IOU.TYPE.REQUEST), - [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SEND_MONEY]: ROUTES.MONEY_REQUEST_PARTICIPANTS.getRoute(CONST.IOU.TYPE.SEND), - [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.START_CHAT]: ROUTES.NEW_CHAT, - [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND]: ROUTES.SEARCH, - }; - - return fallbackRoutes[contentType]; - } + const referralLink = `${CONST.REFERRAL_PROGRAM.LINK}/?thanks=${encodeURIComponent(account.primaryLogin)}`; return ( - - Navigation.goBack(getFallbackRoute())} - /> - + - {contentHeader} - {contentBody} - {shouldShowClipboard && ( - - - - )} - {shouldShowBody2 && ( - - {translate(`referralProgram.${CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SHARE_CODE}.body2`)} - - )} - {translate('requestorStep.learnMore')} - - -