mirror of
https://github.com/borbann-platform/backend-api.git
synced 2025-12-18 20:24:05 +01:00
feat: add PipelineSummary component and integrate it into the multi-step form for enhanced overview of pipeline configuration
This commit is contained in:
parent
42b9fdedae
commit
6a48f4f234
@ -9,6 +9,7 @@ import { AddDataSource } from "@/components/pipeline/add-data-source";
|
|||||||
import { PipelineAiAssistant } from "@/components/pipeline/ai-assistant";
|
import { PipelineAiAssistant } from "@/components/pipeline/ai-assistant";
|
||||||
import { PipelineDetails } from "@/components/pipeline/details";
|
import { PipelineDetails } from "@/components/pipeline/details";
|
||||||
import { ScheduleAndInformation } from "@/components/pipeline/schedule-and-information";
|
import { ScheduleAndInformation } from "@/components/pipeline/schedule-and-information";
|
||||||
|
import { PipelineSummary } from "@/components/pipeline/summary";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import { Form } from "@/components/ui/form";
|
import { Form } from "@/components/ui/form";
|
||||||
@ -21,17 +22,8 @@ const stepComponents = [
|
|||||||
<AddDataSource key="datasource" />,
|
<AddDataSource key="datasource" />,
|
||||||
<PipelineAiAssistant key="ai" />,
|
<PipelineAiAssistant key="ai" />,
|
||||||
<ScheduleAndInformation key="schedule" />,
|
<ScheduleAndInformation key="schedule" />,
|
||||||
<div
|
<PipelineSummary key="summary" />,
|
||||||
key="inputs"
|
,
|
||||||
className="border border-dashed rounded-md flex flex-col items-center justify-center h-[8rem]"
|
|
||||||
>
|
|
||||||
<h3 className="text-base font-semibold text-center">
|
|
||||||
No Inputs Added Yet!
|
|
||||||
</h3>
|
|
||||||
<p className="text-xs text-muted-foreground text-center">
|
|
||||||
Start building your form by adding input fields.
|
|
||||||
</p>
|
|
||||||
</div>,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const motionVariants = {
|
const motionVariants = {
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useFormContext } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
@ -10,6 +13,8 @@ import { Label } from "../ui/label";
|
|||||||
import { Textarea } from "../ui/textarea";
|
import { Textarea } from "../ui/textarea";
|
||||||
|
|
||||||
export function PipelineDetails() {
|
export function PipelineDetails() {
|
||||||
|
const { register } = useFormContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="border-0 hover:border-highlight-border transition-all duration-200">
|
<Card className="border-0 hover:border-highlight-border transition-all duration-200">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
@ -22,7 +27,11 @@ export function PipelineDetails() {
|
|||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="name">Pipeline Name</Label>
|
<Label htmlFor="name">Pipeline Name</Label>
|
||||||
<Input id="name" placeholder="e.g., Property Listings Pipeline" />
|
<Input
|
||||||
|
id="name"
|
||||||
|
placeholder="e.g., Property Listings Pipeline"
|
||||||
|
{...register("name")}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
@ -31,6 +40,7 @@ export function PipelineDetails() {
|
|||||||
id="description"
|
id="description"
|
||||||
placeholder="Describe what this pipeline collects and how it will be used"
|
placeholder="Describe what this pipeline collects and how it will be used"
|
||||||
rows={4}
|
rows={4}
|
||||||
|
{...register("description")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -39,6 +49,7 @@ export function PipelineDetails() {
|
|||||||
<Input
|
<Input
|
||||||
id="tags"
|
id="tags"
|
||||||
placeholder="e.g., real-estate, properties, listings"
|
placeholder="e.g., real-estate, properties, listings"
|
||||||
|
{...register("tags")}
|
||||||
/>
|
/>
|
||||||
<p className="text-xs text-muted-foreground mt-1">
|
<p className="text-xs text-muted-foreground mt-1">
|
||||||
Separate tags with commas
|
Separate tags with commas
|
||||||
|
|||||||
118
frontend/components/pipeline/summary.tsx
Normal file
118
frontend/components/pipeline/summary.tsx
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
CardDescription,
|
||||||
|
CardHeader,
|
||||||
|
CardTitle,
|
||||||
|
} from "@/components/ui/card";
|
||||||
|
import { useFormContext } from "react-hook-form";
|
||||||
|
|
||||||
|
export const PipelineSummary = () => {
|
||||||
|
const { getValues } = useFormContext();
|
||||||
|
const values = getValues();
|
||||||
|
|
||||||
|
const tags = values.tags
|
||||||
|
? values.tags
|
||||||
|
.split(",")
|
||||||
|
.map((tag: string) => tag.trim()) // trim each tag
|
||||||
|
.filter(Boolean) // filter out empty strings
|
||||||
|
: [];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card className="mt-6 border-0 hover:border-highlight-border transition-all duration-200">
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>Pipeline Summary</CardTitle>
|
||||||
|
<CardDescription>
|
||||||
|
A quick overview of the pipeline configuration. Review before
|
||||||
|
launching.
|
||||||
|
</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent className="space-y-6 pt-6">
|
||||||
|
{/* details */}
|
||||||
|
<section>
|
||||||
|
<h3 className="text-xl font-semibold">Pipeline Details</h3>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div>
|
||||||
|
<strong>Name:</strong> {values.name || "—"}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>Description:</strong> {values.description || "—"}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>Tags:</strong>
|
||||||
|
<div className="flex flex-wrap gap-2 mt-2">
|
||||||
|
{tags.length > 0 ? (
|
||||||
|
tags.map((tag: string, index: number) => (
|
||||||
|
<Badge key={index} variant="outline">
|
||||||
|
{tag}
|
||||||
|
</Badge>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
No tags added
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* data sources */}
|
||||||
|
<section>
|
||||||
|
<h3 className="text-xl font-semibold">Data Sources</h3>
|
||||||
|
{values.dataSources && values.dataSources.length > 0 ? (
|
||||||
|
<ul className="list-disc pl-6 space-y-1">
|
||||||
|
{values.dataSources.map((src: string, index: number) => (
|
||||||
|
<li key={index}>{src}</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
) : (
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
No data sources added.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* AI Assistant */}
|
||||||
|
<section>
|
||||||
|
<h3 className="text-xl font-semibold">AI Assistant</h3>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div>
|
||||||
|
<strong>Prompt:</strong> {values.aiPrompt || "—"}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>Mode:</strong> {values.aiMode || "Default"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* schedule */}
|
||||||
|
<section>
|
||||||
|
<h3 className="text-xl font-semibold">Schedule</h3>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div>
|
||||||
|
<strong>Frequency:</strong> {values.schedule || "—"}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>Start Date:</strong> {values.startDate || "—"}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>Timezone:</strong> {values.timezone || "—"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* form Inputs */}
|
||||||
|
<section>
|
||||||
|
<h3 className="text-xl font-semibold">Form Inputs</h3>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
No input fields added yet.
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user