"use client"; import { useState } from "react"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { Github, Sparkles, Check } from "lucide-react"; import { toast } from "sonner"; import { CursorIcon } from "@/components/icons/custom-icons"; interface ConnectSourcesModalProps { open: boolean; onOpenChange: (open: boolean) => void; projectId: string; } // Mock connection states - these would come from your database in production const useConnectionStates = () => { const [connections, setConnections] = useState({ vibn: false, chatgpt: false, github: false, v0: false, }); return { connections, setConnections }; }; export function ConnectSourcesModal({ open, onOpenChange, projectId, }: ConnectSourcesModalProps) { const { connections, setConnections } = useConnectionStates(); const handleConnect = async (source: "vibn" | "chatgpt" | "github" | "v0") => { // Mock connection logic - replace with actual OAuth/API integration const sourceName = source === "vibn" ? "Vib'n Extension" : source === "chatgpt" ? "ChatGPT" : source === "github" ? "GitHub" : "v0"; toast.success(`Connecting to ${sourceName}...`); // Simulate connection delay setTimeout(() => { setConnections((prev) => ({ ...prev, [source]: true })); toast.success(`${sourceName} connected successfully!`); }, 1000); }; const handleDisconnect = (source: "vibn" | "chatgpt" | "github" | "v0") => { const sourceName = source === "vibn" ? "Vib'n Extension" : source === "chatgpt" ? "ChatGPT" : source === "github" ? "GitHub" : "v0"; setConnections((prev) => ({ ...prev, [source]: false })); toast.success(`${sourceName} disconnected`); }; const sources = [ { id: "vibn" as const, name: "Vib'n Extension", description: "Connect the Vib'n extension with Cursor for seamless development tracking", icon: CursorIcon, color: "text-foreground", bgColor: "bg-primary/10", }, { id: "chatgpt" as const, name: "ChatGPT", description: "Connect your ChatGPT project for AI-powered insights and context", icon: Sparkles, color: "text-green-500", bgColor: "bg-green-500/10", }, { id: "github" as const, name: "GitHub", description: "Sync your repository to track code changes and generate screens", icon: Github, color: "text-foreground", bgColor: "bg-foreground/10", }, { id: "v0" as const, name: "v0", description: "Connect v0 to generate and iterate on UI designs", icon: Sparkles, color: "text-blue-500", bgColor: "bg-blue-500/10", }, ]; return ( Connect Sources Connect external sources to enhance your product development workflow
{sources.map((source) => { const Icon = source.icon; const isConnected = connections[source.id]; return (

{source.name}

{isConnected && (
Connected
)}

{source.description}

{isConnected ? ( ) : ( )}
); })}
); }