import { Breadcrumbs } from "@/client/components/Breadcrumbs"; import { CodeViewer } from "@/client/components/CodeViewer"; import { MarkdownContent } from "@/client/components/MarkdownContent"; import { RepoNav } from "@/client/components/RepoNav"; import { BlobActionsIsland } from "@/client/islands/blob-actions"; import { IslandHost } from "@/client/server/IslandHost"; type BreadcrumbItem = { name: string; href: string | null; }; export type BlobPageProps = { owner: string; repo: string; refEnc: string; fileName: string; codeLang?: string | null; lineCount?: number; sizeStr?: string; viewRawHref: string; rawHref: string; tooLarge?: boolean; isImage?: boolean; isPdf?: boolean; mediaSrc?: string; isMarkdown?: boolean; markdownRaw?: string; mdOwner?: string; mdRepo?: string; mdRef?: string; mdBase?: string; isBinary?: boolean; codeText?: string; breadcrumbs?: BreadcrumbItem[]; parentHref?: string | null; }; export function BlobPage(props: BlobPageProps) { const { owner, repo, refEnc, fileName, codeLang, lineCount, sizeStr, viewRawHref, rawHref, tooLarge, isImage, isPdf, mediaSrc, isMarkdown, markdownRaw, mdOwner, mdRepo, mdRef, mdBase, isBinary, codeText, breadcrumbs, parentHref, } = props; const showCopy = !isMarkdown && !isImage && !isPdf && !isBinary && !tooLarge; return (
File

Blob: {fileName}

{codeLang ? ( {codeLang} ) : null} {isMarkdown ? ( Markdown ) : null} {isMarkdown || codeLang ? ( lineCount ? ( {lineCount} line{lineCount === 1 ? "" : "s"} ) : null ) : sizeStr ? ( {sizeStr} ) : null}
{tooLarge ? (
File too large to preview.
) : null} {!tooLarge && isImage && mediaSrc ? (
{fileName}
) : null} {!tooLarge && isPdf && mediaSrc ? (
) : null} {!tooLarge && isMarkdown && markdownRaw && mdOwner && mdRepo && mdRef ? ( ) : null} {!tooLarge && isBinary && !isImage && !isPdf ? (
Binary file.
) : null} {!tooLarge && !isBinary && !isMarkdown && codeText !== undefined ? ( ) : null}
); }