@@ -18,7 +18,7 @@ import { DateRange } from 'react-day-picker';
18
18
import { ApplicationHeader } from '@/components/header' ;
19
19
import { ApplicationShell } from '@/components/shell' ;
20
20
import { EmptyPlaceholder } from '@/components/ui/empty-placeholder' ;
21
- import { ReturnMethod , usePerformanceData } from './hooks/usePerformanceData ' ;
21
+ import { ReturnMethod , usePerformanceData } from './hooks/use-performance-data ' ;
22
22
import { BenchmarkSymbolSelector } from '@/components/benchmark-symbol-selector' ;
23
23
24
24
const PORTFOLIO_TOTAL : ComparisonItem = {
@@ -33,6 +33,36 @@ type ComparisonItem = {
33
33
name : string ;
34
34
} ;
35
35
36
+ function PerformanceContent ( {
37
+ performanceData,
38
+ isLoading,
39
+ } : {
40
+ performanceData : any [ ] | undefined ;
41
+ isLoading : boolean ;
42
+ } ) {
43
+ return (
44
+ < div className = "relative" >
45
+ { performanceData && performanceData . length > 0 && < PerformanceChart data = { performanceData } /> }
46
+
47
+ { ! performanceData ?. length && ! isLoading && (
48
+ < EmptyPlaceholder
49
+ className = "mx-auto flex h-[400px] max-w-[420px] items-center justify-center"
50
+ icon = { < BarChart className = "h-10 w-10" /> }
51
+ title = "No performance data"
52
+ description = "Select accounts to compare their performance over time."
53
+ />
54
+ ) }
55
+
56
+ { /* Overlay loading indicator */ }
57
+ { isLoading && (
58
+ < div className = "absolute inset-0 flex items-center justify-center bg-background/50" >
59
+ < Skeleton className = "h-[400px] w-full bg-muted/50" />
60
+ </ div >
61
+ ) }
62
+ </ div >
63
+ ) ;
64
+ }
65
+
36
66
export default function PerformancePage ( ) {
37
67
const [ selectedItems , setSelectedItems ] = useState < ComparisonItem [ ] > ( [ PORTFOLIO_TOTAL ] ) ;
38
68
const [ dateRange , setDateRange ] = useState < DateRange | undefined > ( {
@@ -139,18 +169,10 @@ export default function PerformancePage() {
139
169
</ div >
140
170
</ CardHeader >
141
171
< CardContent className = "space-y-6" >
142
- { isLoadingPerformance ? (
143
- < Skeleton className = "h-[400px] w-full" />
144
- ) : performanceData && performanceData . length > 0 ? (
145
- < PerformanceChart data = { performanceData } />
146
- ) : (
147
- < EmptyPlaceholder
148
- className = "mx-auto flex h-[400px] max-w-[420px] items-center justify-center"
149
- icon = { < BarChart className = "h-10 w-10" /> }
150
- title = "No performance data"
151
- description = "Select accounts to compare their performance over time."
152
- />
153
- ) }
172
+ < PerformanceContent
173
+ performanceData = { performanceData }
174
+ isLoading = { isLoadingPerformance }
175
+ />
154
176
</ CardContent >
155
177
</ Card >
156
178
</ div >
@@ -168,7 +190,7 @@ function PerformanceDashboardSkeleton() {
168
190
< Skeleton className = "h-4 w-[100px]" />
169
191
</ CardHeader >
170
192
< CardContent >
171
- < Skeleton className = "h-[400px] w-full" />
193
+ < Skeleton className = "h-[400px] w-full bg-muted/50 " />
172
194
</ CardContent >
173
195
</ Card >
174
196
</ main >
0 commit comments