From 70aae371d52f5db09dcf2d24cd0e0f114653cd5b Mon Sep 17 00:00:00 2001 From: ymmot239 <77180103+ymmot239@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:57:42 -0500 Subject: [PATCH 01/27] Short update moving computers. created most of the setup page Need to create the server response to client moves. --- saves/puzzles | 0 src/client/puzzle/puzzle-manager.tsx | 14 ++++++ src/client/puzzle/puzzle.tsx | 6 +-- src/client/puzzle/select-puzzle.tsx | 72 ++++++++++++++++++++++++++++ src/client/puzzle/setup-puzzle.tsx | 47 ++++++++++++++++++ src/client/setup/setup.tsx | 4 ++ src/common/chess-engine.ts | 18 +++++++ src/server/api/api.ts | 52 +++++++++++++++----- src/server/api/game-manager.ts | 35 ++++++++++++++ 9 files changed, 233 insertions(+), 15 deletions(-) create mode 100644 saves/puzzles create mode 100644 src/client/puzzle/puzzle-manager.tsx create mode 100644 src/client/puzzle/select-puzzle.tsx create mode 100644 src/client/puzzle/setup-puzzle.tsx diff --git a/saves/puzzles b/saves/puzzles new file mode 100644 index 00000000..e69de29b diff --git a/src/client/puzzle/puzzle-manager.tsx b/src/client/puzzle/puzzle-manager.tsx new file mode 100644 index 00000000..1283bf55 --- /dev/null +++ b/src/client/puzzle/puzzle-manager.tsx @@ -0,0 +1,14 @@ + +/** + * Class for managing saved puzzles and user completion status + * + * Users are tracked by cookie id, though it doesn't save across devices and clients + */ +export class PuzzleManager{ + public static getAllPuzzles(){ + + } + public static getPuzzle(){ + + } +} \ No newline at end of file diff --git a/src/client/puzzle/puzzle.tsx b/src/client/puzzle/puzzle.tsx index bb6d901c..2e3dc381 100644 --- a/src/client/puzzle/puzzle.tsx +++ b/src/client/puzzle/puzzle.tsx @@ -1,3 +1,3 @@ -export function Puzzle() { - return <>; -} +export function Puzzle(): JSX.Element { + return <> +} \ No newline at end of file diff --git a/src/client/puzzle/select-puzzle.tsx b/src/client/puzzle/select-puzzle.tsx new file mode 100644 index 00000000..631e6c17 --- /dev/null +++ b/src/client/puzzle/select-puzzle.tsx @@ -0,0 +1,72 @@ +import { Button, MenuItem } from "@blueprintjs/core"; +import { ItemRenderer, Select } from "@blueprintjs/select"; +import { post } from "../api"; +import { useNavigate } from "react-router-dom"; +import { PuzzleComponents } from "../../server/api/api"; + +const renderPuzzleOptions: ItemRenderer = ( + puzzleNumber, + { modifiers, handleFocus, handleClick }, +) => { + return ( + + ); +}; + +interface SelectPuzzleProps { + puzzles: Map; + selectedPuzzle: string | undefined; + onPuzzleSelected: (puzzle: string) => void; +} + +export function SelectPuzzle(props: SelectPuzzleProps) { + const navigate = useNavigate(); + const hasSelection = props.selectedPuzzle !== undefined; + + const submit = ( +