From 48bb534a51065adeba6788a8dfb83f2cf9fe5e14 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 25 Jun 2025 10:06:57 -0800 Subject: [PATCH] chore: fix idle state icon when disabled (#18554) When the workspace is off, we set a disabled text/stroke color, but for the idle icon that also needs a fill, this only changed the outline making it look weird. Instead, move the disabled logic into the component so we can apply a matching fill. I felt it looked too thick with both the outline and fill, so I also removed the outline. Really I think maybe the workspace status should be a separate column rather than disabling these icons, but this maintains the status quo. Before with mismatching stroke and fill color: ![screenshot](https://github.com/user-attachments/assets/961014b7-1e26-49f0-aa87-834f2f367618) After with disabled fill and stroke removal: ![screenshot](https://github.com/user-attachments/assets/205e4515-dc01-4437-87ec-a0f8a546da3b) Enabled fill and stroke removal: ![screenshot](https://github.com/user-attachments/assets/04f5914e-f96c-4c75-8873-e3fc9c854d95) --- site/src/modules/apps/AppStatusStateIcon.tsx | 11 ++++-- .../WorkspaceAppStatus.stories.tsx | 36 ++++++++++++++++++- .../WorkspaceAppStatus/WorkspaceAppStatus.tsx | 4 --- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/site/src/modules/apps/AppStatusStateIcon.tsx b/site/src/modules/apps/AppStatusStateIcon.tsx index 3497773952..1800c81958 100644 --- a/site/src/modules/apps/AppStatusStateIcon.tsx +++ b/site/src/modules/apps/AppStatusStateIcon.tsx @@ -24,16 +24,23 @@ export const AppStatusStateIcon: FC = ({ latest, className: customClassName, }) => { - const className = cn(["size-4 shrink-0", customClassName]); + const className = cn([ + "size-4 shrink-0", + customClassName, + disabled && "text-content-disabled", + ]); switch (state) { case "idle": + // The pause icon is outlined; add a fill since it is hard to see and + // remove the stroke so it is not overly thick. return ( ); diff --git a/site/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.stories.tsx b/site/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.stories.tsx index 0e229467b9..9327ff6b46 100644 --- a/site/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.stories.tsx +++ b/site/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.stories.tsx @@ -69,9 +69,43 @@ export const LongMessage: Story = { }, }; -export const Disabled: Story = { +export const DisabledComplete: Story = { args: { status: MockWorkspaceAppStatus, disabled: true, }, }; + +export const DisabledFailure: Story = { + args: { + status: { + ...MockWorkspaceAppStatus, + state: "failure", + message: "Couldn't figure out how to start the dev server", + }, + disabled: true, + }, +}; + +export const DisabledWorking: Story = { + args: { + status: { + ...MockWorkspaceAppStatus, + state: "working", + message: "Starting dev server...", + uri: "", + }, + disabled: true, + }, +}; + +export const DisabledIdle: Story = { + args: { + status: { + ...MockWorkspaceAppStatus, + state: "idle", + message: "Done for now", + }, + disabled: true, + }, +}; diff --git a/site/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.tsx b/site/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.tsx index 587ae9f5b0..633a9fcbc1 100644 --- a/site/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.tsx +++ b/site/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.tsx @@ -7,7 +7,6 @@ import { } from "components/Tooltip/Tooltip"; import capitalize from "lodash/capitalize"; import { AppStatusStateIcon } from "modules/apps/AppStatusStateIcon"; -import { cn } from "utils/cn"; type WorkspaceAppStatusProps = { status: APIWorkspaceAppStatus | null; @@ -37,9 +36,6 @@ export const WorkspaceAppStatus = ({ latest disabled={disabled} state={status.state} - className={cn({ - "text-content-disabled": disabled, - })} /> {message}