| 1 |
import { __ } from '@wordpress/i18n'; |
| 2 |
import Icon from '../components/Icon'; |
| 3 |
import { LockIcon, StarIcon } from '../icons'; |
| 4 |
|
| 5 |
/** Visual match for BrandToggle “off” state — inline styles so WP admin CSS cannot wash it out */ |
| 6 |
const ProLockedTogglePreview = () => ( |
| 7 |
<div |
| 8 |
className="relative inline-flex shrink-0 cursor-not-allowed select-none" |
| 9 |
style={{ width: 40, height: 22 }} |
| 10 |
role="presentation" |
| 11 |
aria-hidden="true" |
| 12 |
title={__('Requires Pro license', 'ultimate-store-kit')} |
| 13 |
> |
| 14 |
<span |
| 15 |
style={{ |
| 16 |
position: 'absolute', |
| 17 |
inset: 0, |
| 18 |
borderRadius: 9999, |
| 19 |
background: '#cbd5e1', |
| 20 |
border: '1px solid #94a3b8', |
| 21 |
boxSizing: 'border-box', |
| 22 |
}} |
| 23 |
/> |
| 24 |
<span |
| 25 |
style={{ |
| 26 |
position: 'absolute', |
| 27 |
top: '50%', |
| 28 |
left: 3, |
| 29 |
width: 16, |
| 30 |
height: 16, |
| 31 |
marginTop: -8, |
| 32 |
borderRadius: 9999, |
| 33 |
background: '#ffffff', |
| 34 |
boxShadow: '0 1px 4px rgba(0,0,0,0.22)', |
| 35 |
}} |
| 36 |
/> |
| 37 |
</div> |
| 38 |
); |
| 39 |
|
| 40 |
const ProModulePlaceholder = ({ module }) => { |
| 41 |
const title = module?.label || module?.id || ''; |
| 42 |
const description = module?.description || ''; |
| 43 |
const iconName = module?.icon || module?.id || 'grid'; |
| 44 |
|
| 45 |
const cardShell = |
| 46 |
'rounded-usk border border-solid border-gray-100 bg-white'; |
| 47 |
|
| 48 |
return ( |
| 49 |
<div className="flex flex-col gap-5"> |
| 50 |
<div |
| 51 |
className={`flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between ${cardShell}`} |
| 52 |
> |
| 53 |
<div className="flex min-w-0 items-center gap-3"> |
| 54 |
<div |
| 55 |
className="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-uks-brand/10 text-uks-brand" |
| 56 |
aria-hidden="true" |
| 57 |
> |
| 58 |
<Icon name={iconName} /> |
| 59 |
</div> |
| 60 |
<div className="min-w-0"> |
| 61 |
<h3 className="m-0 text-base font-bold text-slate-800">{title}</h3> |
| 62 |
{description && ( |
| 63 |
<p className="m-0 mt-1 text-[12px] leading-snug text-slate-500"> |
| 64 |
{description} |
| 65 |
</p> |
| 66 |
)} |
| 67 |
</div> |
| 68 |
</div> |
| 69 |
<div className="flex shrink-0 justify-end sm:pl-2"> |
| 70 |
<ProLockedTogglePreview /> |
| 71 |
</div> |
| 72 |
</div> |
| 73 |
|
| 74 |
<div className={cardShell}> |
| 75 |
<div className="flex flex-col items-center justify-center px-6 py-16 text-center sm:px-10 sm:py-20"> |
| 76 |
<div |
| 77 |
className="mx-auto mb-6 flex h-14 w-14 items-center justify-center rounded-xl bg-uks-brand/10 text-uks-brand" |
| 78 |
aria-hidden="true" |
| 79 |
> |
| 80 |
<LockIcon className="h-7 w-7" stroke="currentColor" /> |
| 81 |
</div> |
| 82 |
<h4 className="m-0 mb-2 text-lg font-bold tracking-tight text-slate-800"> |
| 83 |
{__('Module is currently disabled', 'ultimate-store-kit')} |
| 84 |
</h4> |
| 85 |
<p className="m-0 mb-6 max-w-md text-[13px] leading-relaxed text-slate-500"> |
| 86 |
{__( |
| 87 |
'This is a Pro feature. Upgrade to Ultimate Store Kit Pro to unlock this module and configure its settings.', |
| 88 |
'ultimate-store-kit' |
| 89 |
)} |
| 90 |
</p> |
| 91 |
<a |
| 92 |
href="https://storekit.pro/pricing/" |
| 93 |
target="_blank" |
| 94 |
rel="noopener noreferrer" |
| 95 |
className="inline-flex items-center gap-2 rounded-lg border-0 bg-uks-brand px-5 py-2.5 text-sm font-semibold text-white no-underline transition-opacity hover:opacity-90" |
| 96 |
> |
| 97 |
<StarIcon className="h-4 w-4" /> |
| 98 |
{__('Get Pro', 'ultimate-store-kit')} |
| 99 |
</a> |
| 100 |
</div> |
| 101 |
</div> |
| 102 |
</div> |
| 103 |
); |
| 104 |
}; |
| 105 |
|
| 106 |
export default ProModulePlaceholder; |
| 107 |
|