page.tsx — ui Source File
Architecture documentation for page.tsx, a tsx file in the ui codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 26ce8225_0c7d_3cb1_b705_738f5d2791bb["page.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 26ce8225_0c7d_3cb1_b705_738f5d2791bb --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb["navigation"] 26ce8225_0c7d_3cb1_b705_738f5d2791bb --> f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb 79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"] 26ce8225_0c7d_3cb1_b705_738f5d2791bb --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81 732e465a_ced3_b1a5_d804_02cfa6f4300b["chart-display"] 26ce8225_0c7d_3cb1_b705_738f5d2791bb --> 732e465a_ced3_b1a5_d804_02cfa6f4300b b5745d66_2f51_7fb8_758d_e409c7f36c09["_legacy-styles"] 26ce8225_0c7d_3cb1_b705_738f5d2791bb --> b5745d66_2f51_7fb8_758d_e409c7f36c09 175cabf4_ccf1_1226_595a_f3c2558c47a2["charts"] 26ce8225_0c7d_3cb1_b705_738f5d2791bb --> 175cabf4_ccf1_1226_595a_f3c2558c47a2 style 26ce8225_0c7d_3cb1_b705_738f5d2791bb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as React from "react"
import { notFound } from "next/navigation"
import { cn } from "@/lib/utils"
import {
ChartDisplay,
getCachedRegistryItem,
getChartHighlightedCode,
} from "@/components/chart-display"
import { getActiveStyle } from "@/registry/_legacy-styles"
import { charts } from "@/app/(app)/charts/charts"
export const revalidate = false
export const dynamic = "force-static"
export const dynamicParams = false
interface ChartPageProps {
params: Promise<{
type: string
}>
}
const chartTypes = [
"area",
"bar",
"line",
"pie",
"radar",
"radial",
"tooltip",
] as const
type ChartType = (typeof chartTypes)[number]
export async function generateStaticParams() {
return chartTypes.map((type) => ({
type,
}))
}
export default async function ChartPage({ params }: ChartPageProps) {
const { type } = await params
if (!chartTypes.includes(type as ChartType)) {
return notFound()
}
const chartType = type as ChartType
const chartList = charts[chartType]
const activeStyle = await getActiveStyle()
// Prefetch all chart data in parallel for better performance.
// Charts are rendered via iframes, so we only need the metadata and highlighted code.
const chartDataPromises = chartList.map(async (chart) => {
const registryItem = await getCachedRegistryItem(chart.id, activeStyle.name)
if (!registryItem) return null
const highlightedCode = await getChartHighlightedCode(
registryItem.files?.[0]?.content ?? ""
)
if (!highlightedCode) return null
return {
...registryItem,
highlightedCode,
fullWidth: chart.fullWidth,
}
})
const prefetchedCharts = await Promise.all(chartDataPromises)
return (
<div className="grid flex-1 gap-12 lg:gap-24">
<h2 className="sr-only">
{type.charAt(0).toUpperCase() + type.slice(1)} Charts
</h2>
<div className="grid flex-1 scroll-mt-20 items-stretch gap-10 md:grid-cols-2 md:gap-6 lg:grid-cols-3 xl:gap-10">
{Array.from({ length: 12 }).map((_, index) => {
const chart = prefetchedCharts[index]
return chart ? (
<ChartDisplay
key={chart.name}
chart={chart}
style={activeStyle.name}
className={cn(chart.fullWidth && "md:col-span-2 lg:col-span-3")}
/>
) : (
<div
key={`empty-${index}`}
className="hidden aspect-square w-full rounded-lg border border-dashed xl:block"
/>
)
})}
</div>
</div>
)
}
Domain
Subdomains
Functions
Types
Dependencies
- _legacy-styles
- chart-display
- charts
- navigation
- react
- 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 DocumentationAtlas domain, Changelog subdomain.
What functions are defined in page.tsx?
page.tsx defines 2 function(s): ChartPage, generateStaticParams.
What does page.tsx depend on?
page.tsx imports 6 module(s): _legacy-styles, chart-display, charts, navigation, react, utils.
Where is page.tsx in the architecture?
page.tsx is located at apps/v4/app/(app)/charts/[type]/page.tsx (domain: DocumentationAtlas, subdomain: Changelog, directory: apps/v4/app/(app)/charts/[type]).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free