From e017787441667cfae8007d802742bf18b8663f28 Mon Sep 17 00:00:00 2001 From: djmil Date: Mon, 20 Nov 2023 22:03:06 +0100 Subject: [PATCH] final ui layout --- webapp/src/App.css | 11 +- webapp/src/App.js | 4 +- webapp/src/components/Checkers.css | 1 - webapp/src/container/Games.css | 141 +++++---------------- webapp/src/container/Games.jsx | 12 +- webapp/src/container/games/ActionPanel.css | 84 ++++++++++++ webapp/src/container/games/ActionPanel.jsx | 1 + webapp/src/container/games/GameBoard.css | 11 +- webapp/src/container/games/GameBoard.jsx | 20 +-- 9 files changed, 146 insertions(+), 139 deletions(-) create mode 100644 webapp/src/container/games/ActionPanel.css diff --git a/webapp/src/App.css b/webapp/src/App.css index 4178dc1..20b648c 100644 --- a/webapp/src/App.css +++ b/webapp/src/App.css @@ -1,10 +1,18 @@ +h1 { + margin-top: 10px; + margin-bottom: 10px; +} + .Header .OnlineToggle { transform: scale(.5); margin-left: -19px; + margin-top: -7px; } .Header { display: flex; + justify-content: center; + margin-left: 60px; } .Header nav { @@ -12,8 +20,9 @@ justify-content: center; display: flex; flex-wrap: wrap; + padding-left: 30px; - padding-top: 10px; + padding-bottom: 5px; } .Header a { diff --git a/webapp/src/App.js b/webapp/src/App.js index db764f8..07dffe8 100644 --- a/webapp/src/App.js +++ b/webapp/src/App.js @@ -57,9 +57,7 @@ function Header({ configReducer, isPolling }) { return (
-

- CordaCheckers -

+

CordaCheckers

- New - Proposal - Active - Archive +
+ New + Proposal + Active + Archive +
) } @@ -119,7 +121,7 @@ function GameBoardRoutes({ gamesReducer, gamesApi, username }) { dispatchGames({ type: 'nextNewGame', board }); } - const onStoneMove = (uuid, move) => gamesApi.pushGameMove({uuid, move, message: games.active.message}); + const onStoneMove = (uuid, move) => gamesApi.pushGameMove({ uuid, move, message: games.active.message }); return ( diff --git a/webapp/src/container/games/ActionPanel.css b/webapp/src/container/games/ActionPanel.css new file mode 100644 index 0000000..201bcaa --- /dev/null +++ b/webapp/src/container/games/ActionPanel.css @@ -0,0 +1,84 @@ +.ActionPanel button { + width: fit-content; + padding: 6px; + padding-left: 15px; + padding-right: 15px; + border-radius: 5px; + border: 0.5px solid darkgrey; + margin: 2px; +} + +.ActionPanel .Create.ready { + background-color: #00b0ff30; +} + +.ActionPanel .Create.ready:hover { + background-color: #00b0ffa0; +} + +.ActionPanel .Create.ready:active { + background-color: #00b0fff0; +} + +.ActionPanel .Cancel.ready, +.ActionPanel .Reject.ready, +.ActionPanel .Surrender.ready { + background-color: #ffaaaa60 +} + +.ActionPanel .Cancel.ready:hover, +.ActionPanel .Reject.ready:hover, +.ActionPanel .Surrender.ready:hover { + background-color: #ff000060 +} + +.ActionPanel .Cancel.ready:active, +.ActionPanel .Reject.ready:active, +.ActionPanel .Surrender.ready:active { + background-color: #ff0000a0 +} + +.ActionPanel .Accept.ready { + background-color: #00af0018; +} + +.ActionPanel .Accept.ready:hover { + background-color: #00af0060; +} + +.ActionPanel .Accept.ready:active { + background-color: #00af00a0; +} + +/* + * Draw + */ + .ActionPanel .Draw.ready, + .ActionPanel .Draw.accept, + .ActionPanel .Draw.reject { + background-color: #ffff0018; + } + + .ActionPanel .Draw.ready:hover { + background-color: #ffff0040; + } + + .ActionPanel .Draw.ready:active { + background-color: #ffff00a0; + } + + .ActionPanel .Draw.accept:hover { + background-color: #a4ff4a50; + } + + .ActionPanel .Draw.accept:active { + background-color: #10ff0080; + } + + .ActionPanel .Draw.reject:hover { + background-color: #ffaaaa60; + } + + .ActionPanel .Draw.reject:active { + background-color: #ff000090; + } \ No newline at end of file diff --git a/webapp/src/container/games/ActionPanel.jsx b/webapp/src/container/games/ActionPanel.jsx index c3eb254..55912a5 100644 --- a/webapp/src/container/games/ActionPanel.jsx +++ b/webapp/src/container/games/ActionPanel.jsx @@ -1,6 +1,7 @@ import React, { useContext } from 'react'; import { GamesContext } from '../../context/games'; import Wobler from '../../components/Wobler'; +import './ActionPanel.css' /* * NewGame actoins diff --git a/webapp/src/container/games/GameBoard.css b/webapp/src/container/games/GameBoard.css index 85bd13c..cb92396 100644 --- a/webapp/src/container/games/GameBoard.css +++ b/webapp/src/container/games/GameBoard.css @@ -1,14 +1,12 @@ .GameBoard .Player { display: flex; flex-direction: row; - align-items: center; - justify-content: center; } .GameBoard .Tile { line-height: 34px; height: 34px; - width: 34px; + width: 34px; margin-right: -1px; margin-top: -1px; } @@ -18,10 +16,5 @@ } .GameBoard .Tile.white.interactive:hover { - background-color:azure; -} - -.Message2Opponent { - margin: 10px; - width: 270px; + background-color: azure; } \ No newline at end of file diff --git a/webapp/src/container/games/GameBoard.jsx b/webapp/src/container/games/GameBoard.jsx index 71f4202..c2fb429 100644 --- a/webapp/src/container/games/GameBoard.jsx +++ b/webapp/src/container/games/GameBoard.jsx @@ -6,27 +6,27 @@ import { Color, Player, Board } from '../../components/Checkers'; import './GameBoard.css'; export default function GameBoard({ username, onStoneClick, onStoneMove }) { - const game = useSelectedGame(); + const game = useSelectedGame() || {}; - const opponentColor = Color.opposite(game?.myColor); - const [opponentName, myName] = (game?.opponentName) ? [game.opponentName, username] : ['', '']; - const flipBoard = (game?.myColor === Color.black) ? true : null; + const myName = game.opponentName ? username : ''; + const opponentColor = Color.opposite(game.myColor); + const flipBoard = (game.myColor === Color.black) ? true : null; const optionalOnStoneClick = (typeof onStoneClick !== 'function') ? null : - (cellId) => onStoneClick(game?.uuid, cellId); + (cellId) => onStoneClick(game.uuid, cellId); const optionalOnStoneMove = (typeof onStoneMove !== 'function') ? null : - (move) => onStoneMove(game?.uuid, move); + (move) => onStoneMove(game.uuid, move); return (
- - + - - {game?.isPushingGameMove ? Moving... : null /* TODO: isPushing shall be stored per game. curernty it is global indicator */} + + {game.isPushingGameMove ? Moving... : null /* TODO: isPushing shall be stored per game. curernty it is global indicator */}
) }