Enhance EventFight handling by adding conditional relation names and improving group button visibility
Some checks failed
SteamWarCI Build failed
Some checks failed
SteamWarCI Build failed
This commit is contained in:
@ -21,15 +21,13 @@
|
|||||||
import type { RouteDefinition } from "svelte-spa-router";
|
import type { RouteDefinition } from "svelte-spa-router";
|
||||||
import Router from "svelte-spa-router";
|
import Router from "svelte-spa-router";
|
||||||
import NavLinks from "@components/moderator/layout/NavLinks.svelte";
|
import NavLinks from "@components/moderator/layout/NavLinks.svelte";
|
||||||
import { Switch } from "@components/ui/switch";
|
|
||||||
import { Label } from "@components/ui/label";
|
|
||||||
import { navigate } from "astro:transitions/client";
|
|
||||||
import Players from "@components/moderator/pages/players/Players.svelte";
|
import Players from "@components/moderator/pages/players/Players.svelte";
|
||||||
import Events from "@components/moderator/pages/events/Events.svelte";
|
import Events from "@components/moderator/pages/events/Events.svelte";
|
||||||
import Dashboard from "@components/moderator/pages/dashboard/Dashboard.svelte";
|
import Dashboard from "@components/moderator/pages/dashboard/Dashboard.svelte";
|
||||||
import Event from "@components/moderator/pages/event/Event.svelte";
|
import Event from "@components/moderator/pages/event/Event.svelte";
|
||||||
import Pages from "@components/moderator/pages/pages/Pages.svelte";
|
import Pages from "@components/moderator/pages/pages/Pages.svelte";
|
||||||
import Generator from "@components/moderator/pages/generators/Generator.svelte";
|
import Generator from "@components/moderator/pages/generators/Generator.svelte";
|
||||||
|
import Schematics from "@components/moderator/pages/schems/Schematics.svelte";
|
||||||
import { Tooltip } from "bits-ui";
|
import { Tooltip } from "bits-ui";
|
||||||
|
|
||||||
const routes: RouteDefinition = {
|
const routes: RouteDefinition = {
|
||||||
@ -39,6 +37,7 @@
|
|||||||
"/event/:id": Event,
|
"/event/:id": Event,
|
||||||
"/event/:id/generate": Generator,
|
"/event/:id/generate": Generator,
|
||||||
"/pages": Pages,
|
"/pages": Pages,
|
||||||
|
"/schems": Schematics,
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -47,10 +46,6 @@
|
|||||||
<div class="flex h-16 items-center px-4">
|
<div class="flex h-16 items-center px-4">
|
||||||
<a href="/" class="text-sm font-bold transition-colors text-primary"> SteamWar </a>
|
<a href="/" class="text-sm font-bold transition-colors text-primary"> SteamWar </a>
|
||||||
<NavLinks />
|
<NavLinks />
|
||||||
<div class="ml-auto flex items-center space-x-4">
|
|
||||||
<Switch id="new-ui-switch" checked={true} onclick={() => navigate("/admin")} />
|
|
||||||
<Label for="new-ui-switch">New UI!</Label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -258,12 +258,14 @@
|
|||||||
{group?.name ?? "Keine Gruppe"}
|
{group?.name ?? "Keine Gruppe"}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell class="text-right">
|
<TableCell class="text-right">
|
||||||
|
{#if group}
|
||||||
<Button variant="ghost" size="icon" onclick={() => openGroupEditDialog(group!)}>
|
<Button variant="ghost" size="icon" onclick={() => openGroupEditDialog(group!)}>
|
||||||
<EditIcon />
|
<EditIcon />
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" size="icon" onclick={() => openGroupResultsDialog(group!)}>
|
<Button variant="ghost" size="icon" onclick={() => openGroupResultsDialog(group!)}>
|
||||||
<GroupIcon />
|
<GroupIcon />
|
||||||
</Button>
|
</Button>
|
||||||
|
{/if}
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger>
|
<DropdownMenuTrigger>
|
||||||
<Button variant="ghost" size="icon">
|
<Button variant="ghost" size="icon">
|
||||||
|
|||||||
@ -26,8 +26,8 @@ export class EventModel {
|
|||||||
return v.map((fight) => {
|
return v.map((fight) => {
|
||||||
let f = JSON.parse(JSON.stringify(fight)) as EventFight;
|
let f = JSON.parse(JSON.stringify(fight)) as EventFight;
|
||||||
|
|
||||||
let blueTeamRelation = f.blueTeam.name;
|
let blueTeamRelation = "";
|
||||||
let redTeamRelation = f.redTeam.name;
|
let redTeamRelation = "";
|
||||||
|
|
||||||
let relations = rels.filter((relation) => relation.fight === f.id);
|
let relations = rels.filter((relation) => relation.fight === f.id);
|
||||||
|
|
||||||
@ -54,11 +54,11 @@ export class EventModel {
|
|||||||
...f,
|
...f,
|
||||||
blueTeam: {
|
blueTeam: {
|
||||||
...f.blueTeam,
|
...f.blueTeam,
|
||||||
nameWithRelation: `${f.blueTeam.name} (${blueTeamRelation})`,
|
nameWithRelation: blueTeamRelation ? `${f.blueTeam.name} (${blueTeamRelation})` : f.blueTeam.name,
|
||||||
},
|
},
|
||||||
redTeam: {
|
redTeam: {
|
||||||
...f.redTeam,
|
...f.redTeam,
|
||||||
nameWithRelation: `${f.redTeam.name} (${redTeamRelation})`,
|
nameWithRelation: redTeamRelation ? `${f.redTeam.name} (${redTeamRelation})` : f.redTeam.name,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user