Skip to content

Commit

Permalink
chore: remove FEATURE_BEAT flag (#2059)
Browse files Browse the repository at this point in the history
  • Loading branch information
wescopeland authored Nov 28, 2023
1 parent d74d235 commit d6e6e7f
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ FORWARD_PHPMYADMIN_PORT=64080

# Feature Flags

FEATURE_BEAT=true
#FEATURE_EXAMPLE=true

# Application

Expand Down
3 changes: 1 addition & 2 deletions .env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ SCOUT_DRIVER=null
SESSION_DRIVER=array
TELESCOPE_ENABLED=false
DEBUGBAR_ENABLED=false
CSP_ENABLED=false
FEATURE_BEAT=true
CSP_ENABLED=false
2 changes: 1 addition & 1 deletion app/Helpers/render/game.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function RenderGameSort(
// }
echo "<a href='/game/$gameID?$flagParam&s=$sort4'>Points$mark4</a> - ";
echo "<a href='/game/$gameID?$flagParam&s=$sort5'>Title$mark5</a>";
if (config('feature.beat') && $canSortByType) {
if ($canSortByType) {
echo " - ";
echo "<a href='/game/$gameID?$flagParam&s=$sort6'>Type$mark6</a>";
}
Expand Down
4 changes: 1 addition & 3 deletions app/Helpers/render/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ function RenderCompletedGamesList(
</label>
HTML;

if (config('feature.beat')) {
echo "<a href='" . route('user.completion-progress', $username) . "'>more...</a>";
}
echo "<a href='" . route('user.completion-progress', $username) . "'>more...</a>";
echo "</div>";

echo "<div id='usercompletedgamescomponent'>";
Expand Down
5 changes: 1 addition & 4 deletions app/Platform/Components/GameCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,7 @@ private function buildCardUserProgressionData(array $userGameProgressionAwards,
$highestProgressionStatus = null;
$highestProgressionAwardDate = null;

$progressionTypes = ['completed', 'mastered'];
if (config('feature.beat')) {
$progressionTypes = ['beaten-softcore', 'beaten-hardcore', 'completed', 'mastered'];
}
$progressionTypes = ['beaten-softcore', 'beaten-hardcore', 'completed', 'mastered'];

foreach ($progressionTypes as $progressionType) {
if (isset($userGameProgressionAwards[$progressionType])) {
Expand Down
4 changes: 0 additions & 4 deletions app/Platform/Controllers/BeatenGamesLeaderboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ class BeatenGamesLeaderboardController extends Controller

public function __invoke(Request $request): View
{
if (!config('feature.beat')) {
abort(404);
}

$validatedData = $request->validate([
'page.number' => 'sometimes|integer|min:1',
'filter.system' => 'sometimes|integer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public function __construct(protected PlayerProgressionService $playerProgressio

public function __invoke(Request $request): View
{
if (!config('feature.beat')) {
abort(404);
}

$targetUsername = $request->route()->parameters['user'];
$validatedData = $request->validate([
'page.number' => 'sometimes|integer|min:1',
Expand Down
2 changes: 1 addition & 1 deletion config/envy.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
'REDIS_CACHE_DB',
'MYSQL_ATTR_SSL_CA',
// config/feature.php
'FEATURE_BEAT',
//
// config/filesystem.php
'AWS_ENDPOINT',
'AWS_URL',
Expand Down
9 changes: 3 additions & 6 deletions config/feature.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?php

return [

/*
* If true, player-facing beaten games UI/UX is enabled.
*/
'beat' => env('FEATURE_BEAT', false),

/**
* 'example' => env('FEATURE_EXAMPLE', false),
*/
];
2 changes: 1 addition & 1 deletion public/gameInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ function () {
', [
'beatenGameCreditDialogContext' => $beatenGameCreditDialogContext,
'gameId' => $gameID,
'isBeatable' => $isGameBeatable && config('feature.beat') === true,
'isBeatable' => $isGameBeatable,
'isBeatenHardcore' => $isBeatenHardcore,
'isBeatenSoftcore' => $isBeatenSoftcore,
'isCompleted' => !is_null($userGameProgressionAwards['completed']),
Expand Down
3 changes: 1 addition & 2 deletions public/userInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,7 @@ function resize() {
}

$canShowProgressionStatusComponent =
config('feature.beat')
&& !empty($userCompletedGamesList)
!empty($userCompletedGamesList)
// Needs at least one non-event game.
&& count(array_filter($userCompletedGamesList, fn ($game) => $game['ConsoleID'] != 101)) > 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
<div class="grid grid-cols-2 gap-px mb-2">
<x-global-statistics.stat-embed label="Games" :count="$numGames" href="{{ route('game.index', ['s' => 1]) }}" />
<x-global-statistics.stat-embed label="Achievements" :count="$numAchievements" href="/achievementList.php" />
@hasfeature("beat")
<x-global-statistics.stat-embed label="Games Mastered" :count="$numHardcoreMasteryAwards" href="/recentMastery.php?t=1&m=1" />
<x-global-statistics.stat-embed label="Games Beaten" :count="$numHardcoreGameBeatenAwards" href="/recentMastery.php?t=8&m=1" />
@endhasfeature
<x-global-statistics.stat-embed label="Games Mastered" :count="$numHardcoreMasteryAwards" href="/recentMastery.php?t=1&m=1" />
<x-global-statistics.stat-embed label="Games Beaten" :count="$numHardcoreGameBeatenAwards" href="/recentMastery.php?t=8&m=1" />
<x-global-statistics.stat-embed label="Registered Players" :count="$numRegisteredPlayers" href="/userList.php" />
<x-global-statistics.stat-embed label="Achievement Unlocks" :count="$numAwarded" href="/recentMastery.php" />
</div>
Expand All @@ -31,14 +29,12 @@
:timestamp="$lastMasteredTimeAgo"
/>

@hasfeature("beat")
<x-global-statistics.recent-game-progress
headingLabel="Most recent game beaten"
:game="$lastBeatenGame"
:userId="$lastBeatenUserId"
:timestamp="$lastBeatenTimeAgo"
/>
@endhasfeature
<x-global-statistics.recent-game-progress
headingLabel="Most recent game beaten"
:game="$lastBeatenGame"
:userId="$lastBeatenUserId"
:timestamp="$lastBeatenTimeAgo"
/>
</div>

@if ($lastRegisteredUser)
Expand Down
9 changes: 0 additions & 9 deletions resources/views/components/feature-flags.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ function handleToggleCookie(cookieName) {
}
</script>

<div class="flex justify-between">
<p>Beaten Games Player-facing UX</p>
@hasfeature("beat")
Enabled
@else
Disabled
@endhasfeature
</div>

{{-- EXAMPLE
<div class="flex justify-between">
<p>Aggregate Queries</p>
Expand Down
5 changes: 1 addition & 4 deletions resources/views/components/menu/account.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@
</x-slot>
<x-dropdown-header>{{ $user->username }}</x-dropdown-header>
<x-dropdown-item :link="route('user.show', $user)">{{ __res('profile', 1) }}</x-dropdown-item>

@hasfeature("beat")
<x-dropdown-item :link="route('user.completion-progress', $user)">Completion Progress</x-dropdown-item>
@endhasfeature
<x-dropdown-item :link="route('user.completion-progress', $user)">Completion Progress</x-dropdown-item>

@if($user->Permissions >= Permissions::Registered)
<x-dropdown-item :link="url('gameList.php?t=play')">Want to Play Games</x-dropdown-item>
Expand Down
4 changes: 1 addition & 3 deletions resources/views/components/menu/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@
<div class="dropdown-divider"></div>
<x-dropdown-item :link="url('userList.php')">{{ __res('user') }}</x-dropdown-item>
<x-dropdown-item :link="url('globalRanking.php')">Global Points Ranking</x-dropdown-item>
@hasfeature("beat")
<x-dropdown-item :link="route('ranking.beaten-games')">Global Beaten Games Ranking</x-dropdown-item>
@endhasfeature
<x-dropdown-item :link="route('ranking.beaten-games')">Global Beaten Games Ranking</x-dropdown-item>
<x-dropdown-item :link="url('recentMastery.php')">Recent Game Awards</x-dropdown-item>
<x-dropdown-item :link="url('developerstats.php')">Developer Stats</x-dropdown-item>
<div class="dropdown-divider"></div>
Expand Down
10 changes: 4 additions & 6 deletions resources/views/content/top-links.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
<span class="text-yellow-400"><x-fas-trophy/></span>
Global Points Ranking
</a>
@hasfeature("beat")
<a class="btn text-center py-2" href="{{ route('ranking.beaten-games') }}">
<span class="text-yellow-400"><x-fas-medal/></span>
Global Beaten Games Ranking
</a>
@endhasfeature
<a class="btn text-center py-2" href="{{ route('ranking.beaten-games') }}">
<span class="text-yellow-400"><x-fas-medal/></span>
Global Beaten Games Ranking
</a>
@if(config('services.discord.invite_id'))
<a class="btn text-center py-2" href="https://discord.gg/{{ config('services.discord.invite_id') }}">
<span class="text-discord"><x-fab-discord/></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,19 @@
@endif
</div>

@hasfeature("beat")
@if ($achievement['type'] && !$useMinimalLayout)
<div class="flex items-center gap-x-1 md:hidden -mt-1.5">
<div class="-mt-1.5">
<x-game.achievements-list.type-indicator
:achievementType="$achievement['type']"
:progressionTypeValue="$progressionTypeValue"
:winConditionTypeValue="$winConditionTypeValue"
:beatenGameCreditDialogContext="$beatenGameCreditDialogContext"
:isCreditDialogEnabled="$isCreditDialogEnabled"
/>
</div>
@if ($achievement['type'] && !$useMinimalLayout)
<div class="flex items-center gap-x-1 md:hidden -mt-1.5">
<div class="-mt-1.5">
<x-game.achievements-list.type-indicator
:achievementType="$achievement['type']"
:progressionTypeValue="$progressionTypeValue"
:winConditionTypeValue="$winConditionTypeValue"
:beatenGameCreditDialogContext="$beatenGameCreditDialogContext"
:isCreditDialogEnabled="$isCreditDialogEnabled"
/>
</div>
@endif
@endhasfeature
</div>
@endif
</div>

<p class="leading-4">
Expand All @@ -106,19 +104,17 @@
</div>

<div class="md:col-span-2 md:flex md:flex-col-reverse md:justify-end md:pt-1 md:gap-y-1">
@hasfeature("beat")
@if ($achievement['type'] && !$useMinimalLayout)
<div class="hidden md:flex items-center justify-end gap-x-1">
<x-game.achievements-list.type-indicator
:achievementType="$achievement['type']"
:progressionTypeValue="$progressionTypeValue"
:winConditionTypeValue="$winConditionTypeValue"
:beatenGameCreditDialogContext="$beatenGameCreditDialogContext"
:isCreditDialogEnabled="$isCreditDialogEnabled"
/>
</div>
@endif
@endhasfeature
@if ($achievement['type'] && !$useMinimalLayout)
<div class="hidden md:flex items-center justify-end gap-x-1">
<x-game.achievements-list.type-indicator
:achievementType="$achievement['type']"
:progressionTypeValue="$progressionTypeValue"
:winConditionTypeValue="$winConditionTypeValue"
:beatenGameCreditDialogContext="$beatenGameCreditDialogContext"
:isCreditDialogEnabled="$isCreditDialogEnabled"
/>
</div>
@endif

@if (!$useMinimalLayout)
<x-game.achievements-list.list-item-global-progress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,19 @@
<div class="text-lg {{ $colorClassName }} mb-1.5 mt-0.5 flex items-center gap-x-1">
<p>{{ $statusLabel }}</p>

@hasfeature('beat')
@if (!$isBeaten && $isBeatable)
<x-modal-trigger
modalTitleLabel="Beaten Game Credit"
resourceApiRoute="/request/game/beaten-credit.php"
:resourceId="$gameId"
:resourceContext="$beatenGameCreditDialogContext"
>
<x-slot name="trigger">
<x-fas-info-circle
aria-label="Learn about beaten game credit"
class="{{ $colorClassName }} w-5 h-5 -mt-1"
/>
</x-slot>
</x-modal-trigger>
@endif
@endhasfeature
@if (!$isBeaten && $isBeatable)
<x-modal-trigger
modalTitleLabel="Beaten Game Credit"
resourceApiRoute="/request/game/beaten-credit.php"
:resourceId="$gameId"
:resourceContext="$beatenGameCreditDialogContext"
>
<x-slot name="trigger">
<x-fas-info-circle
aria-label="Learn about beaten game credit"
class="{{ $colorClassName }} w-5 h-5 -mt-1"
/>
</x-slot>
</x-modal-trigger>
@endif
</div>

0 comments on commit d6e6e7f

Please sign in to comment.