@@ -11,6 +11,7 @@ import {
1111 type LimitPool ,
1212 type LimitPoolMember ,
1313 type LimitPoolWindow ,
14+ paceRemainingPercent ,
1415 remainingPercent ,
1516} from "@t3tools/shared/usageLimits" ;
1617import { AlertTriangleIcon , ExternalLinkIcon , TicketIcon } from "lucide-react" ;
@@ -137,6 +138,7 @@ function SegmentPopover({
137138} ) {
138139 const timestampFormat = usePrimarySettings ( ( settings ) => settings . timestampFormat ) ;
139140 const remaining = remainingPercent ( window ) ;
141+ const timeLeft = paceRemainingPercent ( window , now ) ;
140142 const resetsIn = formatResetsIn ( window , now ) ;
141143 const where =
142144 account . environments . length > 0
@@ -177,6 +179,7 @@ function SegmentPopover({
177179 { resetsIn ? ` · ${ resetsIn . replace ( "resets in " , "in " ) } ` : "" }
178180 </ Row >
179181 ) : null }
182+ { timeLeft !== null ? < Row label = "Even pace" > { timeLeft } % left by now</ Row > : null }
180183 { reset && reset . restoresPercent > 0 ? (
181184 < Row label = "Restores" > +{ reset . restoresPercent } % of pool</ Row >
182185 ) : null }
@@ -226,6 +229,7 @@ function PoolSegment({
226229} ) {
227230 const [ open , setOpen ] = useState ( false ) ;
228231 const remaining = remainingPercent ( window ) ;
232+ const timeLeft = paceRemainingPercent ( window , now ) ;
229233 const resetsIn = formatResetsIn ( window , now ) ;
230234 const credits = account . limits . resetCredits ?. availableCount ?? 0 ;
231235 return (
@@ -236,33 +240,42 @@ function PoolSegment({
236240 < button
237241 type = "button"
238242 style = { { gridColumn : index , gridRow : 1 } }
239- aria-label = { `${ account . displayName ?? ( account . email ? accountInitials ( account . email ) : account . driver ) } : ${ remaining } % left${ resetsIn ? `, ${ resetsIn } ` : "" } ${ credits ? `, ${ credits } reset ${ credits === 1 ? "credit" : "credits" } banked` : "" } ` }
240- className = "relative h-5 min-w-0 cursor-pointer overflow-hidden rounded-md bg-muted text-start outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background data-[popup-open]:ring-1 data-[popup-open]:ring-inset data-[popup-open]:ring-border @2xl/pool:h-8"
243+ aria-label = { `${ account . displayName ?? ( account . email ? accountInitials ( account . email ) : account . driver ) } : ${ remaining } % left${ resetsIn ? `, ${ resetsIn } ` : "" } ${ timeLeft === null ? "" : `, ${ timeLeft } % of the window left` } ${ credits ? `, ${ credits } reset ${ credits === 1 ? "credit" : "credits" } banked` : "" } ` }
244+ className = "relative h-5 min-w-0 cursor-pointer rounded-md bg-muted text-start outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background data-[popup-open]:ring-1 data-[popup-open]:ring-inset data-[popup-open]:ring-border @2xl/pool:h-8"
241245 />
242246 }
243247 >
244- < div
245- aria-hidden
246- className = "absolute inset-y-0 left-0 rounded-md opacity-35"
247- style = { { width : `${ remaining } %` , backgroundColor : color } }
248- />
249- { remaining < 100 && reset && refillPercent > 0 ? (
248+ < div aria-hidden className = "absolute inset-0 overflow-hidden rounded-md" >
250249 < div
251250 aria-hidden
252- className = "absolute inset-y-0 right-0 opacity-20"
253- style = { {
254- width : `${ Math . min ( 100 - remaining , refillPercent ) } %` ,
255- backgroundImage : `repeating-linear-gradient(135deg, ${ color } 0 1px, transparent 1px 5px)` ,
256- } }
251+ className = "absolute inset-y-0 left-0 rounded-md opacity-35"
252+ style = { { width : `${ remaining } %` , backgroundColor : color } }
253+ />
254+ { remaining < 100 && reset && refillPercent > 0 ? (
255+ < div
256+ aria-hidden
257+ className = "absolute inset-y-0 right-0 opacity-20"
258+ style = { {
259+ width : `${ Math . min ( 100 - remaining , refillPercent ) } %` ,
260+ backgroundImage : `repeating-linear-gradient(135deg, ${ color } 0 1px, transparent 1px 5px)` ,
261+ } }
262+ />
263+ ) : null }
264+ </ div >
265+ { timeLeft !== null ? (
266+ < span
267+ aria-hidden
268+ className = "absolute -inset-y-1 w-0.5 -translate-x-1/2 rounded-full bg-muted-foreground"
269+ style = { { left : `${ timeLeft } %` } }
257270 />
258271 ) : null }
259272 < span
260273 aria-hidden
261- className = "absolute inset-0 flex items-center justify-center text-3xs leading-none font-semibold text-foreground/80 tabular-nums @2xl/pool:hidden"
274+ className = "absolute inset-0 flex items-center justify-center overflow-hidden rounded-md text-3xs leading-none font-semibold text-foreground/80 tabular-nums @2xl/pool:hidden"
262275 >
263276 { index }
264277 </ span >
265- < div className = "relative hidden h-full min-w-0 items-center gap-1.5 px-2 text-xs @2xl/pool:flex" >
278+ < div className = "relative hidden h-full min-w-0 items-center gap-1.5 overflow-hidden rounded-md px-2 text-xs @2xl/pool:flex" >
266279 { showAccountName ? (
267280 < AccountName
268281 account = { account }
@@ -271,7 +284,7 @@ function PoolSegment({
271284 ) : null }
272285 < span className = "shrink-0 font-semibold text-foreground tabular-nums" > { remaining } %</ span >
273286 { resetsIn || credits ? (
274- < span className = "ms-auto flex shrink- 0 items-center gap-1.5 rounded-sm bg-background/85 px-1.5 py-0.5 text-2xs text-foreground tabular-nums" >
287+ < span className = "ms-auto flex min-w- 0 items-center gap-1.5 overflow-hidden rounded-sm bg-background/85 px-1.5 py-0.5 text-2xs whitespace-nowrap text-foreground tabular-nums" >
275288 { resetsIn ?. replace ( "resets in " , "↻ " ) ?? "" }
276289 { credits ? (
277290 < >
0 commit comments