"use client" import { useState } from "react" import { usePipelines, useConfigurePipeline } from "@/hooks/use-pipelines" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Textarea } from "@/components/ui/textarea" import { Label } from "@/components/ui/label" import { Badge } from "@/components/ui/badge" import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table" import { Spinner } from "@/components/ui/spinner" import { toast } from "sonner" export default function PipelinesPage() { const { data: pipelines, isLoading } = usePipelines() const configure = useConfigurePipeline() const [triggerEvent, setTriggerEvent] = useState("") const [stepsJson, setStepsJson] = useState("[]") const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() try { const steps = JSON.parse(stepsJson) await configure.mutateAsync({ trigger_event: triggerEvent, steps }) toast.success("Pipeline configured") } catch { toast.error("Failed — check JSON syntax") } } return (