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. 9 imports, 0 dependents.

File tsx Internationalization RTLLayout 9 imports 3 functions

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

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

import { highlightCode } from "@/lib/highlight-code"
import { getRegistryItem } from "@/lib/registry"
import { cn } from "@/lib/utils"
import { ChartIframe } from "@/components/chart-iframe"
import { ChartToolbar } from "@/components/chart-toolbar"
import { type Style } from "@/registry/_legacy-styles"

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

export function ChartDisplay({
  chart,
  style,
  className,
}: {
  chart: Chart
  style: string
} & React.ComponentProps<"div">) {
  return (
    <div
      className={cn(
        "themes-wrapper group relative flex flex-col overflow-hidden rounded-xl transition-all duration-200 ease-in-out hover:z-30",
        className
      )}
    >
      <ChartToolbar
        chart={chart}
        className="relative z-20 flex justify-end px-3 py-2.5"
      />
      <div className="bg-background relative z-10 overflow-hidden rounded-xl">
        <ChartIframe
          src={`/view/${style}/${chart.name}`}
          height={460}
          title={chart.name}
        />
      </div>
    </div>
  )
}

// Exported for parallel prefetching in page components.
export const getCachedRegistryItem = React.cache(
  async (name: string, styleName: Style["name"]) => {
    return await getRegistryItem(name, styleName)
  }
)

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

Subdomains

Types

Dependencies

  • _legacy-styles
  • chart-iframe
  • 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 Internationalization domain, RTLLayout 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 9 module(s): _legacy-styles, chart-iframe, chart-toolbar, highlight-code, react, registry, schema, utils, and 1 more.
Where is chart-display.tsx in the architecture?
chart-display.tsx is located at apps/v4/components/chart-display.tsx (domain: Internationalization, subdomain: RTLLayout, directory: apps/v4/components).

Analyze Your Own Codebase

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

Try Supermodel Free