diff --git a/webapp/src/components/Game/GameSelector.jsx b/webapp/src/components/Game/GameSelector.jsx index 6c99e1a..f9f60b4 100644 --- a/webapp/src/components/Game/GameSelector.jsx +++ b/webapp/src/components/Game/GameSelector.jsx @@ -3,24 +3,40 @@ import React from 'react'; import { useLocation, matchPath } from "react-router"; import { AppData } from "../../context/data" +import { AppContext } from "../../context/app" import Proposal from './GameSelector/GameProposal'; -export default function Game() { +export default function GameSelector() { const [data] = React.useContext(AppData) + const [ctx, dispatchCtx] = React.useContext(AppContext) const { pathname } = useLocation(); const isProposalPath = matchPath("/game/proposal/*", pathname); - const isActivelPath = matchPath("/game/active/*", pathname); - const isArchivePath = matchPath("/game/archive/*", pathname); + const isActivelPath = matchPath("/game/active/*", pathname); + const isArchivePath = matchPath("/game/archive/*", pathname); + + console.log("GameSelector appCtx", ctx) + + const onClick_proposal = (selectedGame) => { + dispatchCtx({ component: "game-selector", selectedGameProposal: selectedGame }) + } + + const onClick_active = (selectedGame) => { + dispatchCtx({ component: "game-selector", selectedActiveGame: selectedGame }) + } + + const onClick_archive = (selectedGame) => { + dispatchCtx({ component: "game-selector", selectedArchiveGame: selectedGame }) + } if (!data.games) return