implemented usePreviousPlayer, preparing to implement gold chip funcitonality
This commit is contained in:
@@ -1,26 +1,24 @@
|
||||
import { ResourceProps } from "../../util/propTypes";
|
||||
import { ResourceCost } from "../../util/types";
|
||||
import { useEffect } from "react";
|
||||
import { v4 } from "uuid";
|
||||
import "./AvailableChips.css"
|
||||
|
||||
export default function AvailableChips({ state, setState, liftSelection }: ResourceProps) {
|
||||
useEffect(() => {
|
||||
return;
|
||||
}, [state])
|
||||
|
||||
export default function AvailableChips({ state, liftSelection }: ResourceProps) {
|
||||
return (
|
||||
<div className="available-chips">
|
||||
{
|
||||
Object.keys(state.gameboard.tradingResources).map((key: string | keyof ResourceCost) => {
|
||||
Object.keys(state.gameboard.tradingResources).map((key: string) => {
|
||||
const typedKey = key as keyof ResourceCost;
|
||||
return (
|
||||
<div key={v4()} className={`chips-${key}`}>
|
||||
<button
|
||||
key={v4()}
|
||||
value={key}
|
||||
onClick={() => liftSelection(key as keyof ResourceCost)}
|
||||
// @ts-ignore
|
||||
disabled={state.gameboard.tradingResources[typedKey] <= 0}
|
||||
onClick={() => liftSelection(typedKey)}
|
||||
>
|
||||
{key}: {state.gameboard.tradingResources[key as keyof ResourceCost]}
|
||||
{key}: {state.gameboard.tradingResources[typedKey]}
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user