import "@fortawesome/fontawesome-svg-core/styles.css";
// import "bootstrap/dist/css/bootstrap.min.css";
// import "bootswatch/dist/materia/bootstrap.min.css";
import "bootswatch/dist/darkly/bootstrap.min.css";
import { useEffect } from "react";
import "react-grid-layout/css/styles.css";
import "reflect-metadata";
import "swagger-ui-react/swagger-ui.css";
import { IoSocketClient } from "../lib/communication/IoSocketClient";
import { getDispatcher } from "../lib/dispatcher/getDispatcher";
import { getNopeLogger } from "../lib/logger/getLogger";
import "./graph.css";

export default function App({ Component, pageProps }) {
  const dispatcher = getDispatcher({
    communicator: new IoSocketClient("localhost:7000"),
    logger: getNopeLogger("dispatcher", "debug")
  });

  useEffect(() => {
    return () => {
      // componentwillunmount in functional component.
      // Anything in here is fired on component unmount.
      dispatcher.dispose();
    };
  }, []);

  const params = {
    dispatcher,
    ...pageProps
  };

  return <Component {...params} />;
}
