@@ -6,6 +6,7 @@ import { EmptyState } from './EmptyState';
66import { ContributorSummary as ContributorSummaryData } from '../types/campaign' ;
77import { apiRequest } from '../services/httpClient' ;
88import { buildContributorCsv , downloadCsv } from '../utils/exportCsv' ;
9+ import { useMinDisplayTime } from '../hooks/useMinDisplayTime' ;
910
1011const POLL_INTERVAL_MS = 30_000 ;
1112
@@ -77,24 +78,52 @@ export function ContributorSummary({
7778 } ;
7879 } , [ campaignId , fetchContributors ] ) ;
7980
80- if ( externalLoading || ( isLoading && contributors . length === 0 ) ) {
81+ const showSkeleton = useMinDisplayTime ( externalLoading || ( isLoading && contributors . length === 0 ) ) ;
82+ if ( showSkeleton ) {
8183 return (
8284 < section
83- className = "contributor-summary contributor-summary-loading"
85+ className = "contributor-summary"
86+ aria-busy = "true"
8487 aria-label = "Contributor summary"
8588 >
8689 < h3 className = "contributor-summary-title" > Contributors</ h3 >
8790 < div className = "contributor-summary-stats" style = { { marginTop : 12 } } >
88- { Array . from ( { length : 3 } ) . map ( ( _ , i ) => (
91+ { Array . from ( { length : 4 } ) . map ( ( _ , i ) => (
8992 < article key = { i } className = "contributor-stat" >
9093 < div className = "skeleton skeleton-line" style = { { width : 100 } } />
9194 < div
9295 className = "skeleton skeleton-line"
9396 style = { { width : 60 , height : 20 , marginTop : 8 } }
9497 />
98+ < div className = "skeleton skeleton-line" style = { { width : 140 , height : 10 , marginTop : 6 } } />
9599 </ article >
96100 ) ) }
97101 </ div >
102+ < div className = "contributor-table-wrap" aria-hidden = "true" >
103+ < div className = "contributor-table contributor-table-head" >
104+ < div className = "contributor-table-row" >
105+ < span > < div className = "skeleton skeleton-line" style = { { width : 80 } } /> </ span >
106+ < span > < div className = "skeleton skeleton-line" style = { { width : 80 } } /> </ span >
107+ < span > < div className = "skeleton skeleton-line" style = { { width : 80 } } /> </ span >
108+ </ div >
109+ </ div >
110+ < div className = "contributor-table contributor-table-body" >
111+ { Array . from ( { length : 3 } ) . map ( ( _ , i ) => (
112+ < div key = { i } className = "contributor-table-row" >
113+ < div className = "contributor-address" style = { { display : 'flex' , alignItems : 'center' , gap : 10 } } >
114+ < div className = "skeleton" style = { { width : 24 , height : 24 , borderRadius : '50%' } } />
115+ < div className = "skeleton skeleton-line" style = { { width : 120 } } />
116+ </ div >
117+ < div className = "contributor-amounts" >
118+ < div className = "skeleton skeleton-line" style = { { width : 60 } } />
119+ </ div >
120+ < div className = "contributor-amounts" >
121+ < div className = "skeleton skeleton-line" style = { { width : 60 } } />
122+ </ div >
123+ </ div >
124+ ) ) }
125+ </ div >
126+ </ div >
98127 </ section >
99128 ) ;
100129 }
0 commit comments