@@ -26,12 +26,16 @@ export default function ProviderOverviewDashboard({
2626 sections,
2727 quotaReports,
2828 usageTotals,
29+ usageLoading = false ,
30+ quotasLoading = false ,
2931 onSelectProvider,
3032 onEditConfig,
3133} : {
3234 sections : WorkspaceSections ;
3335 quotaReports : Record < string , ProviderQuotaReportView > ;
3436 usageTotals : Record < string , ProviderUsageTotals > ;
37+ usageLoading ?: boolean ;
38+ quotasLoading ?: boolean ;
3539 onSelectProvider : ( name : string ) => void ;
3640 onEditConfig ?: ( ) => void ;
3741} ) {
@@ -47,10 +51,12 @@ export default function ProviderOverviewDashboard({
4751
4852 const attention = useMemo ( ( ) => buildAttentionItems ( sections , { } ) , [ sections ] ) ;
4953 const attentionCount = attention . length ;
50- const reauthCount = useMemo (
51- ( ) => sections . needsSetup . filter ( p => p . activeNeedsReauth ) . length ,
54+ const readyReauthCount = useMemo (
55+ ( ) => sections . ready . filter ( p => p . activeNeedsReauth ) . length ,
5256 [ sections ] ,
5357 ) ;
58+ const readyCount = sections . ready . length - readyReauthCount ;
59+ const needsAttentionCount = sections . needsSetup . length + readyReauthCount ;
5460
5561 /* Rate-limit rows: urgency first (highest utilisation), then name */
5662 const quotaProviders = useMemo ( ( ) => {
@@ -96,10 +102,10 @@ export default function ProviderOverviewDashboard({
96102 </ div >
97103
98104 < div className = "pws-dashboard-summary" >
99- < SummaryCard count = { sections . ready . length } label = { t ( "pws.status.ready" ) } tone = "ok" />
105+ < SummaryCard count = { readyCount } label = { t ( "pws.status.ready" ) } tone = "ok" />
100106 < SummaryCard
101- count = { sections . needsSetup . length }
102- label = { reauthCount > 0 ? t ( "pws.status.needsAttention" ) : t ( "pws.status.needsSetup" ) }
107+ count = { needsAttentionCount }
108+ label = { readyReauthCount > 0 ? t ( "pws.status.needsAttention" ) : t ( "pws.status.needsSetup" ) }
103109 tone = "warn"
104110 />
105111 < SummaryCard count = { sections . disabled . length } label = { t ( "prov.disabledBadge" ) } tone = "muted" />
@@ -132,9 +138,13 @@ export default function ProviderOverviewDashboard({
132138 ) }
133139
134140 < div className = "pws-dashboard-columns" >
135- { quotaProviders . length > 0 && (
136- < section className = "pws-dashboard-section" aria-label = { t ( "pws.dashboard.rateLimits" ) } >
137- < h3 className = "pws-dashboard-section-title" > { t ( "pws.dashboard.rateLimits" ) } </ h3 >
141+ < section
142+ className = "pws-dashboard-section pws-dashboard-section--rate-limits"
143+ aria-label = { t ( "pws.dashboard.rateLimits" ) }
144+ aria-busy = { quotasLoading || undefined }
145+ >
146+ < h3 className = "pws-dashboard-section-title" > { t ( "pws.dashboard.rateLimits" ) } </ h3 >
147+ { quotaProviders . length > 0 ? (
138148 < div className = "pws-dashboard-rows" >
139149 { quotaProviders . map ( ( { item, report } ) => (
140150 < button
@@ -157,17 +167,39 @@ export default function ProviderOverviewDashboard({
157167 threshold = { 80 }
158168 t = { t }
159169 layout = "stacked"
170+ pending = { quotasLoading && ! report . quota }
160171 />
161172 </ div >
162173 </ button >
163174 ) ) }
164175 </ div >
165- </ section >
166- ) }
176+ ) : quotasLoading ? (
177+ < div className = "pws-dashboard-rows pws-dashboard-rows--pending" aria-hidden = "true" >
178+ { Array . from ( { length : 3 } , ( _ , index ) => (
179+ < div key = { index } className = "pws-dashboard-row pws-dashboard-row--skeleton" >
180+ < span className = "pws-dashboard-row-icon pws-skel" />
181+ < div className = "pws-dashboard-row-info" >
182+ < span className = "pws-skel pws-skel--name" />
183+ < span className = "pws-skel pws-skel--meta" />
184+ </ div >
185+ < div className = "pws-dashboard-row-bars" >
186+ < QuotaBars quota = { null } threshold = { 80 } t = { t } layout = "stacked" pending />
187+ </ div >
188+ </ div >
189+ ) ) }
190+ </ div >
191+ ) : (
192+ < p className = "muted pws-dashboard-empty" > { t ( "pws.dashboard.noRateLimits" ) } </ p >
193+ ) }
194+ </ section >
167195
168- { mostUsed . length > 0 ? (
169- < section className = "pws-dashboard-section" aria-label = { t ( "pws.dashboard.recentlyUsed" ) } >
170- < h3 className = "pws-dashboard-section-title" > { t ( "pws.dashboard.recentlyUsed" ) } </ h3 >
196+ < section
197+ className = "pws-dashboard-section pws-dashboard-section--recent"
198+ aria-label = { t ( "pws.dashboard.recentlyUsed" ) }
199+ aria-busy = { usageLoading || undefined }
200+ >
201+ < h3 className = "pws-dashboard-section-title" > { t ( "pws.dashboard.recentlyUsed" ) } </ h3 >
202+ { mostUsed . length > 0 ? (
171203 < div className = "pws-dashboard-rows" >
172204 { mostUsed . map ( provider => (
173205 < button
@@ -185,13 +217,20 @@ export default function ProviderOverviewDashboard({
185217 </ button >
186218 ) ) }
187219 </ div >
188- </ section >
189- ) : (
190- < section className = "pws-dashboard-section" aria-label = { t ( "pws.dashboard.recentlyUsed" ) } >
191- < h3 className = "pws-dashboard-section-title" > { t ( "pws.dashboard.recentlyUsed" ) } </ h3 >
192- < p className = "muted" > { t ( "pws.dashboard.noUsage" ) } </ p >
193- </ section >
194- ) }
220+ ) : usageLoading ? (
221+ < div className = "pws-dashboard-rows pws-dashboard-rows--pending" aria-hidden = "true" >
222+ { Array . from ( { length : 3 } , ( _ , index ) => (
223+ < div key = { index } className = "pws-dashboard-row pws-dashboard-row--skeleton" >
224+ < span className = "pws-dashboard-row-icon pws-skel" />
225+ < span className = "pws-skel pws-skel--name" />
226+ < span className = "pws-skel pws-skel--count" />
227+ </ div >
228+ ) ) }
229+ </ div >
230+ ) : (
231+ < p className = "muted pws-dashboard-empty" > { t ( "pws.dashboard.noUsage" ) } </ p >
232+ ) }
233+ </ section >
195234 </ div >
196235 </ div >
197236 ) ;
0 commit comments