From 3df32174dc89632d9ff052a85ca8d156753717fb Mon Sep 17 00:00:00 2001 From: hcwinsemius Date: Sat, 25 Jan 2025 09:54:03 +0100 Subject: [PATCH] Add sliding right sidebar for GCP management #2 --- dashboard/src/nav/Navbar.css | 27 +++++++++++++- dashboard/src/views/calibration.jsx | 55 +++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/dashboard/src/nav/Navbar.css b/dashboard/src/nav/Navbar.css index 2b70d3d..2c973db 100644 --- a/dashboard/src/nav/Navbar.css +++ b/dashboard/src/nav/Navbar.css @@ -72,6 +72,7 @@ overflow-y: auto; transition: left 0.3s ease; z-index: 1050; + box-shadow: 2px 0 5px rgba(0,0,0,0.5); } .sidebar.open { @@ -123,4 +124,28 @@ background-color: rgba(0, 0, 0, 0.5); z-index: 1040; cursor: pointer; -} \ No newline at end of file +} + +.sidebar-right { + position: fixed; + top: 0; + height: 100%; + width: 300px; + background-color: #343a40; + transition: right 0.3s ease; + color: white; + z-index: 1050; + padding: 20px; + right: 0px; + overflow-y: auto; + box-shadow: -2px 0 5px rgba(0,0,0,0.5); +} + +.sidebar-right.hidden { + right: -320px; + box-shadow: none; +} + +.sidebar-right.visible { + right: 0px; +} diff --git a/dashboard/src/views/calibration.jsx b/dashboard/src/views/calibration.jsx index ab27cad..a0f420f 100644 --- a/dashboard/src/views/calibration.jsx +++ b/dashboard/src/views/calibration.jsx @@ -1,7 +1,8 @@ import React, { useState } from 'react'; +import { FaChevronLeft, FaChevronRight } from 'react-icons/fa'; import VideoTab from './calibrationTabs/videoTab' import XYZWidget from './calibrationTabs/XyzWidget'; - +import '../nav/Navbar.css' import './calibration.css'; // Ensure the styles reflect the updated layout. const Calibration = () => { @@ -10,6 +11,8 @@ const Calibration = () => { const [selectedWidgetId, setSelectedWidgetId] = useState(null); // To track which widget is being updated const [nextId, setNextId] = useState(1); // widget ids increment automatically const [dots, setDots] = useState([]); // Array of { x, y, id } objects + const [GCPsVisible, setGCPsVisible] = useState(false); // State to toggle GCP menu right-side + const [formData, setFormData] = useState({ video: '', @@ -62,9 +65,21 @@ const Calibration = () => { }; +// Toggles the right menu + const toggleMenu = () => { + setGCPsVisible((prev) => !prev); + }; + // Detects clicks outside the menu and closes it + const handleBackgroundClick = (e) => { + if (menuVisible) { + setMenuVisible(false); + } + }; + return (
+ {GCPsVisible &&
}

Camera calibration

{/* Form container */} @@ -133,8 +148,37 @@ const Calibration = () => {
)} -
-
+ + {/* Right-side button to toggle the menu */} + + {/* Sliding menu (right tabs column) */} +
+ + ORC Logo + {' '} GCPs + +
+{/*
*/} +{/*
*/} + {widgets.map((widget) => (
@@ -158,11 +202,8 @@ const Calibration = () => {
))}
+
-
- - - {/* Submit button section */}