PluginProbe
Extendify / 2.2.0
Extendify v2.2.0
3.2.3 3.2.2 3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 All 129 releases
extendify / src / Assist / components / dashboard / domains / DomainBanner.jsx

DomainBanner.jsx in Extendify 2.2.0, at src/Assist/components/dashboard/domains/DomainBanner.jsx

85 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from '@wordpress/i18n';
2 import { Icon, globe, close } from '@wordpress/icons';
3 import { safeParseJson } from '@shared/lib/parsing';
4 import {
5 domainSearchUrl,
6 createDomainUrlLink,
7 deleteDomainCache,
8 } from '@assist/lib/domains';
9 import { useDomainActivities } from '@assist/state/domain-activities';
10 import { useGlobalStore } from '@assist/state/globals';
11
12 const domains = safeParseJson(window.extSharedData.resourceData)?.domains || [];
13
14 export const DomainBanner = () => {
15 const { dismissBanner } = useGlobalStore();
16 const { setDomainActivity } = useDomainActivities();
17
18 if (!domainSearchUrl || !domains?.length) return null;
19
20 return (
21 <div
22 className="relative mb-6 h-full min-h-32 w-full rounded border border-gray-300 bg-white px-5 py-5 text-base lg:px-8 lg:py-6"
23 data-test="assist-domain-banner-main-domain-module">
24 <button
25 type="button"
26 onClick={() => dismissBanner('domain-banner')}
27 className="absolute right-0 top-0 flex h-8 w-8 items-center justify-center rounded-bl rounded-se bg-gray-100 text-center hover:bg-gray-300 rtl:left-0 rtl:right-auto rtl:rounded-bl-none rtl:rounded-br">
28 <Icon icon={close} size={32} className="fill-current" />
29 </button>
30 <div className="grid gap-4 md:grid-cols-2 md:gap-12">
31 <div className="domain-name-message">
32 <div className="text-lg font-semibold">
33 {__('Your Own Domain Awaits', 'extendify-local')}
34 </div>
35 <div className="mt-1 text-sm">
36 {__(
37 'Move from a subdomain to a custom domain for improved website identity and SEO benefits.',
38 'extendify-local',
39 )}
40 </div>
41 </div>
42 <div className="domain-name-action">
43 {!domains?.length > 0 && (
44 <div className="flex h-full items-center justify-center">
45 {__('Service offline. Check back later.', 'extendify-local')}
46 </div>
47 )}
48
49 {domains?.length > 0 ? (
50 <>
51 <div className="mb-4 flex flex-col gap-1">
52 <div className="flex items-center gap-1 font-semibold">
53 <Icon icon={globe} size={24} className="fill-current" />
54 {domains[0]}
55 </div>
56 <p className="m-0 p-0 text-sm">
57 {__(
58 // translators: this refers to a domain name
59 'Available and just right for your site',
60 'extendify-local',
61 )}
62 </p>
63 </div>
64
65 <a
66 href={createDomainUrlLink(domainSearchUrl, domains[0])}
67 onClick={() => {
68 deleteDomainCache();
69 setDomainActivity({
70 domain: domains[0],
71 position: 'buy-banner',
72 });
73 }}
74 target="_blank"
75 className="inline-flex h-10 cursor-pointer items-center rounded-sm bg-design-main px-4 text-sm text-design-text no-underline hover:opacity-90">
76 {__('Secure a domain', 'extendify-local')}
77 </a>
78 </>
79 ) : null}
80 </div>
81 </div>
82 </div>
83 );
84 };
85