import { DatabaseIcon, FileUp, Globe, Plus, Trash2 } from "lucide-react"; import { useState } from "react"; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "../ui/accordion"; import { Badge } from "../ui/badge"; import { Button } from "../ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "../ui/card"; import { Input } from "../ui/input"; import { Label } from "../ui/label"; import { Textarea } from "../ui/textarea"; type SourceType = "website" | "file" | "api"; type Source = { id: string; type: SourceType; }; export function AddDataSource() { const [sources, setSources] = useState([ { id: "source-1", type: "website" }, { id: "source-2", type: "file" }, { id: "source-3", type: "api" }, ]); const addSource = (type: SourceType) => { const newId = `source-${Date.now()}`; setSources((prev) => [...prev, { id: newId, type }]); }; const removeSource = (id: string) => { setSources((prev) => prev.filter((source) => source.id !== id)); }; const renderSourceItem = (source: Source) => { const commonProps = { className: "border rounded-md mb-4 data-source-card", value: source.id, }; return (
{source.type === "website" && ( )} {source.type === "file" && ( )} {source.type === "api" && ( )} {`${ source.type.charAt(0).toUpperCase() + source.type.slice(1) } Source`}
{source.type === "website" && (
Pattern Detection