diff --git a/src/views/Dashboard/layouts/SidebarMenu/index.js b/src/views/Dashboard/layouts/SidebarMenu/index.js index fd2926a..16e4ccf 100644 --- a/src/views/Dashboard/layouts/SidebarMenu/index.js +++ b/src/views/Dashboard/layouts/SidebarMenu/index.js @@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react"; import Avatar from "../../../../components/Avatar"; import { connect } from "react-redux"; import { useNavigate } from "react-router-dom"; -import { user, dialog } from "../../../../redux/actions"; +import { user, dialog, publicApi } from "../../../../redux/actions"; const SidebarMenu = ({ page, @@ -11,6 +11,8 @@ const SidebarMenu = ({ setDialog, user, sidebar, + changeDarkMode, + isDark, }) => { const navigate = useNavigate(); const [activeDropdown, setActiveDropdown] = useState(null); @@ -25,87 +27,95 @@ const SidebarMenu = ({ accept: () => logout(), open: true, }), + dark: () => changeDarkMode(!isDark), }; - }, [user]); + }, [user, isDark]); - const Dropdown = React.useCallback(({item}) => { - return ( -
{user.firstName === null ? "" @@ -141,11 +159,13 @@ const SidebarMenu = ({ const mapStateToProps = (state) => ({ user: state.user.status, sidebar: state.dashboard.sidebar, + isDark: state.publicApi.isDark, }); const mapDispatchToProps = { logout: user.logout, setDialog: dialog.set, + changeDarkMode: publicApi.setIsDark, }; export default connect(mapStateToProps, mapDispatchToProps)(SidebarMenu);