import React, { useEffect } from "react"; import { BrowserRouter, Routes, Route } from "react-router-dom"; import { Navigate } from "react-router-dom"; import { connect } from "react-redux"; import { publicApi, menu } from "./redux/actions"; import Navbar from "./components/Navbar"; import BG from "./components/BG"; import BottomNavigation from "./components/BottomNavigation"; import _ from "lodash"; import Home from "./views/Home"; import Auth from "./views/Auth"; import Products from "./views/Products"; import Product from "./views/Product"; import ShoppingCart from "./views/ShoppingCart"; import DeliveryForm from "./views/DeliveryForm"; import Videos from "./views/Videos"; import Video from "./views/Video"; import VideoDisplay from "./views/VideoDisplay"; import AR from "./views/AR"; import QR from "./views/QR"; import NotFound from "./views/404"; import Orders from "./views/Orders"; import Order from "./views/Order"; import Activation from "./views/Activation"; import Faq from "./views/Faq"; import Contact from "./views/Contact"; import Dashboard from "./views/Dashboard"; import FooterDesign1 from "./components/Footer"; import Blogs from "./views/Blogs"; import Blog from "./views/Blog"; import About from "./views/About"; import Dialog from "./components/Dialog"; import Address from "./views/Address"; import Favorites from "./views/Favorites"; import Addresses from "./views/Dashboard/layouts/Mobile/ProfileAddress"; function Router({ isDark, isMobile, headerOptions, dialog, menu, setMenu }) { useEffect(() => { window.addEventListener("scroll", () => {}); }, []); const prevDefault = (e) => { setMenu(); e.stopPropagation(); }; return (
{menu && (
prevDefault(e)} style={{ zIndex: 60 }} >
)} {dialog.open && } {headerOptions?.shown && } {isMobile && ( <> )} } /> } /> } /> {/* } /> */} } /> } /> } /> } /> ) : ( ) } > } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> {!isMobile && }
); } const mapStateToProps = (state) => ({ isDark: state.publicApi.isDark, isMobile: state.publicApi.isMobile, isLogin: state.user.status, headerOptions: state.publicApi.headerOptions, dialog: state.dialog.dialog, menu: state.menu.open, }); const mapDispatchToProps = { setDesktopContentTransform: publicApi.setDesktopContentTransform, setMenu: menu.set, }; export default connect(mapStateToProps, mapDispatchToProps)(Router);