"use client" import { useState } from "react" import { cn } from "@lib/utils" import { dmSans125ClassName, dmSansClassName } from "@/lib/fonts" import { Loader2, XIcon } from "lucide-react" import { Button } from "@ui/components/button" import { Checkbox } from "@ui/components/checkbox" import * as DialogPrimitive from "@radix-ui/react-dialog" import { Dialog, DialogContent, DialogTitle, DialogDescription, } from "@repo/ui/components/dialog" const PROVIDER_LABELS: Record = { "google-drive": "Google Drive", notion: "Notion", onedrive: "OneDrive", gmail: "Gmail", github: "GitHub", "web-crawler": "Web Crawler", s3: "S3", } interface RemoveConnectionDialogProps { open: boolean onOpenChange: (open: boolean) => void providerName?: string provider?: string documentCount?: number onConfirm: (deleteDocuments: boolean) => void isDeleting: boolean } export function RemoveConnectionDialog({ open, onOpenChange, providerName, provider, documentCount = 0, onConfirm, isDeleting, }: RemoveConnectionDialogProps) { const [alsoDelete, setAlsoDelete] = useState(false) const displayName = providerName || (provider ? PROVIDER_LABELS[provider] : "this connection") const memoryNoun = documentCount === 1 ? "memory" : "memories" const hasMemories = documentCount > 0 const handleConfirm = () => { onConfirm(alsoDelete) } return ( { if (!isDeleting) { onOpenChange(o) if (!o) setAlsoDelete(false) } }} >
Disconnect {displayName}? Close
{hasMemories ? ( <> Sync stops. Your{" "} {documentCount} {memoryNoun} {" "} stay in Supermemory. ) : ( <>Sync stops. No memories were imported from this connection. )} {hasMemories && ( )}
) }