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

chart-toolbar.tsx — ui Source File

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

File tsx Internationalization RTLLayout 6 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  5fa80f26_e414_03f6_687e_bfb3c7f9ff71["chart-toolbar.tsx"]
  d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3["lucide-react"]
  5fa80f26_e414_03f6_687e_bfb3c7f9ff71 --> d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  5fa80f26_e414_03f6_687e_bfb3c7f9ff71 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  1c0309b7_7660_a423_33cb_84600ee8c1ed["chart-code-viewer"]
  5fa80f26_e414_03f6_687e_bfb3c7f9ff71 --> 1c0309b7_7660_a423_33cb_84600ee8c1ed
  68e596e7_6979_4afc_6ab2_5388e7fb2914["chart-copy-button"]
  5fa80f26_e414_03f6_687e_bfb3c7f9ff71 --> 68e596e7_6979_4afc_6ab2_5388e7fb2914
  732e465a_ced3_b1a5_d804_02cfa6f4300b["chart-display"]
  5fa80f26_e414_03f6_687e_bfb3c7f9ff71 --> 732e465a_ced3_b1a5_d804_02cfa6f4300b
  b2c60dee_4ede_8485_a6b4_91c999cdc69f["separator"]
  5fa80f26_e414_03f6_687e_bfb3c7f9ff71 --> b2c60dee_4ede_8485_a6b4_91c999cdc69f
  style 5fa80f26_e414_03f6_687e_bfb3c7f9ff71 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import {
  AreaChartIcon,
  BarChartBigIcon,
  HexagonIcon,
  LineChartIcon,
  MousePointer2Icon,
  PieChartIcon,
  RadarIcon,
} from "lucide-react"

import { cn } from "@/lib/utils"
import { ChartCodeViewer } from "@/components/chart-code-viewer"
import { ChartCopyButton } from "@/components/chart-copy-button"
import { type Chart } from "@/components/chart-display"
import { Separator } from "@/registry/new-york-v4/ui/separator"

export function ChartToolbar({
  chart,
  className,
  children,
}: {
  chart: Chart
} & React.ComponentProps<"div">) {
  return (
    <div className={cn("flex items-center gap-2", className)}>
      <div className="text-muted-foreground flex items-center gap-1.5 pl-1 text-[13px] [&>svg]:h-[0.9rem] [&>svg]:w-[0.9rem]">
        <ChartTitle chart={chart} />
      </div>
      <div className="ml-auto flex items-center gap-2 [&>form]:flex">
        <ChartCopyButton
          event="copy_chart_code"
          name={chart.name}
          code={chart.files?.[0]?.content ?? ""}
          className="[&_svg]-h-3 text-foreground hover:bg-muted dark:text-foreground h-6 w-6 rounded-[6px] bg-transparent shadow-none [&_svg]:w-3"
        />
        <Separator
          orientation="vertical"
          className="mx-0 hidden !h-4 md:flex"
        />
        <ChartCodeViewer chart={chart}>{children}</ChartCodeViewer>
      </div>
    </div>
  )
}

function ChartTitle({ chart }: { chart: Chart }) {
  if (chart.name.includes("chart-line")) {
    return (
      <>
        <LineChartIcon /> Line Chart
      </>
    )
  }

  if (chart.name.includes("chart-bar")) {
    return (
      <>
        <BarChartBigIcon /> Bar Chart
      </>
    )
  }

  if (chart.name.includes("chart-pie")) {
    return (
      <>
        <PieChartIcon /> Pie Chart
      </>
    )
  }

  if (chart.name.includes("chart-area")) {
    return (
      <>
        <AreaChartIcon /> Area Chart
      </>
    )
  }

  if (chart.name.includes("chart-radar")) {
    return (
      <>
        <HexagonIcon /> Radar Chart
      </>
    )
  }

  if (chart.name.includes("chart-radial")) {
    return (
      <>
        <RadarIcon /> Radial Chart
      </>
    )
  }

  if (chart.name.includes("chart-tooltip")) {
    return (
      <>
        <MousePointer2Icon />
        Tooltip
      </>
    )
  }

  return chart.name
}

Subdomains

Dependencies

  • chart-code-viewer
  • chart-copy-button
  • chart-display
  • lucide-react
  • separator
  • utils

Frequently Asked Questions

What does chart-toolbar.tsx do?
chart-toolbar.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-toolbar.tsx?
chart-toolbar.tsx defines 2 function(s): ChartTitle, ChartToolbar.
What does chart-toolbar.tsx depend on?
chart-toolbar.tsx imports 6 module(s): chart-code-viewer, chart-copy-button, chart-display, lucide-react, separator, utils.
Where is chart-toolbar.tsx in the architecture?
chart-toolbar.tsx is located at apps/v4/components/chart-toolbar.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