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 { useEffect } from "react";
|
||||||
import { Routes, Route } from "react-router-dom";
|
import { Routes, Route, Navigate } from "react-router-dom";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
// import "./App.css";
|
// import "./App.css";
|
||||||
@@ -79,7 +79,8 @@ function App() {
|
|||||||
<Route
|
<Route
|
||||||
exact
|
exact
|
||||||
path="/"
|
path="/"
|
||||||
element={<ProtectedRoute Component={MonitorsWithAdminProp} />}
|
/* TODO redirect to /monitors */
|
||||||
|
element={<Navigate to="/monitors" />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/monitors"
|
path="/monitors"
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ function Sidebar() {
|
|||||||
const [popup, setPopup] = useState();
|
const [popup, setPopup] = useState();
|
||||||
const { user } = useSelector((state) => state.auth);
|
const { user } = useSelector((state) => state.auth);
|
||||||
|
|
||||||
// Remove demo password if demo
|
|
||||||
const accountMenuItem = menu.find((item) => item.name === "Account");
|
const accountMenuItem = menu.find((item) => item.name === "Account");
|
||||||
if (user.role?.includes("demo") && accountMenuItem) {
|
if (user.role?.includes("demo") && accountMenuItem) {
|
||||||
accountMenuItem.nested = accountMenuItem.nested.filter((item) => {
|
accountMenuItem.nested = accountMenuItem.nested.filter((item) => {
|
||||||
@@ -149,7 +148,7 @@ function Sidebar() {
|
|||||||
if (matchedKey) {
|
if (matchedKey) {
|
||||||
setOpen((prev) => ({ ...prev, [PATH_MAP[matchedKey]]: true }));
|
setOpen((prev) => ({ ...prev, [PATH_MAP[matchedKey]]: true }));
|
||||||
}
|
}
|
||||||
}, []);
|
}, [location]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
@@ -304,6 +303,7 @@ function Sidebar() {
|
|||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
) : collapsed ? (
|
) : collapsed ? (
|
||||||
|
/* TODO Do we ever get here? */
|
||||||
<React.Fragment key={item.name}>
|
<React.Fragment key={item.name}>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
placement="right"
|
placement="right"
|
||||||
|
|||||||
Reference in new issue
Block a user