import { LoadingIndicator } from "@/components"; import ErrorBoundary from "@/components/ErrorBoundary"; import { useNotification } from "@/modules/redux/hooks"; import { useReduxStore } from "@/modules/redux/hooks/base"; import SocketIO from "@/modules/socketio"; import LaunchError from "@/pages/LaunchError"; import Sidebar from "@/Sidebar"; import { Environment } from "@/utilities"; import { FunctionComponent, useEffect } from "react"; import { Row } from "react-bootstrap"; import { Navigate, Outlet } from "react-router-dom"; import { useEffectOnceWhen } from "rooks"; import Header from "./Header"; const App: FunctionComponent = () => { const { status } = useReduxStore((s) => s.site); useEffect(() => { SocketIO.initialize(); }, []); 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 (
); }; export default App;