1
- import { makeStyles } from "@mui/styles" ;
2
- import { AppPreviewLink } from "components/Resources/AppLink/AppPreviewLink" ;
3
- import { FC } from "react" ;
4
- import { combineClasses } from "utils/combineClasses" ;
5
- import { WorkspaceAgent } from "api/typesGenerated" ;
1
+ import { type Interpolation , type Theme } from "@emotion/react" ;
2
+ import { type FC } from "react" ;
3
+ import type { WorkspaceAgent } from "api/typesGenerated" ;
6
4
import { Stack } from "../Stack/Stack" ;
5
+ import { AppPreviewLink } from "./AppLink/AppPreviewLink" ;
7
6
8
7
interface AgentRowPreviewStyles {
9
8
// Helpful when there are more than one row so the values are aligned
@@ -18,57 +17,58 @@ export const AgentRowPreview: FC<AgentRowPreviewProps> = ({
18
17
agent,
19
18
alignValues,
20
19
} ) => {
21
- const styles = useStyles ( { alignValues } ) ;
22
-
23
20
return (
24
21
< Stack
25
22
key = { agent . id }
26
23
direction = "row"
27
24
alignItems = "center"
28
25
justifyContent = "space-between"
29
- className = { styles . agentRow }
26
+ css = { styles . agentRow }
30
27
>
31
28
< Stack direction = "row" alignItems = "baseline" >
32
- < div className = { styles . agentStatusWrapper } >
33
- < div className = { styles . agentStatusPreview } > </ div >
29
+ < div css = { styles . agentStatusWrapper } >
30
+ < div css = { styles . agentStatusPreview } > </ div >
34
31
</ div >
35
32
< Stack
36
33
alignItems = "baseline"
37
34
direction = "row"
38
35
spacing = { 4 }
39
- className = { styles . agentData }
36
+ css = { styles . agentData }
40
37
>
41
38
< Stack
42
39
direction = "row"
43
40
alignItems = "baseline"
44
41
spacing = { 1 }
45
- className = { combineClasses ( [
42
+ css = { [
46
43
styles . noShrink ,
47
44
styles . agentDataItem ,
48
- styles . agentDataName ,
49
- ] ) }
45
+ ( theme ) => ( {
46
+ [ theme . breakpoints . up ( "sm" ) ] : {
47
+ minWidth : alignValues ? 240 : undefined ,
48
+ } ,
49
+ } ) ,
50
+ ] }
50
51
>
51
52
< span > Agent:</ span >
52
- < span className = { styles . agentDataValue } > { agent . name } </ span >
53
+ < span css = { styles . agentDataValue } > { agent . name } </ span >
53
54
</ Stack >
54
55
55
56
< Stack
56
57
direction = "row"
57
58
alignItems = "baseline"
58
59
spacing = { 1 }
59
- className = { combineClasses ( [
60
+ css = { [
60
61
styles . noShrink ,
61
62
styles . agentDataItem ,
62
- styles . agentDataOS ,
63
- ] ) }
63
+ ( theme ) => ( {
64
+ [ theme . breakpoints . up ( "sm" ) ] : {
65
+ minWidth : alignValues ? 100 : undefined ,
66
+ } ,
67
+ } ) ,
68
+ ] }
64
69
>
65
70
< span > OS:</ span >
66
- < span
67
- className = { combineClasses ( [
68
- styles . agentDataValue ,
69
- styles . agentOS ,
70
- ] ) }
71
- >
71
+ < span css = { [ styles . agentDataValue , styles . agentOS ] } >
72
72
{ agent . operating_system }
73
73
</ span >
74
74
</ Stack >
@@ -77,7 +77,7 @@ export const AgentRowPreview: FC<AgentRowPreviewProps> = ({
77
77
direction = "row"
78
78
alignItems = "center"
79
79
spacing = { 1 }
80
- className = { styles . agentDataItem }
80
+ css = { styles . agentDataItem }
81
81
>
82
82
< span > Apps:</ span >
83
83
< Stack
@@ -90,7 +90,7 @@ export const AgentRowPreview: FC<AgentRowPreviewProps> = ({
90
90
< AppPreviewLink key = { app . slug } app = { app } />
91
91
) ) }
92
92
{ agent . apps . length === 0 && (
93
- < span className = { styles . agentDataValue } > None</ span >
93
+ < span css = { styles . agentDataValue } > None</ span >
94
94
) }
95
95
</ Stack >
96
96
</ Stack >
@@ -100,8 +100,8 @@ export const AgentRowPreview: FC<AgentRowPreviewProps> = ({
100
100
) ;
101
101
} ;
102
102
103
- const useStyles = makeStyles ( ( theme ) => ( {
104
- agentRow : {
103
+ const styles = {
104
+ agentRow : ( theme ) => ( {
105
105
padding : theme . spacing ( 2 , 4 ) ,
106
106
backgroundColor : theme . palette . background . paperLight ,
107
107
fontSize : 16 ,
@@ -120,73 +120,59 @@ const useStyles = makeStyles((theme) => ({
120
120
top : 0 ,
121
121
left : 49 ,
122
122
} ,
123
- } ,
123
+ } ) ,
124
124
125
- agentStatusWrapper : {
125
+ agentStatusWrapper : ( theme ) => ( {
126
126
width : theme . spacing ( 4.5 ) ,
127
127
display : "flex" ,
128
128
justifyContent : "center" ,
129
129
flexShrink : 0 ,
130
- } ,
130
+ } ) ,
131
131
132
- agentStatusPreview : {
132
+ agentStatusPreview : ( theme ) => ( {
133
133
width : 10 ,
134
134
height : 10 ,
135
135
border : `2px solid ${ theme . palette . text . secondary } ` ,
136
136
borderRadius : "100%" ,
137
137
position : "relative" ,
138
138
zIndex : 1 ,
139
139
background : theme . palette . background . paper ,
140
- } ,
140
+ } ) ,
141
141
142
142
agentName : {
143
143
fontWeight : 600 ,
144
144
} ,
145
145
146
- agentOS : {
146
+ agentOS : ( theme ) => ( {
147
147
textTransform : "capitalize" ,
148
148
fontSize : 14 ,
149
149
color : theme . palette . text . secondary ,
150
- } ,
150
+ } ) ,
151
151
152
- agentData : {
152
+ agentData : ( theme ) => ( {
153
153
fontSize : 14 ,
154
154
color : theme . palette . text . secondary ,
155
155
156
156
[ theme . breakpoints . down ( "md" ) ] : {
157
157
gap : theme . spacing ( 2 ) ,
158
158
flexWrap : "wrap" ,
159
159
} ,
160
- } ,
160
+ } ) ,
161
161
162
- agentDataName : {
163
- [ theme . breakpoints . up ( "sm" ) ] : {
164
- minWidth : ( { alignValues } : AgentRowPreviewStyles ) =>
165
- alignValues ? 240 : undefined ,
166
- } ,
167
- } ,
168
-
169
- agentDataOS : {
170
- [ theme . breakpoints . up ( "sm" ) ] : {
171
- minWidth : ( { alignValues } : AgentRowPreviewStyles ) =>
172
- alignValues ? 100 : undefined ,
173
- } ,
174
- } ,
175
-
176
- agentDataValue : {
162
+ agentDataValue : ( theme ) => ( {
177
163
color : theme . palette . text . primary ,
178
- } ,
164
+ } ) ,
179
165
180
166
noShrink : {
181
167
flexShrink : 0 ,
182
168
} ,
183
169
184
- agentDataItem : {
170
+ agentDataItem : ( theme ) => ( {
185
171
[ theme . breakpoints . down ( "md" ) ] : {
186
172
flexDirection : "column" ,
187
173
alignItems : "flex-start" ,
188
174
gap : theme . spacing ( 1 ) ,
189
175
width : "fit-content" ,
190
176
} ,
191
- } ,
192
- } ) ) ;
177
+ } ) ,
178
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments