diff --git a/src/components/admin/flow-canvas.tsx b/src/components/admin/flow-canvas.tsx index cf94405..a4a1659 100644 --- a/src/components/admin/flow-canvas.tsx +++ b/src/components/admin/flow-canvas.tsx @@ -1,7 +1,7 @@ 'use client'; -import React from 'react'; +import React, { useState } from 'react'; import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card'; import { MoreVertical, Trash2, Edit, Plus, Move } from 'lucide-react'; import { Button } from '@/components/ui/button'; @@ -11,9 +11,28 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogDescription, + DialogFooter, + DialogClose, +} from '@/components/ui/dialog'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import { Textarea } from '../ui/textarea'; -// Mock data for the flow steps. In a real app, this would come from a database. -const flowSteps = [ +type FlowStep = { + id: number; + title: string; + type: string; + description: string; +}; + +// Mock data for the flow steps. +const initialFlowSteps: FlowStep[] = [ { id: 1, title: 'Project Type', type: 'Step 1', description: 'What are you looking to build?' }, { id: 2, title: 'Service Type', type: 'Step 2', description: 'Choose a service.' }, { id: 3, title: 'Project Stage', type: 'Step 3', description: 'Choose the stage of your project.' }, @@ -28,7 +47,70 @@ const flowSteps = [ { id: 12, title: 'Results', type: 'Results', description: 'Show the project estimate.' }, ]; -function FlowStepCard({ step }: { step: typeof flowSteps[0] }) { +function EditStepDialog({ + step, + isOpen, + onOpenChange, + onSave, +}: { + step: FlowStep | null; + isOpen: boolean; + onOpenChange: (isOpen: boolean) => void; + onSave: (updatedStep: FlowStep) => void; +}) { + const [editedStep, setEditedStep] = useState(step); + + React.useEffect(() => { + setEditedStep(step); + }, [step]); + + if (!editedStep) return null; + + const handleSave = () => { + onSave(editedStep); + onOpenChange(false); + }; + + return ( + + + + Edit Step: {step?.title} + + Modify the details for this step in your flow. + + +
+
+ + setEditedStep({ ...editedStep, title: e.target.value })} + /> +
+
+ +