File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import { pluginReact } from '@rsbuild/plugin-react';
55const dataSource =
66 process . env . RSBUILD_PUBLIC_DATA_SOURCE === 'mock' ? 'mock' : 'remote' ;
77
8+ const buildTime = new Date ( ) . toISOString ( ) ;
9+
810export default defineConfig ( {
911 plugins : [ pluginReact ( ) ] ,
1012 source : {
@@ -13,6 +15,7 @@ export default defineConfig({
1315 } ,
1416 define : {
1517 'import.meta.env.RSBUILD_PUBLIC_DATA_SOURCE' : JSON . stringify ( dataSource ) ,
18+ 'import.meta.env.RSBUILD_BUILD_TIME' : JSON . stringify ( buildTime ) ,
1619 } ,
1720 } ,
1821 resolve : {
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ import history from '@data';
1111const DATA_SOURCE =
1212 import . meta. env . RSBUILD_PUBLIC_DATA_SOURCE === 'mock' ? 'mock' : 'remote' ;
1313
14+ /** Build timestamp injected at compile time */
15+ const BUILD_TIME = import . meta. env . RSBUILD_BUILD_TIME as string | undefined ;
16+
1417const STACKS = [
1518 { id : 'rspack' , label : 'Rspack' } ,
1619 { id : 'rsbuild' , label : 'Rsbuild' } ,
@@ -324,16 +327,20 @@ interface UpdateSchedule {
324327const SCHEDULE_HOURS_UTC = [ 1 , 13 ] as const ;
325328
326329function buildUpdateSchedule ( referenceTime : Date ) : UpdateSchedule {
327- const lastUpdate = getPrevScheduledTime ( referenceTime ) ;
328330 const nextUpdate = getNextScheduledTime ( referenceTime ) ;
329331
330332 const countdownMinutes = Math . max (
331333 0 ,
332334 Math . floor ( ( nextUpdate . getTime ( ) - referenceTime . getTime ( ) ) / 60_000 ) ,
333335 ) ;
334336
337+ // Use actual build time if available, otherwise fall back to calculated previous schedule
338+ const lastUpdated = BUILD_TIME
339+ ? formatTimestamp ( new Date ( BUILD_TIME ) )
340+ : formatTimestamp ( getPrevScheduledTime ( referenceTime ) ) ;
341+
335342 return {
336- lastUpdated : formatTimestamp ( lastUpdate ) ,
343+ lastUpdated,
337344 countdownMinutes,
338345 } ;
339346}
Original file line number Diff line number Diff line change @@ -135,24 +135,25 @@ export function Timeline({
135135 onValueChange = { ( value ) => onStackChange ?.( value ) }
136136 >
137137 < SelectTrigger
138- className = "min-w-0 flex-1 max-w-[200px] "
138+ className = "min-w-0 flex-1 max-w-fit "
139139 aria-label = "Select stack"
140140 >
141- < div className = "flex flex-1 items-center justify-between gap-2" >
142- < span className = "truncate font-medium text-foreground/90" >
143- { selectedStackMeta ?. label ?? 'Select stack' }
141+ < SelectValue placeholder = "Select stack…" >
142+ < span className = "flex items-center gap-2" >
143+ < span className = "font-medium text-foreground/90" >
144+ { selectedStackMeta ?. label ?? 'Select stack' }
145+ </ span >
146+ { selectedStackMeta ? (
147+ < Badge
148+ variant = "outline"
149+ className = "shrink-0 border-border/40 text-[11px]"
150+ >
151+ { selectedStackMeta . runs } { ' ' }
152+ { selectedStackMeta . runs === 1 ? 'run' : 'runs' }
153+ </ Badge >
154+ ) : null }
144155 </ span >
145- { selectedStackMeta ? (
146- < Badge
147- variant = "outline"
148- className = "border-border/40 text-[11px]"
149- >
150- { selectedStackMeta . runs } { ' ' }
151- { selectedStackMeta . runs === 1 ? 'run' : 'runs' }
152- </ Badge >
153- ) : null }
154- </ div >
155- < SelectValue className = "sr-only" placeholder = "Select stack…" />
156+ </ SelectValue >
156157 </ SelectTrigger >
157158 < SelectContent >
158159 { stacks ?. map ( ( stack ) => (
You can’t perform that action at this time.
0 commit comments