From f7054bd1da8bc88b7e62707f01c7a9bd1250af0c Mon Sep 17 00:00:00 2001 From: Cliff Hill Date: Wed, 8 Oct 2025 20:13:21 -0400 Subject: [PATCH] Working on organizing the CSS better. Signed-off-by: Cliff Hill --- .../src/components/BookingConfirmation.tsx | 13 +- frontend/src/components/BookingForm.tsx | 152 +++--------------- frontend/src/components/BookingList.tsx | 27 +--- frontend/src/components/RoomDetailsModal.tsx | 3 +- frontend/src/components/RoomList.tsx | 92 +++-------- frontend/src/components/RoomSelect.tsx | 48 ++++-- frontend/src/styles/BookingConfirmation.css | 10 ++ frontend/src/styles/BookingForm.css | 76 ++++++++- frontend/src/styles/RoomDetailsModal.css | 4 + frontend/src/styles/RoomSelect.css | 33 ++++ frontend/src/styles/colors.css | 8 + 11 files changed, 217 insertions(+), 249 deletions(-) create mode 100644 frontend/src/styles/BookingConfirmation.css create mode 100644 frontend/src/styles/RoomDetailsModal.css create mode 100644 frontend/src/styles/RoomSelect.css diff --git a/frontend/src/components/BookingConfirmation.tsx b/frontend/src/components/BookingConfirmation.tsx index f71a5971..19336e2a 100644 --- a/frontend/src/components/BookingConfirmation.tsx +++ b/frontend/src/components/BookingConfirmation.tsx @@ -13,6 +13,7 @@ // External imports import React from "react"; import { Box, Button } from "@mui/material"; +import "../styles/BookingConfirmation.css"; // Internal imports @@ -45,17 +46,7 @@ const BookingConfirmation: React.FC = ({ return null; } return ( - + {deleted ? ( <>

Booking Deleted

diff --git a/frontend/src/components/BookingForm.tsx b/frontend/src/components/BookingForm.tsx index 24ec5201..40b35f1c 100644 --- a/frontend/src/components/BookingForm.tsx +++ b/frontend/src/components/BookingForm.tsx @@ -27,6 +27,7 @@ import { Select, TextField, } from "@mui/material"; +import "../styles/BookingForm.css"; import { SelectChangeEvent } from "@mui/material/Select"; // Internal imports @@ -376,22 +377,8 @@ const BookingForm: React.FC = ({ } fullWidth margin="normal" - InputProps={{ - readOnly: true, - sx: { - color: "rgba(34,34,34,0.8) !important", - opacity: 0.8, - WebkitTextFillColor: "rgba(34,34,34,0.8)", - }, - inputProps: { - style: { - color: "rgba(34,34,34,0.8)", - background: "#f0f0f0", - opacity: 0.8, - WebkitTextFillColor: "rgba(34,34,34,0.8)", - }, - }, - }} + InputProps={{ readOnly: true }} + className="bookingform-viewfield" disabled /> ) : ( @@ -419,26 +406,8 @@ const BookingForm: React.FC = ({ onChange={(e) => setTitle(e.target.value)} fullWidth margin="normal" - InputProps={ - isViewMode - ? { - readOnly: true, - sx: { - color: "rgba(34,34,34,0.8) !important", - opacity: 0.8, - WebkitTextFillColor: "rgba(34,34,34,0.8)", - }, - inputProps: { - style: { - color: "rgba(34,34,34,0.8)", - background: "#f0f0f0", - opacity: 0.8, - WebkitTextFillColor: "rgba(34,34,34,0.8)", - }, - }, - } - : {} - } + InputProps={isViewMode ? { readOnly: true } : {}} + className={isViewMode ? "bookingform-viewfield" : undefined} disabled={isViewMode} /> {/* Start time */} @@ -463,26 +432,8 @@ const BookingForm: React.FC = ({ fullWidth margin="normal" {...(!isViewMode && { required: true })} - InputProps={ - isViewMode - ? { - readOnly: true, - sx: { - color: "rgba(34,34,34,0.8) !important", - opacity: 0.8, - WebkitTextFillColor: "rgba(34,34,34,0.8)", - }, - inputProps: { - style: { - color: "rgba(34,34,34,0.8)", - background: "#f0f0f0", - opacity: 0.8, - WebkitTextFillColor: "rgba(34,34,34,0.8)", - }, - }, - } - : {} - } + InputProps={isViewMode ? { readOnly: true } : {}} + className={isViewMode ? "bookingform-viewfield" : undefined} disabled={isViewMode} /> @@ -510,26 +461,8 @@ const BookingForm: React.FC = ({ fullWidth margin="normal" {...(!isViewMode && { required: true })} - InputProps={ - isViewMode - ? { - readOnly: true, - sx: { - color: "rgba(34,34,34,0.8) !important", - opacity: 0.8, - WebkitTextFillColor: "rgba(34,34,34,0.8)", - }, - inputProps: { - style: { - color: "rgba(34,34,34,0.8)", - background: "#f0f0f0", - opacity: 0.8, - WebkitTextFillColor: "rgba(34,34,34,0.8)", - }, - }, - } - : {} - } + InputProps={isViewMode ? { readOnly: true } : {}} + className={isViewMode ? "bookingform-viewfield" : undefined} disabled={isViewMode} /> @@ -557,31 +490,14 @@ const BookingForm: React.FC = ({ } fullWidth margin="normal" - InputProps={{ - readOnly: true, - sx: { - color: "rgba(34,34,34,0.8) !important", - opacity: 0.8, - WebkitTextFillColor: "rgba(34,34,34,0.8)", - }, - inputProps: { - style: { - color: "rgba(34,34,34,0.8)", - background: "#f0f0f0", - opacity: 0.8, - WebkitTextFillColor: "rgba(34,34,34,0.8)", - }, - }, - }} + InputProps={{ readOnly: true }} + className="bookingform-viewfield" disabled placeholder={invitees.length === 0 ? "No invitees" : undefined} /> ) : ( - + Invitees = ({ logger.info(`[RoomSelect] Room changed to ${e.target.value}`); onChange(e.target.value as string | number); }} - sx={{ - backgroundColor: selectBgColor, - color: "#fff", - transition: "background-color 0.2s", - }} + className="room-select-dropdown" + style={ + selectBgColor + ? { + backgroundColor: selectBgColor, + color: "#fff", + transition: "background-color 0.2s", + } + : undefined + } > {rooms.map((room) => { - // Compute room index directly from room.id const roomIdx = ((Number(room.id) - 1) % 20) + 1; const bgColor = `var(--room-color-${roomIdx})`; const isSelected = String(selectedRoomId) === String(room.id); + // For selected: background white, foreground = bgColor + // For unselected: background = bgColor, foreground = white + // For hover: handled by CSS return ( {room.name} diff --git a/frontend/src/styles/BookingConfirmation.css b/frontend/src/styles/BookingConfirmation.css new file mode 100644 index 00000000..045b9387 --- /dev/null +++ b/frontend/src/styles/BookingConfirmation.css @@ -0,0 +1,10 @@ +/* BookingConfirmation component styles */ +.booking-confirmation-container { + background: var(--color-white, #fff); + padding: 1.5em; + border-radius: 8px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); + max-width: 400px; + margin: 40px auto; + text-align: center; +} diff --git a/frontend/src/styles/BookingForm.css b/frontend/src/styles/BookingForm.css index 3506dcdd..6291cb62 100644 --- a/frontend/src/styles/BookingForm.css +++ b/frontend/src/styles/BookingForm.css @@ -1,3 +1,77 @@ +/* View mode field styles */ +.bookingform-viewfield { + color: var(--view-mode-color, rgba(34, 34, 34, 0.8)) !important; + background: var(--view-mode-bg-color, #f0f0f0); + opacity: 0.8; + -webkit-text-fill-color: var(--view-mode-color, rgba(34, 34, 34, 0.8)); +} + +/* Label background for InputLabel */ +.bookingform-label-bg { + background-color: var(--color-white, #fff); + opacity: 1; + padding-left: 0.5em; + padding-right: 0.5em; +} + +/* Invitee list container */ +.bookingform-invitee-list { + display: flex; + flex-wrap: wrap; + gap: 0.5em; +} + +/* Invitee chip */ +.bookingform-invitee-chip { + color: var(--color-primary, #1976d2); + margin-right: 8px; +} + +/* Invitee menu item: remaining slots */ +.bookingform-invitee-remaining { + color: var(--color-darker-gray, #222); + font-weight: 600; + font-size: 15px; + pointer-events: none; + background: inherit; +} + +/* Invitee menu item: over capacity */ +.bookingform-invitee-over { + color: var(--color-light-red, #d32f2f); + font-weight: 600; + font-size: 15px; + pointer-events: none; + background: inherit; +} + +/* Invitee menu item: unavailable */ +.bookingform-invitee-unavailable { + color: var(--color-dark-gray, #444); + opacity: 1; + font-weight: normal; + background: inherit; + cursor: not-allowed; + text-decoration: line-through; +} + +/* Invitee menu item: selected */ +.bookingform-invitee-selected { + font-weight: bold; + background-color: var(--invitee-selected, rgba(25, 118, 210, 0.08)); +} + +/* Invitee menu item: normal */ +.bookingform-invitee { + font-weight: normal; + background: inherit; +} + +/* Invitee checkmark */ +.bookingform-invitee-check { + color: var(--color-primary, #1976d2); + margin-right: 8px; +} /* Room label styles */ .booking-form-room-label { display: flex; @@ -7,7 +81,7 @@ /* Room icon styles */ .booking-form-room-icon { padding: 0.5em; - color: rgba(0, 0, 0, 0.54); + color: var(--room-icon, rgba(0, 0, 0, 0.54)); margin-left: 0; } diff --git a/frontend/src/styles/RoomDetailsModal.css b/frontend/src/styles/RoomDetailsModal.css new file mode 100644 index 00000000..386d56a4 --- /dev/null +++ b/frontend/src/styles/RoomDetailsModal.css @@ -0,0 +1,4 @@ +/* RoomDetailsModal component styles */ +.room-details-modal-title { + margin-top: 2em; +} diff --git a/frontend/src/styles/RoomSelect.css b/frontend/src/styles/RoomSelect.css new file mode 100644 index 00000000..19790bd4 --- /dev/null +++ b/frontend/src/styles/RoomSelect.css @@ -0,0 +1,33 @@ +/* RoomSelect component styles */ +.room-select-label-bg { + background-color: var(--color-white, #fff); + opacity: 1; + padding-left: 0.5em; + padding-right: 0.5em; +} +.room-select-dropdown { + background-color: var(--room-select-bg, #fff); + color: var(--room-select-color, #222); +} +.room-select-menu-item { + background-color: var(--room-menu-bg, inherit); + color: var(--room-menu-color, #fff); +} +.room-select-menu-item.selected { + font-weight: bold; + /* background and color set inline for selected */ +} + +.room-select-menu-item:hover, +.room-select-menu-item.Mui-focusVisible { + background-color: #f0f0f0 !important; + color: #111 !important; +} +.room-select-menu-item.unavailable { + color: var(--color-dark-gray, #444); + opacity: 1; + font-weight: normal; + background-color: inherit; + cursor: not-allowed; + text-decoration: line-through; +} diff --git a/frontend/src/styles/colors.css b/frontend/src/styles/colors.css index 8f4c400a..5a9f1de5 100644 --- a/frontend/src/styles/colors.css +++ b/frontend/src/styles/colors.css @@ -11,7 +11,10 @@ --color-on-surface: #23272f; --color-on-surface-secondary: #555; --color-white: #fff; + --color-dark-gray: #444; + --color-darker-gray: #222; --color-disabled: #bdbdbd; + --color-light-red: #d32f2f; /* Room color variables */ --room-color-1: #1976d2; --room-color-2: #388e3c; @@ -33,4 +36,9 @@ --room-color-18: #607d8b; --room-color-19: #795548; --room-color-20: #b71c1c; + + --view-mode-color: rgba(34, 34, 34, 0.8); + --view-mode-bg-color: #f0f0f0; + --invitee-selected: rgba(25, 118, 210, 0.08); + --room-icon: rgba(0, 0, 0, 0.54); }