11"use client" ;
22
3+ import { memo } from 'react' ;
34import dynamic from 'next/dynamic' ;
45import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card' ;
56import { CurrencyDisplay } from '@/components/shared/CurrencyDisplay' ;
@@ -11,6 +12,22 @@ const PlatformVolumeChart = dynamic(() => import('@/components/charts/PlatformVo
1112 loading : ( ) => < Skeleton className = "h-[300px] w-full rounded-xl" /> ,
1213} ) ;
1314
15+ // Memoised so future additions of state to the parent won't re-render the chart.
16+ const AdminChartSection = memo ( function AdminChartSection ( ) {
17+ return (
18+ < Card className = "col-span-4 bg-card border shadow-sm" >
19+ < CardHeader >
20+ < CardTitle > Platform Volume vs Fees</ CardTitle >
21+ </ CardHeader >
22+ < CardContent className = "pl-2" >
23+ < div className = "mt-4" >
24+ < PlatformVolumeChart height = { 300 } />
25+ </ div >
26+ </ CardContent >
27+ </ Card >
28+ ) ;
29+ } ) ;
30+
1431export default function AdminOverviewPage ( ) {
1532 return (
1633 < div className = "space-y-6" >
@@ -68,7 +85,7 @@ export default function AdminOverviewPage() {
6885 </ CardContent >
6986 </ Card >
7087
71- < Card className = "bg-destructive/10 border-destructive/20 shadow-sm" >
88+ < Card className = "col-span-1 bg-destructive/10 border-destructive/20 shadow-sm" >
7289 < CardHeader className = "flex flex-row items-center justify-between pb-2" >
7390 < CardTitle className = "text-sm font-medium text-destructive" > Pending KYB Reviews</ CardTitle >
7491 < AlertTriangle className = "h-4 w-4 text-destructive" />
@@ -83,16 +100,8 @@ export default function AdminOverviewPage() {
83100 </ div >
84101
85102 < div className = "grid gap-4 md:grid-cols-7" >
86- < Card className = "col-span-4 bg-card border shadow-sm" >
87- < CardHeader >
88- < CardTitle > Platform Volume vs Fees</ CardTitle >
89- </ CardHeader >
90- < CardContent className = "pl-2" >
91- < div className = "mt-4" >
92- < PlatformVolumeChart height = { 300 } />
93- </ div >
94- </ CardContent >
95- </ Card >
103+ { /* Chart section is memoised */ }
104+ < AdminChartSection />
96105
97106 < Card className = "col-span-3 bg-card border shadow-sm" >
98107 < CardHeader >
@@ -110,7 +119,7 @@ export default function AdminOverviewPage() {
110119 </ div >
111120 < span className = "text-xs font-mono text-muted-foreground" > 14ms ping</ span >
112121 </ div >
113-
122+
114123 < div className = "flex items-center justify-between" >
115124 < div className = "flex items-center gap-3" >
116125 < div className = "w-2 h-2 rounded-full bg-green-500" > </ div >
0 commit comments