Flatten compact fleet sections (Refs #131)
CI / checks (push) Successful in 5m11s

This commit is contained in:
2026-10-10 19:36:16 -04:00
parent 03e2d08a38
commit 7442c6fd15
+11 -6
View File
@@ -221,7 +221,7 @@
)
);
const liveCount = $derived(healthy.filter((server) => (server.last_players ?? 0) > 0).length);
function grouped(items: FleetServer[]) {
function grouped(items: FleetServer[], groupBy: typeof grouping = grouping) {
const result = new Map<
string,
{
@@ -233,13 +233,13 @@
for (const server of items) {
const identity = fleetIdentity(server);
const key =
grouping === 'map' ? identity.group : grouping === 'game' ? identity.game : 'all';
groupBy === 'map' ? identity.group : groupBy === 'game' ? identity.game : 'all';
if (!result.has(key))
result.set(key, {
title:
grouping === 'map'
groupBy === 'map'
? identity.map
: grouping === 'game'
: groupBy === 'game'
? identity.game === 't5'
? 'Black Ops I'
: identity.game === 't6'
@@ -247,7 +247,7 @@
: 'Other servers'
: '',
servers: [],
launch: grouping === 'map' ? identity.launch : null
launch: groupBy === 'map' ? identity.launch : null
});
result.get(key)!.servers.push(server);
}
@@ -529,8 +529,13 @@
<section class="fleet-section" aria-label={section.title}>
<div class="section-heading">
<h2>{section.title} <span class="count">{section.servers.length}</span></h2>
{#if section.compact && canOperate}<Button
size="sm"
variant="ghost"
onclick={() => launch()}>Add lobby</Button
>{/if}
</div>
{#each grouped(section.servers) as [key, group] (key)}
{#each grouped(section.servers, section.compact ? 'none' : grouping) as [key, group] (key)}
{#if group.title}<div class="group-heading">
<h3>{group.title}</h3>
{#if canOperate && group.launch}<Button