From f4ddc87567247e89c237ae157127ea51b6044e82 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 4 Nov 2024 12:54:09 +0100 Subject: [PATCH] Add employee name to subheader --- src/components/InteractiveStepWrapper.tsx | 5 +++++ .../workspace/companyCards/assignCard/CardSelectionStep.tsx | 5 +++-- .../workspace/companyCards/assignCard/ConfirmationStep.tsx | 4 +++- .../companyCards/assignCard/TransactionStartDateStep.tsx | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/InteractiveStepWrapper.tsx b/src/components/InteractiveStepWrapper.tsx index 290ad628f9cf..ec0d2da02108 100644 --- a/src/components/InteractiveStepWrapper.tsx +++ b/src/components/InteractiveStepWrapper.tsx @@ -20,6 +20,9 @@ type InteractiveStepWrapperProps = { // Title of the back button header headerTitle: string; + // Subtitle of the back button header + headerSubtitle?: string; + // Index of the highlighted step startStepIndex?: number; @@ -48,6 +51,7 @@ function InteractiveStepWrapper( wrapperID, handleBackButtonPress, headerTitle, + headerSubtitle, startStepIndex, stepNames, shouldEnableMaxHeight, @@ -72,6 +76,7 @@ function InteractiveStepWrapper( > diff --git a/src/pages/workspace/companyCards/assignCard/CardSelectionStep.tsx b/src/pages/workspace/companyCards/assignCard/CardSelectionStep.tsx index b2c95ca22f29..84e7ea5723a7 100644 --- a/src/pages/workspace/companyCards/assignCard/CardSelectionStep.tsx +++ b/src/pages/workspace/companyCards/assignCard/CardSelectionStep.tsx @@ -42,7 +42,7 @@ function CardSelectionStep({feed, policyID}: CardSelectionStepProps) { const accountCardList = cardFeeds?.settings?.oAuthAccountDetails?.[feed]?.accountList ?? []; const isEditing = assignCard?.isEditing; - const assignee = assignCard?.data?.email ?? ''; + const assigneeDisplayName = PersonalDetailsUtils.getPersonalDetailByEmail(assignCard?.data?.email ?? '')?.displayName ?? ''; const {cardList, ...cards} = list ?? {}; // We need to filter out cards which already has been assigned const filteredCardList = Object.fromEntries( @@ -124,6 +124,7 @@ function CardSelectionStep({feed, policyID}: CardSelectionStepProps) { startStepIndex={listOptions.length ? 1 : undefined} stepNames={listOptions.length ? CONST.COMPANY_CARD.STEP_NAMES : undefined} headerTitle={translate('workspace.companyCards.assignCard')} + headerSubtitle={assigneeDisplayName} > {!listOptions.length ? ( @@ -149,7 +150,7 @@ function CardSelectionStep({feed, policyID}: CardSelectionStepProps) { {translate('workspace.companyCards.chooseCard')} {translate('workspace.companyCards.chooseCardFor', { - assignee: PersonalDetailsUtils.getPersonalDetailByEmail(assignee ?? '')?.displayName ?? '', + assignee: assigneeDisplayName, feed: CardUtils.getCardFeedName(feed), })} diff --git a/src/pages/workspace/companyCards/assignCard/ConfirmationStep.tsx b/src/pages/workspace/companyCards/assignCard/ConfirmationStep.tsx index ff766a1e7d70..2d0fab26b070 100644 --- a/src/pages/workspace/companyCards/assignCard/ConfirmationStep.tsx +++ b/src/pages/workspace/companyCards/assignCard/ConfirmationStep.tsx @@ -36,6 +36,7 @@ function ConfirmationStep({policyID, backTo}: ConfirmationStepProps) { const safePaddingBottomStyle = useSafePaddingBottomStyle(); const data = assignCard?.data; + const cardholderName = PersonalDetailsUtils.getPersonalDetailByEmail(data?.email ?? '')?.displayName ?? ''; const submit = () => { CompanyCards.assignWorkspaceCompanyCard(policyID, data); @@ -58,6 +59,7 @@ function ConfirmationStep({policyID, backTo}: ConfirmationStepProps) { startStepIndex={3} stepNames={CONST.COMPANY_CARD.STEP_NAMES} headerTitle={translate('workspace.companyCards.assignCard')} + headerSubtitle={cardholderName} > {translate('workspace.companyCards.confirmationDescription')} editStep(CONST.COMPANY_CARD.STEP.ASSIGNEE)} /> diff --git a/src/pages/workspace/companyCards/assignCard/TransactionStartDateStep.tsx b/src/pages/workspace/companyCards/assignCard/TransactionStartDateStep.tsx index 9c53889d6519..d3598ec7ffcc 100644 --- a/src/pages/workspace/companyCards/assignCard/TransactionStartDateStep.tsx +++ b/src/pages/workspace/companyCards/assignCard/TransactionStartDateStep.tsx @@ -11,6 +11,7 @@ import useLocalize from '@hooks/useLocalize'; import useSafePaddingBottomStyle from '@hooks/useSafePaddingBottomStyle'; import useThemeStyles from '@hooks/useThemeStyles'; import DateUtils from '@libs/DateUtils'; +import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import * as CompanyCards from '@userActions/CompanyCards'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -24,6 +25,7 @@ function TransactionStartDateStep() { const [assignCard] = useOnyx(ONYXKEYS.ASSIGN_CARD); const isEditing = assignCard?.isEditing; const data = assignCard?.data; + const assigneeDisplayName = PersonalDetailsUtils.getPersonalDetailByEmail(data?.email ?? '')?.displayName ?? ''; const [dateOptionSelected, setDateOptionSelected] = useState(data?.dateOption ?? CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.FROM_BEGINNING); const [isModalOpened, setIsModalOpened] = useState(false); @@ -88,6 +90,7 @@ function TransactionStartDateStep() { startStepIndex={2} stepNames={CONST.COMPANY_CARD.STEP_NAMES} headerTitle={translate('workspace.companyCards.assignCard')} + headerSubtitle={assigneeDisplayName} > {translate('workspace.companyCards.chooseTransactionStartDate')} {translate('workspace.companyCards.startDateDescription')}