diff --git a/src/client/api.ts b/src/client/api.ts
index 5dd48508..aa258d02 100644
--- a/src/client/api.ts
+++ b/src/client/api.ts
@@ -64,6 +64,7 @@ export function useSocket(
onMessage(message);
}
},
+ share: true,
});
// handle how a message is sent
diff --git a/src/client/game/game.tsx b/src/client/game/game.tsx
index 74c0dcb0..bf26d5ec 100644
--- a/src/client/game/game.tsx
+++ b/src/client/game/game.tsx
@@ -25,6 +25,7 @@ import { ChessEngine } from "../../common/chess-engine";
import type { Move } from "../../common/game-types";
import { NonIdealState, Spinner } from "@blueprintjs/core";
import { AcceptDrawDialog, OfferDrawDialog } from "./draw-dialog";
+import { Sidebar } from "../setup/sidebar";
import { bgColor } from "../check-dark-mode";
import "../colors.css";
@@ -166,17 +167,20 @@ export function Game(): JSX.Element {
aiDifficulty={data.aiDifficulty}
setRotation={setRotation}
/>
-
-
- {gameEndDialog}
- {gameOfferDialog}
- {gameAcceptDialog}
-
+
+
+
+
+ {gameEndDialog}
+ {gameOfferDialog}
+ {gameAcceptDialog}
+
+
>
);
diff --git a/src/client/index.scss b/src/client/index.scss
index a2af4610..c37f6909 100644
--- a/src/client/index.scss
+++ b/src/client/index.scss
@@ -27,3 +27,65 @@
position: absolute;
// border: 3px solid blue;
}
+
+.sidebar {
+ //w3 schools for the win
+ width: 20%;
+ height: 100%;
+ position: fixed; /* Fixed Sidebar (stay in place on scroll) */
+ z-index: 1; /* Stay on top */
+ top: 0; /* Stay at the top */
+ left: 0;
+ overflow-x: hidden; /* Disable horizontal scroll */
+ padding-top: 20px;
+}
+
+.main-dialog {
+ margin-left: 20%;
+ position: fixed;
+ width: 80%;
+ height: 100%;
+ padding-top: 50px;
+}
+
+.flex-container {
+ display: flex;
+ flex-direction: column;
+ padding: 5px;
+ background-color: #eee;
+}
+
+.button-container {
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+ margin-bottom: 5px;
+ margin-top: auto;
+}
+
+@media (max-width: 500px) {
+ .flex-container {
+ flex-direction: row;
+ }
+
+ .button-container {
+ margin-right: 5px;
+ margin-left: auto;
+ margin-bottom: auto;
+ margin-top: 0px;
+ }
+
+ .sidebar {
+ width: 100%;
+ height: 20%;
+ bottom: 0;
+ top: auto;
+ padding-top: 10px !important;
+ }
+
+ .main-dialog {
+ width: 100%;
+ margin-left: auto;
+ padding-top: 0px;
+ }
+}
diff --git a/src/client/setup/lobby.tsx b/src/client/setup/lobby.tsx
index 8dcfebee..acf16621 100644
--- a/src/client/setup/lobby.tsx
+++ b/src/client/setup/lobby.tsx
@@ -4,6 +4,7 @@ import { useNavigate, Navigate } from "react-router-dom";
import { GameStartedMessage } from "../../common/message/game-message";
import { useSocket, useEffectQuery, get } from "../api";
import { ClientType } from "../../common/client-types";
+import { ThemeButtons } from "./setup";
/**
* check for an active game and waits for one or forwards to setup
@@ -41,10 +42,27 @@ export function Lobby() {
} else {
return (
- }
- />
+ <>
+ }
+ />
+
+
+
+ >
);
}
diff --git a/src/client/setup/setup-base.tsx b/src/client/setup/setup-base.tsx
index eaece055..3a5b396f 100644
--- a/src/client/setup/setup-base.tsx
+++ b/src/client/setup/setup-base.tsx
@@ -4,6 +4,7 @@ import { ChessboardWrapper } from "../chessboard/chessboard-wrapper";
import type { PropsWithChildren, ReactNode } from "react";
import { ChessEngine } from "../../common/chess-engine";
import { Side } from "../../common/game-types";
+import { Sidebar } from "./sidebar";
import { bgColor } from "../check-dark-mode";
import "../colors.css";
@@ -20,27 +21,32 @@ interface SetupBaseProps extends PropsWithChildren {
export function SetupBase(props: SetupBaseProps): JSX.Element {
return (
<>
-
-
{}}
- rotation={0}
- />
-
+
+
+
{}}
+ rotation={0}
+ />
+
+
+
>
);
}
diff --git a/src/client/setup/setup.tsx b/src/client/setup/setup.tsx
index 486e5a8f..583a16a9 100644
--- a/src/client/setup/setup.tsx
+++ b/src/client/setup/setup.tsx
@@ -132,20 +132,7 @@ function SetupMain(props: SetupMainProps) {
onClick={() => props.onPageChange(SetupType.PUZZLE)}
className={buttonColor()}
/>
- Display Settings:
-
- {allSettings.map((item, idx) => (
-
+
>
);
@@ -163,8 +150,31 @@ function SetupMain(props: SetupMainProps) {
}}
>
Welcome to Chess Bot!
+
{actions}
>
);
}
+
+export function ThemeButtons(props): JSX.Element {
+ props;
+ return (
+ <>
+