Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Added Timing for each move, Spectator Feature, Chat Feature , Review Page and updated the ui for it #198

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
09f1561
Merge commit '5cc8d2bc0850da6eef3f6e0100b88a0250a7497c' into timer
Airbornharsh Apr 21, 2024
49e91c9
Merge commit 'ec2f10663bbe2144c477f4743ed894e935b8d7b1' into timer
Airbornharsh Apr 21, 2024
8421446
Timer was removed in the UI
Airbornharsh Apr 21, 2024
047947b
Added some Logic for each piece move
Airbornharsh Apr 21, 2024
47e6e4a
addes logic and ui change in Frontend for move timer
Airbornharsh Apr 21, 2024
0fca8f2
Updated the move timings
Airbornharsh Apr 22, 2024
9e84f5e
Merge commit '0fca8f242a8c195356512a42504854b84b766111' into timer
Airbornharsh Apr 22, 2024
4c86309
Merge commit 'e2ad6ce6363312aaae83058744fe03049a825647' into timer
Airbornharsh Apr 22, 2024
e16659f
Updated the logic with own
Airbornharsh Apr 22, 2024
98e3904
cleaning ups
Airbornharsh Apr 22, 2024
9430d23
Formatting
Airbornharsh Apr 22, 2024
f786d47
Added Spector Screen and logic in backend
Airbornharsh Apr 22, 2024
6888956
Added the spectator in the landing to get the rooms
Airbornharsh Apr 22, 2024
a70a085
Added Chatting Feature
Airbornharsh Apr 22, 2024
480e3e3
Added Review Page and users can check the moves also
Airbornharsh Apr 22, 2024
3e92e58
Merge commit 'e51b13ce6b099703eb3ce90f5b8ca03b1db28566' into timer
Airbornharsh Apr 25, 2024
265a137
lint error
Airbornharsh Apr 25, 2024
2917546
Merge commit '35a689dcff2515b0d18e59fbf0dff7633e047ded' into timer
Airbornharsh May 1, 2024
8e23205
Updated according to new Code
Airbornharsh May 1, 2024
0e16979
chenged to previous
Airbornharsh May 3, 2024
5824431
Merge commit '1fe8678701f2f9e78e93612646e203a69c183a82' into timer
Airbornharsh May 3, 2024
ba561f7
Merge commit '467b45381e80908d486d6bd6f542bd0a10722a0b' into timer
Airbornharsh May 5, 2024
63e78d5
Merge commit '172f920a2e76b78c354edaacb05c8871d216f68e' into timer
Airbornharsh May 5, 2024
251e529
Button Color for spectate
Airbornharsh May 5, 2024
dcc9b59
Merge commit '632a0df456cdfa55185bea895ac2afa0d164e529' into timer
Airbornharsh May 5, 2024
a1a4807
Removed package lock json
Airbornharsh May 5, 2024
2786632
Updated lock FIles
Airbornharsh May 5, 2024
de39822
Old Lock
Airbornharsh May 5, 2024
9373220
Yarn lock update to old one
Airbornharsh May 5, 2024
8407256
Old Lock
Airbornharsh May 5, 2024
2fd2e60
Format and stopped timer when game over
Airbornharsh May 5, 2024
efa3c97
Added Review Button in Game Result Modal
Airbornharsh May 5, 2024
ddd0dd0
Merge commit 'e8dd89936e88277c017f2910d72e814d9a2d11a9' into timer
Airbornharsh May 7, 2024
fbfd383
Updated the logic in server
Airbornharsh May 12, 2024
fe8e359
Updateed
Airbornharsh May 12, 2024
b542a8b
Added Chat in Spectator
Airbornharsh May 12, 2024
214cdde
Merge branch 'main' into timer
Airbornharsh May 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@ Let's keep it simple

## Setting it up locally

- Clone the repo
- Copy over .env.example over to .env everywhere
- Update .env
- Postgres DB Credentials
- Github/Google Auth credentials
- npm install
- Start ws server
- cd apps/ws
- npm run dev
- Start Backend
- cd apps/backend
- npm run dev
- Start frontend
- cd apps/frontend
- npm run dev

- Clone the repo
- Copy over .env.example over to .env everywhere
- Update .env
- Postgres DB Credentials
- Github/Google Auth credentials
- npm install
- Start ws server
- cd apps/ws
- npm run dev
- Start Backend
- cd apps/backend
- npm run dev
- Start frontend
- cd apps/frontend
- npm run dev
38 changes: 38 additions & 0 deletions apps/backend/src/router/v1.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
import { Router } from 'express';
import { db } from '../db';

const v1Router = Router();

export const IN_PROGRESS = 'IN_PROGRESS';

v1Router.get('/', (req, res) => {
res.send('Hello, World!');
});

v1Router.get('/games', async (req, res) => {
try {
const games = await db.game.findMany({
include: {
blackPlayer: true,
whitePlayer: true,
},
where: {
status: IN_PROGRESS,
},
});
res.json(games);
} catch (e: any) {
res.status(500).json({ error: e.message });
}
});

v1Router.get('/games/:gameId', async (req, res) => {
try {
const game = await db.game.findUnique({
include: {
blackPlayer: true,
whitePlayer: true,
moves: true,
},
where: {
id: req.params.gameId,
},
});
res.json(game);
} catch (e: any) {
res.status(500).json({ error: e.message });
}
});

export default v1Router;
12 changes: 8 additions & 4 deletions apps/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { Suspense } from 'react';
import { RecoilRoot } from 'recoil';
import { useUser } from '@repo/store/useUser';
import { Loader } from './components/Loader';
import { Spectate } from './screens/Spectate';
import { Review } from './screens/Review';
import { Layout } from './layout';

function App() {
Expand All @@ -27,13 +29,15 @@ function AuthApp() {
<BrowserRouter>
<Routes>
<Route path="/" element={<Layout children={<Landing />} />} />
<Route path="/login" element={<Login />} />
<Route path="/game/:gameId" element={<Layout children={<Game />} />} />
<Route
path="/login"
element={<Login />}
path="/spectate/:gameId"
element={<Layout children={<Spectate />} />}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should ideally happen on the same url
We shouldnt expect spectators to come at a different url
fine for now tho

/>
<Route
path="/game/:gameId"
element={<Layout children={<Game />} />}
path="/review/:gameId"
element={<Layout children={<Review />} />}
/>
</Routes>
</BrowserRouter>
Expand Down
Loading