text: /*!
  
  =========================================================
  * Light Bootstrap Dashboard React - v2.0.0
  =========================================================
  
  * Product Page: https://www.creative-tim.com/product/light-bootstrap-dashboard-react
  * Copyright 2020 Creative Tim (https://www.creative-tim.com)
  * Licensed under MIT (https://github.com/creativetimofficial/light-bootstrap-dashboard-react/blob/master/LICENSE.md)
  
  * Coded by Creative Tim
  
  =========================================================
  
  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  
  */
  import React, { Component } from "react";
  import { useLocation, Route, Switch } from "react-router-dom";
  
  import AdminNavbar from "components/Navbars/AdminNavbar";
  import Footer from "components/Footer/Footer";
  import Sidebar from "components/Sidebar/Sidebar";
  import FixedPlugin from "components/FixedPlugin/FixedPlugin.js";
  
  import routes from "routes.js";
  
  import sidebarImage from "assets/img/sidebar-3.jpg";
  
  function Admin() {
    const [image, setImage] = React.useState(sidebarImage);
    const [color, setColor] = React.useState("black");
    const [hasImage, setHasImage] = React.useState(true);
    const location = useLocation();
    const mainPanel = React.useRef(null);
    const getRoutes = (routes) => {
      return routes.map((prop, key) => {
        if (prop.layout === "/admin") {
          return (
            <Route
              path={prop.layout + prop.path}
              render={(props) => <prop.component {...props} />}
              key={key}
            />
          );
        } else {
          return null;
        }
      });
    };
    React.useEffect(() => {
      document.documentElement.scrollTop = 0;
      document.scrollingElement.scrollTop = 0;
      mainPanel.current.scrollTop = 0;
      if (
        window.innerWidth < 993 &&
        document.documentElement.className.indexOf("nav-open") !== -1
      ) {
        document.documentElement.classList.toggle("nav-open");
        var element = document.getElementById("bodyClick");
        element.parentNode.removeChild(element);
      }
    }, [location]);
    window.addEventListener("DOMContentLoaded", (event) => {
      // Toggle the side navigation
      const sidebarToggle = document.getElementById("#sidebarToggle");
      if (sidebarToggle) {
        // Uncomment Below to persist sidebar toggle between refreshes
        // if (localStorage.getItem('sb|sidebar-toggle') === 'true') {
        //     document.body.classList.toggle('sb-sidenav-toggled');
        // }
        sidebarToggle.addEventListener("click", (event) => {
          event.preventDefault();
          document.div.toggle("sb-sidenav-toggled");
          localStorage.setItem(
            "sb|sidebar-toggle",
            document.div.contains("sb-sidenav-toggled")
          );
        });
      }
    });
    return (
      <>
        <div>
          <Sidebar color={color} image={hasImage ? image : ""} routes={routes} />
          <div className="main-panel" ref={mainPanel}>
            <AdminNavbar />
          {/* <button class="btn btn-primary" id="sidebarToggle">
            Toggle Menu
          </button> */}
            <div className="content">
              <Switch>{getRoutes(routes)}</Switch>
            </div>
            {/* <Footer /> */}
          </div>
        </div>
      </>
    );
  }
  
  export default Admin;
  