"use client" import { useState } from "react" import { Card, CardContent } from "@repo/ui/components/card" import { Badge } from "@repo/ui/components/badge" import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@repo/ui/components/alert-dialog" import { ExternalLink, FileText, Brain, Trash2 } from "lucide-react" import { cn } from "@lib/utils" import { colors } from "@repo/ui/memory-graph/constants" import { getPastelBackgroundColor } from "../memories-utils" interface GoogleDocsCardProps { title: string url: string | null | undefined description?: string | null className?: string onClick?: () => void onDelete?: () => void showExternalLink?: boolean activeMemories?: Array<{ id: string; isForgotten?: boolean }> lastModified?: string | Date } export const GoogleDocsCard = ({ title, url, description, className, onClick, onDelete, showExternalLink = true, activeMemories, lastModified, }: GoogleDocsCardProps) => { const [isDialogOpen, setIsDialogOpen] = useState(false) const handleCardClick = () => { if (!isDialogOpen) { if (onClick) { onClick() } else if (url) { window.open(url, "_blank", "noopener,noreferrer") } } } const handleExternalLinkClick = (e: React.MouseEvent) => { e.stopPropagation() if (url) { window.open(url, "_blank", "noopener,noreferrer") } } return ( {onDelete && ( e.stopPropagation()}> Delete Document Are you sure you want to delete this document and all its related memories? This action cannot be undone. { e.stopPropagation() }} > Cancel { e.stopPropagation() onDelete() }} > Delete )}
Google Docs
Google Docs
{showExternalLink && ( )}

{title || "Untitled Document"}

{description && (

{description}

)}
Google Workspace
{lastModified && ( Modified{" "} {lastModified instanceof Date ? lastModified.toLocaleDateString() : new Date(lastModified).toLocaleDateString()} )}
{activeMemories && activeMemories.length > 0 && (
{activeMemories.length}{" "} {activeMemories.length === 1 ? "memory" : "memories"}
)}
) } GoogleDocsCard.displayName = "GoogleDocsCard"