Home / Function/ BlockViewerProvider() — ui Function Reference

BlockViewerProvider() — ui Function Reference

Architecture documentation for the BlockViewerProvider() function in block-viewer.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  2505a748_77f3_d5f2_8f02_46d02e958467["BlockViewerProvider()"]
  c3ac54aa_58a5_8188_b5f8_014a382dcef3["block-viewer.tsx"]
  2505a748_77f3_d5f2_8f02_46d02e958467 -->|defined in| c3ac54aa_58a5_8188_b5f8_014a382dcef3
  style 2505a748_77f3_d5f2_8f02_46d02e958467 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/components/block-viewer.tsx lines 92–136

function BlockViewerProvider({
  item,
  tree,
  highlightedFiles,
  children,
}: Pick<BlockViewerContext, "item" | "tree" | "highlightedFiles"> & {
  children: React.ReactNode
}) {
  const [view, setView] = React.useState<BlockViewerContext["view"]>("preview")
  const [activeFile, setActiveFile] = React.useState<
    BlockViewerContext["activeFile"]
  >(highlightedFiles?.[0].target ?? null)
  const resizablePanelRef = React.useRef<PanelImperativeHandle>(null)
  const [iframeKey, setIframeKey] = React.useState(0)

  return (
    <BlockViewerContext.Provider
      value={{
        item,
        view,
        setView,
        resizablePanelRef,
        activeFile,
        setActiveFile,
        tree,
        highlightedFiles,
        iframeKey,
        setIframeKey,
      }}
    >
      <div
        id={item.name}
        data-view={view}
        className="group/block-view-wrapper flex min-w-0 scroll-mt-24 flex-col-reverse items-stretch gap-4 overflow-hidden md:flex-col"
        style={
          {
            "--height": item.meta?.iframeHeight ?? "930px",
          } as React.CSSProperties
        }
      >
        {children}
      </div>
    </BlockViewerContext.Provider>
  )
}

Subdomains

Frequently Asked Questions

What does BlockViewerProvider() do?
BlockViewerProvider() is a function in the ui codebase, defined in apps/v4/components/block-viewer.tsx.
Where is BlockViewerProvider() defined?
BlockViewerProvider() is defined in apps/v4/components/block-viewer.tsx at line 92.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free