1
1
import CircularProgress from "@mui/material/CircularProgress" ;
2
2
import Link from "@mui/material/Link" ;
3
- import { makeStyles } from "@mui/styles" ;
4
3
import Tooltip from "@mui/material/Tooltip" ;
5
4
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline" ;
5
+ import { type FC , useState } from "react" ;
6
+ import { useTheme } from "@emotion/react" ;
7
+ import { getApiKey } from "api/api" ;
8
+ import type * as TypesGen from "api/typesGenerated" ;
9
+ import { useProxy } from "contexts/ProxyContext" ;
6
10
import { PrimaryAgentButton } from "components/Resources/AgentButton" ;
7
- import { FC , useState } from "react" ;
8
- import { combineClasses } from "utils/combineClasses" ;
9
- import * as TypesGen from "api/typesGenerated" ;
11
+ import { createAppLinkHref } from "utils/apps" ;
10
12
import { generateRandomString } from "utils/random" ;
11
13
import { BaseIcon } from "./BaseIcon" ;
12
14
import { ShareIcon } from "./ShareIcon" ;
13
- import { useProxy } from "contexts/ProxyContext" ;
14
- import { createAppLinkHref } from "utils/apps" ;
15
- import { getApiKey } from "api/api" ;
16
15
17
16
const Language = {
18
17
appTitle : ( appName : string , identifier : string ) : string =>
@@ -31,7 +30,7 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
31
30
const appsHost = proxy . preferredWildcardHostname ;
32
31
const [ fetchingSessionToken , setFetchingSessionToken ] = useState ( false ) ;
33
32
34
- const styles = useStyles ( ) ;
33
+ const theme = useTheme ( ) ;
35
34
const username = workspace . owner_name ;
36
35
37
36
let appSlug = app . slug ;
@@ -65,12 +64,18 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
65
64
}
66
65
if ( app . health === "unhealthy" ) {
67
66
canClick = false ;
68
- icon = < ErrorOutlineIcon className = { styles . unhealthyIcon } /> ;
67
+ icon = < ErrorOutlineIcon css = { { color : theme . palette . warning . light } } /> ;
69
68
primaryTooltip = "Unhealthy" ;
70
69
}
71
70
if ( ! appsHost && app . subdomain ) {
72
71
canClick = false ;
73
- icon = < ErrorOutlineIcon className = { styles . notConfiguredIcon } /> ;
72
+ icon = (
73
+ < ErrorOutlineIcon
74
+ css = { {
75
+ color : theme . palette . grey [ 300 ] ,
76
+ } }
77
+ />
78
+ ) ;
74
79
primaryTooltip =
75
80
"Your admin has not configured subdomain application access" ;
76
81
}
@@ -86,7 +91,13 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
86
91
endIcon = { isPrivateApp ? undefined : < ShareIcon app = { app } /> }
87
92
disabled = { ! canClick }
88
93
>
89
- < span className = { combineClasses ( { [ styles . appName ] : ! isPrivateApp } ) } >
94
+ < span
95
+ css = {
96
+ ! isPrivateApp && {
97
+ marginRight : theme . spacing ( 1 ) ,
98
+ }
99
+ }
100
+ >
90
101
{ appDisplayName }
91
102
</ span >
92
103
</ PrimaryAgentButton >
@@ -98,7 +109,10 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
98
109
< Link
99
110
href = { href }
100
111
target = "_blank"
101
- className = { canClick ? styles . link : styles . disabledLink }
112
+ css = { {
113
+ pointerEvents : canClick ? "none" : undefined ,
114
+ textDecoration : "none !important" ,
115
+ } }
102
116
onClick = {
103
117
canClick
104
118
? async ( event ) => {
@@ -143,26 +157,3 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
143
157
</ Tooltip >
144
158
) ;
145
159
} ;
146
-
147
- const useStyles = makeStyles ( ( theme ) => ( {
148
- link : {
149
- textDecoration : "none !important" ,
150
- } ,
151
-
152
- disabledLink : {
153
- pointerEvents : "none" ,
154
- textDecoration : "none !important" ,
155
- } ,
156
-
157
- unhealthyIcon : {
158
- color : theme . palette . warning . light ,
159
- } ,
160
-
161
- notConfiguredIcon : {
162
- color : theme . palette . grey [ 300 ] ,
163
- } ,
164
-
165
- appName : {
166
- marginRight : theme . spacing ( 1 ) ,
167
- } ,
168
- } ) ) ;
0 commit comments