sitesmith: topbar button with locked/capped states
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import { useSitesmith } from '../../hooks/useSitesmith';
|
||||
import { useEditorConfig } from '../../state/EditorConfigContext';
|
||||
|
||||
interface Props { onClick: () => void; }
|
||||
|
||||
export const SitesmithButton: React.FC<Props> = ({ onClick }) => {
|
||||
const cfg = useEditorConfig();
|
||||
const siteId = cfg.whpConfig?.siteId ?? 0;
|
||||
const { summary } = useSitesmith(siteId);
|
||||
const locked = summary?.status === 'DISABLED';
|
||||
const capped = summary?.status === 'CAP_REACHED';
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
className="topbar-btn sitesmith-btn"
|
||||
title={locked ? 'Sitesmith — paid addon (click to learn more)' : 'Sitesmith AI Builder'}
|
||||
style={{
|
||||
background: locked ? '#1f1f24' : 'linear-gradient(135deg, #6366f1, #8b5cf6)',
|
||||
color: '#fff', border: 'none', padding: '6px 12px', borderRadius: 6, cursor: 'pointer', fontWeight: 500,
|
||||
}}
|
||||
>
|
||||
✨ Sitesmith
|
||||
{locked && <span aria-hidden style={{ marginLeft: 6, fontSize: 12 }}>🔒</span>}
|
||||
{capped && !locked && <span aria-hidden style={{ marginLeft: 6, fontSize: 11, opacity: 0.85 }}>(cap)</span>}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user