Skip to content

Commit

Permalink
refactor(robot-context): 🎉 update robot sub components for context logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gokhangunduz committed Aug 11, 2023
1 parent 44b6b92 commit d603215
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ui",
"version": "0.11.1",
"version": "0.11.2",
"private": true,
"dependencies": {
"@emotion/css": "^11.10.6",
Expand Down
16 changes: 5 additions & 11 deletions src/components/CodeEditor/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@ import CardLayout from "../../layouts/CardLayout";
import { FullScreen, useFullScreenHandle } from "react-full-screen";
import { BsFullscreen, BsFullscreenExit } from "react-icons/bs";
import { useAppSelector } from "../../hooks/redux";
import useRobot from "../../hooks/useRobot";

interface ICodeEditor {
activeTab: string;
responseRobot: any;
setIsSettedCookie: any;
}

export default function CodeEditor({
activeTab,
responseRobot,
setIsSettedCookie,
}: ICodeEditor): ReactElement {
export default function CodeEditor(): ReactElement {
const [activeTabCodeEditor, setActiveTabCodeEditor] = useState<
"Cloud IDE" | "Physical IDE"
>("Cloud IDE");

const handleFullScreen = useFullScreenHandle();

const { activeTab, responseRobot, setIsSettedCookie } = useRobot();

const { urls } = useAppSelector((state) => state.robot);

const codeEditorTabs = [
Expand Down
19 changes: 3 additions & 16 deletions src/pages/RobotPage/RobotPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactElement, useState } from "react";
import React, { ReactElement } from "react";
import HiddenVDIFrame from "../../components/HiddenVDIFrame/HiddenVDIFrame";
import TaskManagementLayout from "../../layouts/TaskManagementLayout";
import RosConnector from "../../components/RosConnector/RosConnector";
Expand All @@ -17,14 +17,7 @@ import useRobot from "../../hooks/useRobot";
import Overview from "./Overview/Overview";

export default function RobotPage(): ReactElement {
const {
activeTab,
setActiveTab,
responseRobot,
ros,
topicList,
setIsSettedCookie,
} = useRobot();
const { activeTab, setActiveTab, responseRobot } = useRobot();

const { urls } = useAppSelector((state) => state.robot);

Expand Down Expand Up @@ -83,8 +76,6 @@ export default function RobotPage(): ReactElement {
case "Teleoperation":
return (
<Teleoperation
ros={ros}
topicList={topicList}
vdiIngressEndpoint={
urls?.vdi || responseRobot?.vdiIngressEndpoint
}
Expand Down Expand Up @@ -120,11 +111,7 @@ export default function RobotPage(): ReactElement {
);
}
})()}
<CodeEditor
activeTab={activeTab}
responseRobot={responseRobot}
setIsSettedCookie={setIsSettedCookie}
/>
<CodeEditor />
</div>
<RosConnector />
<HiddenVDIFrame />
Expand Down
6 changes: 2 additions & 4 deletions src/pages/RobotPage/Teleoperation/Teleoperation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ import "gridstack/dist/gridstack-extra.css";
import "gridstack/dist/gridstack.min.css";
import { GridStack } from "gridstack";
import ROSLIB from "roslib";
import useRobot from "../../../hooks/useRobot";

interface ITeleoperation {
ros: any;
topicList: string[];
vdiIngressEndpoint: string;
handleForceUpdate: (page: IrobotPages["activeTab"]) => void;
}

export default function Teleoperation({
ros,
topicList,
vdiIngressEndpoint,
handleForceUpdate,
}: ITeleoperation): ReactElement {
Expand All @@ -39,6 +36,7 @@ export default function Teleoperation({
const [selectableTopic, setSelectableTopic] = useState<any>([]);
const [selectedTopic, setSelectedTopic] = useState<string>("");
const handleFullScreen = useFullScreenHandle();
const { ros, topicList } = useRobot();

// GRID
useEffect(() => {
Expand Down

0 comments on commit d603215

Please sign in to comment.