-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(robot-header): 🎉 update robot header with services component
- Loading branch information
1 parent
f1d75f7
commit 5ae2f82
Showing
10 changed files
with
96 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/components/RobotServiceButtons/RobotServiceButtons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { ReactElement } from "react"; | ||
import useRobot from "../../hooks/useRobot"; | ||
import Button from "../Button/Button"; | ||
|
||
export default function RobotServiceButtons(): ReactElement { | ||
const { responseRobot, isSettedCookie } = useRobot(); | ||
|
||
return ( | ||
<div className="flex gap-2"> | ||
<div className="flex items-center rounded-lg"> | ||
<a | ||
target="_blank" | ||
rel="noreferrer" | ||
href={responseRobot?.ideIngressEndpoint || "#"} | ||
> | ||
<Button | ||
disabled={!isSettedCookie} | ||
loading={!isSettedCookie} | ||
text={"Code Editor"} | ||
className="!h-9 text-xs px-4" | ||
/> | ||
</a> | ||
</div> | ||
<div className="flex items-center rounded-lg p-2"> | ||
<a | ||
target="_blank" | ||
rel="noreferrer" | ||
href={ | ||
responseRobot?.vdiIngressEndpoint | ||
? `https://${responseRobot?.vdiIngressEndpoint?.split("//")[1]}` | ||
: "#" | ||
} | ||
> | ||
<Button | ||
disabled={!isSettedCookie} | ||
loading={!isSettedCookie} | ||
text={"Remote Desktop"} | ||
className="!h-9 text-xs px-4" | ||
/> | ||
</a> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
import React from "react"; | ||
import React, { ReactElement } from "react"; | ||
import packageJSON from "../../../package.json"; | ||
import { envFrontendUrl, isProduction } from "../../helpers/envProvider"; | ||
|
||
export default function VersionViewer(): ReactElement { | ||
const developmentURL = `http://localhost:3000${ | ||
window.location.href?.split("robolaunch.cloud")[1] || "" | ||
}`; | ||
|
||
const productionURL = `${envFrontendUrl}${ | ||
window.location.href?.split("3000")[1] || "" | ||
}`; | ||
|
||
export default function VersionViewer() { | ||
return ( | ||
<div | ||
onClick={() => { | ||
if (process.env.NODE_ENV === "development") { | ||
window.location.href = `${process.env.REACT_APP_FRONTEND_URL}${ | ||
window.location.href?.split("3000")[1] || "" | ||
}`; | ||
} else if (process.env.NODE_ENV === "production") { | ||
window.location.href = `http://localhost:3000${ | ||
window.location.href?.split("robolaunch.cloud")[1] || "" | ||
}`; | ||
} | ||
window.location.href = isProduction ? developmentURL : productionURL; | ||
}} | ||
className="fixed bottom-0 right-1 z-50 text-[0.64rem] text-layer-light-700 cursor-crosshair" | ||
> | ||
{process.env.NODE_ENV === "production" ? "P" : "D"} {packageJSON?.version} | ||
{isProduction ? "P" : "D"} {packageJSON?.version} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
export const envOnPremise: boolean = | ||
process.env.REACT_APP_ON_PREMISE === "true" ? true : false; | ||
|
||
export const envFrontendUrl: string = process.env.REACT_APP_FRONTEND_URL || ""; | ||
|
||
export const isProduction: boolean = | ||
process.env.NODE_ENV === "production" ? true : false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters