Skip to content

Fleet events always shown as own fleet in tooltip #1314

Closed
piciolo wants to merge 6 commits into
lanedirt:mainfrom
piciolo:Fleet-events-always-shown-as-Own-Fleet-in-tooltip-#1216
Closed

Fleet events always shown as own fleet in tooltip #1314
piciolo wants to merge 6 commits into
lanedirt:mainfrom
piciolo:Fleet-events-always-shown-as-Own-Fleet-in-tooltip-#1216

Conversation

@piciolo

@piciolo piciolo commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

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

image

piciolo added 5 commits March 23, 2026 20:38
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).
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.
@github-actions

github-actions Bot commented Mar 24, 2026

Copy link
Copy Markdown

Preview deployment

Status URL Commit
❌ Destroyed pr-1314.preview.ogamex.dev -

Preview environment has been cleaned up.

@Geda173 Geda173 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @piciolo,

See my comments below.

<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=""/>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not belong in this PR.

<span class="tooltip tooltipRight tooltipClose"
title="&lt;div class=&quot;htmlTooltip&quot;&gt;
&lt;h1&gt;@lang('Fleet details'):&lt;/h1&gt;
&lt;h1&gt;{{ __('t_ingame.fleet.fleet_details') }}:&lt;/h1&gt;

@Geda173 Geda173 Mar 24, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also doesn't belong in this PR, as well as the other 20+ changes, which belong in #1297.

@piciolo

piciolo commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

@Geda173
I'm closing this PR; I've merged everything into the Multilingual one.

@piciolo piciolo closed this Mar 24, 2026
@Geda173

Geda173 commented Mar 24, 2026

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fleet events always shown as "Own Fleet" in tooltip

2 participants