diff --git a/web/src/components/DeskGrid.css b/web/src/components/DeskGrid.css index 14320b7..825d338 100644 --- a/web/src/components/DeskGrid.css +++ b/web/src/components/DeskGrid.css @@ -1,5 +1,28 @@ -.desk-grid { - display: grid; - grid-template-columns: repeat(10, 1fr); - gap: 10px; +.office-layout { + display: flex; + justify-content: center; + align-items: center; + padding: 20px; + background-color: #ffffff; + border-radius: 8px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); +} + +.office-layout svg { + max-width: 100%; + height: auto; +} + +/* Responsive design */ +@media (max-width: 1200px) { + .office-layout svg { + width: 100%; + height: auto; + } +} + +@media (max-width: 768px) { + .office-layout { + padding: 10px; + } } diff --git a/web/src/components/DeskGrid.jsx b/web/src/components/DeskGrid.jsx index 1cfffc1..eb61aec 100644 --- a/web/src/components/DeskGrid.jsx +++ b/web/src/components/DeskGrid.jsx @@ -1,6 +1,6 @@ import PropTypes from "prop-types"; -import Desk from "./Desk"; +// import Desk from "./Desk"; import "./DeskGrid.css"; const DeskGrid = ({ desks, bookings, onDeskClick, currentUserId }) => { @@ -8,21 +8,287 @@ const DeskGrid = ({ desks, bookings, onDeskClick, currentUserId }) => { return bookings.find((b) => b.desk_id === deskId); }; + // Generate 50 desks if we don't have enough + const allDesks = []; + for (let i = 1; i <= 50; i++) { + const existingDesk = desks.find((d) => d.name === `Desk ${i}`); + if (existingDesk) { + allDesks.push(existingDesk); + } else { + // Create a mock desk for display purposes + allDesks.push({ + id: `mock-${i}`, + name: `Desk ${i}`, + ...existingDesk, + }); + } + } + + // Define desk positions for office layout + const deskPositions = [ + // Top wing (desks 1-12) + ...Array.from({ length: 12 }, (_, i) => ({ + id: allDesks[i].id, + name: allDesks[i].name, + x: 270 + i * 60, + y: 80, + desk: allDesks[i], + })), + // Left wing (desks 13-24) + ...Array.from({ length: 12 }, (_, i) => ({ + id: allDesks[i + 12].id, + name: allDesks[i + 12].name, + x: 80 + (i % 2) * 60, + y: 200 + Math.floor(i / 2) * 60, + desk: allDesks[i + 12], + })), + // Right wing (desks 25-36) + ...Array.from({ length: 12 }, (_, i) => ({ + id: allDesks[i + 24].id, + name: allDesks[i + 24].name, + x: 1020 + (i % 3) * 60, + y: 200 + Math.floor(i / 3) * 60, + desk: allDesks[i + 24], + })), + // Middle section (desks 37-50) + ...Array.from({ length: 14 }, (_, i) => ({ + id: allDesks[i + 36].id, + name: allDesks[i + 36].name, + x: 400 + (i % 5) * 80, + y: 250 + Math.floor(i / 5) * 80, + desk: allDesks[i + 36], + })), + ]; + return ( -