cooking with sqlite

This commit is contained in:
2025-08-05 23:49:13 -04:00
parent 9277089e04
commit 2ce46088d5
13 changed files with 117 additions and 80 deletions

View File

@@ -5,7 +5,7 @@ import { GameContext } from "./Game";
import { produce } from "solid-js/store";
export default ((props) => {
const { setGameState } = useContext(GameContext)!;
const { setGameState, gameState } = useContext(GameContext)!;
return (
<div
@@ -33,20 +33,16 @@ export default ((props) => {
style={{
cursor: "pointer",
}}
onClick={() =>
setGameState(
produce((state) => {
const index = state.hand.indexOf(card);
console.log(index);
state.deck.push(
state.hand.splice(
props.hand.indexOf(card),
1
)[0]!
);
})
)
}
onClick={() => {
const index = gameState()!.hand.indexOf(card);
setGameState({
deck: [card, ...gameState()!.deck],
hand: [
...gameState()!.hand.slice(0, index),
...gameState()!.hand.slice(index + 1),
],
});
}}
/>
)}
</For>