Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dynamics page and react router #115

Merged
merged 9 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions control-station/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions control-station/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.23.1",
"socket.io-client": "^4.7.2"
},
"devDependencies": {
Expand Down
9 changes: 8 additions & 1 deletion control-station/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { ControlPanel, Navbar } from "@/components";
import usePodData from "./services/usePodData";
import PodContext from "./services/PodContext";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import { Dashboard } from "@/views";
import Dynamics from "./views/Dynamics/Dynamics";
vrushang1234 marked this conversation as resolved.
Show resolved Hide resolved

function App() {
const { podData, podSocketClient } = usePodData();
Expand All @@ -10,7 +12,12 @@ function App() {
<main>
<PodContext.Provider value={{ podData, podSocketClient }}>
<Navbar />
<Dashboard />
<BrowserRouter>
<Routes>
<Route path="/" element={<Dashboard />} />
<Route path="/dynamics" element={<Dynamics />} />
</Routes>
</BrowserRouter>
<ControlPanel />
</PodContext.Provider>
</main>
Expand Down
Binary file added control-station/src/data/images/FrontPod.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control-station/src/data/images/SidePod.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions control-station/src/views/Dynamics/Dynamics.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.dynamics {
display: flex;
}

.dynamics-sensorbox {
width: 40%;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
}

.dynamics-pictures {
width: 60%;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
}

.pod-picture-container {
background-color: rgb(209, 209, 209);
width: 60%;
height: 40%;
display: flex;
justify-content: center;
align-items: center;
border-radius: 40px;
}
28 changes: 28 additions & 0 deletions control-station/src/views/Dynamics/Dynamics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import SensorBox from "@/components/SensorBoxes/Sensors/SensorBox";
import PodContext from "@/services/PodContext";
import FrontPod from "@/data/images/FrontPod.png";
import SidePod from "@/data/images/SidePod.png";
import "./Dynamics.css";
import { useContext } from "react";
function Dynamics() {
vrushang1234 marked this conversation as resolved.
Show resolved Hide resolved
const { podData } = useContext(PodContext);
const { gyroscope } = podData;
return (
<div className="dynamics">
<div className="dynamics-sensorbox">
<SensorBox title="Roll" value={gyroscope.roll} />
<SensorBox title="Pitch" value={gyroscope.pitch} />
</div>
<div className="dynamics-pictures">
<div className="pod-picture-container">
<img src={FrontPod} />
</div>
<div className="pod-picture-container">
<img src={SidePod} />
vrushang1234 marked this conversation as resolved.
Show resolved Hide resolved
</div>
</div>
</div>
);
}

export default Dynamics;