// SPDX-FileCopyrightText: © 2017 EteSync Authors // SPDX-License-Identifier: AGPL-3.0-only import * as React from "react"; import { Route, Switch, Redirect, RouteProps } from "react-router"; import { useCredentials } from "./credentials"; import LoadingIndicator from "./widgets/LoadingIndicator"; import SyncGate from "./SyncGate"; import { routeResolver } from "./App"; import SignupPage from "./SignupPage"; import LoginPage from "./LoginPage"; import WizardPage from "./WizardPage"; import { Snackbar } from "@material-ui/core"; import Alert from "@material-ui/lab/Alert"; import { useSelector, useDispatch } from "react-redux"; import { StoreState } from "./store"; import { popMessage } from "./store/actions"; export default function MainRouter() { return ( <> ); } function GlobalMessages() { const dispatch = useDispatch(); const message = useSelector((state: StoreState) => state.messages.first(undefined)); function handleClose() { dispatch(popMessage()); } return ( {message?.message} ); } function PrivateRoute(props: Omit) { const credentials = useCredentials(); const { children, ...rest } = props; if (credentials === undefined) { return (); } return ( ( (credentials) ? ( children ) : ( ) )} /> ); }