| 1 |
/** |
| 2 |
* Schema Website Form Component |
| 3 |
* |
| 4 |
* Extracted from SchemaTab.js - handles website schema form fields |
| 5 |
* |
| 6 |
* @package ThinkRank |
| 7 |
* @since 1.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
import { __ } from '@wordpress/i18n'; |
| 11 |
import { |
| 12 |
Card, |
| 13 |
CardBody, |
| 14 |
CardHeader, |
| 15 |
TextControl, |
| 16 |
TextareaControl, |
| 17 |
ToggleControl, |
| 18 |
Flex, |
| 19 |
FlexItem |
| 20 |
} from '@wordpress/components'; |
| 21 |
|
| 22 |
/** |
| 23 |
* Schema Website Form Component |
| 24 |
*/ |
| 25 |
const SchemaWebsiteForm = ({ |
| 26 |
settings, |
| 27 |
onSettingChange, |
| 28 |
isLoading |
| 29 |
}) => { |
| 30 |
return ( |
| 31 |
<div className="tab-content"> |
| 32 |
<Card size="small"> |
| 33 |
<CardHeader> |
| 34 |
<h3>{__('Website Schema', 'thinkrank')}</h3> |
| 35 |
</CardHeader> |
| 36 |
<CardBody> |
| 37 |
<p className="thinkrank-mb-md"> |
| 38 |
{__('Configure website-specific schema properties for better search engine understanding.', 'thinkrank')} |
| 39 |
</p> |
| 40 |
|
| 41 |
<TextControl |
| 42 |
label={__('Website Name', 'thinkrank')} |
| 43 |
value={settings.website_name || ''} |
| 44 |
onChange={(value) => onSettingChange('website_name', value)} |
| 45 |
help={__('Name of your website (defaults to site title if empty)', 'thinkrank')} |
| 46 |
disabled={!settings.enabled} |
| 47 |
__next40pxDefaultSize={true} |
| 48 |
__nextHasNoMarginBottom={true} |
| 49 |
className="thinkrank-mb-sm" |
| 50 |
/> |
| 51 |
|
| 52 |
<TextControl |
| 53 |
label={__('Website URL', 'thinkrank')} |
| 54 |
value={settings.website_url || ''} |
| 55 |
onChange={(value) => onSettingChange('website_url', value)} |
| 56 |
help={__('Main URL of your website (defaults to home URL if empty)', 'thinkrank')} |
| 57 |
disabled={!settings.enabled} |
| 58 |
__next40pxDefaultSize={true} |
| 59 |
__nextHasNoMarginBottom={true} |
| 60 |
className="thinkrank-mb-sm" |
| 61 |
/> |
| 62 |
|
| 63 |
<TextareaControl |
| 64 |
label={__('Website Description', 'thinkrank')} |
| 65 |
value={settings.website_description || ''} |
| 66 |
onChange={(value) => onSettingChange('website_description', value)} |
| 67 |
help={__('Brief description of your website (defaults to site tagline if empty)', 'thinkrank')} |
| 68 |
disabled={!settings.enabled} |
| 69 |
rows={3} |
| 70 |
__nextHasNoMarginBottom={true} |
| 71 |
className="thinkrank-mb-sm" |
| 72 |
/> |
| 73 |
|
| 74 |
{/* Search Configuration */} |
| 75 |
<div style={{ marginTop: '20px' }}> |
| 76 |
<h5 style={{ margin: '0 0 12px 0', fontSize: '14px', fontWeight: '600', color: '#1e1e1e' }}> |
| 77 |
{__('Search Configuration', 'thinkrank')} |
| 78 |
</h5> |
| 79 |
|
| 80 |
<ToggleControl |
| 81 |
label={__('Enable Sitelinks Search Box', 'thinkrank')} |
| 82 |
checked={settings.website_enable_search ?? true} |
| 83 |
onChange={(value) => onSettingChange('website_enable_search', value)} |
| 84 |
help={__('Enables the sitelinks search box in Google search results', 'thinkrank')} |
| 85 |
__nextHasNoMarginBottom={true} |
| 86 |
className="thinkrank-mb-sm" |
| 87 |
/> |
| 88 |
|
| 89 |
{(settings.website_enable_search ?? true) && ( |
| 90 |
<TextControl |
| 91 |
label={__('Search URL Template', 'thinkrank')} |
| 92 |
value={settings.website_search_url || ''} |
| 93 |
onChange={(value) => onSettingChange('website_search_url', value)} |
| 94 |
help={__('Custom search URL template (use {search_term_string} as placeholder)', 'thinkrank')} |
| 95 |
placeholder={__('Leave empty to use default WordPress search', 'thinkrank')} |
| 96 |
disabled={!settings.enabled} |
| 97 |
__next40pxDefaultSize={true} |
| 98 |
__nextHasNoMarginBottom={true} |
| 99 |
className="thinkrank-mb-sm" |
| 100 |
/> |
| 101 |
)} |
| 102 |
</div> |
| 103 |
|
| 104 |
{/* Logo Integration */} |
| 105 |
<div style={{ marginTop: '20px' }}> |
| 106 |
<h5 style={{ margin: '0 0 12px 0', fontSize: '14px', fontWeight: '600', color: '#1e1e1e' }}> |
| 107 |
{__('Logo Integration', 'thinkrank')} |
| 108 |
</h5> |
| 109 |
|
| 110 |
<div style={{ |
| 111 |
padding: '12px', |
| 112 |
backgroundColor: '#f8f9fa', |
| 113 |
border: '1px solid #dee2e6', |
| 114 |
borderRadius: '4px' |
| 115 |
}}> |
| 116 |
<h6 style={{ margin: '0 0 8px 0', fontSize: '13px' }}>{__('Current Logo:', 'thinkrank')}</h6> |
| 117 |
<p style={{ margin: 0, fontSize: '12px', color: '#666' }}> |
| 118 |
{settings.logo_url |
| 119 |
? __('Logo configured in Site Identity > Site Assets tab.', 'thinkrank') |
| 120 |
: __('No logo configured. Set up in Site Identity > Site Assets tab.', 'thinkrank') |
| 121 |
} |
| 122 |
</p> |
| 123 |
</div> |
| 124 |
</div> |
| 125 |
|
| 126 |
{/* Social Media Integration */} |
| 127 |
<div style={{ marginTop: '20px' }}> |
| 128 |
<h5 style={{ margin: '0 0 12px 0', fontSize: '14px', fontWeight: '600', color: '#1e1e1e' }}> |
| 129 |
{__('Social Media Integration', 'thinkrank')} |
| 130 |
</h5> |
| 131 |
|
| 132 |
<div style={{ |
| 133 |
padding: '12px', |
| 134 |
backgroundColor: '#e7f3ff', |
| 135 |
border: '1px solid #b3d9ff', |
| 136 |
borderRadius: '4px' |
| 137 |
}}> |
| 138 |
<p style={{ margin: '0 0 8px 0', fontSize: '12px', color: '#0073aa' }}> |
| 139 |
💡 {__('Tip: Configure social media profiles in Site Identity > Organization for automatic integration with Website schema.', 'thinkrank')} |
| 140 |
</p> |
| 141 |
<p style={{ margin: 0, fontSize: '12px', color: '#0073aa' }}> |
| 142 |
{__('Social profiles will appear in the "sameAs" property for better brand recognition.', 'thinkrank')} |
| 143 |
</p> |
| 144 |
</div> |
| 145 |
</div> |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
</CardBody> |
| 150 |
</Card> |
| 151 |
</div> |
| 152 |
); |
| 153 |
}; |
| 154 |
|
| 155 |
export default SchemaWebsiteForm; |
| 156 |
|