-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(file-manager): 🎉 add file manager
- Loading branch information
1 parent
f1c480b
commit 23e592f
Showing
9 changed files
with
157 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { ReactElement } from "react"; | ||
import CardLayout from "../../layouts/CardLayout"; | ||
import { FullScreen, useFullScreenHandle } from "react-full-screen"; | ||
import { useAppSelector } from "../../hooks/redux"; | ||
import useRobot from "../../hooks/useRobot"; | ||
import RestartService from "../RestartServiceButton/RestartServiceButton"; | ||
import FullScreenButton from "../FullScreenButton/FullScreenButton"; | ||
import ServiceLogsButton from "../ServiceLogs/ServiceLogs"; | ||
|
||
export default function CodeEditor(): ReactElement { | ||
const handleFullScreen = useFullScreenHandle(); | ||
|
||
const { responseRobot } = useRobot(); | ||
|
||
const { urls } = useAppSelector((state) => state.robot); | ||
|
||
return ( | ||
<div className="animate__animated animate__fadeIn grid h-full"> | ||
<CardLayout loading={true}> | ||
<FullScreen className="relative" handle={handleFullScreen}> | ||
<iframe | ||
allow="clipboard-read" | ||
className={`animate__animated animate__fadeIn w-full ${ | ||
handleFullScreen?.active ? "h-screen" : "h-[45.4rem]" | ||
}`} | ||
src={urls?.ide || responseRobot?.ideIngressEndpoint} | ||
title="Code Editor" | ||
/> | ||
|
||
<div className="absolute bottom-1 right-4 flex scale-[0.88] flex-col gap-4"> | ||
<ServiceLogsButton type="ide" /> | ||
<RestartService type="ide" /> | ||
<FullScreenButton | ||
isFullScreen={handleFullScreen.active} | ||
handleFullScreen={ | ||
handleFullScreen.active | ||
? handleFullScreen.exit | ||
: handleFullScreen.enter | ||
} | ||
/> | ||
</div> | ||
</FullScreen> | ||
</CardLayout> | ||
</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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { stringSlugify } from "../../functions/GeneralFunctions"; | ||
import { IrobotTab } from "../../interfaces/robotInterfaces"; | ||
import ContentLoader from "react-content-loader"; | ||
import { Fragment, ReactElement } from "react"; | ||
import useRobot from "../../hooks/useRobot"; | ||
interface RobotHeaderTabProps { | ||
tab: IrobotTab; | ||
} | ||
|
||
export default function RobotHeaderTab({ | ||
tab, | ||
}: RobotHeaderTabProps): ReactElement { | ||
const { activeTab, setActiveTab, isRobotReady } = useRobot(); | ||
const isActiveTab = tab.name === activeTab; | ||
|
||
const handleClick = () => | ||
!tab?.isLoading && !tab?.isHidden && setActiveTab(tab.name); | ||
|
||
return ( | ||
<li | ||
data-tut={`robot-header-tab-${stringSlugify(tab?.name)}`} | ||
className={`flex cursor-pointer flex-col gap-3 ${ | ||
tab?.isHidden && "!hidden" | ||
}`} | ||
onClick={handleClick} | ||
> | ||
<div | ||
className={`flex min-w-max items-center gap-1 px-2 text-xs font-medium transition-all duration-500 ${ | ||
isActiveTab ? "text-layer-primary-500" : "text-layer-light-500" | ||
}`} | ||
> | ||
{tab?.isLoading || !isRobotReady ? ( | ||
<ContentLoader | ||
speed={1} | ||
width={108} | ||
height={16} | ||
backgroundColor="#f6f6ef" | ||
foregroundColor="#e8e8e3" | ||
> | ||
<rect width="108" height="12" /> | ||
</ContentLoader> | ||
) : ( | ||
<Fragment> | ||
{tab?.icon} | ||
<span>{tab.name}</span> | ||
</Fragment> | ||
)} | ||
</div> | ||
<div | ||
className={`h-[2px] w-full transition-all duration-500 ${ | ||
isActiveTab ? "bg-layer-primary-500" : "bg-layer-light-100" | ||
}`} | ||
/> | ||
</li> | ||
); | ||
} |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.