Home / File/ code-block-command.tsx — ui Source File

code-block-command.tsx — ui Source File

Architecture documentation for code-block-command.tsx, a tsx file in the ui codebase. 7 imports, 0 dependents.

File tsx Internationalization Dictionary 7 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  ca1d2f63_03fd_f5a9_ac1b_da830c057174["code-block-command.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  ca1d2f63_03fd_f5a9_ac1b_da830c057174 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  39a0d62e_8e7d_d097_eb95_91d2bca361f7["icons-react"]
  ca1d2f63_03fd_f5a9_ac1b_da830c057174 --> 39a0d62e_8e7d_d097_eb95_91d2bca361f7
  8c6845ea_e0db_55db_4a65_df2f64d9e581["use-config"]
  ca1d2f63_03fd_f5a9_ac1b_da830c057174 --> 8c6845ea_e0db_55db_4a65_df2f64d9e581
  402113bd_a10d_0255_fccf_87fa40fd281a["copy-button"]
  ca1d2f63_03fd_f5a9_ac1b_da830c057174 --> 402113bd_a10d_0255_fccf_87fa40fd281a
  57e86e45_ac6e_7278_be08_9092724e8401["button"]
  ca1d2f63_03fd_f5a9_ac1b_da830c057174 --> 57e86e45_ac6e_7278_be08_9092724e8401
  ceb41313_de2c_98d6_0449_ab5301fbc3d3["tabs"]
  ca1d2f63_03fd_f5a9_ac1b_da830c057174 --> ceb41313_de2c_98d6_0449_ab5301fbc3d3
  a2518e24_160d_3f8f_bb12_2206d8e84ab8["tooltip"]
  ca1d2f63_03fd_f5a9_ac1b_da830c057174 --> a2518e24_160d_3f8f_bb12_2206d8e84ab8
  style ca1d2f63_03fd_f5a9_ac1b_da830c057174 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { IconCheck, IconCopy, IconTerminal } from "@tabler/icons-react"

import { useConfig } from "@/hooks/use-config"
import { copyToClipboardWithMeta } from "@/components/copy-button"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
  Tabs,
  TabsContent,
  TabsList,
  TabsTrigger,
} from "@/registry/new-york-v4/ui/tabs"
import {
  Tooltip,
  TooltipContent,
  TooltipTrigger,
} from "@/registry/new-york-v4/ui/tooltip"

export function CodeBlockCommand({
  __npm__,
  __yarn__,
  __pnpm__,
  __bun__,
}: React.ComponentProps<"pre"> & {
  __npm__?: string
  __yarn__?: string
  __pnpm__?: string
  __bun__?: string
}) {
  const [config, setConfig] = useConfig()
  const [hasCopied, setHasCopied] = React.useState(false)

  React.useEffect(() => {
    if (hasCopied) {
      const timer = setTimeout(() => setHasCopied(false), 2000)
      return () => clearTimeout(timer)
    }
  }, [hasCopied])

  const packageManager = config.packageManager || "pnpm"
  const tabs = React.useMemo(() => {
    return {
      pnpm: __pnpm__,
      npm: __npm__,
      yarn: __yarn__,
      bun: __bun__,
    }
  }, [__npm__, __pnpm__, __yarn__, __bun__])

  const copyCommand = React.useCallback(() => {
    const command = tabs[packageManager]

    if (!command) {
      return
    }

    copyToClipboardWithMeta(command, {
      name: "copy_npm_command",
// ... (69 more lines)

Subdomains

Functions

Dependencies

  • button
  • copy-button
  • icons-react
  • react
  • tabs
  • tooltip
  • use-config

Frequently Asked Questions

What does code-block-command.tsx do?
code-block-command.tsx is a source file in the ui codebase, written in tsx. It belongs to the Internationalization domain, Dictionary subdomain.
What functions are defined in code-block-command.tsx?
code-block-command.tsx defines 1 function(s): CodeBlockCommand.
What does code-block-command.tsx depend on?
code-block-command.tsx imports 7 module(s): button, copy-button, icons-react, react, tabs, tooltip, use-config.
Where is code-block-command.tsx in the architecture?
code-block-command.tsx is located at apps/v4/components/code-block-command.tsx (domain: Internationalization, subdomain: Dictionary, directory: apps/v4/components).

Analyze Your Own Codebase

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

Try Supermodel Free