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

Skip to content

Commit 27f64de

Browse files
committed
chore: fix idle state icon when disabled
When the workspace is off, we set a disabled color, but for the idle icon that also needs a fill, this only changed the border making it look weird. Instead, move the disabled logic into the component so we can apply a matching fill when necessary.
1 parent 288ec77 commit 27f64de

File tree

3 files changed

+44
-7
lines changed

3 files changed

+44
-7
lines changed

site/src/modules/apps/AppStatusStateIcon.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,23 @@ export const AppStatusStateIcon: FC<AppStatusStateIconProps> = ({
2424
latest,
2525
className: customClassName,
2626
}) => {
27-
const className = cn(["size-4 shrink-0", customClassName]);
27+
const className = cn([
28+
"size-4 shrink-0",
29+
customClassName,
30+
disabled && "text-content-disabled",
31+
]);
2832

2933
switch (state) {
3034
case "idle":
35+
// The pause icon is outlined; add a fill since it is hard to see and
36+
// remove the stroke so it is not overly thick.
3137
return (
3238
<PauseIcon
39+
css={{ strokeWidth: 0 }}
3340
className={cn([
3441
"text-content-secondary",
35-
"fill-content-secondary",
3642
className,
43+
disabled ? "fill-content-disabled" : "fill-content-secondary",
3744
])}
3845
/>
3946
);

site/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.stories.tsx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,43 @@ export const LongMessage: Story = {
6969
},
7070
};
7171

72-
export const Disabled: Story = {
72+
export const DisabledComplete: Story = {
7373
args: {
7474
status: MockWorkspaceAppStatus,
7575
disabled: true,
7676
},
7777
};
78+
79+
export const DisabledFailure: Story = {
80+
args: {
81+
status: {
82+
...MockWorkspaceAppStatus,
83+
state: "failure",
84+
message: "Couldn't figure out how to start the dev server",
85+
},
86+
disabled: true,
87+
},
88+
};
89+
90+
export const DisabledWorking: Story = {
91+
args: {
92+
status: {
93+
...MockWorkspaceAppStatus,
94+
state: "working",
95+
message: "Starting dev server...",
96+
uri: "",
97+
},
98+
disabled: true,
99+
},
100+
};
101+
102+
export const DisabledIdle: Story = {
103+
args: {
104+
status: {
105+
...MockWorkspaceAppStatus,
106+
state: "idle",
107+
message: "Done for now",
108+
},
109+
disabled: true,
110+
},
111+
};

site/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
} from "components/Tooltip/Tooltip";
88
import capitalize from "lodash/capitalize";
99
import { AppStatusStateIcon } from "modules/apps/AppStatusStateIcon";
10-
import { cn } from "utils/cn";
1110

1211
type WorkspaceAppStatusProps = {
1312
status: APIWorkspaceAppStatus | null;
@@ -37,9 +36,6 @@ export const WorkspaceAppStatus = ({
3736
latest
3837
disabled={disabled}
3938
state={status.state}
40-
className={cn({
41-
"text-content-disabled": disabled,
42-
})}
4339
/>
4440
<span className="whitespace-nowrap max-w-72 overflow-hidden text-ellipsis text-sm text-content-primary font-medium">
4541
{message}

0 commit comments

Comments
 (0)