PluginProbe
Extendify / trunk
Extendify vtrunk
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 / SecondaryDomainBanner.jsx

SecondaryDomainBanner.jsx in Extendify trunk, at src/Assist/components/dashboard/domains/SecondaryDomainBanner.jsx

92 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 SecondaryDomainBanner = () => {
17 const { dismissBanner } = useGlobalStore();
18 const { setDomainActivity } = useDomainActivities();
19 useDomainViewActivity({ position: 'addon-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-secondary-domain-module"
27 >
28 <button
29 type="button"
30 onClick={() => dismissBanner('secondary-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 {__('Add An Additional Domain', 'extendify-local')}
39 </div>
40 <div className="mt-1 text-sm">
41 {__(
42 'Having another domain can drive additional traffic to your website.',
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 <a
72 href={createDomainUrlLink(domainSearchUrl, domains[0])}
73 onClick={() => {
74 deleteDomainCache();
75 setDomainActivity({
76 domain: domains[0],
77 position: 'addon-banner',
78 });
79 }}
80 target="_blank"
81 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"
82 >
83 {__('Secure a domain', 'extendify-local')}
84 </a>
85 </>
86 ) : null}
87 </div>
88 </div>
89 </div>
90 );
91 };
92