Simplify theme and fix Redux state bugs

## Changes

- Remove unused semantic color groups (successSecondary, map, chatbot)
- Remove unused properties from primary and tertiary groups
- Inline accent.darker usage in globalTheme.js
- Fix greeting component crash with persisted Redux state
- Fix MonitorGrid key prop warning

## Details

Theme simplification:
- Reduced constants.js from 355 to 291 lines
- Removed 3 unused semantic color groups
- Removed 6 unused properties (contrastBorder, contrastBorderDisabled, etc.)
- Inlined darken() call for accent hover states

Bug fixes:
- Added null-safe selectors in greeting.jsx for state.ui.greeting
- Added initialization check in setGreeting reducer for older persisted state
- Fixed key prop in MonitorGrid to handle both _id and id
- Removed unused console.log and Grid2 import
This commit is contained in:
gorkem-bwl committed 2026-01-15 18:06:40 -05:00
1 parent 206dcae196
commit 8b2ee8d937
9 files changed
+17 -77

No files matched your search

+1 -65
View File
@@ -1,4 +1,4 @@
import { lighten, darken } from "@mui/material/styles"; // CAIO_REVIEW
import { lighten } from "@mui/material/styles"; // CAIO_REVIEW
const typographyBase = 13;
@@ -133,12 +133,6 @@ const newSemanticColors = {
light: lighten(newColors.blueBlueWave, 0.2), //CAIO_REVIEW
dark: lighten(newColors.blueBlueWave, 0.2), //CAIO_REVIEW
},
darker: {
// CAIO_REVIEW
light: darken(newColors.blueBlueWave, 0.2), // CAIO_REVIEW
dark: darken(newColors.blueBlueWave, 0.2), // CAIO_REVIEW
},
contrastText: {
light: newColors.offWhite,
dark: newColors.offWhite,
@@ -165,14 +159,6 @@ const newSemanticColors = {
light: newColors.blueGray500,
dark: newColors.gray500,
},
contrastBorder: {
light: newColors.gray500,
dark: newColors.blueGray600,
},
contrastBorderDisabled: {
light: newColors.gray100,
dark: newColors.blueGray800,
},
lowContrast: {
light: newColors.gray250,
dark: newColors.blueGray600,
@@ -207,18 +193,6 @@ const newSemanticColors = {
light: newColors.blueGray800,
dark: newColors.gray100,
},
background: {
light: newColors.gray50,
dark: newColors.offBlack,
},
border: {
light: newColors.gray500,
dark: newColors.blueGray600,
},
cardShadow: {
light: "0 0 0 1px rgba(0, 0, 0, 0.04), 0 12px 24px rgba(0, 0, 0, 0.08)",
dark: "0 2px 10px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.04)",
},
},
success: {
main: {
@@ -234,20 +208,6 @@ const newSemanticColors = {
dark: newColors.green200,
},
},
successSecondary: {
main: {
light: undefined,
dark: "#073C2D",
},
contrastText: {
light: undefined,
dark: "#34D399",
},
lowContrast: {
light: undefined,
dark: "#094434",
},
},
warning: {
main: {
light: newColors.orange700,
@@ -316,30 +276,6 @@ const newSemanticColors = {
},
},
map: {
main: {
light: newColors.offWhite,
dark: undefined,
},
lowContrast: {
light: newColors.gray200,
dark: undefined,
},
highContrast: {
light: newColors.gray500,
dark: undefined,
},
},
chatbot: {
background: {
light: newColors.gray200,
dark: "#112B2B",
},
textAccent: {
light: "#C084FC",
dark: "#C084FC",
},
},
alert: {
main: {
light: newColors.gray200,
+2 -2
View File
@@ -64,7 +64,7 @@ const baseTheme = (palette) => ({
letterSpacing: "0.5px",
textShadow: "0 0 1px rgba(0, 0, 0, 0.15)",
"&:hover": {
backgroundColor: darken(theme.palette.accent.darker, 0.05),
backgroundColor: darken(theme.palette.accent.main, 0.25),
boxShadow: `0 2px 6px rgba(0, 0, 0, 0.1)`,
transition: "all 0.2s ease-in-out",
},
@@ -74,7 +74,7 @@ const baseTheme = (palette) => ({
props: (props) => props.color === "accent",
style: {
"&:hover": {
backgroundColor: theme.palette.accent.darker,
backgroundColor: darken(theme.palette.accent.main, 0.2),
},
},
},
+2 -2
View File
@@ -136,8 +136,8 @@ const Greeting = ({ type = "" }) => {
const dispatch = useDispatch();
const { t } = useTranslation();
const { firstName } = useSelector((state) => state.auth.user);
const index = useSelector((state) => state.ui.greeting.index);
const lastUpdate = useSelector((state) => state.ui.greeting.lastUpdate);
const index = useSelector((state) => state.ui.greeting?.index ?? 0);
const lastUpdate = useSelector((state) => state.ui.greeting?.lastUpdate ?? null);
const now = new Date();
const hour = now.getHours();