Skip to content

Commit 8b30948

Browse files
committed
feat: use StatusIndicator instead of Circle
1 parent 8bdac49 commit 8b30948

File tree

2 files changed

+9
-50
lines changed

2 files changed

+9
-50
lines changed

site/src/pages/ManagementSettingsPage/IdpSyncPage/IdpSyncPageView.tsx

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { ChooseOne, Cond } from "components/Conditionals/ChooseOne";
1414
import { EmptyState } from "components/EmptyState/EmptyState";
1515
import { Paywall } from "components/Paywall/Paywall";
1616
import { Stack } from "components/Stack/Stack";
17+
import { StatusIndicator } from "components/StatusIndicator/StatusIndicator";
1718
import {
1819
TableLoaderSkeleton,
1920
TableRowSkeleton,
@@ -25,26 +26,6 @@ export type IdpSyncPageViewProps = {
2526
oidcConfig: OIDCConfig | undefined;
2627
};
2728

28-
type CircleProps = {
29-
color: string;
30-
variant?: "solid" | "outlined";
31-
};
32-
33-
const Circle: FC<CircleProps> = ({ color, variant = "solid" }) => {
34-
return (
35-
<div
36-
aria-hidden
37-
css={{
38-
width: 8,
39-
height: 8,
40-
backgroundColor: variant === "solid" ? color : undefined,
41-
border: variant === "outlined" ? `1px solid ${color}` : undefined,
42-
borderRadius: 9999,
43-
}}
44-
/>
45-
);
46-
};
47-
4829
export const IdpSyncPageView: FC<IdpSyncPageViewProps> = ({ oidcConfig }) => {
4930
const theme = useTheme();
5031
const {
@@ -79,7 +60,7 @@ export const IdpSyncPageView: FC<IdpSyncPageViewProps> = ({ oidcConfig }) => {
7960
spacing={1}
8061
alignItems="center"
8162
>
82-
<Circle color={theme.roles.error.fill.solid} />
63+
<StatusIndicator color="error" />
8364
<p>disabled</p>
8465
</Stack>
8566
)}
@@ -102,7 +83,7 @@ export const IdpSyncPageView: FC<IdpSyncPageViewProps> = ({ oidcConfig }) => {
10283
spacing={1}
10384
alignItems="center"
10485
>
105-
<Circle color={theme.roles.error.fill.solid} />
86+
<StatusIndicator color="error" />
10687
<p>disabled</p>
10788
</Stack>
10889
)}

site/src/pages/WorkspacesPage/LastUsed.tsx

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,12 @@
11
import { useTheme } from "@emotion/react";
22
import { Stack } from "components/Stack/Stack";
3+
import { StatusIndicator } from "components/StatusIndicator/StatusIndicator";
34
import dayjs from "dayjs";
45
import relativeTime from "dayjs/plugin/relativeTime";
56
import { useTime } from "hooks/useTime";
67
import type { FC } from "react";
78

89
dayjs.extend(relativeTime);
9-
10-
type CircleProps = {
11-
color: string;
12-
variant?: "solid" | "outlined";
13-
};
14-
15-
const Circle: FC<CircleProps> = ({ color, variant = "solid" }) => {
16-
return (
17-
<div
18-
aria-hidden
19-
css={{
20-
width: 8,
21-
height: 8,
22-
backgroundColor: variant === "solid" ? color : undefined,
23-
border: variant === "outlined" ? `1px solid ${color}` : undefined,
24-
borderRadius: 9999,
25-
}}
26-
/>
27-
);
28-
};
29-
3010
interface LastUsedProps {
3111
lastUsedAt: string;
3212
}
@@ -38,21 +18,19 @@ export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {
3818
const t = dayjs(lastUsedAt);
3919
const now = dayjs();
4020
let message = t.fromNow();
41-
let circle = (
42-
<Circle color={theme.palette.text.secondary} variant="outlined" />
43-
);
21+
let circle = <StatusIndicator color="info" variant="outlined" />;
4422

4523
if (t.isAfter(now.subtract(1, "hour"))) {
46-
circle = <Circle color={theme.roles.success.fill.solid} />;
24+
circle = <StatusIndicator color="success" />;
4725
// Since the agent reports on a 10m interval,
4826
// the last_used_at can be inaccurate when recent.
4927
message = "Now";
5028
} else if (t.isAfter(now.subtract(3, "day"))) {
51-
circle = <Circle color={theme.palette.text.secondary} />;
29+
circle = <StatusIndicator color="info" />;
5230
} else if (t.isAfter(now.subtract(1, "month"))) {
53-
circle = <Circle color={theme.roles.warning.fill.solid} />;
31+
circle = <StatusIndicator color="warning" />;
5432
} else if (t.isAfter(now.subtract(100, "year"))) {
55-
circle = <Circle color={theme.roles.error.fill.solid} />;
33+
circle = <StatusIndicator color="error" />;
5634
} else {
5735
message = "Never";
5836
}

0 commit comments

Comments
 (0)