Skip to content

armgit / ui

Public Imported from GitHub
0
TypeScript
4.1 KB
Raw Blame
type PdfViewerBlockConfig = {
  id: string
  title: string
  badge?: string
  description: string
  command: string
  docsHref: string
  viewHref: string
  hideHeader?: boolean
  previewHeightClassName?: string
}

function getRegistryAddCommand(name: string) {
  return `pnpm dlx shadcn@latest add @extend/${name}`
}

export const PDF_VIEWER_BLOCKS = [
  {
    id: "layout-blocks",
    title: "Layout Blocks",
    description:
      "Structured layout review with typed blocks, confidence, and page overlays.",
    hideHeader: true,
    command: getRegistryAddCommand("layout-blocks-block"),
    docsHref: "/docs/components/layout-blocks",
    viewHref: "/view/blocks/layout-blocks",
  },
  {
    id: "bounding-box-citations",
    title: "Bounding Box Citations",
    description:
      "Extraction citations connected to source bounding boxes in the PDF viewer.",
    command: getRegistryAddCommand("bounding-box-citations-block"),
    docsHref: "/docs/components/bounding-box-citations",
    viewHref: "/view/blocks/bounding-box-citations",
  },
  {
    id: "file-system",
    title: "File System (Finder)",
    description:
      "A Finder-style file browser that opens PDF, DOCX, XLSX, and image files in viewer dialogs.",
    command: getRegistryAddCommand("file-system-block"),
    docsHref: "/docs/components/file-system",
    viewHref: "/view/blocks/file-system",
  },
  {
    id: "pdf-dropzone",
    title: "PDF Dropzone",
    description:
      "A PDF-only upload dropzone that opens the dropped file in the shared viewer.",
    command: getRegistryAddCommand("pdf-dropzone"),
    docsHref: "/docs/components/file-upload",
    viewHref: "/view/blocks/pdf-dropzone",
  },
  {
    id: "e-signature",
    title: "E-Signature",
    description:
      "Signature fields connected to the PDF canvas and signed PDF export.",
    hideHeader: true,
    command: getRegistryAddCommand("e-signature"),
    docsHref: "/docs/components/e-signature",
    viewHref: "/view/blocks/e-signature",
  },
  {
    id: "document-splits",
    title: "Document Splits",
    description:
      "Lazy page thumbnails, draggable split groups, and PDF navigation.",
    command: getRegistryAddCommand("document-splits-block"),
    docsHref: "/docs/components/document-splits",
    viewHref: "/view/blocks/document-splits",
  },
  {
    id: "excel-editor",
    title: "Excel Editor",
    description:
      "A full workbook editor with cell formatting, merge tools, sheets, zoom, and export controls.",
    command: getRegistryAddCommand("excel-editor"),
    docsHref: "/docs/components/xlsx-editor",
    viewHref: "/view/blocks/excel-editor",
  },
  {
    id: "pdf-editor-block",
    title: "PDF Editor",
    badge: "New",
    description:
      "A full PDF editor with annotations, comments, redaction, forms, signatures, stamps, page organization, security, print, and export.",
    command: getRegistryAddCommand("pdf-editor-block"),
    docsHref: "/docs/components/pdf-editor",
    viewHref: "/view/blocks/pdf-editor-block",
    previewHeightClassName: "h-[760px]",
  },
  {
    id: "docx-editor-block",
    title: "DOCX Editor",
    description:
      "A Word-style document editor with formatting controls, page thumbnails, and DOCX export.",
    command: getRegistryAddCommand("docx-editor-block"),
    docsHref: "/docs/components/docx-editor",
    viewHref: "/view/blocks/docx-editor-block",
    previewHeightClassName: "h-[720px]",
  },
  {
    id: "docx-layout-blocks",
    title: "DOCX Layout Blocks",
    description:
      "Inspect parsed layout blocks in the read-only DOCX viewer and select a block to reveal its source.",
    command: getRegistryAddCommand("docx-layout-blocks"),
    docsHref: "/docs/components/docx-viewer#layout-blocks",
    viewHref: "/view/blocks/docx-layout-blocks",
    previewHeightClassName: "h-[720px]",
  },
] as const satisfies readonly PdfViewerBlockConfig[]

export type PdfViewerBlockId = (typeof PDF_VIEWER_BLOCKS)[number]["id"]
export type PdfViewerBlockMetadata = PdfViewerBlockConfig & {
  id: PdfViewerBlockId
}

export function getPdfViewerBlock(
  blockId: string
): PdfViewerBlockMetadata | undefined {
  return PDF_VIEWER_BLOCKS.find((block) => block.id === blockId)
}