diff --git a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/MultiStepForm.spec.tsx b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/MultiStepForm.spec.tsx index 58ddbb74cdf..750b2a86178 100644 --- a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/MultiStepForm.spec.tsx +++ b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/MultiStepForm.spec.tsx @@ -1,4 +1,4 @@ -import { fireEvent, render, screen, waitFor } from '@testing-library/react' +import { render, screen, waitFor } from '@testing-library/react' import { SnackbarProvider } from 'notistack' import React from 'react' @@ -789,90 +789,6 @@ describe('MultiStepForm', () => { }) }) - describe('Edit Manually button', () => { - it('should hide edit manually button when on the language screen', () => { - const journey = { - id: 'test-journey-id' - } as unknown as Journey - - setRouterQuery({ journeyId: 'test-journey-id' }) - - render( - - - - - - - - ) - - const editButton = screen.getByText('Edit Manually') - expect(editButton).toHaveStyle('visibility: hidden') - }) - - it('should show edit manually button when on any screen after the first screen', () => { - const journey = { - id: 'test-journey-id' - } as unknown as Journey - - setRouterQuery({ journeyId: 'test-journey-id' }) - - const { rerender } = render( - - - - - - - - ) - - const editButton = screen.getByText('Edit Manually') - expect(editButton).toHaveStyle('visibility: hidden') - - fireEvent.click(screen.getByTestId('language-next')) - setRouterQuery({ journeyId: 'test-journey-id', screen: 'social' }) - rerender( - - - - - - - - ) - const editButtonAfterRerender = screen.getByText('Edit Manually') - expect(editButtonAfterRerender).toHaveStyle('visibility: visible') - expect(editButtonAfterRerender).toHaveAttribute( - 'href', - '/journeys/test-journey-id' - ) - }) - - it('should disable edit manually button if journey is not found', () => { - const journey = { - id: null - } as unknown as Journey - - setRouterQuery({ journeyId: 'test-journey-id' }) - - render( - - - - - - - - ) - expect(screen.getByText('Edit Manually')).toHaveAttribute( - 'aria-disabled', - 'true' - ) - }) - }) - describe('progress stepper', () => { it('should not render progress stepper when journey has no customization capabilities', async () => { const journeyWithNoCapabilities = { diff --git a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/MultiStepForm.tsx b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/MultiStepForm.tsx index 26318601407..98d5c85c3a8 100644 --- a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/MultiStepForm.tsx +++ b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/MultiStepForm.tsx @@ -1,8 +1,6 @@ import Box from '@mui/material/Box' -import Button from '@mui/material/Button' import Container from '@mui/material/Container' import Stack from '@mui/material/Stack' -import NextLink from 'next/link' import { useRouter } from 'next/router' import { useUser } from 'next-firebase-auth' import { useTranslation } from 'next-i18next' @@ -10,7 +8,6 @@ import { ReactElement, useMemo } from 'react' import { useJourney } from '@core/journeys/ui/JourneyProvider' import { useFlags } from '@core/shared/ui/FlagsProvider' -import Edit3 from '@core/shared/ui/icons/Edit3' import { CUSTOMIZE_SCREEN_QUERY_KEY, @@ -87,7 +84,6 @@ export function MultiStepForm(): ReactElement { const { customizableMedia, templateCustomizationGuestFlow } = useFlags() const journeyId = journey?.id ?? '' - const link = `/journeys/${journeyId}` const { screens, @@ -150,26 +146,6 @@ export function MultiStepForm(): ReactElement { }} > - - - {(hasEditableText || hasCustomizableLinks || hasCustomizableMedia) && ( diff --git a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/DoneScreen/DoneScreen.tsx b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/DoneScreen/DoneScreen.tsx index 9fc51812375..9c94fbfbcd3 100644 --- a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/DoneScreen/DoneScreen.tsx +++ b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/DoneScreen/DoneScreen.tsx @@ -16,6 +16,7 @@ import Play3Icon from '@core/shared/ui/icons/Play3' import { ShareItem } from '../../../../Editor/Toolbar/Items/ShareItem' import { CustomizationScreen } from '../../../utils/getCustomizeFlowConfig' +import { ScreenWrapper } from '../ScreenWrapper' interface DoneScreenProps { handleScreenNavigation?: (screen: CustomizationScreen) => void @@ -40,48 +41,12 @@ export function DoneScreen({ return ( - - {t('Ready to Share!')} - - - {t('Ready to Share!')} - - - {t('Share your unique link on any platform.')} - - - {t('Share your unique link on any platform.')} - - - {steps.length > 0 && ( + {steps.length > 0 && ( )} @@ -131,6 +96,7 @@ export function DoneScreen({ {t('Go To Projects Dashboard')} + ) } diff --git a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LanguageScreen/LanguageScreen.tsx b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LanguageScreen/LanguageScreen.tsx index a1fe586c64c..8eead9c3c37 100644 --- a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LanguageScreen/LanguageScreen.tsx +++ b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LanguageScreen/LanguageScreen.tsx @@ -24,6 +24,7 @@ import { useGetParentTemplateJourneyLanguages } from '../../../../../libs/useGet import { CustomizationScreen } from '../../../utils/getCustomizeFlowConfig' import { CustomizeFlowNextButton } from '../../CustomizeFlowNextButton' import { CardsPreview } from '../LinksScreen/CardsPreview' +import { ScreenWrapper } from '../ScreenWrapper' import { JourneyCustomizeTeamSelect } from './JourneyCustomizeTeamSelect' @@ -168,116 +169,97 @@ export function LanguageScreen({ return ( - - - {t("Let's Get Started!")} - - - {t('Get Started')} - - - {t('A few quick edits and your template will be ready to share.')} - + - {t("A few quick edits and it's ready to share!")} + {`'${journey?.title ?? ''}'`} - - - {`'${journey?.title ?? ''}'`} - - - {steps.length > 0 && } + {steps.length > 0 && } - - {({ handleSubmit, setFieldValue, values }) => ( -
- - - - {t('Select a language')} - - - {t('Select a language')} - - ({ - id: language?.id, - name: language?.name, - slug: language?.slug - }))} - onChange={(value) => setFieldValue('languageSelect', value)} - /> - {isSignedIn && ( - <> - - {t('Select a team')} - + + {({ handleSubmit, setFieldValue, values }) => ( + + + + + {t('Select a language')} + + + {t('Select a language')} + + ({ + id: language?.id, + name: language?.name, + slug: language?.slug + }))} + onChange={(value) => + setFieldValue('languageSelect', value) + } + /> + {isSignedIn && ( + <> + + {t('Select a team')} + - - {t('Select a team')} - - - - )} - handleSubmit()} - disabled={ - (templateCustomizationGuestFlow && !isSignedIn) || loading - } - ariaLabel={t('Next')} - /> - - - - )} - + + {t('Select a team')} + + + + )} + handleSubmit()} + disabled={ + (templateCustomizationGuestFlow && !isSignedIn) || loading + } + ariaLabel={t('Next')} + /> + +
+ + )} +
+
) } diff --git a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LinksScreen/LinksScreen.tsx b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LinksScreen/LinksScreen.tsx index ff41feeb824..f128075d367 100644 --- a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LinksScreen/LinksScreen.tsx +++ b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LinksScreen/LinksScreen.tsx @@ -1,6 +1,5 @@ import { useMutation } from '@apollo/client' import Stack from '@mui/material/Stack' -import Typography from '@mui/material/Typography' import { Formik, FormikHelpers, FormikProvider } from 'formik' import { useTranslation } from 'next-i18next' import { ReactElement, useMemo } from 'react' @@ -28,6 +27,7 @@ import { countries } from '../../../../Editor/Slider/Settings/CanvasDetails/Prop import { CustomizationScreen } from '../../../utils/getCustomizeFlowConfig' import { getJourneyLinks } from '../../../utils/getJourneyLinks' import { CustomizeFlowNextButton } from '../../CustomizeFlowNextButton' +import { ScreenWrapper } from '../ScreenWrapper' import { CardsPreview } from './CardsPreview' import { LinksForm } from './LinksForm' @@ -197,49 +197,18 @@ export function LinksScreen({ width: '100%' }} > - - - {t('Links')} - - - {t('Links')} - - - {t( - 'This content contains buttons linking to external sites. Check them and update the links below.' - )} - - - {t( - 'Buttons here point to external sites. Check and update the links.' - )} - - - + + + >((acc, link) => { diff --git a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/MediaScreen/MediaScreen.tsx b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/MediaScreen/MediaScreen.tsx index 2ba8f54673e..6998317b976 100644 --- a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/MediaScreen/MediaScreen.tsx +++ b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/MediaScreen/MediaScreen.tsx @@ -1,6 +1,4 @@ -import Box from '@mui/material/Box' import Stack from '@mui/material/Stack' -import Typography from '@mui/material/Typography' import { useTranslation } from 'next-i18next' import { ReactElement, useEffect, useState } from 'react' @@ -12,6 +10,7 @@ import { GetJourney_journey_blocks_StepBlock as StepBlock } from '@core/journeys import { getJourneyMedia } from '../../../utils/getJourneyMedia' import { CustomizeFlowNextButton } from '../../CustomizeFlowNextButton' import { useTemplateVideoUpload } from '../../TemplateVideoUploadProvider' +import { ScreenWrapper } from '../ScreenWrapper' import { CardsSection, @@ -83,30 +82,29 @@ export function MediaScreen({ handleNext }: MediaScreenProps): ReactElement { overflow: { xs: 'visible', sm: 'hidden' } }} > - - - {t('Media')} - - - {t('Personalize and manage your media assets')} - - - {showLogo && } - - {showImages && ( - - )} - {showVideos && } - handleNext()} - ariaLabel={t('Next')} - loading={hasActiveUploads} - /> + handleNext()} + ariaLabel={t('Next')} + loading={hasActiveUploads} + /> + } + > + {showLogo && } + + {showImages && ( + + )} + {showVideos && } +
) diff --git a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/ScreenWrapper/ScreenWrapper.tsx b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/ScreenWrapper/ScreenWrapper.tsx new file mode 100644 index 00000000000..5aab822e4bd --- /dev/null +++ b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/ScreenWrapper/ScreenWrapper.tsx @@ -0,0 +1,65 @@ +import Stack from '@mui/material/Stack' +import { SxProps, Theme } from '@mui/material/styles' +import Typography from '@mui/material/Typography' +import { ReactElement, ReactNode } from 'react' + +interface ScreenWrapperProps { + title: string + mobileTitle?: string + subtitle: string + mobileSubtitle?: string + headerSx?: SxProps + footer?: ReactNode + children: ReactNode +} + +export function ScreenWrapper({ + title, + mobileTitle, + subtitle, + mobileSubtitle, + headerSx, + footer, + children +}: ScreenWrapperProps): ReactElement { + return ( + <> + + + {title} + + + {mobileTitle ?? title} + + + {subtitle} + + + {mobileSubtitle ?? subtitle} + + + {children} + {footer} + + ) +} diff --git a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/ScreenWrapper/index.ts b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/ScreenWrapper/index.ts new file mode 100644 index 00000000000..dfa2c06cdb7 --- /dev/null +++ b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/ScreenWrapper/index.ts @@ -0,0 +1 @@ +export { ScreenWrapper } from './ScreenWrapper' diff --git a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/SocialScreen/SocialScreen.tsx b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/SocialScreen/SocialScreen.tsx index d054a95f5bb..ddf431b6261 100644 --- a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/SocialScreen/SocialScreen.tsx +++ b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/SocialScreen/SocialScreen.tsx @@ -1,5 +1,4 @@ import Stack from '@mui/material/Stack' -import Typography from '@mui/material/Typography' import { useTranslation } from 'next-i18next' import { ReactElement } from 'react' @@ -7,6 +6,7 @@ import { DescriptionEdit } from '../../../../Editor/Slider/Settings/SocialDetail import { TitleEdit } from '../../../../Editor/Slider/Settings/SocialDetails/TitleEdit' import { CustomizationScreen } from '../../../utils/getCustomizeFlowConfig' import { CustomizeFlowNextButton } from '../../CustomizeFlowNextButton' +import { ScreenWrapper } from '../ScreenWrapper' import { SocialScreenSocialImage } from './SocialScreenSocialImage' @@ -28,56 +28,36 @@ export function SocialScreen({ px: { xs: 5, sm: 20 } }} > - handleNext()} + ariaLabel={t('Done')} + /> + } > - {t('Final Details')} - - - {t('Final Details')} - - - {t('Customize how your invite appears when shared on social media.')} - - - {t('This is how your content will appear when shared on social media.')} - - - - - - - handleNext()} - ariaLabel={t('Done')} - /> + + + + + + ) } diff --git a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/TextScreen/TextScreen.tsx b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/TextScreen/TextScreen.tsx index 0c70d8d5e8b..a9256acf9da 100644 --- a/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/TextScreen/TextScreen.tsx +++ b/apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/TextScreen/TextScreen.tsx @@ -1,7 +1,6 @@ import { gql, useMutation } from '@apollo/client' import Box from '@mui/material/Box' import Stack from '@mui/material/Stack' -import Typography from '@mui/material/Typography' import { useTranslation } from 'next-i18next' import { ReactElement, useCallback, useEffect, useState } from 'react' @@ -11,6 +10,7 @@ import { GetJourney_journey_journeyCustomizationFields as JourneyCustomizationFi import { JourneyCustomizationFieldUpdate } from '../../../../../../__generated__/JourneyCustomizationFieldUpdate' import { CustomizationScreen } from '../../../utils/getCustomizeFlowConfig' import { CustomizeFlowNextButton } from '../../CustomizeFlowNextButton' +import { ScreenWrapper } from '../ScreenWrapper' export const JOURNEY_CUSTOMIZATION_FIELD_UPDATE = gql` mutation JourneyCustomizationFieldUpdate( @@ -202,101 +202,71 @@ export function TextScreen({ width: '100%' }} > - - - {t('Text')} - - - {t('Text')} - - - {t( - "Fill out the blue fields and we'll customize the content with your information." - )} - - - {t('Fill in the blue fields to customize the content.')} - - - - - {renderEditableText( - journey?.journeyCustomizationDescription ?? '', - replacementItems, - handleValueChange - )} + + } + > + + + {renderEditableText( + journey?.journeyCustomizationDescription ?? '', + replacementItems, + handleValueChange + )} + + - - - + ) }