diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx index 8e753b7..80317d8 100644 --- a/src/components/Card/Card.tsx +++ b/src/components/Card/Card.tsx @@ -18,7 +18,9 @@ export default function Card({ data, state, setState, reserved = false, collapse return (
{data.gemValue.toUpperCase()}
diff --git a/src/components/Card/CardRow.scss b/src/components/Card/CardRow.scss index 009ae88..39f5909 100644 --- a/src/components/Card/CardRow.scss +++ b/src/components/Card/CardRow.scss @@ -23,8 +23,7 @@ width: 100%; .card { - width: 35%; - height: 40vh; + width: 18%; border: 2px solid black; img { @@ -35,8 +34,8 @@ } .foreground { - position: relative; - top: -100%; + // position: relative; + // top: -100%; display: flex; flex-direction: column; align-items: center; diff --git a/src/components/Gameboard/Gameboard.tsx b/src/components/Gameboard/Gameboard.tsx index 3a3f99e..a9e9819 100644 --- a/src/components/Gameboard/Gameboard.tsx +++ b/src/components/Gameboard/Gameboard.tsx @@ -4,7 +4,6 @@ import { Link } from 'react-router-dom'; import initializeBoard, { setCardRows } from '../../util/setup/initializeBoard'; import { AppState, PlayerData, ResourceCost, UIState } from '../../util/types'; import { defaultUIState } from '../../util/setup/defaultUIState'; -import { getChipsActions } from '../Player/ActionMethods'; import { StateProps } from '../../util/propTypes'; import './Gameboard.scss'; @@ -15,7 +14,7 @@ import CardRow from '../Card/CardRow'; import { useCurrentPlayer } from '../../hooks/useCurrentPlayer'; import usePreviousPlayer from '../../hooks/usePreviousPlayer'; import { shouldRightSideCollapse } from '../../util/mechanics/shouldRightSideCollapse'; -const { validateChips } = getChipsActions; +import { setStateUpdateSelection } from '../../hooks/stateSetters'; export default function Gameboard({ state, setState }: StateProps) { const [view, setView] = useState(Loading...
); @@ -25,26 +24,7 @@ export default function Gameboard({ state, setState }: StateProps) { // callbacks for lifting state const liftSelection = useCallback((value: keyof ResourceCost) => { if (!state.actions.getChips.active) return; - setState((prev: AppState) => { - let newSelection = prev.actions.getChips.selection; - newSelection?.push(value); - - let newState = { - ...prev, - actions: { - ...state.actions, - getChips: { - active: true, - selection: newSelection, - valid: false - } - } - } - - const result = validateChips(newState); - newState.actions.getChips.valid = result; - return newState; - }) + setState((prev: AppState) => setStateUpdateSelection(prev, value)); }, [state]); const liftCollapsed = useCallback((collapsed: boolean, tier = 5) => { @@ -123,7 +103,9 @@ export default function Gameboard({ state, setState }: StateProps) {