Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/icons/ph/medal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions config/packages/twig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ twig:
'src/Presentation/Template/Admin': 'admin'
'src/Presentation/Template/reports': 'reports'
'src/Presentation/Template/turbo': 'turbo'
'src/Presentation/Template/macro': 'macro'

when@test:
twig:
Expand Down
6 changes: 3 additions & 3 deletions src/Presentation/Controller/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class: Game::class,
}

$reports = $game->getReports()->toArray();
$mostUpvotedReport = null;
$topReport = null;

if (!empty($reports)) {
/** @var array<int, Report> $reports */
Expand All @@ -89,7 +89,7 @@ class: Game::class,
return $b->getCreatedAt() <=> $a->getCreatedAt();
});

$mostUpvotedReport = $reports[0];
$topReport = $reports[0];
}

$createReportForm = $this->createForm(CreateReportForm::class, null, [
Expand All @@ -106,7 +106,7 @@ class: Game::class,
'game' => $game,
'reports' => $reports ?? [],
'gameSlug' => $game->getSlug(),
'mostUpvotedReport' => $mostUpvotedReport,
'topReport' => $topReport,
'createReportForm' => $createReportForm->createView(),
'createReportCommentForm' => $createReportCommentForm->createView(),
]);
Expand Down
7 changes: 7 additions & 0 deletions src/Presentation/Template/macro/_ordinal_macro.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% macro ordinal(text) %}
{% if text|length > 1 and text|slice(-1) matches '/^[1-9]$/' %}
{{ text|slice(0, -1) }}<span class="align-super text-xs leading-none">{{ text|slice(-1) }}</span>
{% else %}
{{ text }}
{% endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% macro reverse_ordinal(text) %}
{% if text|length > 1 %}
<span class="align-super text-xs leading-none">{{ text|first }}</span>{{ text|slice(1) }}
{% else %}
{{ text }}
{% endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@

<div class="divider divider-secondary"></div>

{% include '@reports/partials/_reports_top_report.html.twig' %}

{% if game.description is defined %}
<div class="divider divider-start text-lg font-bold">{{ 'game.description'|trans }}</div>

<p class="text-left text-base-content/80 leading-relaxed">
{{ game.description|raw }}
</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% trans_default_domain 'report' %}
{% import '@macro/_reverse_ordinal_macro.html.twig' as reverse_ordinal %}

{% if reports|length > 0 %}
</tbody>
Expand All @@ -15,9 +16,10 @@
</div>

<div class="mt-4 text-base-content/50">
<p>{{ 'list.table.notice.60fps'|trans }}</p>
<p>{{ 'list.table.notice.stable_FPS'|trans }}</p>
<p>{{ 'list.table.notice.better_resolution'|trans }}</p>
<p>{{ 'list.table.notice.native_resolution'|trans }}</p>
<p>{{ reverse_ordinal.reverse_ordinal('list.table.notice.60fps'|trans) }}</p>
<p>{{ reverse_ordinal.reverse_ordinal('list.table.notice.stable_FPS'|trans) }}</p>
<p>{{ reverse_ordinal.reverse_ordinal('list.table.notice.better_resolution'|trans) }}</p>
<p>{{ reverse_ordinal.reverse_ordinal('list.table.notice.native_resolution'|trans) }}</p>
<p>{{ reverse_ordinal.reverse_ordinal('list.table.notice.switch_2_edition'|trans) }}</p>
</div>
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{% trans_default_domain 'report' %}
{% import '@macro/_ordinal_macro.html.twig' as ordinal %}

{% if reports|length > 0 %}
<div class="overflow-x-auto min-h-32 max-h-151">
<table class="table table-zebra table-pin-rows table-pin-cols table-fixed w-full">
<thead>
<tr>
<th class="text-center">{{ 'list.table.header.status'|trans }}</th>
<th class="text-center">{{ 'list.table.header.60fps'|trans }}</th>
<th class="text-center">{{ 'list.table.header.stable_FPS'|trans }}</th>
<th class="text-center">{{ 'list.table.header.better_resolution'|trans }}</th>
<th class="text-center">{{ 'list.table.header.native_resolution'|trans }}</th>
<th class="text-center">{{ 'list.table.header.60fps'|trans }}</th>
<th class="text-center">{{ 'list.table.header.stable_FPS'|trans }}</th>
<th class="text-center">{{ 'list.table.header.better_resolution'|trans }}</th>
<th class="text-center">{{ 'list.table.header.native_resolution'|trans }}</th>
<th class="text-center">{{ ordinal.ordinal('list.table.header.60fps'|trans) }}</th>
<th class="text-center">{{ ordinal.ordinal('list.table.header.stable_FPS'|trans) }}</th>
<th class="text-center">{{ ordinal.ordinal('list.table.header.better_resolution'|trans) }}</th>
<th class="text-center">{{ ordinal.ordinal('list.table.header.native_resolution'|trans) }}</th>
<th class="text-center">{{ ordinal.ordinal('list.table.header.60fps'|trans) }}</th>
<th class="text-center">{{ ordinal.ordinal('list.table.header.stable_FPS'|trans) }}</th>
<th class="text-center">{{ ordinal.ordinal('list.table.header.better_resolution'|trans) }}</th>
<th class="text-center">{{ ordinal.ordinal('list.table.header.native_resolution'|trans) }}</th>
<th class="text-center">{{ 'list.table.header.better_loading_times'|trans }}</th>
<th class="text-center">{{ 'list.table.header.switch_2_edition'|trans }}</th>
<th class="text-center">{{ ordinal.ordinal('list.table.header.switch_2_edition'|trans) }}</th>
<th class="text-center">{{ 'list.table.header.upvoted'|trans }}</th>
<th class="text-center">{{ 'list.table.header.issue'|trans }}</th>
</tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{% trans_default_domain 'report' %}

{% if topReport is defined and topReport is not null %}

{% set status = topReport.gameStatus %}
{% set statusBg = '' %}
{% set statusIcon = '' %}

{% if status == enum('App\\Infrastructure\\Enum\\ReportGameStatusEnum').OK %}
{% set statusIcon = 'ph:smiley' %}
{% set statusBg = 'bg-info/50' %}
{% elseif status == enum('App\\Infrastructure\\Enum\\ReportGameStatusEnum').BUGGED %}
{% set statusIcon = 'ph:smiley-x-eyes' %}
{% set statusBg = 'bg-primary/50' %}
{% elseif status == enum('App\\Infrastructure\\Enum\\ReportGameStatusEnum').BAD %}
{% set statusIcon = 'ph:smiley-nervous' %}
{% set statusBg = 'bg-warning/50' %}
{% else %}
{% set statusIcon = 'ph:sparkle' %}

{% set statusBg = 'bg-success/50' %}
{% endif %}

<div class="divider divider-start text-lg font-bold flex">
<div class="py-0.5 px-2.5 border-2 rounded-xl bg-accent/50 flex items-center">
<div class="w-6 h-6 mr-1">{{ ux_icon('ph:medal') }}</div> {{ 'most_upvoted.title'|trans }}
</div>
</div>

<div class="flex justify-between">
<div class="badge {{ statusBg }} gap-2">
<span>Status:</span>
<div class="w-4 h-4 tooltip tooltip-right" data-tip="{{ topReport.gameStatus.name }}">
{{ ux_icon(statusIcon) }}
</div>
</div>

<div class="badge {{ topReport.isSwitch2Edition ? 'bg-accent/50' : 'bg-neutral/50 grayscale text-base-content/20' }}">
{{ 'most_upvoted.badge.switch_2_edition'|trans }}
</div>

<div class="badge {{ topReport.hasImprovedLoadingTimes ? 'bg-accent/50' : 'bg-neutral/50 grayscale text-base-content/20' }}">
{{ 'most_upvoted.badge.better_loading_times'|trans }}
</div>
</div>

<div class="flex justify-between">
<div class="badge {{ topReport.is60FpsPortable ? 'bg-secondary/50' : 'bg-neutral/50 grayscale text-base-content/20' }}">
{{ 'most_upvoted.badge.60fps_portable'|trans }}
</div>

<div class="badge {{ topReport.hasStableFrameratePortable ? 'bg-secondary/50' : 'bg-neutral/50 grayscale text-base-content/20' }}">
{{ 'most_upvoted.badge.stable_fps_portable'|trans }}
</div>

<div class="badge {{ topReport.hasResolutionImprovedPortable ? 'bg-secondary/50' : 'bg-neutral/50 grayscale text-base-content/20' }}">
{{ 'most_upvoted.badge.resolution_improved_portable'|trans }}
</div>

<div class="badge {{ topReport.isNativeResolutionPortable ? 'bg-secondary/50' : 'bg-neutral/50 grayscale text-base-content/20' }}">
{{ 'most_upvoted.badge.native_resolution_portable'|trans }}
</div>
</div>

<div class="flex justify-between">
<div class="badge {{ topReport.is60FpsDocked ? 'bg-primary/50' : 'bg-neutral/50 grayscale text-base-content/20' }}">
{{ 'most_upvoted.badge.60fps_tv'|trans }}
</div>

<div class="badge {{ topReport.hasStableFramerateDocked ? 'bg-primary/50' : 'bg-neutral/50 grayscale text-base-content/20' }}">
{{ 'most_upvoted.badge.stable_fps_tv'|trans }}
</div>

<div class="badge {{ topReport.hasResolutionImprovedDocked ? 'bg-primary/50' : 'bg-neutral/50 grayscale text-base-content/20' }}">
{{ 'most_upvoted.badge.resolution_improved_tv'|trans }}
</div>

<div class="badge {{ topReport.isNativeResolutionDocked ? 'bg-primary/50' : 'bg-neutral/50 grayscale text-base-content/20' }}">
{{ 'most_upvoted.badge.native_resolution_tv'|trans }}
</div>
</div>

<div class="divider divider-accent"></div>

{% endif %}
34 changes: 25 additions & 9 deletions translations/report.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ game:
release_date: 'Release Date'
developer: 'Developer'
publisher: 'Publisher'
description: 'Description'

add_report:
label: 'Add a Report'
Expand Down Expand Up @@ -40,19 +41,34 @@ list:
table:
header:
status: 'Status'
60fps: '60 FPS*'
stable_FPS: 'Stable FPS**'
better_resolution: 'Better Res***'
native_resolution: 'Native Res****'
60fps: '60 FPS1'
stable_FPS: 'Stable FPS2'
better_resolution: 'Better Res3'
native_resolution: 'Native Res4'
better_loading_times: 'Better loading'
switch_2_edition: 'Switch 2 Edition'
switch_2_edition: 'S2E5'
issue: 'Issue?'
upvoted: 'Upvoted'
portable_label: 'Portable'
tv_label: 'TV'
misc_label: 'Misc'
notice:
60fps: '*Target above 30 FPS'
stable_FPS: '**Framerate is consistently at 30 or 60 FPS related to the reported framerate'
better_resolution: '***Has a better resolution than on Nintendo Switch 1 system in related mode'
native_resolution: '****Can hit 1080p in portable mode and/or 4K in TV mode on Nintendo Switch 2 system'
60fps: '1: Target above 30 FPS'
stable_FPS: '2: Framerate is consistently at 30 or 60 FPS related to the reported framerate'
better_resolution: '3: Has a better resolution than on Nintendo Switch 1 system in related mode'
native_resolution: '4: Can hit 1080p in portable mode and/or 4K in TV mode on Nintendo Switch 2 system'
switch_2_edition: '5: Is a "Switch 2 Edition" or not'

most_upvoted:
title: 'Top report'
badge:
60fps_portable: '60 FPS on portable'
stable_fps_portable: 'Stable FPS on portable'
resolution_improved_portable: 'Better Resolution on portable'
native_resolution_portable: 'Native Resolution on portable'
60fps_tv: '60 FPS on TV'
stable_fps_tv: 'Stable FPS on TV'
resolution_improved_tv: 'Better Resolution on TV'
native_resolution_tv: 'Native Resolution on TV'
better_loading_times: 'Better loading times'
switch_2_edition: 'Switch 2 Edition'