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 @@ - + + + + + Bisca de 9 + + + + Bisca de 3 + + + + + + + + + + Single Player + + + Go against one of our bots! + + + + + + Start Game + + + + + + + + MultiPlayer + + + Go one on one with another player! + + + + Open games (oldest first) + + + No open games yet. Try hosting one! + + + + + + + + {{ index + 1 }} + + + Started: {{ game.began_at }} + host: {{ + game.player1?.nickname || 'Anonymous' }} + + + + + + Loading + more... + + + + + + Host Game + + + + + + + + + + Hosting Game + + + + + + + Waiting for opponents... + Cancel Hosting + + + + + + + Join Game + + Hosted by {{ selectedGame.player1?.nickname || 'Anonymous' }} + + + + + + Game Type: Bisca de {{ selectedMode }} + Started at: {{ selectedGame?.began_at }} + + + + Waiting for the host to start... + + + + + Leave + + + + {{ isReady ? 'Cancel Ready' : 'Ready up' }} + + + + + + + \ No newline at end of file
Waiting for opponents...
Game Type: Bisca de {{ selectedMode }}
Started at: {{ selectedGame?.began_at }}