File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,15 @@ import Tooltip from "@material-ui/core/Tooltip"
66import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline"
77import { FC } from "react"
88import * as TypesGen from "../../api/typesGenerated"
9+ import { generateRandomString } from "../../util/random"
910import { BaseIcon } from "./BaseIcon"
1011import { ShareIcon } from "./ShareIcon"
1112
13+ const Language = {
14+ appTitle : ( appName : string , identifier : string ) : string =>
15+ `${ appName } - ${ identifier } ` ,
16+ }
17+
1218export interface AppLinkProps {
1319 appsHost ?: string
1420 workspace : TypesGen . Workspace
@@ -92,6 +98,18 @@ export const AppLink: FC<AppLinkProps> = ({
9298 href = { href }
9399 target = "_blank"
94100 className = { canClick ? styles . link : styles . disabledLink }
101+ onClick = {
102+ canClick
103+ ? ( event ) => {
104+ event . preventDefault ( )
105+ window . open (
106+ href ,
107+ Language . appTitle ( appDisplayName , generateRandomString ( 12 ) ) ,
108+ "width=900,height=600" ,
109+ )
110+ }
111+ : undefined
112+ }
95113 >
96114 { button }
97115 </ Link >
Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ import ComputerIcon from "@material-ui/icons/Computer"
55import { FC } from "react"
66import * as TypesGen from "../../api/typesGenerated"
77import { combineClasses } from "../../util/combineClasses"
8+ import { generateRandomString } from "../../util/random"
89
910export const Language = {
1011 linkText : "Terminal" ,
12+ terminalTitle : ( identifier : string ) : string => `Terminal - ${ identifier } ` ,
1113}
1214
1315export interface TerminalLinkProps {
@@ -40,6 +42,14 @@ export const TerminalLink: FC<React.PropsWithChildren<TerminalLinkProps>> = ({
4042 href = { href }
4143 className = { combineClasses ( [ styles . link , className ] ) }
4244 target = "_blank"
45+ onClick = { ( event ) => {
46+ event . preventDefault ( )
47+ window . open (
48+ href ,
49+ Language . terminalTitle ( generateRandomString ( 12 ) ) ,
50+ "width=900,height=600" ,
51+ )
52+ } }
4353 >
4454 < Button startIcon = { < ComputerIcon /> } size = "small" >
4555 { Language . linkText }
You can’t perform that action at this time.
0 commit comments