diff --git a/src/app/admin/flows/[id]/page.tsx b/src/app/admin/flows/[id]/page.tsx index 6aeab51..6bd16b7 100644 --- a/src/app/admin/flows/[id]/page.tsx +++ b/src/app/admin/flows/[id]/page.tsx @@ -1,144 +1,161 @@ 'use client'; -import { useEffect, useState, useActionState } from 'react'; -import { useFormStatus } from 'react-dom'; -import { getFlow, saveFlow, type Flow } from '@/lib/actions/flows'; import { Button } from '@/components/ui/button'; +import { Card, CardContent } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; -import { Textarea } from '@/components/ui/textarea'; -import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from '@/components/ui/card'; -import { useToast } from '@/hooks/use-toast'; -import Link from 'next/link'; -import { ChevronLeft } from 'lucide-react'; -import { Skeleton } from '@/components/ui/skeleton'; +import { Badge } from '@/components/ui/badge'; +import { + Play, + Share2, + MessageSquare, + Pencil, + Settings, + Bike, + Footprints, + MoreHorizontal, + Plus, + Minus, + Code2 +} from 'lucide-react'; +import { FlowNode, FlowNodeInput, FlowNodeOption, FlowNodeMessage } from '@/components/admin/flow-node'; -interface FlowFormPageProps { - params: { id: string }; -} - -function SubmitButton({ isNew }: { isNew: boolean }) { - const { pending } = useFormStatus(); +export default function FlowEditorPage() { return ( - - ); -} +
+ {/* Header */} +
+
+

Quick Carb Calculator

+ +
+
+ + + +
+
+ + {/* Main Content */} +
+ {/* Flow Canvas */} +
+ {/* This is a static representation. A real implementation would use a library like React Flow. */} +
+ } /> +
-export default function FlowFormPage({ params }: FlowFormPageProps) { - const [state, formAction] = useActionState(saveFlow, { success: false, message: '', errors: null }); - const [flow, setFlow] = useState(null); - const [isLoading, setIsLoading] = useState(true); - const { toast } = useToast(); - - const isNew = params.id === 'new'; - - useEffect(() => { - if (!isNew) { - const fetchFlow = async () => { - setIsLoading(true); - const existingFlow = await getFlow(Number(params.id)); - setFlow(existingFlow); - setIsLoading(false); - }; - fetchFlow(); - } else { - setIsLoading(false); - } - }, [params.id, isNew]); - - useEffect(() => { - if (state.message && !state.success) { - toast({ - title: 'Error', - description: state.message, - variant: 'destructive', - }); - } - }, [state, toast]); - - if (isLoading) { - return ( -
- - - - - - - -
- - +
+ + + + + } text="Ride" /> + } text="Run" /> + } text="Other" /> +
+

Default

+ Set Sport
-
- - -
-
- - + +
+ +
+ + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + Set Assistant + +
+ + + {/* Canvas Controls */} +
+ + + + + + + + +
+
+ + {/* Phone Preview */} +
+ + +
+ {/* Chat messages */} +
+ First, what are you fueling for? +
+
+ Ride +
+
+ Run +
+
+ Other +
+ +
+ Run +
+ +
+ Great! How long will you be doing this activity? +
+
+ I'll try 3h30 +
+
+ Understood! Now, how hard will you be going? +
+
+ I'd say a good 8 out of 10 +
+
+ Total carbs: 90-120g +
+
- - -
- ) - } - - const getError = (field: string) => { - return state.errors?.find(e => e.path?.[0] === field)?.message; - } - - return ( -
-
- -

- {isNew ? 'Create New Flow' : 'Edit Flow'} -

- -
- - - Flow Details - - {isNew ? 'Fill in the details for your new flow.' : 'Update the details for this flow.'} - - - - -
- - - {getError('name') &&

{getError('name')}

} -
-
- - - {getError('path') &&

{getError('path')}

} -
-
- -