Hide the "In Development" banner once a game is open
The badge on the homepage and briefing page was static markup, wired to nothing - flipping a game's status to open in the admin panel had no effect on it. It's now driven by GameRepository::hasOpenGame() and only shows while every game is still in development/locked. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Game\Repository;
|
namespace App\Game\Repository;
|
||||||
|
|
||||||
use App\Game\Entity\Game;
|
use App\Game\Entity\Game;
|
||||||
|
use App\Game\Enum\GameStatus;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
@@ -15,4 +16,9 @@ class GameRepository extends ServiceEntityRepository
|
|||||||
{
|
{
|
||||||
parent::__construct($registry, Game::class);
|
parent::__construct($registry, Game::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasOpenGame(): bool
|
||||||
|
{
|
||||||
|
return $this->count(['status' => GameStatus::OPEN]) > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Website\Controller;
|
namespace App\Website\Controller;
|
||||||
|
|
||||||
|
use App\Game\Repository\GameRepository;
|
||||||
use App\Game\Service\FeedbackService;
|
use App\Game\Service\FeedbackService;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
@@ -11,17 +12,19 @@ use Symfony\Component\Routing\Annotation\Route;
|
|||||||
final class HomeController extends AbstractController
|
final class HomeController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route(path: '', name: 'website_home')]
|
#[Route(path: '', name: 'website_home')]
|
||||||
public function index(): Response
|
public function index(GameRepository $gameRepository): Response
|
||||||
{
|
{
|
||||||
return $this->render(
|
return $this->render('website/home/index.html.twig', [
|
||||||
'website/home/index.html.twig');
|
'showDevBanner' => !$gameRepository->hasOpenGame(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route(path: '/briefing', name: 'website_intro')]
|
#[Route(path: '/briefing', name: 'website_intro')]
|
||||||
public function intro(FeedbackService $feedbackService): Response
|
public function intro(FeedbackService $feedbackService, GameRepository $gameRepository): Response
|
||||||
{
|
{
|
||||||
return $this->render('website/home/intro.html.twig', [
|
return $this->render('website/home/intro.html.twig', [
|
||||||
'feedbackSummary' => $feedbackService->getFeedbackSummary(),
|
'feedbackSummary' => $feedbackService->getFeedbackSummary(),
|
||||||
|
'showDevBanner' => !$gameRepository->hasOpenGame(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,9 @@
|
|||||||
<div class="col-lg-5 text-center">
|
<div class="col-lg-5 text-center">
|
||||||
<div class="dev-watermark-wrap">
|
<div class="dev-watermark-wrap">
|
||||||
<img src="{{ asset('images/AI_virus.png') }}" alt="AI Virus" class="img-fluid" style="max-height: 260px;">
|
<img src="{{ asset('images/AI_virus.png') }}" alt="AI Virus" class="img-fluid" style="max-height: 260px;">
|
||||||
<span class="dev-watermark-badge">In Development</span>
|
{% if showDevBanner %}
|
||||||
|
<span class="dev-watermark-badge">In Development</span>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -81,7 +81,9 @@
|
|||||||
<div class="text-center mb-4">
|
<div class="text-center mb-4">
|
||||||
<div class="dev-watermark-wrap">
|
<div class="dev-watermark-wrap">
|
||||||
<img src="{{ asset('images/AI_virus.png') }}" alt="AI Virus" class="img-fluid" style="max-height: 220px;">
|
<img src="{{ asset('images/AI_virus.png') }}" alt="AI Virus" class="img-fluid" style="max-height: 220px;">
|
||||||
<span class="dev-watermark-badge">In Development</span>
|
{% if showDevBanner %}
|
||||||
|
<span class="dev-watermark-badge">In Development</span>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user