This commit is contained in:
+11
-6
@@ -221,7 +221,7 @@
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
const liveCount = $derived(healthy.filter((server) => (server.last_players ?? 0) > 0).length);
|
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<
|
const result = new Map<
|
||||||
string,
|
string,
|
||||||
{
|
{
|
||||||
@@ -233,13 +233,13 @@
|
|||||||
for (const server of items) {
|
for (const server of items) {
|
||||||
const identity = fleetIdentity(server);
|
const identity = fleetIdentity(server);
|
||||||
const key =
|
const key =
|
||||||
grouping === 'map' ? identity.group : grouping === 'game' ? identity.game : 'all';
|
groupBy === 'map' ? identity.group : groupBy === 'game' ? identity.game : 'all';
|
||||||
if (!result.has(key))
|
if (!result.has(key))
|
||||||
result.set(key, {
|
result.set(key, {
|
||||||
title:
|
title:
|
||||||
grouping === 'map'
|
groupBy === 'map'
|
||||||
? identity.map
|
? identity.map
|
||||||
: grouping === 'game'
|
: groupBy === 'game'
|
||||||
? identity.game === 't5'
|
? identity.game === 't5'
|
||||||
? 'Black Ops I'
|
? 'Black Ops I'
|
||||||
: identity.game === 't6'
|
: identity.game === 't6'
|
||||||
@@ -247,7 +247,7 @@
|
|||||||
: 'Other servers'
|
: 'Other servers'
|
||||||
: '',
|
: '',
|
||||||
servers: [],
|
servers: [],
|
||||||
launch: grouping === 'map' ? identity.launch : null
|
launch: groupBy === 'map' ? identity.launch : null
|
||||||
});
|
});
|
||||||
result.get(key)!.servers.push(server);
|
result.get(key)!.servers.push(server);
|
||||||
}
|
}
|
||||||
@@ -529,8 +529,13 @@
|
|||||||
<section class="fleet-section" aria-label={section.title}>
|
<section class="fleet-section" aria-label={section.title}>
|
||||||
<div class="section-heading">
|
<div class="section-heading">
|
||||||
<h2>{section.title} <span class="count">{section.servers.length}</span></h2>
|
<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>
|
</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">
|
{#if group.title}<div class="group-heading">
|
||||||
<h3>{group.title}</h3>
|
<h3>{group.title}</h3>
|
||||||
{#if canOperate && group.launch}<Button
|
{#if canOperate && group.launch}<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user