Skip to content

Commit

Permalink
Merge pull request #43 from deanblackborough/v1.07.0
Browse files Browse the repository at this point in the history
v1.07.0
  • Loading branch information
deanblackborough authored Aug 29, 2022
2 parents 4dff360 + e5c3a50 commit cf90a38
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 38 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

The complete changelog for the Costs to Expect REST API, our changelog follows the format defined at https://keepachangelog.com/en/1.0.0/

## [1.07.0] - [2022-08-29]
### Changed
- Added a "How to score" section to the top of each score sheet.
- Added text explaining all the options above open games.
- Renamed the "Share" link.
- Improved the experience for new users, added text to guide the user.
### Fixed
- Corrected a validation error when credentials are invalid.
- Corrected menu links.

## [1.06.1] - [2022-08-27]
### Changed
- Updated the footer.
Expand Down
2 changes: 1 addition & 1 deletion app/Auth/Guard/Api/Guard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 8 additions & 0 deletions app/Http/Controllers/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,

Expand Down
4 changes: 2 additions & 2 deletions config/app/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
'error_email' => env('ERROR_EMAIL'),
'cookie_user' => env('SESSION_NAME_USER'),
'cookie_bearer' => env('SESSION_NAME_BEARER'),
'version' => '1.06.1',
'release_date' => '27th August 2022'
'version' => '1.07.0',
'release_date' => '29th August 2022'
];
4 changes: 2 additions & 2 deletions resources/views/components/offcanvas.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<a class="nav-link @if($active === 'home') active @endif" @if($active === 'home') aria-current="page" @endif href="{{ route('home') }}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link @if($active === 'games') active @endif" @if($active === 'home') aria-current="page" @endif href="{{ route('games') }}">Games</a>
<a class="nav-link @if($active === 'games') active @endif" @if($active === 'games') aria-current="page" @endif href="{{ route('games') }}">Games</a>
</li>
<li class="nav-item ps-3">
<a class="nav-link" href="{{ route('game.create.view') }}">- New Game</a>
</li>
<li class="nav-item">
<a class="nav-link @if($active === 'players') active @endif" @if($active === 'home') aria-current="page" @endif href="{{ route('players') }}">Players</a>
<a class="nav-link @if($active === 'players') active @endif" @if($active === 'players') aria-current="page" @endif href="{{ route('players') }}">Players</a>
</li>
<li class="nav-item ps-3">
<a class="nav-link" href="{{ route('player.create.view') }}">- New Player</a>
Expand Down
43 changes: 34 additions & 9 deletions resources/views/game.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,34 @@

<h2>Game overview</h2>

@if($game['complete'] !== 1)
<p>Start or continue your game using the links below. <mark>[Score Sheet]</mark> is the link to the score sheet for
a signed-in user, <mark>[Public Score Sheet]</mark> 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.</p>

<p>If you need to remove a player from the game, click the <mark>[Remove Player]</mark> button next to the player's name, there
score sheet and access token will be removed immediately.</p>
@else
<p>We are working on a game player log and game statistics, as soon as we add them, they will
appear here.</p>

@endif

<ul class="list-unstyled">
<li class="mb-3">
<span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-controller" viewBox="0 0 16 16">
<path d="M11.5 6.027a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm-1.5 1.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1zm2.5-.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm-1.5 1.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1zm-6.5-3h1v1h1v1h-1v1h-1v-1h-1v-1h1v-1z"/>
<path d="M3.051 3.26a.5.5 0 0 1 .354-.613l1.932-.518a.5.5 0 0 1 .62.39c.655-.079 1.35-.117 2.043-.117.72 0 1.443.041 2.12.126a.5.5 0 0 1 .622-.399l1.932.518a.5.5 0 0 1 .306.729c.14.09.266.19.373.297.408.408.78 1.05 1.095 1.772.32.733.599 1.591.805 2.466.206.875.34 1.78.364 2.606.024.816-.059 1.602-.328 2.21a1.42 1.42 0 0 1-1.445.83c-.636-.067-1.115-.394-1.513-.773-.245-.232-.496-.526-.739-.808-.126-.148-.25-.292-.368-.423-.728-.804-1.597-1.527-3.224-1.527-1.627 0-2.496.723-3.224 1.527-.119.131-.242.275-.368.423-.243.282-.494.575-.739.808-.398.38-.877.706-1.513.773a1.42 1.42 0 0 1-1.445-.83c-.27-.608-.352-1.395-.329-2.21.024-.826.16-1.73.365-2.606.206-.875.486-1.733.805-2.466.315-.722.687-1.364 1.094-1.772a2.34 2.34 0 0 1 .433-.335.504.504 0 0 1-.028-.079zm2.036.412c-.877.185-1.469.443-1.733.708-.276.276-.587.783-.885 1.465a13.748 13.748 0 0 0-.748 2.295 12.351 12.351 0 0 0-.339 2.406c-.022.755.062 1.368.243 1.776a.42.42 0 0 0 .426.24c.327-.034.61-.199.929-.502.212-.202.4-.423.615-.674.133-.156.276-.323.44-.504C4.861 9.969 5.978 9.027 8 9.027s3.139.942 3.965 1.855c.164.181.307.348.44.504.214.251.403.472.615.674.318.303.601.468.929.503a.42.42 0 0 0 .426-.241c.18-.408.265-1.02.243-1.776a12.354 12.354 0 0 0-.339-2.406 13.753 13.753 0 0 0-.748-2.295c-.298-.682-.61-1.19-.885-1.465-.264-.265-.856-.523-1.733-.708-.85-.179-1.877-.27-2.913-.27-1.036 0-2.063.091-2.913.27z"/>
</svg>
Overview
Game Overview
</span>

@if (array_key_exists('collection', $game['players']))
<ul class="list-unstyled mb-2">

@foreach ($game['players']['collection'] as $__player)
<li>
<li class="pb-2">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-person-fill" viewBox="0 0 16 16">
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
</svg>
Expand All @@ -47,19 +60,31 @@
(0 pts)
@endif

<a href="{{ route('game.score-sheet', ['game_id' => $game['id'], 'player_id' => $__player['id']]) }}">[Score sheet]</a>

@if (array_key_exists($game['id'], $share_tokens) && array_key_exists($__player['id'], $share_tokens[$game['id']]))
<a href="{{ route('public.score-sheet', ['token' => $share_tokens[$game['id']][$__player['id']]]) }}">[Share]</a>
@endif
<ul class="list-inline ps-4">
<li class="list-inline-item"><a href="{{ route('game.score-sheet', ['game_id' => $game['id'], 'player_id' => $__player['id']]) }}">[Score sheet]</a></li>
@if (array_key_exists($game['id'], $share_tokens) && array_key_exists($__player['id'], $share_tokens[$game['id']]))
<li class="list-inline-item"><a href="{{ route('public.score-sheet', ['token' => $share_tokens[$game['id']][$__player['id']]]) }}">[Public Score Sheet]</a></li>
@endif
@if ($game['complete'] !== 1)
<li class="list-inline-item"><a href="{{ route('game.player.delete', ['game_id' => $game['id'], 'player_id' => $__player['id']]) }}">[Remove Player]</a></li>
@endif
</ul>
</li>
@endforeach
</ul>
@endif

@if ($game['complete'] !== 1)
<a href="{{ route('game.add-players.view', ['game_id' => $game['id']]) }}" class="btn btn-sm btn-primary">Add Players</a>
<form action="{{ route('game.complete', ['game_id' => $game['id']]) }}" method="POST" class="d-inline">@csrf <button type="submit" class="btn btn-sm btn-primary">Complete</button></form>
<div class="pb-3 pt-1">
<form action="{{ route('game.delete', ['game_id' => $game['id']]) }}" method="POST" class="d-inline">@csrf <button type="submit" class="btn btn-sm btn-danger">Delete Game</button></form>
</div>
<div class="pb-1">
<a href="{{ route('game.add-players.view', ['game_id' => $game['id']]) }}" class="btn btn-sm btn-primary">Add Additional Players</a>
</div>
<div>
<form action="{{ route('game.complete', ['game_id' => $game['id']]) }}" method="POST" class="d-inline">@csrf <button type="submit" class="btn btn-sm btn-primary">Complete Game</button></form>
<form action="{{ route('game.complete.play-again', ['game_id' => $game['id']]) }}" method="POST" class="d-inline">@csrf <button type="submit" class="btn btn-sm btn-primary">Complete Game & Play Again</button></form>
</div>
@endif
</li>
</ul>
Expand Down
47 changes: 31 additions & 16 deletions resources/views/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
<h2>Open Games</h2>
<p class="fs-5 col-md-8">Resume your open games...</p>

<p>Start or continue your game(s) using the links below. <mark>[Score Sheet]</mark> is the link to the score sheet for
a signed-in user, <mark>[Public Score Sheet]</mark> 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.</p>

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

<ul class="list-unstyled">
@foreach ($open_games as $__open_game)
<li class="mb-3">
Expand All @@ -28,7 +35,7 @@
<path d="M3.051 3.26a.5.5 0 0 1 .354-.613l1.932-.518a.5.5 0 0 1 .62.39c.655-.079 1.35-.117 2.043-.117.72 0 1.443.041 2.12.126a.5.5 0 0 1 .622-.399l1.932.518a.5.5 0 0 1 .306.729c.14.09.266.19.373.297.408.408.78 1.05 1.095 1.772.32.733.599 1.591.805 2.466.206.875.34 1.78.364 2.606.024.816-.059 1.602-.328 2.21a1.42 1.42 0 0 1-1.445.83c-.636-.067-1.115-.394-1.513-.773-.245-.232-.496-.526-.739-.808-.126-.148-.25-.292-.368-.423-.728-.804-1.597-1.527-3.224-1.527-1.627 0-2.496.723-3.224 1.527-.119.131-.242.275-.368.423-.243.282-.494.575-.739.808-.398.38-.877.706-1.513.773a1.42 1.42 0 0 1-1.445-.83c-.27-.608-.352-1.395-.329-2.21.024-.826.16-1.73.365-2.606.206-.875.486-1.733.805-2.466.315-.722.687-1.364 1.094-1.772a2.34 2.34 0 0 1 .433-.335.504.504 0 0 1-.028-.079zm2.036.412c-.877.185-1.469.443-1.733.708-.276.276-.587.783-.885 1.465a13.748 13.748 0 0 0-.748 2.295 12.351 12.351 0 0 0-.339 2.406c-.022.755.062 1.368.243 1.776a.42.42 0 0 0 .426.24c.327-.034.61-.199.929-.502.212-.202.4-.423.615-.674.133-.156.276-.323.44-.504C4.861 9.969 5.978 9.027 8 9.027s3.139.942 3.965 1.855c.164.181.307.348.44.504.214.251.403.472.615.674.318.303.601.468.929.503a.42.42 0 0 0 .426-.241c.18-.408.265-1.02.243-1.776a12.354 12.354 0 0 0-.339-2.406 13.753 13.753 0 0 0-.748-2.295c-.298-.682-.61-1.19-.885-1.465-.264-.265-.856-.523-1.733-.708-.85-.179-1.877-.27-2.913-.27-1.036 0-2.063.091-2.913.27z"/>
</svg>
<a href="{{ route('game.show', ['game_id' => $__open_game['id']]) }}" class="ps-2">
Overview
Game Overview
</a>
</span>

Expand All @@ -54,25 +61,25 @@
<ul class="list-inline ps-4">
<li class="list-inline-item"><a href="{{ route('game.score-sheet', ['game_id' => $__open_game['id'], 'player_id' => $__player['id']]) }}">[Score sheet]</a></li>
@if (array_key_exists($__open_game['id'], $share_tokens) && array_key_exists($__player['id'], $share_tokens[$__open_game['id']]))
<li class="list-inline-item"><a href="{{ route('public.score-sheet', ['token' => $share_tokens[$__open_game['id']][$__player['id']]]) }}">[Share]</a></li>
<li class="list-inline-item"><a href="{{ route('public.score-sheet', ['token' => $share_tokens[$__open_game['id']][$__player['id']]]) }}">[Public Score Sheet]</a></li>
@endif
<li class="list-inline-item"><a href="{{ route('game.player.delete', ['game_id' => $__open_game['id'], 'player_id' => $__player['id']]) }}">[Remove]</a></li>
<li class="list-inline-item"><a href="{{ route('game.player.delete', ['game_id' => $__open_game['id'], 'player_id' => $__player['id']]) }}">[Remove Player]</a></li>
</ul>
</li>
@endforeach
</ul>
@endif

<div class="pb-1">
<a href="{{ route('game.add-players.view', ['game_id' => $__open_game['id']]) }}" class="btn btn-sm btn-primary">Add Players</a>
<div class="pb-3 pt-1">
<form action="{{ route('game.delete', ['game_id' => $__open_game['id']]) }}" method="POST" class="d-inline">@csrf <button type="submit" class="btn btn-sm btn-danger">Delete Game</button></form>
</div>
@if ($__open_game['complete'] !== 1)
<div class="pb-1">
<form action="{{ route('game.complete', ['game_id' => $__open_game['id']]) }}" method="POST" class="d-inline">@csrf <button type="submit" class="btn btn-sm btn-primary">Complete</button></form>
<form action="{{ route('game.complete.play-again', ['game_id' => $__open_game['id']]) }}" method="POST" class="d-inline">@csrf <button type="submit" class="btn btn-sm btn-primary">Complete & Play Again</button></form>
<a href="{{ route('game.add-players.view', ['game_id' => $__open_game['id']]) }}" class="btn btn-sm btn-primary">Add Additional Players</a>
</div>
@if ($__open_game['complete'] !== 1)
<div>
<form action="{{ route('game.delete', ['game_id' => $__open_game['id']]) }}" method="POST" class="d-inline">@csrf <button type="submit" class="btn btn-sm btn-danger">Delete</button></form>
<form action="{{ route('game.complete', ['game_id' => $__open_game['id']]) }}" method="POST" class="d-inline">@csrf <button type="submit" class="btn btn-sm btn-primary">Complete Game</button></form>
<form action="{{ route('game.complete.play-again', ['game_id' => $__open_game['id']]) }}" method="POST" class="d-inline">@csrf <button type="submit" class="btn btn-sm btn-primary">Complete Game & Play Again</button></form>
</div>
@endif
</li>
Expand Down Expand Up @@ -122,9 +129,14 @@
</ul>
@endforeach
@else
<p class="text-primary">You haven't finished any games yet, once you do,
they will show up here.
</p>

<div class="alert alert-dark" role="alert">
<h4 class="alert-heading">No games yet!</h4>
<p>As soon as you complete a game, this is where your recent games will show,
you will have quick access to statistics for each game and access to the
game log.</p>
</div>

@endif
</div>

Expand All @@ -146,10 +158,13 @@
@endforeach
</ul>
@else
<p class="text-primary">You haven't added any players yet, you need to
<a href="{{ route('player.create.view') }}">add</a>
some players before you can start a game.
</p>

<div class="alert alert-dark" role="alert">
<h4 class="alert-heading">No Players!</h4>
<p>Add a player using this <a href="{{ route('player.create.view') }}">link</a>, as soon as
you do you can start a game..</p>
</div>

@endif
</div>
</div>
Expand Down
14 changes: 8 additions & 6 deletions resources/views/new-game.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
@csrf

<div class="mb-3">
<h2>New Game</h2>
<p>Select the players.</p>
<h2>Start a New Game</h2>
<p>Select the players, we will then generate score sheets for each of them.</p>

@foreach ($players as $__player)
<div class="form-check">
Expand All @@ -47,10 +47,12 @@

<button type="submit" class="btn btn-primary w-100">Start Game</button>
@else
<span class="text-primary">
You can't start a game without players, add at least one
<a href="{{ route('player.create.view') }}">player</a> to get started.
</span>
<div class="alert alert-dark" role="alert">
<h4 class="alert-heading">Oops!, No Players!</h4>
<p>Before you can start a game you need to add your players.</p>
<p>Add a player using this <a href="{{ route('player.create.view') }}">link</a>, as soon as
you do you can start a game..</p>
</div>
@endif
</form>
</main>
Expand Down
Loading

0 comments on commit cf90a38

Please sign in to comment.