diff --git a/web/package.json b/web/package.json index cbb774de..8fb469c8 100644 --- a/web/package.json +++ b/web/package.json @@ -1,42 +1,42 @@ { "name": "one_api_web", - "version": "1.0.0", + "version": "1.2.0", "proxy": "http://127.0.0.1:3000", "private": true, "homepage": "", "dependencies": { - "@emotion/cache": "^11.9.3", - "@emotion/react": "^11.9.3", - "@emotion/styled": "^11.9.3", - "@mui/icons-material": "^5.8.4", - "@mui/lab": "^5.0.0-alpha.169", - "@mui/material": "^5.8.6", - "@mui/system": "^5.8.6", - "@mui/utils": "^5.8.6", + "@emotion/cache": "^11.11.0", + "@emotion/react": "^11.11.3", + "@emotion/styled": "^11.11.0", + "@mui/icons-material": "^5.15.7", + "@mui/lab": "^5.0.0-alpha.163", + "@mui/material": "^5.15.7", + "@mui/system": "^5.15.7", + "@mui/utils": "^5.15.7", "@mui/x-data-grid": "^6.19.4", "@mui/x-date-pickers": "^6.18.5", - "@tabler/icons-react": "^2.44.0", - "apexcharts": "^3.35.3", + "@tabler/icons-react": "^2.46.0", + "apexcharts": "^3.45.2", "axios": "^0.27.2", "dayjs": "^1.11.10", - "formik": "^2.2.9", - "framer-motion": "^6.3.16", + "formik": "^2.4.5", + "framer-motion": "^11.0.3", "history": "^5.3.0", "marked": "^4.1.1", - "material-ui-popup-state": "^4.0.1", + "material-ui-popup-state": "^5.0.10", "notistack": "^3.0.1", "prop-types": "^15.8.1", "react": "^18.2.0", - "react-apexcharts": "^1.4.0", - "react-device-detect": "^2.2.2", + "react-apexcharts": "^1.4.1", + "react-device-detect": "^2.2.3", "react-dom": "^18.2.0", "react-perfect-scrollbar": "^1.5.8", - "react-redux": "^8.0.2", - "react-router": "6.3.0", - "react-router-dom": "6.3.0", + "react-redux": "^9.1.0", + "react-router": "6.21.3", + "react-router-dom": "6.21.3", "react-scripts": "^5.0.1", "react-turnstile": "^1.1.2", - "redux": "^4.2.0", + "redux": "^5.0.1", "yup": "^0.32.11" }, "scripts": { @@ -67,19 +67,20 @@ ] }, "devDependencies": { - "@babel/core": "^7.21.4", - "@babel/eslint-parser": "^7.21.3", - "eslint": "^8.38.0", - "eslint-config-prettier": "^8.8.0", + "@babel/core": "^7.23.9", + "@babel/eslint-parser": "^7.23.10", + "@babel/plugin-proposal-private-property-in-object": "^7.21.11", + "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", "eslint-config-react-app": "^7.0.1", "eslint-plugin-flowtype": "^8.0.3", - "eslint-plugin-import": "^2.27.5", - "eslint-plugin-jsx-a11y": "^6.7.1", - "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-react": "^7.32.2", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jsx-a11y": "^6.8.0", + "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", - "immutable": "^4.3.0", - "prettier": "^2.8.7", - "sass": "^1.53.0" + "immutable": "^4.3.5", + "prettier": "^3.2.4", + "sass": "^1.70.0" } } diff --git a/web/src/App.js b/web/src/App.js index d6ac62c3..e2db4eee 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -1,8 +1,9 @@ -import { useSelector } from 'react-redux'; +import { useEffect } from 'react'; +import { useSelector, useDispatch } from 'react-redux'; import { ThemeProvider } from '@mui/material/styles'; import { CssBaseline, StyledEngineProvider } from '@mui/material'; - +import { SET_THEME } from 'store/actions'; // routing import Routes from 'routes'; @@ -21,8 +22,16 @@ import CopySnackbar from 'ui-component/Snackbar'; // ==============================|| APP ||============================== // const App = () => { + const dispatch = useDispatch(); const customization = useSelector((state) => state.customization); + useEffect(() => { + const storedTheme = localStorage.getItem('theme'); + if (storedTheme) { + dispatch({ type: SET_THEME, theme: storedTheme }); + } + }, [dispatch]); + return ( diff --git a/web/src/assets/scss/_themes-vars.module.scss b/web/src/assets/scss/_themes-vars.module.scss index a470b033..661bb6c6 100644 --- a/web/src/assets/scss/_themes-vars.module.scss +++ b/web/src/assets/scss/_themes-vars.module.scss @@ -46,11 +46,16 @@ $grey600: #4b5565; $grey700: #364152; $grey900: #121926; +$tableBackground: #f4f6f8; +$tableBorderBottom: #f1f3f4; + // ==============================|| DARK THEME VARIANTS ||============================== // // paper & background $darkBackground: #1a223f; // level 3 $darkPaper: #111936; // level 4 +$darkDivider: rgba(227, 232, 239, 0.2); +$darkSelectedBack : rgba(124, 77, 255, 0.15); // dark 800 & 900 $darkLevel1: #29314f; // level 1 @@ -154,4 +159,9 @@ $darkTextSecondary: #8492c4; darkSecondaryDark: $darkSecondaryDark; darkSecondary200: $darkSecondary200; darkSecondary800: $darkSecondary800; + + darkDivider: $darkDivider; + darkSelectedBack: $darkSelectedBack; + tableBackground: $tableBackground; + tableBorderBottom: $tableBorderBottom; } diff --git a/web/src/layout/MainLayout/Header/ProfileSection/index.js b/web/src/layout/MainLayout/Header/ProfileSection/index.js index a5001e5d..b4f3e55f 100644 --- a/web/src/layout/MainLayout/Header/ProfileSection/index.js +++ b/web/src/layout/MainLayout/Header/ProfileSection/index.js @@ -71,8 +71,8 @@ const ProfileSection = () => { alignItems: 'center', borderRadius: '27px', transition: 'all .2s ease-in-out', - borderColor: theme.palette.primary.light, - backgroundColor: theme.palette.primary.light, + borderColor: theme.typography.menuChip.background, + backgroundColor: theme.typography.menuChip.background, '&[aria-controls="menu-list-grow"], &:hover': { borderColor: theme.palette.primary.main, background: `${theme.palette.primary.main}!important`, diff --git a/web/src/layout/MainLayout/Header/index.js b/web/src/layout/MainLayout/Header/index.js index 51d40c75..8fd9c950 100644 --- a/web/src/layout/MainLayout/Header/index.js +++ b/web/src/layout/MainLayout/Header/index.js @@ -7,6 +7,7 @@ import { Avatar, Box, ButtonBase } from '@mui/material'; // project imports import LogoSection from '../LogoSection'; import ProfileSection from './ProfileSection'; +import ThemeButton from 'ui-component/ThemeButton'; // assets import { IconMenu2 } from '@tabler/icons-react'; @@ -37,9 +38,8 @@ const Header = ({ handleLeftDrawerToggle }) => { sx={{ ...theme.typography.commonAvatar, ...theme.typography.mediumAvatar, + ...theme.typography.menuButton, transition: 'all .2s ease-in-out', - background: theme.palette.secondary.light, - color: theme.palette.secondary.dark, '&:hover': { background: theme.palette.secondary.dark, color: theme.palette.secondary.light @@ -55,7 +55,7 @@ const Header = ({ handleLeftDrawerToggle }) => { - + ); diff --git a/web/src/layout/MainLayout/Sidebar/MenuCard/index.js b/web/src/layout/MainLayout/Sidebar/MenuCard/index.js index cde68729..dadd3eca 100644 --- a/web/src/layout/MainLayout/Sidebar/MenuCard/index.js +++ b/web/src/layout/MainLayout/Sidebar/MenuCard/index.js @@ -36,7 +36,7 @@ import { useNavigate } from 'react-router-dom'; // })); const CardStyle = styled(Card)(({ theme }) => ({ - background: theme.palette.primary.light, + background: theme.typography.menuChip.background, marginBottom: '22px', overflow: 'hidden', position: 'relative', diff --git a/web/src/layout/MainLayout/Sidebar/index.js b/web/src/layout/MainLayout/Sidebar/index.js index f0c6dc83..479432ed 100644 --- a/web/src/layout/MainLayout/Sidebar/index.js +++ b/web/src/layout/MainLayout/Sidebar/index.js @@ -38,6 +38,15 @@ const Sidebar = ({ drawerOpen, drawerToggle, window }) => { > + + + @@ -45,7 +54,13 @@ const Sidebar = ({ drawerOpen, drawerToggle, window }) => { - + diff --git a/web/src/layout/MinimalLayout/Header/index.js b/web/src/layout/MinimalLayout/Header/index.js index 7ec388c1..98061aaf 100644 --- a/web/src/layout/MinimalLayout/Header/index.js +++ b/web/src/layout/MinimalLayout/Header/index.js @@ -5,6 +5,7 @@ import LogoSection from 'layout/MainLayout/LogoSection'; import { Link } from 'react-router-dom'; import { useLocation } from 'react-router-dom'; import { useSelector } from 'react-redux'; +import ThemeButton from 'ui-component/ThemeButton'; // ==============================|| MAIN NAVBAR / HEADER ||============================== // @@ -38,6 +39,7 @@ const Header = () => { + {account.user ? (