refactor(css): migrate base.css to MUI GlobalStyles and Leaflet to styled()
Phase 2 of the "fully MUI" cleanup — eliminates two more stylesheets.
- base.css -> src/admin/GlobalStyles.tsx: the reset, typography,
scrollbar/::selection, theme cross-fade timing and all utility
classes now live in a single theme-aware MUI <GlobalStyles>, rendered
inside MuiProvider so every rule resolves against theme.vars (verified
reactive in both schemes). base.css deleted.
- attendance.css -> a styled("div") LocationMap in AttendanceLocation;
attendance.css deleted.
- App.tsx bootstrap loader is now fully self-contained (inline spinner
+ keyframes, theme-aware background read from the data-theme attr),
since it renders before MuiProvider/GlobalStyles mount — it no longer
depends on the removed .admin-spinner / var(--bg-primary).
tsc -b --noEmit and npm run build clean; verified in Chrome (light +
dark): body bg, text, fonts, .text-warning/.link-accent all correct.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,10 +6,25 @@ import Forbidden from "../components/Forbidden";
|
||||
import { useNavigate, useParams, Link as RouterLink } from "react-router-dom";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { styled } from "@mui/material/styles";
|
||||
|
||||
import L from "leaflet";
|
||||
import "leaflet/dist/leaflet.css";
|
||||
|
||||
// Leaflet map container (was the .attendance-location-map rule). zIndex:0
|
||||
// creates a stacking context so Leaflet's internal z-indexes stay contained.
|
||||
const LocationMap = styled("div")(({ theme }) => ({
|
||||
height: "400px",
|
||||
borderRadius: "8px",
|
||||
marginBottom: "1.5rem",
|
||||
background: theme.vars!.palette.background.paper,
|
||||
position: "relative",
|
||||
zIndex: 0,
|
||||
"@media (max-width:640px)": {
|
||||
height: "clamp(220px, 45vh, 400px)",
|
||||
},
|
||||
}));
|
||||
|
||||
import { formatDate, formatTime } from "../utils/attendanceHelpers";
|
||||
import {
|
||||
attendanceLocationOptions,
|
||||
@@ -209,10 +224,8 @@ export default function AttendanceLocation() {
|
||||
{record.user_name} — {formatDate(record.shift_date)}
|
||||
</Typography>
|
||||
|
||||
{/* Leaflet map — kept entirely as-is */}
|
||||
{hasAnyLocation && (
|
||||
<div ref={mapRef} className="attendance-location-map" />
|
||||
)}
|
||||
{/* Leaflet map */}
|
||||
{hasAnyLocation && <LocationMap ref={mapRef} />}
|
||||
|
||||
{/* Location detail grid */}
|
||||
<Box
|
||||
|
||||
Reference in New Issue
Block a user