From 011df22d6019e91c6a175203991613f1c656fffd Mon Sep 17 00:00:00 2001 From: fullsizemalt <106900403+fullsizemalt@users.noreply.github.com> Date: Fri, 19 Dec 2025 14:25:54 -0800 Subject: [PATCH] feat: Mobile responsive 3D viewer improvements - Implemented responsive header with collapsible sidebar toggle - Added mobile-optimized styles for PlantDataCard (full-width bottom sheet) - Adjusted positioning of map controls and legend for mobile screens - Added mobile interaction improvements (auto-close sidebar on select) - Refined typography and spacing for touch targets --- .../components/facility3d/PlantDataCard.tsx | 6 +- frontend/src/pages/Facility3DViewerPage.tsx | 218 ++++++++++-------- 2 files changed, 119 insertions(+), 105 deletions(-) diff --git a/frontend/src/components/facility3d/PlantDataCard.tsx b/frontend/src/components/facility3d/PlantDataCard.tsx index d1d6fab..f7bdaf5 100644 --- a/frontend/src/components/facility3d/PlantDataCard.tsx +++ b/frontend/src/components/facility3d/PlantDataCard.tsx @@ -66,7 +66,7 @@ export function PlantDataCard({ plant, onClose }: PlantDataCardProps) { : `R${plant.row} • C${plant.column} • T${plant.tier}`; return ( -
+
{/* Header */}
@@ -75,8 +75,8 @@ export function PlantDataCard({ plant, onClose }: PlantDataCardProps) { {plantInfo.tagNumber} {plantInfo.stage?.replace('_', ' ') || 'VEG'} diff --git a/frontend/src/pages/Facility3DViewerPage.tsx b/frontend/src/pages/Facility3DViewerPage.tsx index 603310e..629e33b 100644 --- a/frontend/src/pages/Facility3DViewerPage.tsx +++ b/frontend/src/pages/Facility3DViewerPage.tsx @@ -1,8 +1,9 @@ +// ... imports ... import { useEffect, useState, Suspense, Component, ReactNode, useCallback } from 'react'; import { Canvas } from '@react-three/fiber'; import { Html, CameraControls } from '@react-three/drei'; import { layoutApi, Floor3DData, Room3D, Position3D, Section3D } from '../lib/layoutApi'; -import { Loader2, ArrowLeft, Maximize, MousePointer2, Layers, Thermometer, Droplets, Activity, Leaf, Eye, EyeOff, Clock } from 'lucide-react'; +import { Loader2, ArrowLeft, Maximize, MousePointer2, Layers, Thermometer, Droplets, Activity, Leaf, Eye, EyeOff, Clock, Menu } from 'lucide-react'; import { Link, useSearchParams } from 'react-router-dom'; import { FacilityScene } from '../components/facility3d/FacilityScene'; import { PlantSearch } from '../components/facility3d/PlantSearch'; @@ -15,10 +16,8 @@ import { HierarchyBreadcrumb } from '../components/facility3d/HierarchyBreadcrum import { PlantDataCard } from '../components/facility3d/PlantDataCard'; import { SCALE } from '../components/facility3d/coordinates'; -/** - * Calculate plant world coordinates matching SmartRack's grid logic exactly. - * This ensures beacon position matches where plants are actually rendered. - */ +// ... calculatePlantCoords and ErrorBoundary remain unchanged ... + function calculatePlantCoords( section: Section3D, position: { row: number; column: number; tier: number }, @@ -87,6 +86,9 @@ export default function Facility3DViewerPage() { const [selectedPlant, setSelectedPlant] = useState(null); const [visMode, setVisMode] = useState('STANDARD'); + // Mobile Nav State + const [isSidebarOpen, setIsSidebarOpen] = useState(false); + // Phase 2: Search state const [highlightedTags, setHighlightedTags] = useState([]); const [dimMode, setDimMode] = useState(false); @@ -201,6 +203,8 @@ export default function Facility3DViewerPage() { setBeaconPosition(null); setHighlightedTags([]); setDimMode(false); + // Mobile UX: Close sidebar after selection + setIsSidebarOpen(false); }; const resetView = () => { @@ -292,22 +296,31 @@ export default function Facility3DViewerPage() { return (
{/* Header */} -
-
- - Back +
+
+ {/* Mobile Menu Toggle */} + + + + Back
-

- Facility 3D - BETA +

+ Facility 3D + 3D View + BETA

-
+
{allFloors.length > 1 ? (