diff --git a/frontend/app/(sidebar)/data-pipeline/create/create-pipeline-multiform.tsx b/frontend/app/(sidebar)/data-pipeline/create/create-pipeline-multiform.tsx new file mode 100644 index 0000000..ded062e --- /dev/null +++ b/frontend/app/(sidebar)/data-pipeline/create/create-pipeline-multiform.tsx @@ -0,0 +1,130 @@ +"use client"; + +import { AnimatePresence, motion } from "framer-motion"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import { toast } from "sonner"; + +import { AddDataSource } from "@/components/pipeline/add-data-source"; +import { PipelineAiAssistant } from "@/components/pipeline/ai-assistant"; +import { PipelineDetails } from "@/components/pipeline/details"; +import { ScheduleAndInformation } from "@/components/pipeline/schedule-and-information"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent } from "@/components/ui/card"; +import { Form } from "@/components/ui/form"; +import { cn } from "@/lib/utils"; + +const TOTAL_STEPS = 5; + +const stepComponents = [ + , + , + , + , +
+

+ No Inputs Added Yet! +

+

+ Start building your form by adding input fields. +

+
, +]; + +const motionVariants = { + enter: { opacity: 0, x: 50 }, + center: { opacity: 1, x: 0 }, + exit: { opacity: 0, x: -50 }, +}; + +export default function CratePipelineForm() { + const [step, setStep] = useState(0); + const isFirstStep = step === 0; + const isLastStep = step === TOTAL_STEPS - 1; + + const form = useForm(); + const { handleSubmit, reset } = form; + + const onSubmit = async (formData: unknown) => { + if (!isLastStep) return setStep((s) => s + 1); + console.log(formData); + reset(); + setStep(0); + toast.success("Form successfully submitted"); + }; + + const handleBack = () => setStep((s) => (s > 0 ? s - 1 : s)); + + const StepForm = ( +
+ + {stepComponents[step]} +
+ + +
+
+ + ); + + return ( +
+ {/* stepper */} +
+ {Array.from({ length: TOTAL_STEPS }).map((_, index) => ( +
+
+ {index < TOTAL_STEPS - 1 && ( +
+ )} +
+ ))} +
+ + {/* animated form */} + + + + + {StepForm} + + + + +
+ ); +} diff --git a/frontend/app/(sidebar)/data-pipeline/create/page.tsx b/frontend/app/(sidebar)/data-pipeline/create/page.tsx index 42edcdf..7f20f31 100644 --- a/frontend/app/(sidebar)/data-pipeline/create/page.tsx +++ b/frontend/app/(sidebar)/data-pipeline/create/page.tsx @@ -1,25 +1,11 @@ import { Button } from "@/components/ui/button"; import { ArrowLeft } from "lucide-react"; import Link from "next/link"; -import PageHeader from "@/components/page-header"; -import { PipelineDetails } from "@/components/pipeline/details"; -import { PipelineAiAssistant } from "@/components/pipeline/ai-assistant"; -import { AddDataSource } from "@/components/pipeline/add-data-source"; -import { ScheduleAndInformation } from "@/components/pipeline/schedule-and-information"; +import CratePipelineForm from "./create-pipeline-multiform"; export default function CreatePipelinePage() { return (
- -
- -
-
- - -
- -
- -
-
- +
- - + {/* + */}
diff --git a/frontend/components/pipeline/add-data-source.tsx b/frontend/components/pipeline/add-data-source.tsx index b16ef6b..cc655cb 100644 --- a/frontend/components/pipeline/add-data-source.tsx +++ b/frontend/components/pipeline/add-data-source.tsx @@ -5,6 +5,8 @@ import { AccordionItem, AccordionTrigger, } from "../ui/accordion"; +import { Badge } from "../ui/badge"; +import { Button } from "../ui/button"; import { Card, CardContent, @@ -12,15 +14,13 @@ import { CardHeader, CardTitle, } from "../ui/card"; -import { Label } from "../ui/label"; import { Input } from "../ui/input"; -import { Badge } from "../ui/badge"; +import { Label } from "../ui/label"; import { Textarea } from "../ui/textarea"; -import { Button } from "../ui/button"; export function AddDataSource() { return ( - + Data Sources diff --git a/frontend/components/pipeline/ai-assistant.tsx b/frontend/components/pipeline/ai-assistant.tsx index 810899d..1ce3375 100644 --- a/frontend/components/pipeline/ai-assistant.tsx +++ b/frontend/components/pipeline/ai-assistant.tsx @@ -1,76 +1,69 @@ -import { Switch } from "../ui/switch"; -import { BrainCircuit } from "lucide-react"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "../ui/card"; import { Label } from "../ui/label"; -import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "../ui/card"; import { Textarea } from "../ui/textarea"; -export function PipelineAiAssistant(){ - return ( - - -
- - - AI Assistant - - - Customize how AI processes your data - +export function PipelineAiAssistant() { + return ( + + + AI Assistant + Customize how AI processes your data + + +
+
+ +