Skip to content

Commit ea5e303

Browse files
authored
Merge pull request #352 from manish591/feat/added-themes
Feat/added themes
2 parents 72423ac + ba680d2 commit ea5e303

31 files changed

+366
-115
lines changed

apps/frontend/public/github.svg

Lines changed: 1 addition & 0 deletions
Loading

apps/frontend/public/google.svg

Lines changed: 1 addition & 0 deletions
Loading

apps/frontend/public/theme.svg

Lines changed: 1 addition & 0 deletions
Loading

apps/frontend/src/App.css

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
.loader {
2+
width: 100%;
3+
height: 100vh;
4+
}
5+
6+
.loader__main {
7+
width: 100%;
8+
height: 100%;
9+
display: flex;
10+
align-items: center;
11+
justify-content: center;
12+
gap: 50px;
13+
}
14+
15+
.loader__dot {
16+
width: 20px;
17+
height: 20px;
18+
background-color: white;
19+
border-radius: 20px;
20+
transform: translate(0px, -40px);
21+
animation: bounce 1s infinite;
22+
}
23+
24+
.loader__dot:nth-child(2) {
25+
animation-delay: 0.2s;
26+
}
27+
28+
.loader__dot:nth-child(3) {
29+
animation-delay: 0.4s;
30+
}
31+
32+
@keyframes bounce {
33+
0% {
34+
transform: translate(0px, -10px);
35+
}
36+
40% {
37+
width: 0px;
38+
height: 2px;
39+
transform: translate(0px, 40px) scale(1.7);
40+
}
41+
100% {
42+
height: 20px;
43+
transform: translate(0px, -20px);
44+
}
45+
}

apps/frontend/src/App.tsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import './App.css';
1+
import "./App.css";
2+
import "./themes.css";
23
import { BrowserRouter, Route, Routes } from 'react-router-dom';
34
import { Landing } from './screens/Landing';
45
import { Game } from './screens/Game';
@@ -7,13 +8,18 @@ import { Suspense } from 'react';
78
import { RecoilRoot } from 'recoil';
89
import { Loader } from './components/Loader';
910
import { Layout } from './layout';
11+
import { Settings } from './screens/Settings';
12+
import { Themes } from "./components/themes";
13+
import { ThemesProvider } from "./context/themeContext";
1014

1115
function App() {
1216
return (
13-
<div className="min-h-screen bg-stone-800">
17+
<div className="min-h-screen bg-bgMain text-textMain">
1418
<RecoilRoot>
1519
<Suspense fallback={<Loader />}>
16-
<AuthApp />
20+
<ThemesProvider>
21+
<AuthApp />
22+
</ThemesProvider>
1723
</Suspense>
1824
</RecoilRoot>
1925
</div>
@@ -24,15 +30,24 @@ function AuthApp() {
2430
return (
2531
<BrowserRouter>
2632
<Routes>
27-
<Route path="/" element={<Layout children={<Landing />} />} />
33+
<Route
34+
path="/"
35+
element={<Layout><Landing /></Layout>}
36+
/>
2837
<Route
2938
path="/login"
3039
element={<Login />}
3140
/>
3241
<Route
3342
path="/game/:gameId"
34-
element={<Layout children={<Game />} />}
43+
element={<Layout><Game /></Layout>}
3544
/>
45+
<Route
46+
path='/settings'
47+
element={<Layout><Settings /></Layout>}
48+
>
49+
<Route path="themes" element={<Themes />} />
50+
</Route>
3651
</Routes>
3752
</BrowserRouter>
3853
);

apps/frontend/src/assets/github.png

-796 Bytes
Binary file not shown.

apps/frontend/src/assets/google.png

-950 Bytes
Binary file not shown.

apps/frontend/src/assets/react.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/frontend/src/components/Card.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,16 @@ export function PlayCard() {
8484
const navigate = useNavigate();
8585
return (
8686
<Card className="bg-transparent border-none">
87-
<CardHeader className="pb-3 text-center text-white shadow-md">
87+
<CardHeader className="pb-3 text-center">
8888
<CardTitle className="font-semibold tracking-wide flex flex-col items-center justify-center">
89-
<p>
90-
Play
91-
<span className="text-green-700 font-bold pt-1"> Chess</span>
89+
<p className='text-white'>
90+
Play <span className="text-green-600 font-bold pt-1">Chess</span>
9291
</p>
9392
<img className="pl-1 w-1/2 mt-4" src={chessIcon} alt="chess" />
9493
</CardTitle>
95-
<CardDescription></CardDescription>
94+
<CardDescription />
9695
</CardHeader>
97-
<CardContent className="grid gap-2 cursor-pointer shadow-md mt-1">
96+
<CardContent className="grid gap-2 cursor-pointer mt-1">
9897
{gameModeData.map((data) => {
9998
return <GameModeComponent {...data} />;
10099
})}

apps/frontend/src/components/ChessBoard.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export const ChessBoard = memo(({
7474
socket: WebSocket;
7575
}) => {
7676
console.log("chessboard reloaded")
77-
const { height, width } = useWindowSize();
7877

7978
const [isFlipped, setIsFlipped] = useRecoilState(isBoardFlippedAtom);
8079
const [userSelectedMoveIndex, setUserSelectedMoveIndex] = useRecoilState(
@@ -93,11 +92,7 @@ export const ChessBoard = memo(({
9392

9493
const labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
9594
const [canvas, setCanvas] = useState<HTMLCanvasElement | null>(null);
96-
const OFFSET = 100;
97-
const boxSize =
98-
width > height
99-
? Math.floor((height - OFFSET) / 8)
100-
: Math.floor((width - OFFSET) / 8);
95+
const boxSize = 80;
10196
const [gameOver, setGameOver] = useState(false);
10297
const moveAudio = new Audio(MoveSound);
10398
const captureAudio = new Audio(CaptureSound);
@@ -337,7 +332,7 @@ export const ChessBoard = memo(({
337332
height: boxSize,
338333
}}
339334
key={j}
340-
className={`${isRightClickedSquare ? (isMainBoxColor ? 'bg-[#CF664E]' : 'bg-[#E87764]') : isKingInCheckSquare ? 'bg-[#FF6347]' : isHighlightedSquare ? `${isMainBoxColor ? 'bg-[#BBCB45]' : 'bg-[#F4F687]'}` : isMainBoxColor ? 'bg-[#739552]' : 'bg-[#EBEDD0]'} ${''}`}
335+
className={`${isRightClickedSquare ? (isMainBoxColor ? 'bg-[#CF664E]' : 'bg-[#E87764]') : isKingInCheckSquare ? 'bg-[#FF6347]' : isHighlightedSquare ? `${isMainBoxColor ? 'bg-[#BBCB45]' : 'bg-[#F4F687]'}` : isMainBoxColor ? 'bg-boardDark' : 'bg-boardLight'} ${''}`}
341336
onContextMenu={(e) => {
342337
e.preventDefault();
343338
}}

0 commit comments

Comments
 (0)