@@ -287,23 +287,23 @@ function RateLimitsSection({
287287 < InfoIconTooltip
288288 content = {
289289 < div className = "flex max-w-xs flex-col gap-3 py-1" >
290- < div className = "flex flex-col items-start gap-1" >
291- < Badge variant = "small" > Token bucket </ Badge >
292- < span className = "text-text-bright" >
290+ < div className = "flex flex-col items-start gap-1.5 " >
291+ < RateLimitTypeBadge type = "tokenBucket" / >
292+ < span className = "pl-0.5 text-text-bright" >
293293 Requests consume tokens from a bucket that refills over time. When empty,
294294 requests are rate limited.
295295 </ span >
296296 </ div >
297- < div className = "flex flex-col items-start gap-1" >
298- < Badge variant = "small" > Fixed window </ Badge >
299- < span className = "text-text-bright" >
297+ < div className = "flex flex-col items-start gap-1.5 " >
298+ < RateLimitTypeBadge type = "fixedWindow" / >
299+ < span className = "pl-0.5 text-text-bright" >
300300 Allows a set number of requests per time window. The window resets at
301301 fixed intervals.
302302 </ span >
303303 </ div >
304- < div className = "flex flex-col items-start gap-1" >
305- < Badge variant = "small" > Sliding window </ Badge >
306- < span className = "text-text-bright" >
304+ < div className = "flex flex-col items-start gap-1.5 " >
305+ < RateLimitTypeBadge type = "slidingWindow" / >
306+ < span className = "pl-0.5 text-text-bright" >
307307 Allows a set number of requests per rolling time window. The limit is
308308 continuously evaluated.
309309 </ span >
@@ -413,26 +413,35 @@ function RateLimitRow({
413413 ) ;
414414}
415415
416- function RateLimitTypeBadge ( { config } : { config : RateLimitInfo [ "config" ] } ) {
417- switch ( config . type ) {
416+ function RateLimitTypeBadge ( {
417+ config,
418+ type,
419+ } : {
420+ config ?: RateLimitInfo [ "config" ] ;
421+ type ?: "tokenBucket" | "fixedWindow" | "slidingWindow" ;
422+ } ) {
423+ const rateLimitType = type ?? config ?. type ;
424+ switch ( rateLimitType ) {
418425 case "tokenBucket" :
419426 return (
420- < Badge variant = "small" className = "w-fit" >
427+ < Badge variant = "small" className = "w-fit bg-blue-500/20 text-blue-400 " >
421428 Token bucket
422429 </ Badge >
423430 ) ;
424431 case "fixedWindow" :
425432 return (
426- < Badge variant = "small" className = "w-fit" >
433+ < Badge variant = "small" className = "w-fit bg-purple-500/20 text-purple-400 " >
427434 Fixed window
428435 </ Badge >
429436 ) ;
430437 case "slidingWindow" :
431438 return (
432- < Badge variant = "small" className = "w-fit" >
439+ < Badge variant = "small" className = "w-fit bg-green-500/20 text-green-400 " >
433440 Sliding window
434441 </ Badge >
435442 ) ;
443+ default :
444+ return null ;
436445 }
437446}
438447
0 commit comments