File tree 3 files changed +39
-8
lines changed
3 files changed +39
-8
lines changed Original file line number Diff line number Diff line change
1
+ import type { Meta , StoryObj } from "@storybook/react" ;
2
+ import { Latency } from "./Latency" ;
3
+
4
+ const meta : Meta < typeof Latency > = {
5
+ title : "components/Latency" ,
6
+ component : Latency ,
7
+ } ;
8
+
9
+ export default meta ;
10
+ type Story = StoryObj < typeof Latency > ;
11
+
12
+ export const Low : Story = {
13
+ args : {
14
+ latency : 10 ,
15
+ } ,
16
+ } ;
17
+
18
+ export const Medium : Story = {
19
+ args : {
20
+ latency : 150 ,
21
+ } ,
22
+ } ;
23
+
24
+ export const High : Story = {
25
+ args : {
26
+ latency : 300 ,
27
+ } ,
28
+ } ;
29
+
30
+ export const Loading : Story = {
31
+ args : {
32
+ isLoading : true ,
33
+ } ,
34
+ } ;
Original file line number Diff line number Diff line change @@ -7,15 +7,12 @@ import { type FC } from "react";
7
7
import { getLatencyColor } from "utils/latency" ;
8
8
import { Abbr } from "components/Abbr/Abbr" ;
9
9
10
- interface ProxyStatusLatencyProps {
10
+ interface LatencyProps {
11
11
latency ?: number ;
12
12
isLoading ?: boolean ;
13
13
}
14
14
15
- export const ProxyStatusLatency : FC < ProxyStatusLatencyProps > = ( {
16
- latency,
17
- isLoading,
18
- } ) => {
15
+ export const Latency : FC < LatencyProps > = ( { latency, isLoading } ) => {
19
16
const theme = useTheme ( ) ;
20
17
// Always use the no latency color for loading.
21
18
const color = getLatencyColor ( theme , isLoading ? undefined : latency ) ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import { usePermissions } from "contexts/auth/usePermissions";
17
17
import type { ProxyContextValue } from "contexts/ProxyContext" ;
18
18
import { Abbr } from "components/Abbr/Abbr" ;
19
19
import { displayError } from "components/GlobalSnackbar/utils" ;
20
- import { ProxyStatusLatency } from "components/ProxyStatusLatency/ProxyStatusLatency " ;
20
+ import { Latency } from "components/Latency/Latency " ;
21
21
import { CoderIcon } from "components/Icons/CoderIcon" ;
22
22
import { UserDropdown } from "./UserDropdown/UserDropdown" ;
23
23
@@ -276,7 +276,7 @@ const ProxyMenu: FC<ProxyMenuProps> = ({ proxyContextValue }) => {
276
276
/>
277
277
</ div >
278
278
279
- < ProxyStatusLatency
279
+ < Latency
280
280
latency = { latencies ?. [ selectedProxy . id ] ?. latencyMS }
281
281
isLoading = { proxyLatencyLoading ( selectedProxy ) }
282
282
/>
@@ -385,7 +385,7 @@ const ProxyMenu: FC<ProxyMenuProps> = ({ proxyContextValue }) => {
385
385
386
386
{ proxy . display_name }
387
387
388
- < ProxyStatusLatency
388
+ < Latency
389
389
latency = { latencies ?. [ proxy . id ] ?. latencyMS }
390
390
isLoading = { proxyLatencyLoading ( proxy ) }
391
391
/>
You can’t perform that action at this time.
0 commit comments