import { Accessor, createContext, For, useContext } from "solid-js"; import type { SimpleAction, SimplePlayerView, SimpleResult, } from "@games/shared/games/simple"; import { me } from "~/profile"; import Hand from "./Hand"; import Pile from "./Pile"; import { TableContext } from "./Table"; import { Portal } from "solid-js/web"; import FannedHand from "./FannedHand"; export const GameContext = createContext<{ view: Accessor; submitAction: (action: SimpleAction) => any; }>(); export default () => { const table = useContext(TableContext)!; const view = table.view as Accessor; const submitAction = (action: SimpleAction) => table.sendWs({ action }); return ( submitAction({ type: "draw" })} /> submitAction({ type: "discard", card })} />
It's{" "} {view().playerTurn == me() ? "your" : table.playerNames[view().playerTurn] + "'s"} {" "} turn
{([playerKey, handCount], i) => ( { const midOffset = i() + 0.5 - Object.values(view().playerHandCounts).length / 2; ref.style = `position: absolute; display: flex; justify-content: center; top: 65%;`; }} > )}
); };