Skip to content

Conversation

@mous13
Copy link
Contributor

@mous13 mous13 commented Oct 23, 2025

PR contains a redesign of the mission page.

Copy link
Member

@jannes-io jannes-io left a comment

Choose a reason for hiding this comment

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

I haven't had a chance to open it up locally yet to see what it looks like. I'll do that later this weekend to see if I have any remarks on the design.

}

uasort($units, fn (Unit $a, Unit $b) => $a->getPosition() <=> $b->getPosition());
return $this->unitsWithRSVPs = $units;
Copy link
Member

Choose a reason for hiding this comment

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

Not a big fan of the assign-return, just split them up.

Suggested change
return $this->unitsWithRSVPs = $units;
$this->unitsWithRSVPs = $units;
return $this->unitsWithRSVPs;

Comment on lines +72 to +83
private function loadRSVPs(): void
{
if (!empty($this->rsvpsByUserId)) {
return;
}

foreach ($this->mission->getRsvps() as $rsvp) {
if ($user = $rsvp->getUser()) {
$this->rsvpsByUserId[$user->getId()] = $rsvp;
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Change this function to also return $this->rsvpsByUserId (maybe also change its name to match it). And then everywhere where this function is used, don't directly access $this->rsvpsByUserId anymore.

That way it's very clear in the usages what it returns, and it's not some magic private variable.

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps it's a little overkill to have this in a separate twig file? Unless there's a good reason for it, like it's being used in multiple locations?

{% block tabs %}
<button type="button" class="btn-outlined w-100 mt-2" data-tab-id="brief" >Briefing</button>
<button type="button" class="btn-outlined w-100 mt-2" data-tab-id="attendance" >Attendance</button>
<button type="button" class="btn-outlined w-100 mt-2" data-tab-id="aar" >After Action Reports</button>
Copy link
Member

Choose a reason for hiding this comment

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

AARs tab should not be visible if user can not view after action reports.

</div>
</div>
<div id="aar">
{% if can('view_after_action_reports', mission.operation) and not mission.afterActionReports.empty %}
Copy link
Member

Choose a reason for hiding this comment

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

Move permission check around the entire tab panel

Comment on lines +82 to +86
<div id="attendance">
<div id="attendance">
{{ component('Forumify\\Perscom\\MissionRoster', {mission: mission}) }}
</div>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why there's 2 divs with the same ID

Suggested change
<div id="attendance">
<div id="attendance">
{{ component('Forumify\\Perscom\\MissionRoster', {mission: mission}) }}
</div>
</div>
<div id="attendance">
{{ component('Forumify\\Perscom\\MissionRoster', {mission: mission}) }}
</div>

Comment on lines +64 to +81
<div id="brief">
<div>
<div class="box">
<h3>{{ 'perscom.mission.mission'|trans }}</h3>
<p class="mb-6">
{{ 'perscom.mission.start'|trans }}
<span class="text-bold">{{ mission.start|format_date(true) }}</span>
</p>
{% if mission.end %}
<p class="mb-2">
{{ 'perscom.mission.end'|trans }}
<span class="text-bold">{{ mission.end|format_date(true) }}</span>
</p>
{% endif %}
{{ mission.briefing|rich }}
</div>
</div>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

Seems to be too much nesting?

Suggested change
<div id="brief">
<div>
<div class="box">
<h3>{{ 'perscom.mission.mission'|trans }}</h3>
<p class="mb-6">
{{ 'perscom.mission.start'|trans }}
<span class="text-bold">{{ mission.start|format_date(true) }}</span>
</p>
{% if mission.end %}
<p class="mb-2">
{{ 'perscom.mission.end'|trans }}
<span class="text-bold">{{ mission.end|format_date(true) }}</span>
</p>
{% endif %}
{{ mission.briefing|rich }}
</div>
</div>
</div>
<div id="brief" class="box">
<h3>{{ 'perscom.mission.mission'|trans }}</h3>
<p class="mb-6">
{{ 'perscom.mission.start'|trans }}
<span class="text-bold">{{ mission.start|format_date(true) }}</span>
</p>
{% if mission.end %}
<p class="mb-2">
{{ 'perscom.mission.end'|trans }}
<span class="text-bold">{{ mission.end|format_date(true) }}</span>
</p>
{% endif %}
{{ mission.briefing|rich }}
</div>

Comment on lines +42 to +43
<div class="flex gap-2" {{ stimulus_controller('forumify/forumify-platform/tabs') }}>
<div class="w-20">
Copy link
Member

Choose a reason for hiding this comment

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

This does not seem mobile responsive? You should use grid. See templates/frontend/components/course_class/class.html.twig as example.

<div class="card-body text-center">
{% if mission.operation.image %}
<div class="border-b">
<img src="{{ asset(mission.operation.image, 'forumify.asset') }}" width="250px" height="auto">
Copy link
Member

Choose a reason for hiding this comment

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

Add class="rounded", and set width/height through style. See class.html.twig

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.

2 participants