PluginProbe
Extendify / 3.1.1
Extendify v3.1.1
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 0.5.0 0.6.0 All 127 releases
extendify / src / Assist / components / dashboard / domains / DomainBanner.jsx

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

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