when you click on edit flows, the whole flow sjould be displayed with an
This commit is contained in:
@@ -8,11 +8,12 @@ import { Button } from '@/components/ui/button';
|
|||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Label } from '@/components/ui/label';
|
import { Label } from '@/components/ui/label';
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card';
|
import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from '@/components/ui/card';
|
||||||
import { useToast } from '@/hooks/use-toast';
|
import { useToast } from '@/hooks/use-toast';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { ChevronLeft } from 'lucide-react';
|
import { ChevronLeft, Plus } from 'lucide-react';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
|
import { FlowCanvas } from '@/components/admin/flow-canvas';
|
||||||
|
|
||||||
interface FlowFormPageProps {
|
interface FlowFormPageProps {
|
||||||
params: { id: string };
|
params: { id: string };
|
||||||
@@ -93,7 +94,7 @@ export default function FlowFormPage({ params }: FlowFormPageProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form action={formAction} className="space-y-8">
|
<div className="space-y-8">
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<Button variant="outline" size="icon" asChild>
|
<Button variant="outline" size="icon" asChild>
|
||||||
<Link href="/admin/flows">
|
<Link href="/admin/flows">
|
||||||
@@ -106,6 +107,7 @@ export default function FlowFormPage({ params }: FlowFormPageProps) {
|
|||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form action={formAction} className="space-y-8">
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>Flow Details</CardTitle>
|
<CardTitle>Flow Details</CardTitle>
|
||||||
@@ -131,9 +133,15 @@ export default function FlowFormPage({ params }: FlowFormPageProps) {
|
|||||||
{getError('description') && <p className="text-sm text-destructive">{getError('description')}</p>}
|
{getError('description') && <p className="text-sm text-destructive">{getError('description')}</p>}
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
<CardFooter>
|
||||||
|
|
||||||
<SubmitButton isNew={isNew} />
|
<SubmitButton isNew={isNew} />
|
||||||
|
</CardFooter>
|
||||||
|
</Card>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
{!isNew && (
|
||||||
|
<FlowCanvas />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import React 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';
|
||||||
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from '@/components/ui/dropdown-menu';
|
||||||
|
|
||||||
|
// Mock data for the flow steps. In a real app, this would come from a database.
|
||||||
|
const flowSteps = [
|
||||||
|
{ 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.' },
|
||||||
|
{ id: 4, title: 'Design Process', type: 'Step 4', description: 'What type of design process?' },
|
||||||
|
{ id: 5, title: 'Page Count', type: 'Step 5', description: 'How many pages/screens?' },
|
||||||
|
{ id: 6, title: 'Animations', type: 'Step 6', description: 'Implement animated elements?' },
|
||||||
|
{ id: 7, title: 'Illustrations', type: 'Step 7', description: 'Create tailored illustrations?' },
|
||||||
|
{ id: 8, title: 'Branding', type: 'Step 8', description: 'Have you thought about branding?' },
|
||||||
|
{ id: 9, title: 'Additional Features', type: 'Step 9', description: 'Develop additional features?' },
|
||||||
|
{ id: 10, title: 'Shopping Cart', type: 'Step 10', description: 'Need a shopping cart?' },
|
||||||
|
{ id: 11, title: 'UI/UX Design', type: 'Step 12', description: 'What type of design process?' },
|
||||||
|
{ id: 12, title: 'Results', type: 'Results', description: 'Show the project estimate.' },
|
||||||
|
];
|
||||||
|
|
||||||
|
function FlowStepCard({ step }: { step: typeof flowSteps[0] }) {
|
||||||
|
return (
|
||||||
|
<Card className="w-72 shadow-md hover:shadow-lg transition-shadow bg-card">
|
||||||
|
<CardHeader className="flex flex-row items-center justify-between pb-2">
|
||||||
|
<div className="space-y-1">
|
||||||
|
<p className="text-xs font-semibold uppercase text-primary">{step.type}</p>
|
||||||
|
<CardTitle className="text-lg">{step.title}</CardTitle>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<Button variant="ghost" size="icon" className="cursor-move h-8 w-8">
|
||||||
|
<Move className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<Button variant="ghost" size="icon" className="h-8 w-8">
|
||||||
|
<MoreVertical className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent align="end">
|
||||||
|
<DropdownMenuItem>
|
||||||
|
<Edit className="mr-2 h-4 w-4" />
|
||||||
|
<span>Edit</span>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem className="text-destructive">
|
||||||
|
<Trash2 className="mr-2 h-4 w-4" />
|
||||||
|
<span>Delete</span>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
</div>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<p className="text-sm text-muted-foreground">{step.description}</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function FlowCanvas() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>Flow Canvas</CardTitle>
|
||||||
|
<CardDescription>
|
||||||
|
Visually represent and manage the steps of your flow.
|
||||||
|
</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<div className="relative rounded-lg border border-dashed bg-muted/50 p-8 min-h-[500px]">
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8">
|
||||||
|
{flowSteps.map((step) => (
|
||||||
|
<FlowStepCard key={step.id} step={step} />
|
||||||
|
))}
|
||||||
|
<Button variant="outline" className="w-72 h-full min-h-[150px] border-dashed flex flex-col gap-2 items-center justify-center text-muted-foreground hover:text-foreground hover:border-primary">
|
||||||
|
<Plus className="h-8 w-8" />
|
||||||
|
<span>Add New Step</span>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user