|
|
@ -1,4 +1,4 @@ |
|
|
import { FC } from "react"; |
|
|
|
|
|
|
|
|
import { FC, useState } from "react"; |
|
|
import { Switch, Redirect, Route, useLocation } from "react-router-dom"; |
|
|
import { Switch, Redirect, Route, useLocation } from "react-router-dom"; |
|
|
|
|
|
|
|
|
import { useAppSelector } from "app/hooks"; |
|
|
import { useAppSelector } from "app/hooks"; |
|
|
@ -11,22 +11,47 @@ import { userListPath } from "modules/user/paths"; |
|
|
import UsersPane from "modules/user/UsersPane"; |
|
|
import UsersPane from "modules/user/UsersPane"; |
|
|
import { selectSocket, SocketState } from "modules/socket/slice"; |
|
|
import { selectSocket, SocketState } from "modules/socket/slice"; |
|
|
|
|
|
|
|
|
const MainPane: FC = () => { |
|
|
|
|
|
|
|
|
interface MainProps { |
|
|
|
|
|
onShowMenu: () => void; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const MainPane: FC<MainProps> = ({ onShowMenu }) => { |
|
|
return ( |
|
|
return ( |
|
|
<main className="flex-1 min-h-0 w-full"> |
|
|
<main className="flex-1 min-h-0 w-full"> |
|
|
<Switch> |
|
|
<Switch> |
|
|
<Route path={roomListPath}> |
|
|
<Route path={roomListPath}> |
|
|
<RoomsPane /> |
|
|
|
|
|
|
|
|
<RoomsPane onShowMenu={onShowMenu} /> |
|
|
</Route> |
|
|
</Route> |
|
|
<Route path={userListPath}> |
|
|
<Route path={userListPath}> |
|
|
<UsersPane /> |
|
|
|
|
|
|
|
|
<UsersPane onShowMenu={onShowMenu} /> |
|
|
</Route> |
|
|
</Route> |
|
|
</Switch> |
|
|
</Switch> |
|
|
</main> |
|
|
</main> |
|
|
); |
|
|
); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const ConnectedApp: FC = ({ children }) => { |
|
|
|
|
|
|
|
|
const InnerApp: FC<{}> = () => { |
|
|
|
|
|
const [showMenu, setShowMenu] = useState(false); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
<div className="h-full w-full flex flex-col"> |
|
|
|
|
|
<Menu |
|
|
|
|
|
show={showMenu} |
|
|
|
|
|
onHide={() => { |
|
|
|
|
|
setShowMenu(false); |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
|
|
|
<MainPane |
|
|
|
|
|
onShowMenu={() => { |
|
|
|
|
|
setShowMenu(true); |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
|
|
|
<Footer /> |
|
|
|
|
|
</div> |
|
|
|
|
|
); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const ConnectedApp: FC<{}> = () => { |
|
|
const socket = useAppSelector(selectSocket); |
|
|
const socket = useAppSelector(selectSocket); |
|
|
const location = useLocation(); |
|
|
const location = useLocation(); |
|
|
|
|
|
|
|
|
@ -41,7 +66,7 @@ const ConnectedApp: FC = ({ children }) => { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return <div className="h-full w-full flex flex-col">{children}</div>; |
|
|
|
|
|
|
|
|
return <InnerApp />; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const SolsticeApp = () => ( |
|
|
const SolsticeApp = () => ( |
|
|
@ -50,11 +75,7 @@ const SolsticeApp = () => ( |
|
|
<ConnectPage /> |
|
|
<ConnectPage /> |
|
|
</Route> |
|
|
</Route> |
|
|
<Route path="/"> |
|
|
<Route path="/"> |
|
|
<ConnectedApp> |
|
|
|
|
|
<Menu /> |
|
|
|
|
|
<MainPane /> |
|
|
|
|
|
<Footer /> |
|
|
|
|
|
</ConnectedApp> |
|
|
|
|
|
|
|
|
<ConnectedApp /> |
|
|
</Route> |
|
|
</Route> |
|
|
</Switch> |
|
|
</Switch> |
|
|
); |
|
|
); |
|
|
|