Skip to content

Commit 774daa1

Browse files
committed
feat: open app on tab or slim-window
1 parent e7f1081 commit 774daa1

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

site/src/modules/resources/AppLink/AppLink.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
129129
}
130130

131131
event.preventDefault();
132+
132133
// This is an external URI like "vscode://", so
133134
// it needs to be opened with the browser protocol handler.
134-
if (app.external && !app.url.startsWith("http")) {
135-
// If the protocol is external the browser does not
136-
// redirect the user from the page.
135+
const isBrowserProtocol = app.external && !app.url.startsWith("http");
137136

137+
if (isBrowserProtocol) {
138138
// This is a magic undocumented string that is replaced
139139
// with a brand-new session token from the backend.
140140
// This only exists for external URLs, and should only
@@ -149,12 +149,22 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
149149
setFetchingSessionToken(false);
150150
}
151151
window.location.href = url;
152-
} else {
153-
window.open(
154-
href,
155-
Language.appTitle(appDisplayName, generateRandomString(12)),
156-
"width=900,height=600",
157-
);
152+
return;
153+
}
154+
155+
switch (app.open_in) {
156+
case "slim-window": {
157+
window.open(
158+
href,
159+
Language.appTitle(appDisplayName, generateRandomString(12)),
160+
"width=900,height=600",
161+
);
162+
return;
163+
}
164+
case "tab": {
165+
window.open(href);
166+
return;
167+
}
158168
}
159169
}}
160170
>

0 commit comments

Comments
 (0)