Browse Source

fix path resolver

amenpunk 3 năm trước cách đây
mục cha
commit
c9e5f7340c
2 tập tin đã thay đổi với 17 bổ sung13 xóa
  1. 1 1
      src/Components/Dashboard.js
  2. 16 12
      src/Components/Navigation/listItems.js

+ 1 - 1
src/Components/Dashboard.js

@@ -22,7 +22,7 @@ import Footer from "../Components/Footer";
 
 import { Drawer as MuiDrawer, AppBar as MuiAppBar } from "../Components/Navigation/AppBar"
 import { MainListItems, SecondaryListItems } from '../Components/Navigation/listItems';
-import ProfilePicture from '../Images/man.png';
+// import ProfilePicture from '../Images/man.png';
 import { useDispatch, useSelector } from 'react-redux';
 import { removeToken } from '../Slices/tokenSlice';
 

+ 16 - 12
src/Components/Navigation/listItems.js

@@ -1,13 +1,17 @@
 import * as React from 'react';
 import { Nav } from 'react-bootstrap';
 
-import { Fingerprint, ExpandLess, ExpandMore } from '@mui/icons-material/'
+// import { Fingerprint, ExpandLess, ExpandMore } from '@mui/icons-material/'
 import { useNavigate, useResolvedPath, useMatch } from 'react-router-dom'
-import { Collapse, ListItem, List, ListItemIcon, ListItemText, ListSubheader } from '@mui/material/'
+import { 
+  ListItem, List, ListItemIcon, ListItemText, ListSubheader 
+  // Collapse,
+} from '@mui/material/'
 
 import {
-  MainItems, ExtraItems, PruebaItems, TxTStyle,
-  UserItems
+  MainItems, ExtraItems, TxTStyle,
+  UserItems,
+ // PruebaItems
 } from '../../Utils/MenuItems'
 
 
@@ -15,7 +19,7 @@ function NavItem(props) {
 
   let navigate = useNavigate()
   let resolved = useResolvedPath(props.route);
-  let match = useMatch({ path: resolved.pathname, end: true });
+  let match = useMatch({ path: resolved.pathname, end: false });
 
   let { title, route, icon, open, AppBarVisible, setOpen } = props
 
@@ -43,14 +47,14 @@ function NavItem(props) {
 
 export const MainListItems = (props) => {
 
-  const [open, setOpen] = React.useState(false);
+  // const [open, setOpen] = React.useState(false);
 
-  const showPruebas = () => {
-    if (!props.AppBarVisible) {
-      props.setAppBarVisible(true);
-    }
-    setOpen(!open);
-  };
+  // const showPruebas = () => {
+  //   if (!props.AppBarVisible) {
+  //     props.setAppBarVisible(true);
+  //   }
+  //   setOpen(!open);
+  // };
 
   return (
     <List>