diff --git a/site/src/components/Badges/Badges.stories.tsx b/site/src/components/Badges/Badges.stories.tsx index cde5326a1e..7a346d96a1 100644 --- a/site/src/components/Badges/Badges.stories.tsx +++ b/site/src/components/Badges/Badges.stories.tsx @@ -7,10 +7,6 @@ import { EnabledBadge, EnterpriseBadge, EntitledBadge, - HealthyBadge, - NotHealthyBadge, - NotReachableBadge, - NotRegisteredBadge, PremiumBadge, PreviewBadge, } from "./Badges"; @@ -34,19 +30,6 @@ export const Entitled: Story = { children: , }, }; -export const ProxyStatus: Story = { - args: { - children: ( - <> - - - - - - - ), - }, -}; export const Disabled: Story = { args: { children: , diff --git a/site/src/components/Badges/Badges.tsx b/site/src/components/Badges/Badges.tsx index 7d6a508494..9cd62de362 100644 --- a/site/src/components/Badges/Badges.tsx +++ b/site/src/components/Badges/Badges.tsx @@ -1,10 +1,5 @@ import { Badge } from "components/Badge/Badge"; import { Stack } from "components/Stack/Stack"; -import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from "components/Tooltip/Tooltip"; import { type FC, forwardRef, @@ -27,57 +22,6 @@ export const EntitledBadge: FC = () => { ); }; - -interface HealthyBadgeProps { - derpOnly?: boolean; -} - -export const HealthyBadge: FC = ({ derpOnly }) => { - return ( - - {derpOnly ? "Healthy (DERP only)" : "Healthy"} - - ); -}; - -export const NotHealthyBadge: FC = () => { - return ( - - Unhealthy - - ); -}; - -export const NotRegisteredBadge: FC = () => { - return ( - - - - Never seen - - - - Workspace Proxy has never come online and needs to be started. - - - ); -}; - -export const NotReachableBadge: FC = () => { - return ( - - - - Not reachable - - - - Workspace Proxy not responding to http(s) requests. - - - ); -}; - export const DisabledBadge: FC = forwardRef< HTMLDivElement, HTMLAttributes diff --git a/site/src/components/StatusIndicator/StatusIndicator.stories.tsx b/site/src/components/StatusIndicator/StatusIndicator.stories.tsx index 8653fc37a2..93e39e8302 100644 --- a/site/src/components/StatusIndicator/StatusIndicator.stories.tsx +++ b/site/src/components/StatusIndicator/StatusIndicator.stories.tsx @@ -1,5 +1,12 @@ import type { Meta, StoryObj } from "@storybook/react-vite"; -import { StatusIndicator, StatusIndicatorDot } from "./StatusIndicator"; +import { + StatusHealthyIndicator, + StatusIndicator, + StatusIndicatorDot, + StatusNotHealthyIndicator, + StatusNotReachableIndicator, + StatusNotRegisteredIndicator, +} from "./StatusIndicator"; const meta: Meta = { title: "components/StatusIndicator", @@ -53,3 +60,33 @@ export const Small: Story = { size: "sm", }, }; + +export const Healthy: Story = { + args: { + children: , + }, +}; + +export const HealthyDERPOnly: Story = { + args: { + children: , + }, +}; + +export const NotHealthy: Story = { + args: { + children: , + }, +}; + +export const NotReachable: Story = { + args: { + children: , + }, +}; + +export const NotRegistered: Story = { + args: { + children: , + }, +}; diff --git a/site/src/components/StatusIndicator/StatusIndicator.tsx b/site/src/components/StatusIndicator/StatusIndicator.tsx index 28155d54fb..d8f607250a 100644 --- a/site/src/components/StatusIndicator/StatusIndicator.tsx +++ b/site/src/components/StatusIndicator/StatusIndicator.tsx @@ -1,4 +1,9 @@ import { cva, type VariantProps } from "class-variance-authority"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "components/Tooltip/Tooltip"; import { createContext, type FC, forwardRef, useContext } from "react"; import { cn } from "utils/cn"; @@ -93,3 +98,59 @@ export const StatusIndicatorDot: FC = ({ /> ); }; + +interface StatusHealthyIndicatorProps { + derpOnly?: boolean; +} + +export const StatusHealthyIndicator: FC = ({ + derpOnly, +}: StatusHealthyIndicatorProps) => { + return ( + + + {derpOnly ? "Healthy (DERP only)" : "Healthy"} + + ); +}; + +export const StatusNotHealthyIndicator: FC = () => { + return ( + + + Unhealthy + + ); +}; + +export const StatusNotRegisteredIndicator: FC = () => { + return ( + + + + + Never seen + + + + Workspace Proxy has never come online and needs to be started. + + + ); +}; + +export const StatusNotReachableIndicator: FC = () => { + return ( + + + + + Not reachable + + + + Workspace Proxy not responding to http(s) requests. + + + ); +}; diff --git a/site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyRow.tsx b/site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyRow.tsx index 17fa32fc84..ac8aee23da 100644 --- a/site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyRow.tsx +++ b/site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyRow.tsx @@ -3,11 +3,11 @@ import type { Region, WorkspaceProxy } from "api/typesGenerated"; import { Avatar } from "components/Avatar/Avatar"; import { AvatarData } from "components/Avatar/AvatarData"; import { - HealthyBadge, - NotHealthyBadge, - NotReachableBadge, - NotRegisteredBadge, -} from "components/Badges/Badges"; + StatusHealthyIndicator, + StatusNotHealthyIndicator, + StatusNotReachableIndicator, + StatusNotRegisteredIndicator, +} from "components/StatusIndicator/StatusIndicator"; import { TableCell, TableRow } from "components/Table/Table"; import type { ProxyLatencyReport } from "contexts/useProxyLatency"; import type { FC, ReactNode } from "react"; @@ -194,15 +194,15 @@ const DetailedProxyStatus: FC = ({ proxy }) => { switch (proxy.status.status) { case "ok": - return ; + return ; case "unhealthy": - return ; + return ; case "unreachable": - return ; + return ; case "unregistered": - return ; + return ; default: - return ; + return ; } }; @@ -212,10 +212,9 @@ interface ProxyStatusProps { // ProxyStatus will only show "healthy" or "not healthy" status. const ProxyStatus: FC = ({ proxy }) => { - let icon = ; - if (proxy.healthy) { - icon = ; - } - - return icon; + return proxy.healthy ? ( + + ) : ( + + ); };