File size: 1,768 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | import page from '@automattic/calypso-router';
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 {
domain: string;
whois: WhoIs;
hostingProvider?: HostingProvider;
urlData?: UrlData;
domainRef: React.RefObject< HTMLObjectElement >;
}
export const DomainSection: React.FC< DomainSectionProps > = ( props ) => {
const translate = useTranslate();
const { domain, whois, hostingProvider, urlData, domainRef } = props;
const { is_wpcom: isWPcom } = urlData?.platform_data || {};
const goToDomainsPage = () => {
if ( ! isWPcom ) {
page( '/setup/domain-transfer' );
}
};
return (
<MetricsSection
name={ translate( 'Domain' ) }
title={
isWPcom
? translate(
"Your domain {{good}}setup is excellent{{/good}}, contributing positively to your site's visibility and growth.",
getTitleTranslateOptions()
)
: translate(
"Your domain {{good}}setup is good{{/good}}, but you could boost your site's visibility and growth.",
getTitleTranslateOptions()
)
}
subtitle={ ! isWPcom ? translate( 'Optimize your domain' ) : undefined }
subtitleOnClick={ goToDomainsPage }
ref={ domainRef }
>
<DomainInformation
domain={ domain }
whois={ whois }
hostingProvider={ hostingProvider }
urlData={ urlData }
hideTitle
/>
</MetricsSection>
);
};
|