Home / File/ code-viewer.tsx — ui Source File

code-viewer.tsx — ui Source File

Architecture documentation for code-viewer.tsx, a tsx file in the ui codebase. 2 imports, 1 dependents.

File tsx ApplicationExhibition PlaygroundAI 2 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  951c5cbd_b2fd_ab32_959d_0fe7c7e5a262["code-viewer.tsx"]
  57e86e45_ac6e_7278_be08_9092724e8401["button"]
  951c5cbd_b2fd_ab32_959d_0fe7c7e5a262 --> 57e86e45_ac6e_7278_be08_9092724e8401
  0896a8fa_5462_a73a_5add_fb8176921778["dialog"]
  951c5cbd_b2fd_ab32_959d_0fe7c7e5a262 --> 0896a8fa_5462_a73a_5add_fb8176921778
  5ee45142_aa10_ca73_456e_5946db3e53c3["page.tsx"]
  5ee45142_aa10_ca73_456e_5946db3e53c3 --> 951c5cbd_b2fd_ab32_959d_0fe7c7e5a262
  style 951c5cbd_b2fd_ab32_959d_0fe7c7e5a262 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { Button } from "@/registry/new-york-v4/ui/button"
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/registry/new-york-v4/ui/dialog"

export function CodeViewer() {
  return (
    <Dialog>
      <DialogTrigger asChild>
        <Button variant="secondary">View code</Button>
      </DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <DialogTitle>View code</DialogTitle>
          <DialogDescription>
            You can use the following code to start integrating your current
            prompt and settings into your application.
          </DialogDescription>
        </DialogHeader>
        <div className="grid gap-4">
          <div className="rounded-md bg-black p-6">
            <pre>
              <code className="grid gap-1 text-sm text-white [&_span]:h-4">
                <span>
                  <span className="text-sky-300">import</span> os
                </span>
                <span>
                  <span className="text-sky-300">import</span> openai
                </span>
                <span />
                <span>
                  openai.api_key = os.getenv(
                  <span className="text-green-300">
                    &quot;OPENAI_API_KEY&quot;
                  </span>
                  )
                </span>
                <span />
                <span>response = openai.Completion.create(</span>
                <span>
                  {" "}
                  model=
                  <span className="text-green-300">&quot;davinci&quot;</span>,
                </span>
                <span>
                  {" "}
                  prompt=<span className="text-amber-300">&quot;&quot;</span>,
                </span>
                <span>
                  {" "}
                  temperature=<span className="text-amber-300">0.9</span>,
                </span>
                <span>
                  {" "}
                  max_tokens=<span className="text-amber-300">5</span>,
                </span>
                <span>
                  {" "}
                  top_p=<span className="text-amber-300">1</span>,
                </span>
                <span>
                  {" "}
                  frequency_penalty=<span className="text-amber-300">0</span>,
                </span>
                <span>
                  {" "}
                  presence_penalty=<span className="text-green-300">0</span>,
                </span>
                <span>)</span>
              </code>
            </pre>
          </div>
          <div>
            <p className="text-muted-foreground text-sm">
              Your API Key can be found here. You should use environment
              variables or a secret management tool to expose your key to your
              applications.
            </p>
          </div>
        </div>
      </DialogContent>
    </Dialog>
  )
}

Subdomains

Functions

Dependencies

  • button
  • dialog

Frequently Asked Questions

What does code-viewer.tsx do?
code-viewer.tsx is a source file in the ui codebase, written in tsx. It belongs to the ApplicationExhibition domain, PlaygroundAI subdomain.
What functions are defined in code-viewer.tsx?
code-viewer.tsx defines 1 function(s): CodeViewer.
What does code-viewer.tsx depend on?
code-viewer.tsx imports 2 module(s): button, dialog.
What files import code-viewer.tsx?
code-viewer.tsx is imported by 1 file(s): page.tsx.
Where is code-viewer.tsx in the architecture?
code-viewer.tsx is located at apps/v4/app/(app)/examples/playground/components/code-viewer.tsx (domain: ApplicationExhibition, subdomain: PlaygroundAI, directory: apps/v4/app/(app)/examples/playground/components).

Analyze Your Own Codebase

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

Try Supermodel Free