page.tsx — ui Source File
Architecture documentation for page.tsx, a tsx file in the ui codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 23647c21_1c6c_439d_faec_b1bc1792190f["page.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 23647c21_1c6c_439d_faec_b1bc1792190f --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 9c1a1e1b_87f8_29d5_c12d_e83869cf94e4["next"] 23647c21_1c6c_439d_faec_b1bc1792190f --> 9c1a1e1b_87f8_29d5_c12d_e83869cf94e4 f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb["navigation"] 23647c21_1c6c_439d_faec_b1bc1792190f --> f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb 109802f5_d07a_09ac_1761_f7055113f24f["site"] 23647c21_1c6c_439d_faec_b1bc1792190f --> 109802f5_d07a_09ac_1761_f7055113f24f 68b933cf_7ffc_0fbc_a41d_80f8f6fa24c1["blocks"] 23647c21_1c6c_439d_faec_b1bc1792190f --> 68b933cf_7ffc_0fbc_a41d_80f8f6fa24c1 79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"] 23647c21_1c6c_439d_faec_b1bc1792190f --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81 9798186b_08af_1d79_2ad7_d662300dc0ba["registry-styles"] 23647c21_1c6c_439d_faec_b1bc1792190f --> 9798186b_08af_1d79_2ad7_d662300dc0ba b13c0946_a391_4bd9_2f39_a58656bb80bd["mdx.css"] 23647c21_1c6c_439d_faec_b1bc1792190f --> b13c0946_a391_4bd9_2f39_a58656bb80bd 7a25f51b_551e_131b_bc51_bd5ccc7c308c["registry"] 23647c21_1c6c_439d_faec_b1bc1792190f --> 7a25f51b_551e_131b_bc51_bd5ccc7c308c style 23647c21_1c6c_439d_faec_b1bc1792190f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as React from "react"
import { Metadata } from "next"
import { notFound } from "next/navigation"
import { siteConfig } from "@/config/site"
import { getAllBlockIds } from "@/lib/blocks"
import { absoluteUrl, cn } from "@/lib/utils"
import { Style, styles } from "@/registry/registry-styles"
import "@/styles/mdx.css"
import { getRegistryComponent, getRegistryItem } from "@/lib/registry"
const getCachedRegistryItem = React.cache(
async (name: string, style: Style["name"]) => {
return await getRegistryItem(name, style)
}
)
export const dynamicParams = false
export async function generateMetadata({
params,
}: {
params: {
style: Style["name"]
name: string
}
}): Promise<Metadata> {
const { name, style } = params
const item = await getCachedRegistryItem(name, style)
if (!item) {
return {}
}
const title = item.name
const description = item.description
return {
title: `${item.name}${item.description ? ` - ${item.description}` : ""}`,
description,
openGraph: {
title,
description,
type: "article",
url: absoluteUrl(`/blocks/${style}/${item.name}`),
images: [
{
url: siteConfig.ogImage,
width: 1200,
height: 630,
alt: siteConfig.name,
},
],
},
twitter: {
card: "summary_large_image",
title,
description,
images: [siteConfig.ogImage],
creator: "@shadcn",
},
}
}
export async function generateStaticParams() {
const blockIds = await getAllBlockIds()
return styles
.map((style) =>
blockIds.map((name) => ({
style: style.name,
name,
}))
)
.flat()
}
export default async function BlockPage({
params,
}: {
params: {
style: Style["name"]
name: string
}
}) {
const { name, style } = params
const item = await getCachedRegistryItem(name, style)
const Component = getRegistryComponent(name, style)
if (!item || !Component) {
return notFound()
}
return (
<>
<div className={cn("themes-wrapper bg-background", item.meta?.container)}>
<Component />
</div>
</>
)
}
Domain
Subdomains
Dependencies
- blocks
- mdx.css
- navigation
- next
- react
- registry
- registry-styles
- site
- utils
Source
Frequently Asked Questions
What does page.tsx do?
page.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, Styles subdomain.
What functions are defined in page.tsx?
page.tsx defines 4 function(s): BlockPage, generateMetadata, generateStaticParams, getCachedRegistryItem.
What does page.tsx depend on?
page.tsx imports 9 module(s): blocks, mdx.css, navigation, next, react, registry, registry-styles, site, and 1 more.
Where is page.tsx in the architecture?
page.tsx is located at deprecated/www/app/(view)/view/styles/[style]/[name]/page.tsx (domain: ComponentRegistry, subdomain: Styles, directory: deprecated/www/app/(view)/view/styles/[style]/[name]).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free