| 1 |
/** |
| 2 |
* Schema Local Business Form Component |
| 3 |
* |
| 4 |
* Extracted from SchemaTab.js - handles local business 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 |
SelectControl |
| 17 |
} from '@wordpress/components'; |
| 18 |
|
| 19 |
/** |
| 20 |
* Schema Local Business Form Component |
| 21 |
*/ |
| 22 |
const SchemaLocalBusinessForm = ({ |
| 23 |
settings, |
| 24 |
onSettingChange, |
| 25 |
isLoading, |
| 26 |
onNavigate |
| 27 |
}) => { |
| 28 |
return ( |
| 29 |
<div className="tab-content"> |
| 30 |
<Card size="small"> |
| 31 |
<CardHeader> |
| 32 |
<h3>{__('Local Business Schema', 'thinkrank')}</h3> |
| 33 |
</CardHeader> |
| 34 |
<CardBody> |
| 35 |
<div style={{ |
| 36 |
padding: '16px', |
| 37 |
backgroundColor: '#f0f6ff', |
| 38 |
border: '1px solid #0073aa', |
| 39 |
borderRadius: '6px', |
| 40 |
marginBottom: '20px' |
| 41 |
}}> |
| 42 |
<h4 style={{ margin: '0 0 12px 0', fontSize: '14px', color: '#0073aa' }}> |
| 43 |
{__('📍 LocalBusiness Schema Data Sources', 'thinkrank')} |
| 44 |
</h4> |
| 45 |
<p style={{ margin: '0 0 12px 0', fontSize: '13px', color: '#666' }}> |
| 46 |
{__('LocalBusiness schema is automatically generated using data from other ThinkRank tabs. No additional configuration needed here.', 'thinkrank')} |
| 47 |
</p> |
| 48 |
<div style={{ fontSize: '12px', color: '#555' }}> |
| 49 |
<strong>{__('Data Sources:', 'thinkrank')}</strong> |
| 50 |
<ul style={{ margin: '8px 0 0 0', paddingLeft: '20px' }}> |
| 51 |
<li>{__('Business Info: Name, address, phone, email, coordinates, price range, hours', 'thinkrank')}</li> |
| 52 |
<li>{__('Organization: Logo, social media profiles, contact information', 'thinkrank')}</li> |
| 53 |
<li>{__('Site Identity: Branding assets and site information', 'thinkrank')}</li> |
| 54 |
</ul> |
| 55 |
</div> |
| 56 |
</div> |
| 57 |
|
| 58 |
<h4 className="thinkrank-mb-xs">{__('Business Information', 'thinkrank')}</h4> |
| 59 |
<div style={{ |
| 60 |
padding: '12px', |
| 61 |
backgroundColor: '#f8f9fa', |
| 62 |
border: '1px solid #dee2e6', |
| 63 |
borderRadius: '4px', |
| 64 |
marginBottom: '16px' |
| 65 |
}}> |
| 66 |
<p style={{ margin: '0 0 8px 0', fontSize: '13px', fontWeight: '500' }}> |
| 67 |
{__('📋 Managed in Site Identity > Business Info:', 'thinkrank')} |
| 68 |
</p> |
| 69 |
<ul style={{ margin: 0, paddingLeft: '20px', fontSize: '12px', color: '#666' }}> |
| 70 |
<li>{__('Business name, type, and description', 'thinkrank')}</li> |
| 71 |
<li>{__('Complete address (street, city, state, postal code, country)', 'thinkrank')}</li> |
| 72 |
<li>{__('Phone number and email address', 'thinkrank')}</li> |
| 73 |
<li>{__('Geographic coordinates (latitude/longitude)', 'thinkrank')}</li> |
| 74 |
<li>{__('Price range and business hours', 'thinkrank')}</li> |
| 75 |
</ul> |
| 76 |
</div> |
| 77 |
|
| 78 |
<h4 className="thinkrank-mb-xs">{__('Organization & Branding', 'thinkrank')}</h4> |
| 79 |
<div style={{ |
| 80 |
padding: '12px', |
| 81 |
backgroundColor: '#f8f9fa', |
| 82 |
border: '1px solid #dee2e6', |
| 83 |
borderRadius: '4px', |
| 84 |
marginBottom: '16px' |
| 85 |
}}> |
| 86 |
<p style={{ margin: '0 0 8px 0', fontSize: '13px', fontWeight: '500' }}> |
| 87 |
{__('🏢 Managed in Schema Manager > Organization:', 'thinkrank')} |
| 88 |
</p> |
| 89 |
<ul style={{ margin: 0, paddingLeft: '20px', fontSize: '12px', color: '#666' }}> |
| 90 |
<li>{__('Organization logo and branding assets', 'thinkrank')}</li> |
| 91 |
<li>{__('Social media profiles (sameAs property)', 'thinkrank')}</li> |
| 92 |
<li>{__('Contact point information and hours', 'thinkrank')}</li> |
| 93 |
</ul> |
| 94 |
</div> |
| 95 |
|
| 96 |
<h4 className="thinkrank-mb-xs">{__('Data Validation', 'thinkrank')}</h4> |
| 97 |
<div style={{ |
| 98 |
padding: '12px', |
| 99 |
backgroundColor: '#f0f9ff', |
| 100 |
border: '1px solid #0ea5e9', |
| 101 |
borderRadius: '4px', |
| 102 |
marginBottom: '16px' |
| 103 |
}}> |
| 104 |
<p style={{ margin: '0 0 12px 0', fontSize: '13px', fontWeight: '500', color: '#0369a1' }}> |
| 105 |
{__('📊 Validate LocalBusiness Schema Data', 'thinkrank')} |
| 106 |
</p> |
| 107 |
<p style={{ margin: '0 0 12px 0', fontSize: '12px', color: '#666' }}> |
| 108 |
{__('LocalBusiness schema validation happens in the source tabs where the data is managed:', 'thinkrank')} |
| 109 |
</p> |
| 110 |
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}> |
| 111 |
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}> |
| 112 |
<span style={{ fontSize: '12px', color: '#666' }}>•</span> |
| 113 |
<a |
| 114 |
href="#" |
| 115 |
onClick={(e) => { |
| 116 |
e.preventDefault(); |
| 117 |
if (onNavigate) { |
| 118 |
onNavigate('site-identity', 'local-seo'); |
| 119 |
} |
| 120 |
}} |
| 121 |
style={{ fontSize: '12px', color: '#0073aa', textDecoration: 'none' }} |
| 122 |
> |
| 123 |
{__('Validate Business Info (address, phone, email, coordinates, price range) →', 'thinkrank')} |
| 124 |
</a> |
| 125 |
</div> |
| 126 |
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}> |
| 127 |
<span style={{ fontSize: '12px', color: '#666' }}>•</span> |
| 128 |
<a |
| 129 |
href="#" |
| 130 |
onClick={(e) => { |
| 131 |
e.preventDefault(); |
| 132 |
if (onNavigate) { |
| 133 |
onNavigate('schema', 'organization'); |
| 134 |
} |
| 135 |
}} |
| 136 |
style={{ fontSize: '12px', color: '#0073aa', textDecoration: 'none' }} |
| 137 |
> |
| 138 |
{__('Validate Organization (logo, social media, contact info) →', 'thinkrank')} |
| 139 |
</a> |
| 140 |
</div> |
| 141 |
</div> |
| 142 |
</div> |
| 143 |
|
| 144 |
<h4 className="thinkrank-mb-xs">{__('Schema Generation Status', 'thinkrank')}</h4> |
| 145 |
<div style={{ |
| 146 |
padding: '12px', |
| 147 |
backgroundColor: settings.enabled ? '#f0f9ff' : '#fef2f2', |
| 148 |
border: `1px solid ${settings.enabled ? '#0ea5e9' : '#f87171'}`, |
| 149 |
borderRadius: '4px', |
| 150 |
marginBottom: '16px' |
| 151 |
}}> |
| 152 |
<p style={{ margin: '0 0 8px 0', fontSize: '13px', fontWeight: '500', color: settings.enabled ? '#0369a1' : '#dc2626' }}> |
| 153 |
{settings.enabled |
| 154 |
? __('� |
| 155 |
LocalBusiness Schema Generation: Enabled', 'thinkrank') |
| 156 |
: __('❌ LocalBusiness Schema Generation: Disabled', 'thinkrank') |
| 157 |
} |
| 158 |
</p> |
| 159 |
<p style={{ margin: 0, fontSize: '12px', color: '#666' }}> |
| 160 |
{settings.enabled |
| 161 |
? __('LocalBusiness schema will be automatically generated using data from Business Info, Organization, and Site Identity tabs.', 'thinkrank') |
| 162 |
: __('Enable schema generation in the main Schema Manager settings to activate LocalBusiness schema output.', 'thinkrank') |
| 163 |
} |
| 164 |
</p> |
| 165 |
</div> |
| 166 |
|
| 167 |
<div style={{ |
| 168 |
padding: '12px', |
| 169 |
backgroundColor: '#f8f9fa', |
| 170 |
border: '1px solid #dee2e6', |
| 171 |
borderRadius: '4px', |
| 172 |
marginBottom: '12px' |
| 173 |
}}> |
| 174 |
<h5 style={{ margin: '0 0 8px 0', fontSize: '13px' }}>{__('Current Logo:', 'thinkrank')}</h5> |
| 175 |
<p style={{ margin: 0, fontSize: '12px', color: '#666' }}> |
| 176 |
{settings.logo_url |
| 177 |
? __('Logo configured in Site Identity > Hero & Branding', 'thinkrank') |
| 178 |
: __('No logo configured. Set up in Site Identity > Hero & Branding tab.', 'thinkrank') |
| 179 |
} |
| 180 |
</p> |
| 181 |
</div> |
| 182 |
|
| 183 |
<div style={{ |
| 184 |
padding: '12px', |
| 185 |
backgroundColor: '#f8f9fa', |
| 186 |
border: '1px solid #dee2e6', |
| 187 |
borderRadius: '4px' |
| 188 |
}}> |
| 189 |
<h5 style={{ margin: '0 0 8px 0', fontSize: '13px' }}>{__('Current Social Media:', 'thinkrank')}</h5> |
| 190 |
<p style={{ margin: 0, fontSize: '12px', color: '#666' }}> |
| 191 |
{(() => { |
| 192 |
const socialProfiles = [ |
| 193 |
settings.organization_social_facebook, |
| 194 |
settings.organization_social_twitter, |
| 195 |
settings.organization_social_linkedin, |
| 196 |
settings.organization_social_instagram, |
| 197 |
settings.organization_social_youtube |
| 198 |
].filter(profile => profile && profile.trim()); |
| 199 |
|
| 200 |
return socialProfiles.length > 0 |
| 201 |
? __(`${socialProfiles.length} social media profiles configured in Organization settings`, 'thinkrank') |
| 202 |
: __('No social media profiles configured. Set up in Schema Manager > Organization tab.', 'thinkrank'); |
| 203 |
})()} |
| 204 |
</p> |
| 205 |
</div> |
| 206 |
|
| 207 |
</CardBody> |
| 208 |
</Card> |
| 209 |
</div> |
| 210 |
); |
| 211 |
}; |
| 212 |
|
| 213 |
export default SchemaLocalBusinessForm; |
| 214 |
|