From 4aece040ecd8859fd55022cc96aa560d55cfbd35 Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Mon, 1 Apr 2024 19:31:34 -0400 Subject: [PATCH] feat(game): adjust compare progress ux (#2314) --- .../components/game-progress-bar.blade.php | 6 +- .../game/compare-progress.blade.php | 108 ++++++++++-------- .../views/pages-legacy/gameInfo.blade.php | 10 +- 3 files changed, 72 insertions(+), 52 deletions(-) diff --git a/resources/views/components/game-progress-bar.blade.php b/resources/views/components/game-progress-bar.blade.php index e3385981ff..173edbacd8 100644 --- a/resources/views/components/game-progress-bar.blade.php +++ b/resources/views/components/game-progress-bar.blade.php @@ -1,5 +1,6 @@ @props([ 'awardIndicator' => null, // 'unfinished' | 'beaten-softcore' | 'beaten-hardcore' | 'completed' | 'mastered' | null + 'containerClassNames' => '', 'hardcoreProgress' => 0, 'maxProgress' => 100, 'softcoreProgress' => 0, @@ -32,7 +33,7 @@ $tooltipLabel = "Progress: {$hardcoreProgress}/{$maxProgress} (hardcore)"; } else if ($hardcoreProgress === 0 && $softcoreProgress > 0) { // Only softcore progress. - $tooltipLabel = "Progress: {$softcoreProgress}/{$maxProgress} (softcore only)"; + $tooltipLabel = "Progress: {$softcoreProgress}/{$maxProgress} (softcore)"; } else { // Mixed progress. $tooltipLabel = "Progress: {$softcoreProgress}/{$maxProgress} (softcore), {$hardcoreProgress}/{$maxProgress} (hardcore)"; @@ -40,14 +41,13 @@ } ?> -
+
@if ($hardcoreProgress > 0) diff --git a/resources/views/components/game/compare-progress.blade.php b/resources/views/components/game/compare-progress.blade.php index 98701ecf1a..638f318aaa 100644 --- a/resources/views/components/game/compare-progress.blade.php +++ b/resources/views/components/game/compare-progress.blade.php @@ -26,6 +26,10 @@ $followedUserCompletion = PlayerGame::where('game_id', $game->ID) ->whereIn('user_id', $followedUserIds) + ->where(function ($query) { + $query->where('achievements_unlocked', '>', 0) + ->orWhere('achievements_unlocked_hardcore', '>', 0); + }) ->select($fields) ->orderBy('achievements_unlocked_hardcore', 'DESC') ->orderBy('achievements_unlocked', 'DESC') @@ -41,40 +45,43 @@

Compare Progress

-
+
@if ($followedUserCompletion === null)

RetroAchievements is a lot more fun with others.

@if ($user === null) @@ -83,30 +90,41 @@ function selectSearchBoxUser() {

Find users to follow here!

@endif @elseif (empty($followedUserCompletion)) -

None of your followed users have played this game

+

None of your followed users have unlocked any achievements for this game.

@else

Compare to a followed user:

- - @foreach ($followedUserCompletion as $completion) - - - - - - @endforeach -
{!! userAvatar($friend, iconSize: 20) !!} - - {{ $completion['achievements_unlocked'] }}/{{ $completion['achievements_total'] }} - -
+
+ @foreach ($followedUserCompletion as $completion) + @php + $friend = User::find($completion['user_id']); + @endphp +
+
+ {!! userAvatar($friend, iconSize: 20) !!} +
+ + + +
+ @endforeach + @endif -

Compare with any user:

- -
- - +
+

Compare with any user:

+
+ + +
diff --git a/resources/views/pages-legacy/gameInfo.blade.php b/resources/views/pages-legacy/gameInfo.blade.php index 99bc51d798..fa1973b98c 100644 --- a/resources/views/pages-legacy/gameInfo.blade.php +++ b/resources/views/pages-legacy/gameInfo.blade.php @@ -1005,10 +1005,12 @@ function resize() { if ($user !== null && $numAchievements > 0) { $gameModel = Game::find($gameID); ?> - +
+ +