Home / File/ chart-display.tsx — ui Source File

chart-display.tsx — ui Source File

Architecture documentation for chart-display.tsx, a tsx file in the ui codebase. 7 imports, 0 dependents.

File tsx ComponentRegistry ChartRegistry 7 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  3ecd5bbf_5fab_7d59_90a0_a989605868f3["chart-display.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  3ecd5bbf_5fab_7d59_90a0_a989605868f3 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  ceec689a_1334_a657_3c35_094070222b09["schema"]
  3ecd5bbf_5fab_7d59_90a0_a989605868f3 --> ceec689a_1334_a657_3c35_094070222b09
  6802ce19_522d_e5fb_e458_8826d9f6952e["zod"]
  3ecd5bbf_5fab_7d59_90a0_a989605868f3 --> 6802ce19_522d_e5fb_e458_8826d9f6952e
  7edb604f_23f1_911f_0682_b46c871a68d6["highlight-code"]
  3ecd5bbf_5fab_7d59_90a0_a989605868f3 --> 7edb604f_23f1_911f_0682_b46c871a68d6
  7a25f51b_551e_131b_bc51_bd5ccc7c308c["registry"]
  3ecd5bbf_5fab_7d59_90a0_a989605868f3 --> 7a25f51b_551e_131b_bc51_bd5ccc7c308c
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  3ecd5bbf_5fab_7d59_90a0_a989605868f3 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  39474a7e_421f_cb55_fe40_0258bdb292f9["chart-toolbar"]
  3ecd5bbf_5fab_7d59_90a0_a989605868f3 --> 39474a7e_421f_cb55_fe40_0258bdb292f9
  style 3ecd5bbf_5fab_7d59_90a0_a989605868f3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as React from "react"
import { registryItemSchema } from "shadcn/schema"
import { z } from "zod"

import { highlightCode } from "@/lib/highlight-code"
import { getRegistryItem } from "@/lib/registry"
import { cn } from "@/lib/utils"
import { ChartToolbar } from "@/components/chart-toolbar"

export type Chart = z.infer<typeof registryItemSchema> & {
  highlightedCode: string
}

export async function ChartDisplay({
  name,
  children,
  className,
}: { name: string } & React.ComponentProps<"div">) {
  const chart = await getCachedRegistryItem(name)
  const highlightedCode = await getChartHighlightedCode(
    chart?.files?.[0]?.content ?? ""
  )

  if (!chart || !highlightedCode) {
    return null
  }

  return (
    <div
      className={cn(
        "themes-wrapper group relative flex flex-col overflow-hidden rounded-xl border shadow transition-all duration-200 ease-in-out hover:z-30",
        className
      )}
    >
      <ChartToolbar
        chart={{ ...chart, highlightedCode }}
        className="relative z-20 flex justify-end border-b bg-card px-3 py-2.5 text-card-foreground"
      >
        {children}
      </ChartToolbar>
      <div className="relative z-10 [&>div]:rounded-none [&>div]:border-none [&>div]:shadow-none">
        {children}
      </div>
    </div>
  )
}

const getCachedRegistryItem = React.cache(async (name: string) => {
  return await getRegistryItem(name)
})

const getChartHighlightedCode = React.cache(async (content: string) => {
  return await highlightCode(content)
})

Subdomains

Types

Dependencies

  • chart-toolbar
  • highlight-code
  • react
  • registry
  • schema
  • utils
  • zod

Frequently Asked Questions

What does chart-display.tsx do?
chart-display.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, ChartRegistry subdomain.
What functions are defined in chart-display.tsx?
chart-display.tsx defines 3 function(s): ChartDisplay, getCachedRegistryItem, getChartHighlightedCode.
What does chart-display.tsx depend on?
chart-display.tsx imports 7 module(s): chart-toolbar, highlight-code, react, registry, schema, utils, zod.
Where is chart-display.tsx in the architecture?
chart-display.tsx is located at deprecated/www/components/chart-display.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: deprecated/www/components).

Analyze Your Own Codebase

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

Try Supermodel Free