supermemory/apps/web/components/document-cards/note-preview.tsx
ved015 4e607f9fd7 fix: Add plugin document rendering and MCP preview support (#938)
<h3>Implement comprehensive plugin document rendering support including MCP previews and plugin specific content handling.</h3>
<br>
<br>

<img width="1680" height="471" alt="Screenshot 2026-05-12 at 8 24 49 PM" src="https://github.com/user-attachments/assets/f1294bc2-2841-4833-9f01-ac47b8c52c01" />

<br>
<br>

<img width="1680" height="963" alt="Screenshot 2026-05-12 at 8 28 25 PM" src="https://github.com/user-attachments/assets/9436c7ab-3b9b-4366-86fd-1465407ff0f9" />
2026-05-15 18:26:37 +00:00

52 lines
1.3 KiB
TypeScript

"use client"
import type { DocumentsWithMemoriesResponseSchema } from "@repo/validation/api"
import type { z } from "zod"
import { dmSansClassName } from "@/lib/fonts"
import { cn } from "@lib/utils"
import { DocumentIcon } from "@/components/document-icon"
import type { ParsedPluginDocument } from "@/lib/plugin-document"
import { PluginPreview } from "./plugin-preview"
type DocumentsResponse = z.infer<typeof DocumentsWithMemoriesResponseSchema>
type DocumentWithMemories = DocumentsResponse["documents"][0]
export function NotePreview({
document,
parsed,
}: {
document: DocumentWithMemories
parsed?: ParsedPluginDocument | null
}) {
if (parsed) {
return <PluginPreview parsed={parsed} />
}
return (
<div className="bg-[#0B1017] p-3 rounded-[18px] space-y-2">
<div className="flex items-center gap-1">
<DocumentIcon type="note" className="size-4" />
<p className={cn(dmSansClassName(), "text-[13px] font-semibold")}>
Note
</p>
</div>
<div>
{document.title && (
<p
className={cn(
dmSansClassName(),
"text-[13px] font-semibold line-clamp-2 leading-[125%]",
)}
>
{document.title}
</p>
)}
{document.summary && (
<p className="text-[11px] text-[#737373] line-clamp-4">
{document.summary}
</p>
)}
</div>
</div>
)
}