From 1e91c8575dce88e124a963bfdb5522d62e937550 Mon Sep 17 00:00:00 2001 From: Dean Blackborough Date: Mon, 29 Aug 2022 12:38:13 +0100 Subject: [PATCH 1/5] Intro text - Added introductory text above open games and explained each of the options. --- app/Http/Controllers/Index.php | 8 +++++++ resources/views/game.blade.php | 43 +++++++++++++++++++++++++++------- resources/views/home.blade.php | 25 +++++++++++++------- 3 files changed, 58 insertions(+), 18 deletions(-) diff --git a/app/Http/Controllers/Index.php b/app/Http/Controllers/Index.php index a520e46..cb8aa40 100644 --- a/app/Http/Controllers/Index.php +++ b/app/Http/Controllers/Index.php @@ -17,6 +17,12 @@ public function home(Request $request) { $this->bootstrap($request); + $user = $this->api->getAuthUser(); + + if ($user['status'] !== 200) { + abort(404, 'Unable to fetch your account information from the Costs to Expect API'); + } + $open_games_response = $this->api->getGames( $this->resource_type_id, $this->resource_id, @@ -69,6 +75,8 @@ public function home(Request $request) return view( 'home', [ + 'user_id' => $user['content']['id'], + 'resource_type_id' => $this->resource_type_id, 'resource_id' => $this->resource_id, diff --git a/resources/views/game.blade.php b/resources/views/game.blade.php index 33382f9..9ed2b2e 100644 --- a/resources/views/game.blade.php +++ b/resources/views/game.blade.php @@ -18,6 +18,19 @@

Game overview

+ @if($game['complete'] !== 1) +

Start or continue your game using the links below. [Score Sheet] is the link to the score sheet for + a signed-in user, [Public Score Sheet] is for non-registered users, copy the URL and send it to each user, + if you are on a phone, long press the link and Share.

+ +

If you need to remove a player from the game, click the [Remove Player] button next to the player's name, there + score sheet and access token will be removed immediately.

+ @else +

We are working on a game player log and game statistics, as soon as we add them, they will + appear here.

+ + @endif + diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 1964c46..f4b1798 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -19,6 +19,13 @@

Open Games

Resume your open games...

+

Start or continue your game(s) using the links below. [Score Sheet] is the link to the score sheet for + a signed-in user, [Public Score Sheet] is for non-registered users, copy the URL and send it to each user, + if you are on a phone, long press the link and Share.

+ +

If you need to remove a player from the game, click the [Remove Player] button next to the player's name, there + score sheet and access token will be removed immediately.

+ @endif -
- Add Players +
+
@csrf
- @if ($__open_game['complete'] !== 1)
-
@csrf
-
@csrf
+ Add Additional Players
+ @if ($__open_game['complete'] !== 1)
-
@csrf
+
@csrf
+
@csrf
@endif From a359c2f42bee3f73338684de0a107e8d7c715978 Mon Sep 17 00:00:00 2001 From: Dean Blackborough Date: Mon, 29 Aug 2022 12:42:19 +0100 Subject: [PATCH 2/5] Validate error fix - Fixed validation error for wrong credentials --- app/Auth/Guard/Api/Guard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Auth/Guard/Api/Guard.php b/app/Auth/Guard/Api/Guard.php index 33a8fa0..c56fe9d 100644 --- a/app/Auth/Guard/Api/Guard.php +++ b/app/Auth/Guard/Api/Guard.php @@ -107,7 +107,7 @@ public function validate(array $credentials = [], bool $remember_me = false): bo } if ($response['status'] === 401) { - $this->errors = ['email' => [$response['content']['message']]]; + $this->errors = ['email' => [$response['content']]]; return false; } From 9549f5fb6326d4ade719a44e1062de8f7013670e Mon Sep 17 00:00:00 2001 From: Dean Blackborough Date: Mon, 29 Aug 2022 12:57:34 +0100 Subject: [PATCH 3/5] How to score - Initial experience - Added a how to score section --- resources/views/home.blade.php | 22 +++++++++++++------- resources/views/new-game.blade.php | 14 +++++++------ resources/views/public-score-sheet.blade.php | 9 +++++++- resources/views/score-sheet.blade.php | 10 ++++++++- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index f4b1798..2e07416 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -129,9 +129,14 @@ @endforeach @else -

You haven't finished any games yet, once you do, - they will show up here. -

+ + + @endif
@@ -153,10 +158,13 @@ @endforeach @else -

You haven't added any players yet, you need to - add - some players before you can start a game. -

+ + + @endif diff --git a/resources/views/new-game.blade.php b/resources/views/new-game.blade.php index 76b296d..fffe7d4 100644 --- a/resources/views/new-game.blade.php +++ b/resources/views/new-game.blade.php @@ -20,8 +20,8 @@ @csrf
-

New Game

-

Select the players.

+

Start a New Game

+

Select the players, we will then generate score sheets for each of them.

@foreach ($players as $__player)
@@ -47,10 +47,12 @@ @else - - You can't start a game without players, add at least one - player to get started. - + @endif diff --git a/resources/views/public-score-sheet.blade.php b/resources/views/public-score-sheet.blade.php index e14c2b4..fcc4bf6 100644 --- a/resources/views/public-score-sheet.blade.php +++ b/resources/views/public-score-sheet.blade.php @@ -23,12 +23,19 @@

Player: {{ $player_name }}

+ +

Upper Section

-
How to score

Score the total of all the matched dice.

diff --git a/resources/views/score-sheet.blade.php b/resources/views/score-sheet.blade.php index db5d1ee..26fb46a 100644 --- a/resources/views/score-sheet.blade.php +++ b/resources/views/score-sheet.blade.php @@ -17,13 +17,21 @@

Player: {{ $player_name }}

+ +

Upper Section

-
How to score
+

Score the total of all the matched dice.

From bb15bef93c6958fff6ec5d629d0d6cdb1146ceb3 Mon Sep 17 00:00:00 2001 From: Dean Blackborough Date: Mon, 29 Aug 2022 13:02:51 +0100 Subject: [PATCH 4/5] Correct links - Corrected links --- resources/views/components/offcanvas.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/components/offcanvas.blade.php b/resources/views/components/offcanvas.blade.php index 3d37cb7..b5d4029 100644 --- a/resources/views/components/offcanvas.blade.php +++ b/resources/views/components/offcanvas.blade.php @@ -25,13 +25,13 @@ Home