supermemory/apps/web/components/document-modal/title.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

60 lines
1.3 KiB
TypeScript

import Image from "next/image"
import { cn } from "@lib/utils"
import { dmSansClassName } from "@/lib/fonts"
import { DocumentIcon } from "@/components/document-icon"
function getFileExtension(documentType: string): string | null {
switch (documentType) {
case "pdf":
return ".pdf"
default:
return null
}
}
export function Title({
title,
documentType,
url,
pluginIconSrc,
}: {
title: string | null | undefined
documentType: string
url?: string | null
pluginIconSrc?: string
}) {
const extension = getFileExtension(documentType)
return (
<div
className={cn(
dmSansClassName(),
"text-[16px] font-semibold text-[#FAFAFA] leading-[125%] flex items-center gap-3 min-w-0",
)}
>
<div className="pl-1 flex items-center gap-1 shrink-0">
{pluginIconSrc ? (
<Image
src={pluginIconSrc}
alt=""
width={20}
height={20}
className="rounded-[4px]"
aria-hidden
/>
) : (
<DocumentIcon type={documentType} url={url} className="size-5" />
)}
{extension && (
<p
className={cn(dmSansClassName(), "text-[12px] font-semibold")}
style={{ color: "#FF7673" }}
>
{extension}
</p>
)}
</div>
<span className="truncate">{title || "Untitled Document"}</span>
</div>
)
}