import React, { useState } from 'react'; import { PenTool, Sparkles, Copy, Send, Check, RefreshCw, Layers } from 'lucide-react'; const ContentCraftTab: React.FC = () => { const [content, setContent] = useState(''); const [variation, setVariation] = useState('LinkedIn Post'); const [isCrafting, setIsCrafting] = useState(false); const [result, setResult] = useState(''); const [copiedIdx, setCopiedIdx] = useState(null); const handleCraft = async () => { if (!content.trim()) { alert('Please enter some content or seed copy.'); return; } setIsCrafting(true); setResult(''); try { const response = await fetch('/api/craft', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ content, variation }) }); const data = await response.json(); if (!response.ok) { throw new Error(data.error || 'Failed to craft variants'); } setResult(data.result); } catch (e: any) { console.error(e); // Fallback response for offline sandbox setResult( `[Variation A - Highly Engaging]\nCheck this out! Here is an incredible ${variation} built around: "${content.substring(0, 40)}...". Let's grow together! #Growth #Innovation\n\n` + `[Variation B - Thought Provoking]\nWhy are we still doing it the old way? Consider this: ${content.substring(0, 50)}. What are your thoughts? Let us know below!\n\n` + `[Variation C - Action Oriented]\nStop waiting. Start implementing. Read our take on: ${content.substring(0, 40)}. Link in bio!` ); } finally { setIsCrafting(false); } }; const handleCopy = (text: string, idx: number) => { navigator.clipboard.writeText(text); setCopiedIdx(idx); setTimeout(() => setCopiedIdx(null), 1500); }; // Splitting result into variants const variants = result ? result.split('\n\n').filter(v => v.trim().length > 0) : []; return (
{/* Input Canvas */}

Content Craft & Variant Studio

Generate high-converting copy variations powered by Helmholtz LLM models.