From fc2adf69fe543cf889c50c9efa711089711627aa Mon Sep 17 00:00:00 2001 From: blackpanther1881 Date: Mon, 15 Jan 2024 15:51:10 +0530 Subject: [PATCH 1/2] router fix --- src/App.js | 14 +- src/containers/Common/MobileSidebar.js | 225 +++++++++++++------------ 2 files changed, 121 insertions(+), 118 deletions(-) diff --git a/src/App.js b/src/App.js index 3485201e..d9a04632 100644 --- a/src/App.js +++ b/src/App.js @@ -79,14 +79,12 @@ const Main = () => { address = loginInfo && loginInfo.address; const page = location.pathname; - useEffect(() => { - if (page === "/dashboard/wallet") { - history.push("/#/dashboard/wallet"); - } else if (page === "/dashboard/staking") { - history.push("/#/dashboard/staking"); - } - trackPage(page); - }, [page]); + + if (page === "/dashboard/wallet") { + history.push("/#/dashboard/wallet"); + } else if (page === "/dashboard/staking") { + history.push("/#/dashboard/staking"); + } useEffect(() => { const fetchApi = async () => { diff --git a/src/containers/Common/MobileSidebar.js b/src/containers/Common/MobileSidebar.js index d9ef1b59..45705cd5 100644 --- a/src/containers/Common/MobileSidebar.js +++ b/src/containers/Common/MobileSidebar.js @@ -1,121 +1,126 @@ -import React from 'react'; -import SwipeableDrawer from '@material-ui/core/SwipeableDrawer'; -import Button from '@material-ui/core/Button'; -import List from '@material-ui/core/List'; -import Divider from '@material-ui/core/Divider'; -import MenuIcon from '@material-ui/icons/Menu'; -import {NavLink} from "react-router-dom"; +import React from "react"; +import SwipeableDrawer from "@material-ui/core/SwipeableDrawer"; +import Button from "@material-ui/core/Button"; +import List from "@material-ui/core/List"; +import Divider from "@material-ui/core/Divider"; +import MenuIcon from "@material-ui/icons/Menu"; +import { NavLink } from "react-router-dom"; import Icon from "../../components/Icon"; -import {useTranslation} from "react-i18next"; +import { useTranslation } from "react-i18next"; const EXPLORER_API = process.env.REACT_APP_EXPLORER_API; const MobileSidebar = () => { - const {t} = useTranslation(); - const [state, setState] = React.useState({ - top: false, - left: false, - bottom: false, - right: false, - }); + const { t } = useTranslation(); + const [state, setState] = React.useState({ + top: false, + left: false, + bottom: false, + right: false + }); - const toggleDrawer = (anchor, open) => (event) => { - if (event && event.type === 'keydown' && (event.key === 'Tab' || event.key === 'Shift')) { - return; - } + const toggleDrawer = (anchor, open) => (event) => { + if ( + event && + event.type === "keydown" && + (event.key === "Tab" || event.key === "Shift") + ) { + return; + } - setState({...state, [anchor]: open}); - }; + setState({ ...state, [anchor]: open }); + }; - const list = (anchor) => ( -
- -
  • - -
    -
    - -
    -
    - {t("WALLET")} -
    -
  • -
  • - -
    -
    - -
    -
    - {t("STAKING")} -
    -
  • -
  • - -
    -
    - -
    -
    - {t("EXPLORER")} -
    - -
    -
    -
  • - -
  • - -
    -
    - -
    -
    - {t("HELP")} -
    -
  • + const list = (anchor) => ( +
    + +
  • + +
    +
    + +
    +
    + {t("WALLET")} +
    +
  • +
  • + +
    +
    + +
    +
    + {t("STAKING")} +
    +
  • +
  • + +
    +
    + +
    +
    + {t("EXPLORER")} +
    + +
    +
    +
  • -
    - -
    - ); +
  • + +
    +
    + +
    +
    + {t("HELP")} +
    +
  • +
    + +
    + ); - return ( -
    - - - - - {list('left')} - - -
    - ); + return ( +
    + + + + {list("left")} + + +
    + ); }; -export default MobileSidebar; \ No newline at end of file +export default MobileSidebar; From 6041561199c354acbff3f61e50b1e5a600b20f0f Mon Sep 17 00:00:00 2001 From: blackpanther1881 Date: Mon, 15 Jan 2024 15:51:52 +0530 Subject: [PATCH 2/2] router fix --- src/App.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/App.js b/src/App.js index d9a04632..2d42387a 100644 --- a/src/App.js +++ b/src/App.js @@ -81,6 +81,7 @@ const Main = () => { const page = location.pathname; if (page === "/dashboard/wallet") { + console.log(page, "page-1"); history.push("/#/dashboard/wallet"); } else if (page === "/dashboard/staking") { history.push("/#/dashboard/staking");