import React from "react"; import { Route, Switch, Redirect } from "react-router-dom"; import "react-toastify/dist/ReactToastify.css"; import "./react-confirm-alert.css"; import { uid } from "./utils"; import Home from "./views/Home"; import GameView from "./views/GameView"; import Session from "./views/Session"; import AuthView from "./views/AuthView"; import RoomView from "./views/RoomView"; import { Provider as SocketIOProvider } from "@scripters/use-socket.io"; import { SOCKET_URL, SOCKET_OPTIONS } from "./utils/settings"; const WithSocketIO = ({ children }) => ( {children} ); const MainRoute = () => { return ( {/* for compat with old url scheme */} {({ match: { params: { gameId }, }, }) => { // Redirect to new session id return ( ); }} {/* for compat with old url scheme */} {({ match: { params: { gameId, sessionId }, }, }) => { return ( ); }} {/* Start a new session from this game */} {({ match: { params: { gameId }, }, }) => { // Redirect to new session id return ( ); }} {({ match: { params: { sessionId }, }, location: { state: { fromGame } = {} } = {}, }) => { // Redirect to new session id return ( ); }} {/* Game edition */} {({ match: { params: { gameId }, }, }) => { return ( ); }} {/*Room routes*/} {({ match: { params: { roomId }, }, location: { state: { showInvite = false } = {} } = {}, }) => ( )} {() => { // Redirect to new room return ( ); }} {/* Auth rout */} {/* Default route */} ); }; export default MainRoute;