Skip to content

Commit

Permalink
Make sure we have a value before running replace
Browse files Browse the repository at this point in the history
  • Loading branch information
sixhours committed Dec 16, 2024
1 parent c1dfb2d commit 1d74876
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import type { SiteDetails } from '@automattic/data-stores';

export const MigrationStartedDIFM = ( { site }: { site?: SiteDetails } ) => {
const translate = useTranslate();
const migrationSourceSiteDomain = site?.options?.migration_source_site_domain?.replace(
/^https?:\/\/|\/+$/g,
''
);
const migrationSourceSiteDomain = site?.options?.migration_source_site_domain
? site?.options?.migration_source_site_domain?.replace( /^https?:\/\/|\/+$/g, '' )
: translate( 'your site' );

const title = translate( 'Your migration is underway' );
const subTitle = translate(
"Sit back as {{strong}}%(siteUrl)s{{/strong}} transfers to its new home. Here's what you can expect.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ import type { SiteDetails } from '@automattic/data-stores';

export const MigrationStartedDIY = ( { site }: { site: SiteDetails } ) => {
const title = translate( 'Your migration is underway' );
const migrationSourceSiteDomain = site?.options?.migration_source_site_domain?.replace(
/^https?:\/\/|\/+$/g,
''
);
const migrationSourceSiteDomain = site?.options?.migration_source_site_domain
? site?.options?.migration_source_site_domain?.replace( /^https?:\/\/|\/+$/g, '' )
: translate( 'your site' );

const subTitle = translate(
'Sit back as {{strong}}%(siteUrl)s{{/strong}} transfers to its new home. Get ready for unmatched WordPress hosting.',
{
components: { strong: <strong /> },
args: { siteUrl: migrationSourceSiteDomain ?? translate( 'your site' ) },
args: { siteUrl: migrationSourceSiteDomain },
}
) as string;

Expand Down

0 comments on commit 1d74876

Please sign in to comment.