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:
1 parent
206dcae196
commit
8b2ee8d937
9 files changed
+17
-77
No files matched your search
@@ -16,7 +16,7 @@ const langMap = {
|
||||
const LanguageSelector = () => {
|
||||
const { i18n } = useTranslation();
|
||||
const theme = useTheme();
|
||||
const { language } = useSelector((state) => state.ui);
|
||||
const { language = "en" } = useSelector((state) => state.ui);
|
||||
const dispatch = useDispatch();
|
||||
const handleChange = (event) => {
|
||||
const newLang = event.target.value;
|
||||
|
||||
@@ -2,7 +2,7 @@ import i18n from "../../../Utils/i18n.js";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useEffect } from "react";
|
||||
const I18nLoader = () => {
|
||||
const language = useSelector((state) => state.ui.language);
|
||||
const language = useSelector((state) => state.ui.language ?? "en");
|
||||
|
||||
useEffect(() => {
|
||||
if (language && i18n.language !== language) {
|
||||
|
||||
@@ -84,7 +84,7 @@ const Sidebar = () => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
// Redux state
|
||||
const collapsed = useSelector((state) => state.ui.sidebar.collapsed);
|
||||
const collapsed = useSelector((state) => state.ui.sidebar?.collapsed ?? false);
|
||||
|
||||
const menu = getMenu(t);
|
||||
const otherMenuItems = getOtherMenuItems(t);
|
||||
|
||||
Reference in new issue
Block a user