Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d0bc61d

Browse files
committed
Move progress to bottom
And remove the duplicate "Starting workspace..." text.
1 parent a5a511e commit d0bc61d

File tree

2 files changed

+34
-19
lines changed

2 files changed

+34
-19
lines changed

site/src/pages/TaskPage/TaskPage.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,23 @@ const TaskPage = () => {
109109
// If no template yet, use an indeterminate progress bar.
110110
const transition = (template &&
111111
ActiveTransition(template, task.workspace)) || { P50: 0, P95: null };
112-
const lastStage = buildLogs?.[buildLogs.length - 1]?.stage;
112+
const lastStage =
113+
buildLogs?.[buildLogs.length - 1]?.stage || "Waiting for build status";
113114
content = (
114-
<div className="w-full min-h-80 flex flex-col items-center justify-center gap-2">
115-
<div className="flex flex-col items-center">
115+
<div className="w-full min-h-80 flex flex-col">
116+
<div className="flex flex-col items-center grow justify-center">
116117
<h3 className="m-0 font-medium text-content-primary text-base">
117118
Starting your workspace
118119
</h3>
120+
{lastStage && (
121+
<div className="text-content-secondary text-sm">{lastStage}</div>
122+
)}
119123
</div>
120-
{lastStage && (
121-
<div className="text-content-secondary text-sm">{lastStage}</div>
122-
)}
123-
<div css={{ minWidth: 315 }}>
124+
<div className="w-full">
124125
<WorkspaceBuildProgress
125126
workspace={task.workspace}
126127
transitionStats={transition}
127-
stack={true}
128+
style="task"
128129
/>
129130
</div>
130131
</div>

site/src/pages/WorkspacePage/WorkspaceBuildProgress.tsx

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,13 @@ const estimateFinish = (
6262
interface WorkspaceBuildProgressProps {
6363
workspace: Workspace;
6464
transitionStats: TransitionStats;
65-
// stack indicates to stack the text vertically, otherwise put it on one line.
66-
stack?: boolean;
65+
style?: "workspace" | "task";
6766
}
6867

6968
export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
7069
workspace,
7170
transitionStats,
72-
stack,
71+
style,
7372
}) => {
7473
const job = workspace.latest_build.job;
7574
const [progressValue, setProgressValue] = useState<number | undefined>(0);
@@ -117,6 +116,13 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
117116
}
118117
return (
119118
<div css={styles.stack}>
119+
{style === "task" && (
120+
<div className={"mb-1 text-center"}>
121+
<div css={styles.label} data-chromatic="ignore">
122+
{progressText}
123+
</div>
124+
</div>
125+
)}
120126
<LinearProgress
121127
data-chromatic="ignore"
122128
value={progressValue !== undefined ? progressValue : 0}
@@ -132,23 +138,31 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
132138
// If a transition is set, there is a moment on new load where the
133139
// bar accelerates to progressValue and then rapidly decelerates, which
134140
// is not indicative of true progress.
135-
classes={{ bar: classNames.bar }}
141+
classes={{
142+
bar: classNames.bar,
143+
root: style === "task" ? classNames.root : undefined,
144+
}}
136145
/>
137-
<div className={stack ? "leading-tight mt-1" : "flex mt-1 justify-between"}>
138-
<div css={styles.label}>
139-
{capitalize(workspace.latest_build.status)} workspace...
140-
</div>
141-
<div css={styles.label} data-chromatic="ignore">
142-
{progressText}
146+
{style !== "task" && (
147+
<div className={"flex mt-1 justify-between"}>
148+
<div css={styles.label}>
149+
{capitalize(workspace.latest_build.status)} workspace...
150+
</div>
151+
<div css={styles.label} data-chromatic="ignore">
152+
{progressText}
153+
</div>
143154
</div>
144-
</div>
155+
)}
145156
</div>
146157
);
147158
};
148159

149160
const classNames = {
150161
bar: css`
151162
transition: none;
163+
`,
164+
root: css`
165+
border-radius: 0;
152166
`,
153167
};
154168

0 commit comments

Comments
 (0)