@@ -43,24 +43,15 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
43
43
const appsHost = proxy . preferredWildcardHostname ;
44
44
const [ fetchingSessionToken , setFetchingSessionToken ] = useState ( false ) ;
45
45
const [ iconError , setIconError ] = useState ( false ) ;
46
-
47
46
const theme = useTheme ( ) ;
48
47
const username = workspace . owner_name ;
49
-
50
- let appSlug = app . slug ;
51
- let appDisplayName = app . display_name ;
52
- if ( ! appSlug ) {
53
- appSlug = appDisplayName ;
54
- }
55
- if ( ! appDisplayName ) {
56
- appDisplayName = appSlug ;
57
- }
48
+ const displayName = app . display_name || app . slug ;
58
49
59
50
const href = createAppLinkHref (
60
51
window . location . protocol ,
61
52
preferredPathBase ,
62
53
appsHost ,
63
- appSlug ,
54
+ app . slug ,
64
55
username ,
65
56
workspace ,
66
57
agent ,
@@ -118,7 +109,7 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
118
109
// This is an external URI like "vscode://", so
119
110
// it needs to be opened with the browser protocol handler.
120
111
const shouldOpenAppExternally =
121
- app . external && ! app . url . startsWith ( "http" ) ;
112
+ app . external && app . url ? .startsWith ( "http" ) ;
122
113
123
114
if ( shouldOpenAppExternally ) {
124
115
// This is a magic undocumented string that is replaced
@@ -140,9 +131,7 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
140
131
// an error message will be displayed.
141
132
const openAppExternallyFailedTimeout = 500 ;
142
133
const openAppExternallyFailed = setTimeout ( ( ) => {
143
- displayError (
144
- `${ app . display_name !== "" ? app . display_name : app . slug } must be installed first.` ,
145
- ) ;
134
+ displayError ( `${ displayName } must be installed first.` ) ;
146
135
} , openAppExternallyFailedTimeout ) ;
147
136
window . addEventListener ( "blur" , ( ) => {
148
137
clearTimeout ( openAppExternallyFailed ) ;
@@ -156,7 +145,7 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
156
145
case "slim-window" : {
157
146
window . open (
158
147
href ,
159
- Language . appTitle ( appDisplayName , generateRandomString ( 12 ) ) ,
148
+ Language . appTitle ( displayName , generateRandomString ( 12 ) ) ,
160
149
"width=900,height=600" ,
161
150
) ;
162
151
return ;
@@ -169,7 +158,7 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
169
158
} }
170
159
>
171
160
{ icon }
172
- { appDisplayName }
161
+ { displayName }
173
162
{ canShare && < ShareIcon app = { app } /> }
174
163
</ a >
175
164
</ AgentButton >
0 commit comments