"use client"; import { cn } from "@repo/lib/utils"; import { Badge } from "@repo/ui/components/badge"; import { Button } from "@repo/ui/components/button"; import { GlassMenuEffect } from "@repo/ui/other/glass-effect"; import { Brain, Calendar, ExternalLink, FileText, Hash, X } from "lucide-react"; import { motion } from "motion/react"; import { memo } from "react"; import { GoogleDocs, GoogleDrive, GoogleSheets, GoogleSlides, MicrosoftExcel, MicrosoftOneNote, MicrosoftPowerpoint, MicrosoftWord, NotionDoc, OneDrive, PDF, } from "../assets/icons"; import { HeadingH3Bold } from "../text/heading/heading-h3-bold"; import type { DocumentWithMemories, MemoryEntry, NodeDetailPanelProps, } from "./types"; const formatDocumentType = (type: string) => { // Special case for PDF if (type.toLowerCase() === "pdf") return "PDF"; // Replace underscores with spaces and capitalize each word return type .split("_") .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) .join(" "); }; const getDocumentIcon = (type: string) => { const iconProps = { className: "w-5 h-5 text-slate-300" }; switch (type) { case "google_doc": return ; case "google_sheet": return ; case "google_slide": return ; case "google_drive": return ; case "notion": case "notion_doc": return ; case "word": case "microsoft_word": return ; case "excel": case "microsoft_excel": return ; case "powerpoint": case "microsoft_powerpoint": return ; case "onenote": case "microsoft_onenote": return ; case "onedrive": return ; case "pdf": return ; default: return ; } }; export const NodeDetailPanel = memo( ({ node, onClose, variant = "console" }) => { // Use explicit classes that Tailwind can detect const getPositioningClasses = () => { // Both variants use the same positioning for nodeDetail return "top-4 right-4"; }; if (!node) return null; const isDocument = node.type === "document"; const data = node.data; return ( {/* Glass effect background */}
{isDocument ? ( getDocumentIcon((data as DocumentWithMemories).type) ) : ( )} {isDocument ? "Document" : "Memory"}
{isDocument ? ( <>
Title

{(data as DocumentWithMemories).title || "Untitled Document"}

{(data as DocumentWithMemories).summary && (
Summary

{(data as DocumentWithMemories).summary}

)}
Type

{formatDocumentType((data as DocumentWithMemories).type)}

Memory Count

{(data as DocumentWithMemories).memoryEntries.length}{" "} memories

{((data as DocumentWithMemories).url || (data as DocumentWithMemories).customId) && ( )} ) : ( <>
Memory

{(data as MemoryEntry).memory}

{(data as MemoryEntry).isForgotten && ( Forgotten )} {(data as MemoryEntry).forgetAfter && (

Expires:{" "} {(data as MemoryEntry).forgetAfter ? new Date( (data as MemoryEntry).forgetAfter!, ).toLocaleDateString() : ""}{" "} {"forgetReason" in data && data.forgetReason && `- ${data.forgetReason}`}

)}
Space

{(data as MemoryEntry).spaceId || "Default"}

)}
{new Date(data.createdAt).toLocaleDateString()} {node.id}
); }, ); NodeDetailPanel.displayName = "NodeDetailPanel";