import Socketio from "@modules/socketio"; import { useNotification } from "@redux/hooks"; import { useReduxStore } from "@redux/hooks/base"; import { LoadingIndicator, ModalProvider } from "components"; import Authentication from "pages/Authentication"; import LaunchError from "pages/LaunchError"; import React, { FunctionComponent, useEffect } from "react"; import { Row } from "react-bootstrap"; import { Route, Switch } from "react-router"; import { BrowserRouter, Redirect } from "react-router-dom"; import { useEffectOnceWhen } from "rooks"; import { Environment } from "utilities"; import ErrorBoundary from "../components/ErrorBoundary"; import Router from "../Router"; import Sidebar from "../Sidebar"; import Header from "./Header"; // Sidebar Toggle interface Props {} const App: FunctionComponent = () => { const { status } = useReduxStore((s) => s); const notify = useNotification("has-update", 10 * 1000); // Has any update? useEffectOnceWhen(() => { if (Environment.hasUpdate) { notify({ type: "info", message: "A new version of Bazarr is ready, restart is required", // TODO: Restart action }); } }, status === "initialized"); if (status === "unauthenticated") { return ; } else if (status === "uninitialized") { return ( Please wait ); } else if (status === "error") { return Cannot Initialize Bazarr; } return (
); }; const MainRouter: FunctionComponent = () => { useEffect(() => { Socketio.initialize(); }, []); return ( ); }; export default MainRouter;