feat: redirect from home to monitors, and setting dashboard open when user navigates to screen even withou clicking
This commit is contained in:
1 parent
082380ad8c
commit
f7a72a86c9
2 files changed
+5
-4
No files matched your search
+3
-2
@@ -1,5 +1,5 @@
|
||||
import { useEffect } from "react";
|
||||
import { Routes, Route } from "react-router-dom";
|
||||
import { Routes, Route, Navigate } from "react-router-dom";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useDispatch } from "react-redux";
|
||||
// import "./App.css";
|
||||
@@ -79,7 +79,8 @@ function App() {
|
||||
<Route
|
||||
exact
|
||||
path="/"
|
||||
element={<ProtectedRoute Component={MonitorsWithAdminProp} />}
|
||||
/* TODO redirect to /monitors */
|
||||
element={<Navigate to="/monitors" />}
|
||||
/>
|
||||
<Route
|
||||
path="/monitors"
|
||||
|
||||
@@ -114,7 +114,6 @@ function Sidebar() {
|
||||
const [popup, setPopup] = useState();
|
||||
const { user } = useSelector((state) => state.auth);
|
||||
|
||||
// Remove demo password if demo
|
||||
const accountMenuItem = menu.find((item) => item.name === "Account");
|
||||
if (user.role?.includes("demo") && accountMenuItem) {
|
||||
accountMenuItem.nested = accountMenuItem.nested.filter((item) => {
|
||||
@@ -149,7 +148,7 @@ function Sidebar() {
|
||||
if (matchedKey) {
|
||||
setOpen((prev) => ({ ...prev, [PATH_MAP[matchedKey]]: true }));
|
||||
}
|
||||
}, []);
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<Stack
|
||||
@@ -304,6 +303,7 @@ function Sidebar() {
|
||||
</ListItemButton>
|
||||
</Tooltip>
|
||||
) : collapsed ? (
|
||||
/* TODO Do we ever get here? */
|
||||
<React.Fragment key={item.name}>
|
||||
<Tooltip
|
||||
placement="right"
|
||||
|
||||
Reference in new issue
Block a user