import React, { useState } from 'react'; import { templates } from '../constants/templates'; import Modal from './ui/Modal'; import { Button } from './ui/Button'; import { Plus, Lock, Sparkles } from 'lucide-react'; import AiWorkflowGenerator from './AiWorkflowGenerator'; const TemplatesModal = ({ isOpen, onClose, onSelect, isProActive }) => { const [tab, setTab] = useState('templates'); const handleSelect = (template) => { setTab('templates'); onSelect(template); }; return (
{/* Tab switcher */}
{tab === 'templates' ? ( <>

Start with a pre-configured workflow or start from scratch.

{/* Start from Scratch Option */}
handleSelect(null)} className="flex flex-col items-center justify-center p-6 border-2 border-dashed border-border rounded-xl hover:border-primary hover:bg-primary/5 cursor-pointer transition-all group text-center" >

Start from Scratch

Begin with an empty canvas and build your own workflow.

{/* Prebuilt Templates */} {templates.map((template) => { const locked = template.isPro && !isProActive; return (
!locked && handleSelect(template)} className={`relative flex flex-col p-6 border rounded-xl transition-all bg-card/50 group ${ locked ? 'border-border opacity-60 cursor-not-allowed select-none' : 'border-border hover:border-primary hover:shadow-lg cursor-pointer' }`} > {/* PRO badge */} {template.isPro && ( {locked && } PRO )}
{template.icon}

{template.name}

Prebuilt

{template.description}

{locked ? (
Requires Pro license e.stopPropagation()} className="ml-1 underline hover:text-amber-800" > Upgrade
) : (
Use this template
)}
); })}
) : ( )}
); }; export default TemplatesModal;