Fleet events always shown as own fleet in tooltip #1314
Conversation
Add translation keys for enemy and neutral fleets and update eventrow blade to choose the fleet label based on $fleet_event_row->friendly_status. Tooltip titles now dynamically show 'Enemy fleet', 'Friendly fleet' or 'Own fleet' (plus mission label) for both tooltip variants so fleet relationship is correctly displayed in the UI.
Replace duplicated ternary expressions with a single PHP match that assigns $fleet_type_label based on $fleet_event_row->friendly_status (hostile, neutral, default to own_fleet). Use this variable in the image title attributes (both return and outbound rows) to reduce duplication and improve readability; also reformat the PHP docblock.
Remove the standalone match-based $fleet_type_label assignment and instead compute the fleet type label inline in the img title attributes (handles hostile/neutral/own cases). Also compress the PHP docblock to a single line. This eliminates the extra variable and keeps the tooltip logic local to each title (applied for both return and outgoing fleet rows).
Remove the standalone match-based $fleet_type_label assignment and instead compute the fleet type label inline in the img title attributes (handles hostile/neutral/own cases). Also compress the PHP docblock to a single line. This eliminates the extra variable and keeps the tooltip logic local to each title (applied for both return and outgoing fleet rows).
…irt#1216' of https://github.com/piciolo/OGame into Fleet-events-always-shown-as-Own-Fleet-in-tooltip-lanedirt#1216
Replace inline/legacy localization strings with centralized t_ingame.fleet keys in resources/views/ingame/fleetevents/eventrow.blade.php. Updates include Deep space, Fleet details tooltip, Ships, Shipment and resource labels (Metal, Crystal, Deuterium), and the Recall tooltip label. Also removes an extra trailing newline at EOF.
Preview deployment
Preview environment has been cleaned up. |
| <td class="missionFleet"> | ||
| <img src="/img/fleet/{{ $fleet_event_row->mission_type }}.gif" class="tooltipHTML" | ||
| title="Own fleet | {{ $fleet_event_row->mission_label }} (R)" alt=""/> | ||
| title="{{ $fleet_event_row->friendly_status === 'hostile' ? __('t_ingame.fleet.enemy_fleet') : ($fleet_event_row->friendly_status === 'neutral' ? __('t_ingame.fleet.neutral_fleet') : __('t_ingame.fleet.own_fleet')) }} | {{ $fleet_event_row->mission_label }} (R)" alt=""/> |
There was a problem hiding this comment.
There is one instance missing, namely that of friendly fleets, which should display Friendly fleet. This only happens in the case of ACS Defend.
| @break | ||
| @case (OGame\Models\Enums\PlanetType::DeepSpace) | ||
| <span class="deep-space-text">{{ __('Deep space') }}</span> | ||
| <span class="deep-space-text">{{ __('t_ingame.fleet.deep_space') }}</span> |
There was a problem hiding this comment.
This does not belong in this PR.
| <span class="tooltip tooltipRight tooltipClose" | ||
| title="<div class="htmlTooltip"> | ||
| <h1>@lang('Fleet details'):</h1> | ||
| <h1>{{ __('t_ingame.fleet.fleet_details') }}:</h1> |
There was a problem hiding this comment.
This also doesn't belong in this PR, as well as the other 20+ changes, which belong in #1297.
|
@Geda173 |
|
But why? The own fleet changes belong in this PR, while the translation ones belong in the other one. In the other one I will now have to request changes that you remove the "own fleet" changes that should have been in this one. It was just a matter of removing the translation changes from this one and add the friendly fleet change and it would have been done. |
Description
This PR fixes a bug in the fleet event box where the tooltip for all missions (including hostile ones) was hardcoded as "Own fleet".
Changes made:
Removed hardcoded "Own fleet" string from resources/views/ingame/fleetevents/eventrow.blade.php.
Updated the event row logic to dynamically determine the fleet relationship (Own, Friendly, or Enemy) based on the mission owner.
Integrated localized translation keys in the Blade template using __('t_ingame.fleet.own_fleet'), etc.
Type of Change:
[x] Bug fix
[ ] Feature enhancement
[ ] Documentation update
[ ] Other (please describe):
Related Issues
Fixes #1216
Checklist
[x] Automated Refactoring: Rector has been run and no outstanding issues remain.
[x] Code Standards: Code adheres to PSR-12 coding standards. Verified with Laravel Pint.
[x] Static Analysis: Code passes PHPStan static code analysis.
[x] Testing:
Relevant unit and feature tests are included or updated.
Tests successfully run locally.
[ ] CSS & JS Build: N/A (No changes to assets).
[ ] Documentation: Documentation has been updated via translation keys.
Additional Information
[!IMPORTANT]
Translation Keys Dependency: The specific translation keys used in this fix (own_fleet, enemy_fleet, friendly_fleet, neutral_fleet) are not included in this PR's diff because they have been bundled into the Multilanguage PR #1297