| 1 |
/** |
| 2 |
* Schema Person Form Component |
| 3 |
* |
| 4 |
* Extracted from SchemaGeneration.js - handles person 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 |
Flex, |
| 18 |
FlexItem, |
| 19 |
FormTokenField |
| 20 |
} from '@wordpress/components'; |
| 21 |
import MediaPicker from '../../../common/MediaPicker'; |
| 22 |
|
| 23 |
/** |
| 24 |
* Schema Person Form Component |
| 25 |
*/ |
| 26 |
const SchemaPersonForm = ({ |
| 27 |
settings, |
| 28 |
onSettingChange, |
| 29 |
isLoading |
| 30 |
}) => { |
| 31 |
return ( |
| 32 |
<Card size="small"> |
| 33 |
<CardHeader> |
| 34 |
<h4>👤 {__('Person Configuration', 'thinkrank')}</h4> |
| 35 |
</CardHeader> |
| 36 |
<CardBody> |
| 37 |
<Flex direction="column" gap={3}> |
| 38 |
<TextControl |
| 39 |
label={__('Full Name', 'thinkrank')} |
| 40 |
value={settings.person_name || ''} |
| 41 |
onChange={(value) => onSettingChange('person_name', value)} |
| 42 |
help={__('Full name of the person', 'thinkrank')} |
| 43 |
__next40pxDefaultSize={true} |
| 44 |
__nextHasNoMarginBottom={true} |
| 45 |
/> |
| 46 |
<MediaPicker |
| 47 |
label={__('Profile Image', 'thinkrank')} |
| 48 |
value={settings.person_image || ''} |
| 49 |
onChange={(value) => onSettingChange('person_image', value)} |
| 50 |
help={__('Professional headshot or profile photo', 'thinkrank')} |
| 51 |
allowedTypes={['image']} |
| 52 |
disabled={!settings.enabled} |
| 53 |
/> |
| 54 |
<Flex gap={2}> |
| 55 |
<FlexItem> |
| 56 |
<TextControl |
| 57 |
label={__('Job Title', 'thinkrank')} |
| 58 |
value={settings.person_job_title || ''} |
| 59 |
onChange={(value) => onSettingChange('person_job_title', value)} |
| 60 |
help={__('Professional title or position', 'thinkrank')} |
| 61 |
disabled={!settings.enabled} |
| 62 |
__next40pxDefaultSize={true} |
| 63 |
__nextHasNoMarginBottom={true} |
| 64 |
/> |
| 65 |
</FlexItem> |
| 66 |
<FlexItem> |
| 67 |
<TextControl |
| 68 |
label={__('Nationality', 'thinkrank')} |
| 69 |
value={settings.person_nationality || ''} |
| 70 |
onChange={(value) => onSettingChange('person_nationality', value)} |
| 71 |
help={__('Country of citizenship', 'thinkrank')} |
| 72 |
disabled={!settings.enabled} |
| 73 |
__next40pxDefaultSize={true} |
| 74 |
__nextHasNoMarginBottom={true} |
| 75 |
/> |
| 76 |
</FlexItem> |
| 77 |
</Flex> |
| 78 |
<TextareaControl |
| 79 |
label={__('Biography', 'thinkrank')} |
| 80 |
value={settings.person_description || ''} |
| 81 |
onChange={(value) => onSettingChange('person_description', value)} |
| 82 |
help={__('Brief professional biography or description', 'thinkrank')} |
| 83 |
disabled={!settings.enabled} |
| 84 |
rows={3} |
| 85 |
__nextHasNoMarginBottom={true} |
| 86 |
/> |
| 87 |
<Flex gap={2}> |
| 88 |
<FlexItem> |
| 89 |
<TextControl |
| 90 |
label={__('Website URL', 'thinkrank')} |
| 91 |
type="url" |
| 92 |
value={settings.person_url || ''} |
| 93 |
onChange={(value) => onSettingChange('person_url', value)} |
| 94 |
help={__('Personal or professional website', 'thinkrank')} |
| 95 |
disabled={!settings.enabled} |
| 96 |
__next40pxDefaultSize={true} |
| 97 |
__nextHasNoMarginBottom={true} |
| 98 |
/> |
| 99 |
</FlexItem> |
| 100 |
<FlexItem> |
| 101 |
<TextControl |
| 102 |
label={__('Email Address', 'thinkrank')} |
| 103 |
type="email" |
| 104 |
value={settings.person_email || ''} |
| 105 |
onChange={(value) => onSettingChange('person_email', value)} |
| 106 |
help={__('Professional contact email', 'thinkrank')} |
| 107 |
disabled={!settings.enabled} |
| 108 |
__next40pxDefaultSize={true} |
| 109 |
__nextHasNoMarginBottom={true} |
| 110 |
/> |
| 111 |
</FlexItem> |
| 112 |
</Flex> |
| 113 |
<Flex gap={2}> |
| 114 |
<FlexItem> |
| 115 |
<TextControl |
| 116 |
label={__('Phone Number', 'thinkrank')} |
| 117 |
type="tel" |
| 118 |
value={settings.person_telephone || ''} |
| 119 |
onChange={(value) => onSettingChange('person_telephone', value)} |
| 120 |
help={__('Professional contact number', 'thinkrank')} |
| 121 |
disabled={!settings.enabled} |
| 122 |
__next40pxDefaultSize={true} |
| 123 |
__nextHasNoMarginBottom={true} |
| 124 |
/> |
| 125 |
</FlexItem> |
| 126 |
<FlexItem> |
| 127 |
<TextControl |
| 128 |
label={__('Birth Date', 'thinkrank')} |
| 129 |
type="date" |
| 130 |
value={settings.person_birth_date || ''} |
| 131 |
onChange={(value) => onSettingChange('person_birth_date', value)} |
| 132 |
help={__('Date of birth (optional)', 'thinkrank')} |
| 133 |
disabled={!settings.enabled} |
| 134 |
__next40pxDefaultSize={true} |
| 135 |
__nextHasNoMarginBottom={true} |
| 136 |
/> |
| 137 |
</FlexItem> |
| 138 |
</Flex> |
| 139 |
<TextareaControl |
| 140 |
label={__('Address', 'thinkrank')} |
| 141 |
value={settings.person_address || ''} |
| 142 |
onChange={(value) => onSettingChange('person_address', value)} |
| 143 |
help={__('Professional address (optional)', 'thinkrank')} |
| 144 |
disabled={!settings.enabled} |
| 145 |
rows={2} |
| 146 |
__nextHasNoMarginBottom={true} |
| 147 |
/> |
| 148 |
<TextControl |
| 149 |
label={__('Works For (Organization)', 'thinkrank')} |
| 150 |
value={settings.person_works_for || ''} |
| 151 |
onChange={(value) => onSettingChange('person_works_for', value)} |
| 152 |
help={__('Organization or company name (optional)', 'thinkrank')} |
| 153 |
disabled={!settings.enabled} |
| 154 |
__next40pxDefaultSize={true} |
| 155 |
__nextHasNoMarginBottom={true} |
| 156 |
/> |
| 157 |
<div> |
| 158 |
<label style={{ fontSize: '11px', fontWeight: '500', marginBottom: '8px', display: 'block' }}> |
| 159 |
{__('Social Media Profiles (sameAs)', 'thinkrank')} |
| 160 |
</label> |
| 161 |
<FormTokenField |
| 162 |
value={settings.person_same_as || []} |
| 163 |
onChange={(value) => onSettingChange('person_same_as', value)} |
| 164 |
placeholder={__('Add social media URLs...', 'thinkrank')} |
| 165 |
help={__('Social media profile URLs (LinkedIn, Twitter, etc.) - optional', 'thinkrank')} |
| 166 |
disabled={!settings.enabled} |
| 167 |
__next40pxDefaultSize={true} |
| 168 |
__nextHasNoMarginBottom={true} |
| 169 |
/> |
| 170 |
</div> |
| 171 |
</Flex> |
| 172 |
</CardBody> |
| 173 |
</Card> |
| 174 |
); |
| 175 |
}; |
| 176 |
|
| 177 |
export default SchemaPersonForm; |
| 178 |
|