This commit is contained in:
djmil 2023-11-09 18:20:19 +01:00
parent b632aa7dc3
commit 3171a97827
2 changed files with 27 additions and 18 deletions

View File

@ -63,7 +63,8 @@
.ViewProvider { .ViewProvider {
display: flex; display: flex;
flex-direction: column; flex-flow: column;
height: 340px;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }

View File

@ -3,9 +3,7 @@ import React from 'react';
import { NavLink, Routes, Route } from 'react-router-dom'; import { NavLink, Routes, Route } from 'react-router-dom';
import NewGame from './games/view/NewGame'; import NewGame from './games/view/NewGame';
import GameProposals from './games/view/GameProposals'; import GameSelector from './games/view/GameSelector';
import ActiveGames from './games/view/ActiveGames';
import GamesArchive from './games/view/GamesArchive';
import Create from './games/action/Create'; import Create from './games/action/Create';
import Reject from './games/action/Reject'; import Reject from './games/action/Reject';
@ -27,7 +25,7 @@ export default function Games({ context }) {
<GamesContext.Provider value={context.games} > <GamesContext.Provider value={context.games} >
<GamesDispatchContext.Provider value={context.dispatchGames} > <GamesDispatchContext.Provider value={context.dispatchGames} >
<GamesApiContext.Provider value={context.gamesApi} > <GamesApiContext.Provider value={context.gamesApi} >
<div className="Games"> <div className='Games'>
<div className='left-side'> <div className='left-side'>
<ViewSelector /> <ViewSelector />
<ViewProvider /> <ViewProvider />
@ -47,24 +45,34 @@ export default function Games({ context }) {
}; };
function ViewSelector() { function ViewSelector() {
// TODO: counter Wating for YOU
return ( return (
<nav className='ViewSelector'> <nav className='ViewSelector'>
<NavLink to="new">New</NavLink> <NavLink to='new'>New</NavLink>
<NavLink to="proposal">Proposal</NavLink> <NavLink to='proposal'>Proposal</NavLink>
<NavLink to="active">Active</NavLink> <NavLink to='active'>Active</NavLink>
<NavLink to="archive">Archive</NavLink> <NavLink to='archive'>Archive</NavLink>
</nav> </nav>
) )
} }
function ViewProvider() { function ViewProvider(/*todo: dispatchGame*/) {
return ( return (
<div className='ViewProvider'> <div className='ViewProvider'>
<Routes> <Routes>
<Route path="new" element={<NewGame />} /> <Route path='new' element={<NewGame />} />
<Route path="proposal" element={<GameProposals />} />
<Route path="active" element={<ActiveGames />} /> <Route path='proposal' element={
<Route path="archive" element={<GamesArchive />} /> <GameSelector
yours='GAME_PROPOSAL_WAIT_FOR_YOU'
opponents='GAME_PROPOSAL_WAIT_FOR_OPPONENT'
onClick={(uuid) => console.log("GameProposal", uuid)}
/>
} />
<Route path='active' element={<GameSelector />} />
<Route path='archive' element={<GameSelector />} />
</Routes> </Routes>
</div> </div>
) )
@ -74,10 +82,10 @@ function ActionPanel() {
return ( return (
<div className='ActionPanel'> <div className='ActionPanel'>
<Routes> <Routes>
<Route path="new" element={<Create />} /> <Route path='new' element={<Create />} />
<Route path="proposal" element={[<Accept key={1} />, <Reject key={2} />, <Cancel key={3} />]} /> <Route path='proposal' element={[<Accept key={1} />, <Reject key={2} />, <Cancel key={3} />]} />
<Route path="active" element={[<DrawReq key={1} />, <DrawAcq key={2} />, <Surrender key={3} />]} /> <Route path='active' element={[<DrawReq key={1} />, <DrawAcq key={2} />, <Surrender key={3} />]} />
<Route path="archive" element={[<Backward key={1} />, <Forward key={2} />]} /> <Route path='archive' element={[<Backward key={1} />, <Forward key={2} />]} />
</Routes> </Routes>
</div> </div>
) )