From d8cdbbf2addb1a14d8f2db9cf8939ad37d5ca881 Mon Sep 17 00:00:00 2001 From: Edd Date: Thu, 25 Dec 2025 01:49:02 +0000 Subject: [PATCH] home page feature final --- api/app/Http/Controllers/GameController.php | 6 +- frontend/src/components/layout/NavBar.vue | 5 +- frontend/src/main.js | 2 +- frontend/src/pages/home/HomePage.vue | 293 ++++++++++++++++---- 4 files changed, 240 insertions(+), 66 deletions(-) diff --git a/api/app/Http/Controllers/GameController.php b/api/app/Http/Controllers/GameController.php index bc04482..15061f8 100644 --- a/api/app/Http/Controllers/GameController.php +++ b/api/app/Http/Controllers/GameController.php @@ -30,7 +30,11 @@ class GameController extends Controller $query->where("status", $request->status); } - $query->orderBy("began_at", "desc"); + if ($request->has("sort_direction") && in_array($request->sort_direction, ["asc", "desc"])) { + $query->orderBy("began_at", $request->sort_direction); + }else{ + $query->orderBy("began_at", "desc"); + } return response()->json($query->paginate(15)); } diff --git a/frontend/src/components/layout/NavBar.vue b/frontend/src/components/layout/NavBar.vue index 079c47a..f967e44 100644 --- a/frontend/src/components/layout/NavBar.vue +++ b/frontend/src/components/layout/NavBar.vue @@ -15,13 +15,13 @@ - + Login - + Logout @@ -36,7 +36,6 @@ - +
+
+ + + + + +
+
+ +
+ + + + Single Player + + + Go against one of our bots! + + + +
+ +
+
+
+ + + + MultiPlayer + + + Go one on one with another player! + + + + +
+
+ No open games yet. Try hosting one! +
+
+ +
+ +
+
+ {{ index + 1 }} +
+
+
Started: {{ game.began_at }}
+
host: {{ + game.player1?.nickname || 'Anonymous' }}
+
+
+
+ +
+ Loading + more... +
+
+
+
+ +
+
+
+
+ +
+ + + Hosting Game + + +
+
+
+
+

Waiting for opponents...

+ +
+
+
+
+ + + Join Game + + Hosted by {{ selectedGame.player1?.nickname || 'Anonymous' }} + + + + +
+

Game Type: Bisca de {{ selectedMode }}

+

Started at: {{ selectedGame?.began_at }}

+
+ +
+ Waiting for the host to start... +
+ +
+ + + +
+
+
+
+ + \ No newline at end of file