From 8b452124ff1c551311c65d5862f22f55b670f2de Mon Sep 17 00:00:00 2001 From: Moon Patel <95487062+moonpatel@users.noreply.github.com> Date: Mon, 23 Oct 2023 02:52:10 +0530 Subject: [PATCH] Revert "improved chess board css" This reverts commit 6a11378b4436c718eeab82d02728ce8740f1ab60. --- frontend/src/components/Cell.jsx | 2 +- frontend/src/components/GameHistory.jsx | 4 +- frontend/src/layout/MainLayout.jsx | 204 ++++++++---------- frontend/src/pages/Chess/ChessBoard.jsx | 8 +- frontend/src/pages/Play/ChallengeFriend.jsx | 7 +- frontend/src/pages/Play/ChessGameComputer.jsx | 6 +- .../src/pages/Play/ChessGameMultiplayer.jsx | 35 +-- frontend/src/pages/Play/Computer.jsx | 5 +- frontend/src/pages/Play/Layout.jsx | 6 +- frontend/src/pages/Play/Play.jsx | 9 +- frontend/src/pages/Play/PlayFriend.jsx | 7 +- 11 files changed, 128 insertions(+), 165 deletions(-) diff --git a/frontend/src/components/Cell.jsx b/frontend/src/components/Cell.jsx index ffbaf6a..edaaff3 100644 --- a/frontend/src/components/Cell.jsx +++ b/frontend/src/components/Cell.jsx @@ -36,7 +36,7 @@ const Cell = ({ cell, callbacks }) => { } return ( - { + { let color = theme.colors.lime; return { backgroundColor: squareColor === 'b' ? '#769854' : '#e8edcd', aspectRatio: '1/1' } }} onClick={handleClick} bg={squareColor === 'w' ? "white" : "gray"} > diff --git a/frontend/src/components/GameHistory.jsx b/frontend/src/components/GameHistory.jsx index 60b9dfd..3b2ec09 100644 --- a/frontend/src/components/GameHistory.jsx +++ b/frontend/src/components/GameHistory.jsx @@ -52,8 +52,8 @@ const GameHistory = () => { } return ( -
- +
+ {gameHistoryJSX} diff --git a/frontend/src/layout/MainLayout.jsx b/frontend/src/layout/MainLayout.jsx index 9e8f6d0..f5fb226 100644 --- a/frontend/src/layout/MainLayout.jsx +++ b/frontend/src/layout/MainLayout.jsx @@ -1,129 +1,95 @@ -import React, { useContext, useState } from "react"; +import React, { useContext, useState } from 'react' -import { Outlet } from "react-router-dom"; -import { - AppShell, - Burger, - Container, - Header, - MediaQuery, - Navbar, - Paper, - Text, - createStyles, - useMantineTheme, -} from "@mantine/core"; +import { Outlet } from 'react-router-dom' +import { AppShell, Burger, Container, Header, MediaQuery, Navbar, Paper, Text, createStyles, useMantineTheme } from '@mantine/core' -import UserDataContextProvider, { - UserDataContext, -} from "../context/user-data-context"; -import MainLoader from "../components/MainLoader"; -import NavbarLinks from "../components/NavbarLinks"; -import Logout from "../components/Logout"; +import UserDataContextProvider, { UserDataContext } from '../context/user-data-context'; +import MainLoader from '../components/MainLoader'; +import NavbarLinks from '../components/NavbarLinks'; +import Logout from '../components/Logout'; const useStyles = createStyles(() => ({ - body: { - width: "100%", - height: "100%", - }, - root: { - width: "100%", - height: "100vh", - }, - main: { - width: "100%", - height: "100vh", - }, -})); + body: { + width: '100%', + height: '100%' + + }, + root: { + width: '100%', + height: '100vh' + + }, + main: { + width: '100%', + height: '100vh' + } +})) const MainLayout = () => { - const { classes } = useStyles(); - const theme = useMantineTheme(); - const [opened, setOpened] = useState(false); - const { isLoggedIn, errorMessage } = useContext(UserDataContext); + const { classes } = useStyles(); + const theme = useMantineTheme(); + const [opened, setOpened] = useState(false); + const { isLoggedIn, errorMessage } = useContext(UserDataContext); - if (!isLoggedIn) { - return ; - } + if (!isLoggedIn) { + return + } - return ( - - - - - - ); -}; - -export default MainLayout; +export default MainLayout \ No newline at end of file diff --git a/frontend/src/pages/Chess/ChessBoard.jsx b/frontend/src/pages/Chess/ChessBoard.jsx index 2c19f33..04988cc 100644 --- a/frontend/src/pages/Chess/ChessBoard.jsx +++ b/frontend/src/pages/Chess/ChessBoard.jsx @@ -67,11 +67,11 @@ const ChessBoard = ({ callbacks }) => { if (myColor === 'w') { return ( - +
{chessBoard.map((row, rowIndex) => { return ( - + {row.map(cell => )} ) @@ -83,11 +83,11 @@ const ChessBoard = ({ callbacks }) => { } else { return ( - +
{chessBoard.map((row, rowIndex) => { return ( - + {row.map(cell => ).reverse()} ) diff --git a/frontend/src/pages/Play/ChallengeFriend.jsx b/frontend/src/pages/Play/ChallengeFriend.jsx index 00d03a2..8617fd9 100644 --- a/frontend/src/pages/Play/ChallengeFriend.jsx +++ b/frontend/src/pages/Play/ChallengeFriend.jsx @@ -13,13 +13,12 @@ const ChallengeFriend = () => { return (
diff --git a/frontend/src/pages/Play/ChessGameComputer.jsx b/frontend/src/pages/Play/ChessGameComputer.jsx index a8644a1..1d0d1ec 100644 --- a/frontend/src/pages/Play/ChessGameComputer.jsx +++ b/frontend/src/pages/Play/ChessGameComputer.jsx @@ -70,7 +70,7 @@ const ChessGameComputer = () => { - +
{
- { - - -
+ + +
@@ -124,19 +125,19 @@ const ChessGameMultiplayer = () => {
{ // TODO: handle isWaiting state - // false ? - // <> - // - // - // - // - // - // - // - // : - + false ? + <> + + + + + + + + : + } -
+
{
- { return ( { const user = getUserData(); let username = user.username; return ( - - + + { description={"description"} /> - + diff --git a/frontend/src/pages/Play/Play.jsx b/frontend/src/pages/Play/Play.jsx index b6c2307..0e7ba29 100644 --- a/frontend/src/pages/Play/Play.jsx +++ b/frontend/src/pages/Play/Play.jsx @@ -6,13 +6,13 @@ import { Card, Flex, Image, NavLink, Title } from '@mantine/core' const Play = () => { return ( - - + Play Chess { @@ -32,7 +32,6 @@ const CardItem = ({ label, description, src, to }) => { icon={} description={description} sx={{ backgroundColor: '#1f1f1a', borderRadius: '5px' }} - p='20px' /> ) } diff --git a/frontend/src/pages/Play/PlayFriend.jsx b/frontend/src/pages/Play/PlayFriend.jsx index 2ede59a..f51b7b9 100644 --- a/frontend/src/pages/Play/PlayFriend.jsx +++ b/frontend/src/pages/Play/PlayFriend.jsx @@ -22,13 +22,12 @@ const PlayFriend = () => {