Skip to content

Commit

Permalink
feat: show Message if there are no event instances (#128)
Browse files Browse the repository at this point in the history
Closes: #123
  • Loading branch information
MaSch0212 authored Jul 6, 2024
1 parent 98cb696 commit f1d5425
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/client/src/app/components/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="bg-image pointer-events-none absolute bottom-0 -z-10 opacity-30 dark:opacity-15"></div>
<div class="bg-image pointer-events-none absolute bottom-0 -z-10 opacity-15"></div>

<header class="p-4">
<app-menu />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,25 @@ <h2 class="m-0 pt-4">{{ translations.playerEvents_registrations() }}</h2>
}
@if (event.isStarted) {
<h2 class="m-0 pt-4">{{ translations.playerEvents_games() }}</h2>

@if (games().length === 0) {
<p-messages severity="info">
<ng-template pTemplate>
<span class="i-[mdi--info-circle-outline] mr-2"></span>
<div class="flex flex-col gap-1">
<span class="font-semibold">{{
translations.playerEvents_noGames_general()
}}</span>
<span>{{
hasRegisteredTimeslot()
? translations.playerEvents_noGames_registered()
: translations.playerEvents_noGames_notRegistered()
}}</span>
</div>
</ng-template>
</p-messages>
}

@for (game of games(); track game.timeslot.id) {
<p-card>
<h3 class="m-0 pb-8">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ export class PlayerEventDetailsComponent {
protected readonly timeslots = computed(() =>
[...(this.event()?.timeslots ?? [])].sort((a, b) => compareTimes(a.time, b.time))
);
protected readonly hasRegisteredTimeslot = computed(() =>
this.timeslots().some(x => x.isRegistered)
);
protected readonly timeslotSaveStates = chainSignals(
computed(() => this.timeslots().map(x => x.id), { equal: areArraysEqual }),
id =>
Expand Down
5 changes: 5 additions & 0 deletions src/client/src/app/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@
"time": "Uhrzeit",
"groupCode": "Raumname",
"map": "Bahn",
"noGames": {
"general": "Keine Spiele verfügbar.",
"registered": "Der/die Zeitslot(s) für die du angemeldet bist, finden nicht statt, da sich zu wenig Spieler dafür angemeldet haben.",
"notRegistered": "Du hast dich für keinen Zeitslot angemeldet."
},
"error": {
"load": "Fehler beim Laden der Veranstaltungen.",
"loadOne": "Fehler beim Laden der Veranstaltung.",
Expand Down
5 changes: 5 additions & 0 deletions src/client/src/app/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@
"time": "Time",
"groupCode": "Group code",
"map": "Map",
"noGames": {
"general": "No games available.",
"registered": "The timeslot(s) for which you are registered will not take place because too few players have registered for it.",
"notRegistered": "You have not registered for a timeslot."
},
"error": {
"load": "Failed to load events.",
"loadOne": "Failed to load event.",
Expand Down

0 comments on commit f1d5425

Please sign in to comment.