11import { DateRangePicker } from "@/components/date-range-picker" ;
2- import EmissionsTimeSeriesChart from "@/components/emissions-time-series" ;
3- import ExperimentsBarChart from "@/components/experiment-bar-chart" ;
4- import RadialChart from "@/components/radial-chart" ;
5- import RunsScatterChart from "@/components/runs-scatter-chart" ;
62import { Separator } from "@/components/ui/separator" ;
73import { getDefaultDateRange } from "@/helpers/date-utils" ;
84import { ExperimentReport } from "@/types/experiment-report" ;
95import { Project } from "@/types/project" ;
106import { ConvertedValues , RadialChartData } from "@/types/project-dashboard" ;
117import Image from "next/image" ;
8+ import dynamic from "next/dynamic" ;
129import { ReactNode , useState } from "react" ;
1310import { DateRange } from "react-day-picker" ;
1411import ChartSkeleton from "./chart-skeleton" ;
@@ -20,6 +17,30 @@ import { useRouter } from "next/navigation";
2017import { Table , TableBody , TableHeader } from "./ui/table" ;
2118import { Experiment } from "@/types/experiment" ;
2219
20+ // Lazy-load chart components to keep recharts (~370kB) off the critical path
21+ const RadialChart = dynamic ( ( ) => import ( "@/components/radial-chart" ) , {
22+ loading : ( ) => (
23+ < Card className = "flex flex-col h-full items-center justify-center" >
24+ < CardContent className = "p-0" >
25+ < Skeleton className = "h-44 w-44 rounded-full" />
26+ </ CardContent >
27+ </ Card >
28+ ) ,
29+ ssr : false ,
30+ } ) ;
31+ const ExperimentsBarChart = dynamic (
32+ ( ) => import ( "@/components/experiment-bar-chart" ) ,
33+ { loading : ( ) => < ChartSkeleton height = { 300 } /> , ssr : false } ,
34+ ) ;
35+ const RunsScatterChart = dynamic (
36+ ( ) => import ( "@/components/runs-scatter-chart" ) ,
37+ { loading : ( ) => < ChartSkeleton height = { 300 } /> , ssr : false } ,
38+ ) ;
39+ const EmissionsTimeSeriesChart = dynamic (
40+ ( ) => import ( "@/components/emissions-time-series" ) ,
41+ { loading : ( ) => < ChartSkeleton height = { 350 } /> , ssr : false } ,
42+ ) ;
43+
2344export interface ProjectDashboardBaseProps {
2445 isPublicView : boolean ;
2546 project : Project ;
0 commit comments