@@ -62,13 +62,18 @@ const estimateFinish = (
62
62
interface WorkspaceBuildProgressProps {
63
63
workspace : Workspace ;
64
64
transitionStats : TransitionStats ;
65
- style ?: "workspace" | "task" ;
65
+ // variant changes how the progress bar is displayed: with the workspace
66
+ // variant the workspace transition and time remaining are displayed under the
67
+ // bar aligned to the left and right respectively. With the task variant the
68
+ // workspace transition is not displayed and the time remaining is displayed
69
+ // centered above the bar, and the bar's border radius is removed.
70
+ variant ?: "workspace" | "task" ;
66
71
}
67
72
68
73
export const WorkspaceBuildProgress : FC < WorkspaceBuildProgressProps > = ( {
69
74
workspace,
70
75
transitionStats,
71
- style ,
76
+ variant ,
72
77
} ) => {
73
78
const job = workspace . latest_build . job ;
74
79
const [ progressValue , setProgressValue ] = useState < number | undefined > ( 0 ) ;
@@ -116,7 +121,7 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
116
121
}
117
122
return (
118
123
< div css = { styles . stack } >
119
- { style === "task" && (
124
+ { variant === "task" && (
120
125
< div className = "mb-1 text-center" >
121
126
< div css = { styles . label } data-chromatic = "ignore" >
122
127
{ progressText }
@@ -135,15 +140,17 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
135
140
? "determinate"
136
141
: "indeterminate"
137
142
}
138
- // If a transition is set, there is a moment on new load where the
139
- // bar accelerates to progressValue and then rapidly decelerates, which
140
- // is not indicative of true progress.
141
143
classes = { {
144
+ // If a transition is set, there is a moment on new load where the bar
145
+ // accelerates to progressValue and then rapidly decelerates, which is
146
+ // not indicative of true progress.
142
147
bar : classNames . bar ,
143
- root : style === "task" ? classNames . root : undefined ,
148
+ // With the "task" variant, the progress bar is fullscreen, so remove
149
+ // the border radius.
150
+ root : variant === "task" ? classNames . root : undefined ,
144
151
} }
145
152
/>
146
- { style !== "task" && (
153
+ { variant !== "task" && (
147
154
< div className = "flex mt-1 justify-between" >
148
155
< div css = { styles . label } >
149
156
{ capitalize ( workspace . latest_build . status ) } workspace...
0 commit comments