From 87e0dc2518fbcddac66e2e4279c33d15e77430e6 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 | 311 +++++++++++++++----- 4 files changed, 242 insertions(+), 82 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 b605b46..015f987 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 @@ - +