Skip to content

Commit

Permalink
Site Profiler: Update domain section title based on current domain de…
Browse files Browse the repository at this point in the history
…finitions (#91015)

* Isolate the DomainSection on its own component

* Show a link when the domain is not on WP.com and redirect to the Domain Transfer link

* Site Profiler: Update domain section title based on current domain definitions

* use the translate options util
  • Loading branch information
WBerredo committed May 22, 2024
1 parent d1838d6 commit ae3a928
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions client/site-profiler/components/domain-section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTranslate } from 'i18n-calypso';
import { UrlData } from 'calypso/blocks/import/types';
import DomainInformation from 'calypso/site-profiler/components/domain-information';
import { MetricsSection } from 'calypso/site-profiler/components/metrics-section';
import { getTitleTranslateOptions } from 'calypso/site-profiler/utils/get-title-translate-options';
import type { HostingProvider, WhoIs } from 'calypso/data/site-profiler/types';

interface DomainSectionProps {
Expand All @@ -16,25 +17,28 @@ interface DomainSectionProps {
export const DomainSection: React.FC< DomainSectionProps > = ( props ) => {
const translate = useTranslate();
const { domain, whois, hostingProvider, urlData, domainRef } = props;
const showSubtitle = ! urlData?.platform_data?.is_wpcom;
const { is_wpcom: isWPcom } = urlData?.platform_data || {};
const goToDomainsPage = () => {
if ( showSubtitle ) {
if ( ! isWPcom ) {
page( '/setup/domain-transfer' );
}
};

return (
<MetricsSection
name={ translate( 'Domain' ) }
title={ translate(
'Your domain {{success}}set up is good{{/success}}, but you could boost your site’s visibility and growth.',
{
components: {
success: <span className="success" />,
},
}
) }
subtitle={ showSubtitle ? translate( 'Optimize your domain' ) : undefined }
title={
isWPcom
? translate(
"Your domain {{success}}set up is excelent{{/success}}, contributing positively to your site's visibility and growth.",
getTitleTranslateOptions()
)
: translate(
"Your domain {{success}}set up is good{{/success}}, but you could boost your site's visibility and growth.",
getTitleTranslateOptions()
)
}
subtitle={ ! isWPcom ? translate( 'Optimize your domain' ) : undefined }
subtitleOnClick={ goToDomainsPage }
ref={ domainRef }
>
Expand Down

0 comments on commit ae3a928

Please sign in to comment.