Make Agency Lead field editable in campaign creation
- Add agencyLead state and form field to CreateCampaignModal - Remove disabled attribute and hardcoded value from Agency Lead input - Pass agency_lead to backend API when creating campaigns 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
7e24c9bd50
commit
9c25677563
2 changed files with 14 additions and 8 deletions
|
|
@ -149,12 +149,13 @@ const App: React.FC = () => {
|
|||
}
|
||||
}, [campaignProofs, selectedCampaign, selectedProof]);
|
||||
|
||||
const handleAddNewCampaign = async (campaignData: { name: string; workfrontId: string; clientLead: string; brandGuidelines: string; }) => {
|
||||
const handleAddNewCampaign = async (campaignData: { name: string; workfrontId: string; clientLead: string; agencyLead: string; brandGuidelines: string; }) => {
|
||||
try {
|
||||
const response = await apiService.createCampaign({
|
||||
name: campaignData.name,
|
||||
workfront_id: campaignData.workfrontId,
|
||||
client_lead: campaignData.clientLead,
|
||||
agency_lead: campaignData.agencyLead,
|
||||
brand_guidelines: campaignData.brandGuidelines,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ interface CreateCampaignModalProps {
|
|||
name: string;
|
||||
workfrontId: string;
|
||||
clientLead: string;
|
||||
agencyLead: string;
|
||||
brandGuidelines: string;
|
||||
}) => void;
|
||||
brandGuidelines?: string[];
|
||||
|
|
@ -20,6 +21,7 @@ export const CreateCampaignModal: React.FC<CreateCampaignModalProps> = ({ isOpen
|
|||
const [selectedBrandGuideline, setSelectedBrandGuideline] = useState('');
|
||||
const [workfrontId, setWorkfrontId] = useState('');
|
||||
const [clientLead, setClientLead] = useState('');
|
||||
const [agencyLead, setAgencyLead] = useState('');
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -29,6 +31,7 @@ export const CreateCampaignModal: React.FC<CreateCampaignModalProps> = ({ isOpen
|
|||
setSelectedBrandGuideline('');
|
||||
setWorkfrontId('');
|
||||
setClientLead('');
|
||||
setAgencyLead('');
|
||||
setError(null);
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
|
@ -53,7 +56,7 @@ export const CreateCampaignModal: React.FC<CreateCampaignModalProps> = ({ isOpen
|
|||
e.preventDefault();
|
||||
const isIdValidOnSubmit = /^#WF_\d+$/.test(workfrontId);
|
||||
|
||||
if (!name.trim() || !clientLead.trim() || !workfrontId.trim() || !selectedBrandGuideline.trim()) {
|
||||
if (!name.trim() || !clientLead.trim() || !agencyLead.trim() || !workfrontId.trim() || !selectedBrandGuideline.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -63,13 +66,13 @@ export const CreateCampaignModal: React.FC<CreateCampaignModalProps> = ({ isOpen
|
|||
}
|
||||
|
||||
setError(null);
|
||||
onAddCampaign({ name, workfrontId, clientLead, brandGuidelines: selectedBrandGuideline });
|
||||
onAddCampaign({ name, workfrontId, clientLead, agencyLead, brandGuidelines: selectedBrandGuideline });
|
||||
onClose();
|
||||
};
|
||||
|
||||
if (!isOpen) return null;
|
||||
|
||||
const isFormInvalid = !name.trim() || !workfrontId.trim() || !clientLead.trim() || !selectedBrandGuideline.trim();
|
||||
const isFormInvalid = !name.trim() || !workfrontId.trim() || !clientLead.trim() || !agencyLead.trim() || !selectedBrandGuideline.trim();
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
@ -152,12 +155,14 @@ export const CreateCampaignModal: React.FC<CreateCampaignModalProps> = ({ isOpen
|
|||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700">Agency Lead</label>
|
||||
<label htmlFor="agency-lead" className="block text-sm font-medium text-gray-700">Agency Lead</label>
|
||||
<input
|
||||
type="text"
|
||||
value="Steve O'Donoghue"
|
||||
className="mt-1 block w-full p-2 border border-gray-300 rounded-md shadow-sm bg-gray-100 text-gray-600 cursor-not-allowed"
|
||||
disabled
|
||||
id="agency-lead"
|
||||
value={agencyLead}
|
||||
onChange={(e) => setAgencyLead(e.target.value)}
|
||||
className="mt-1 block w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-brand-accent focus:border-brand-accent transition bg-white text-gray-900"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue