1
- import { cx } from "@emotion/css" ;
2
1
import { useTheme } from "@emotion/react" ;
3
2
import NotificationsOffOutlined from "@mui/icons-material/NotificationsOffOutlined" ;
4
3
import ReplayIcon from "@mui/icons-material/Replay" ;
@@ -9,13 +8,13 @@ import { health, refreshHealth } from "api/queries/debug";
9
8
import type { HealthSeverity } from "api/typesGenerated" ;
10
9
import { ErrorAlert } from "components/Alert/ErrorAlert" ;
11
10
import { Loader } from "components/Loader/Loader" ;
12
- import { type ClassName , useClassName } from "hooks/useClassName" ;
13
11
import kebabCase from "lodash/fp/kebabCase" ;
14
12
import { DashboardFullPage } from "modules/dashboard/DashboardLayout" ;
15
13
import { type FC , Suspense } from "react" ;
16
14
import { Helmet } from "react-helmet-async" ;
17
15
import { useMutation , useQuery , useQueryClient } from "react-query" ;
18
16
import { NavLink , Outlet } from "react-router" ;
17
+ import { cn } from "utils/cn" ;
19
18
import { createDayString } from "utils/createDayString" ;
20
19
import { pageTitle } from "utils/page" ;
21
20
import { HealthIcon } from "./Content" ;
@@ -44,8 +43,12 @@ export const HealthLayout: FC = () => {
44
43
} as const ;
45
44
const visibleSections = filterVisibleSections ( sections ) ;
46
45
47
- const link = useClassName ( classNames . link , [ ] ) ;
48
- const activeLink = useClassName ( classNames . activeLink , [ ] ) ;
46
+ const link = `
47
+ text-content-secondary border-none text-sm w-full flex items-center gap-3
48
+ text-left h-9 px-6 cursor-pointer no-underline transition-colors
49
+ hover:bg-surface-secondary hover:text-content-primary
50
+ ` ;
51
+ const activeLink = "bg-surface-secondary text-content-primary" ;
49
52
50
53
if ( isLoading ) {
51
54
return (
@@ -71,36 +74,17 @@ export const HealthLayout: FC = () => {
71
74
72
75
< DashboardFullPage >
73
76
< div
74
- css = { {
75
- display : "flex" ,
76
- flexBasis : 0 ,
77
- flex : 1 ,
78
- overflow : "hidden" ,
79
- } }
77
+ className = "flex basis-0 flex-1 overflow-hidden"
80
78
>
81
79
< div
82
- css = { {
83
- width : 256 ,
84
- flexShrink : 0 ,
85
- borderRight : `1px solid ${ theme . palette . divider } ` ,
86
- fontSize : 14 ,
87
- } }
80
+ className = "w-64 shrink-0 text-sm border-0 border-solid border-r border-r-border"
88
81
>
89
82
< div
90
- css = { {
91
- padding : 24 ,
92
- display : "flex" ,
93
- flexDirection : "column" ,
94
- gap : 16 ,
95
- } }
83
+ className = "flex flex-col gap-4 p-6"
96
84
>
97
85
< div >
98
86
< div
99
- css = { {
100
- display : "flex" ,
101
- alignItems : "center" ,
102
- justifyContent : "space-between" ,
103
- } }
87
+ className = "flex items-center justify-between"
104
88
>
105
89
< HealthIcon size = { 32 } severity = { healthStatus . severity } />
106
90
@@ -116,12 +100,12 @@ export const HealthLayout: FC = () => {
116
100
{ isRefreshing ? (
117
101
< CircularProgress size = { 16 } />
118
102
) : (
119
- < ReplayIcon css = { { width : 20 , height : 20 } } />
103
+ < ReplayIcon className = "size-5" />
120
104
) }
121
105
</ IconButton >
122
106
</ Tooltip >
123
107
</ div >
124
- < div css = { { fontWeight : 500 , marginTop : 16 } } >
108
+ < div className = "text-medium mt-4" >
125
109
{ healthStatus . healthy ? "Healthy" : "Unhealthy" }
126
110
</ div >
127
111
< div
@@ -132,44 +116,38 @@ export const HealthLayout: FC = () => {
132
116
>
133
117
{ healthStatus . healthy
134
118
? Object . keys ( visibleSections ) . some ( ( key ) => {
135
- const section =
136
- healthStatus [ key as keyof typeof visibleSections ] ;
137
- return section . warnings && section . warnings . length > 0 ;
138
- } )
119
+ const section =
120
+ healthStatus [ key as keyof typeof visibleSections ] ;
121
+ return section . warnings && section . warnings . length > 0 ;
122
+ } )
139
123
? "All systems operational, but performance might be degraded"
140
124
: "All systems operational"
141
125
: "Some issues have been detected" }
142
126
</ div >
143
127
</ div >
144
128
145
- < div css = { { display : "flex" , flexDirection : "column" } } >
146
- < span css = { { fontWeight : 500 } } > Last check</ span >
129
+ < div className = "flex flex-col" >
130
+ < span className = "text-medium" > Last check</ span >
147
131
< span
148
132
data-chromatic = "ignore"
149
- css = { {
150
- color : theme . palette . text . secondary ,
151
- lineHeight : "150%" ,
152
- } }
133
+ className = "text-content-secondary line-height-[150%]"
153
134
>
154
135
{ createDayString ( healthStatus . time ) }
155
136
</ span >
156
137
</ div >
157
138
158
139
< div css = { { display : "flex" , flexDirection : "column" } } >
159
- < span css = { { fontWeight : 500 } } > Version</ span >
140
+ < span className = "text-medium" > Version</ span >
160
141
< span
161
142
data-chromatic = "ignore"
162
- css = { {
163
- color : theme . palette . text . secondary ,
164
- lineHeight : "150%" ,
165
- } }
143
+ className = "text-content-secondary line-height-[150%]"
166
144
>
167
145
{ healthStatus . coder_version }
168
146
</ span >
169
147
</ div >
170
148
</ div >
171
149
172
- < nav css = { { display : "flex" , flexDirection : "column" , gap : 1 } } >
150
+ < nav className = "flex flex-col gap-px" >
173
151
{ Object . entries ( visibleSections )
174
152
. sort ( )
175
153
. map ( ( [ key , label ] ) => {
@@ -182,7 +160,7 @@ export const HealthLayout: FC = () => {
182
160
key = { key }
183
161
to = { `/health/${ kebabCase ( key ) } ` }
184
162
className = { ( { isActive } ) =>
185
- cx ( [ link , isActive && activeLink ] )
163
+ cn ( link , isActive && activeLink )
186
164
}
187
165
>
188
166
< HealthIcon
@@ -205,7 +183,7 @@ export const HealthLayout: FC = () => {
205
183
</ nav >
206
184
</ div >
207
185
208
- < div css = { { overflowY : " auto" , width : "100%" } } >
186
+ < div className = "overflow-y- auto w-full" >
209
187
< Suspense fallback = { < Loader /> } >
210
188
< Outlet context = { healthStatus } />
211
189
</ Suspense >
@@ -229,35 +207,3 @@ const filterVisibleSections = <T extends object>(sections: T) => {
229
207
230
208
return visible ;
231
209
} ;
232
-
233
- const classNames = {
234
- link : ( css , theme ) =>
235
- css ( {
236
- background : "none" ,
237
- pointerEvents : "auto" ,
238
- color : theme . palette . text . secondary ,
239
- border : "none" ,
240
- fontSize : 14 ,
241
- width : "100%" ,
242
- display : "flex" ,
243
- alignItems : "center" ,
244
- gap : 12 ,
245
- textAlign : "left" ,
246
- height : 36 ,
247
- padding : "0 24px" ,
248
- cursor : "pointer" ,
249
- textDecoration : "none" ,
250
-
251
- "&:hover" : {
252
- background : theme . palette . action . hover ,
253
- color : theme . palette . text . primary ,
254
- } ,
255
- } ) ,
256
-
257
- activeLink : ( css , theme ) =>
258
- css ( {
259
- background : theme . palette . action . hover ,
260
- pointerEvents : "none" ,
261
- color : theme . palette . text . primary ,
262
- } ) ,
263
- } satisfies Record < string , ClassName > ;
0 commit comments