Fixes display of author avatar and league links

Ensures author avatar is only displayed if it exists.

Uses dynamic league IDs from the `spielbetrieb` page in the navbar, which
allows changing the league links in the backend.
This commit is contained in:
2025-09-06 19:03:13 +02:00
parent 7e541e1244
commit 3cf8dc6ed7
5 changed files with 19 additions and 8 deletions
@@ -45,7 +45,7 @@ Tags: Vereinsmeisterschaft, Spielbericht
----
Author: - user://myU6sssZ
Author: - user://KOY9VcGi
----
+3 -1
View File
@@ -31,7 +31,9 @@
<?php if ($user = $post->author()->toUser()): ?>
<div class="mt-6 flex border-t border-gray-900/5 pt-6">
<div class="relative flex items-center gap-x-4">
<img src="<?= $user->avatar()->url() ?>" alt="" class="size-10 rounded-full bg-gray-50" />
<?php if ($user->avatar()): ?>
<img src="<?= $user->avatar()->url() ?>" alt="" class="size-10 rounded-full bg-gray-50" />
<?php endif; ?>
<div class="text-sm/6">
<p>
<span class="absolute inset-0"></span>
+9 -4
View File
@@ -1,3 +1,8 @@
<?php
$aklasse = page('spielbetrieb')->aklasse();
$bklasse = page('spielbetrieb')->bklasse();
?>
<nav class="bg-sf_grau-50 shadow-lg sticky top-0 z-50">
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div class="flex h-24 items-center justify-between">
@@ -93,10 +98,10 @@
</button>
<div class="invisible absolute left-0 z-10 mt-2 w-48 rounded-md bg-white opacity-0 shadow-lg transition-all duration-200 group-hover:visible group-hover:opacity-100">
<div class="py-1">
<a href="https://www.ligamanager.schachbund-bayern.de/hof/ergebnisse/spielplan.htm?ligaId=2391"
<a href="https://www.ligamanager.schachbund-bayern.de/hof/ergebnisse/spielplan.htm?ligaId=<?= $aklasse ?>"
class="block px-4 py-2 text-m text-gray-700 hover:bg-gray-100"
target="_blank">A-Klasse</a>
<a href="https://www.ligamanager.schachbund-bayern.de/hof/ergebnisse/spielplan.htm?ligaId=2392"
<a href="https://www.ligamanager.schachbund-bayern.de/hof/ergebnisse/spielplan.htm?ligaId=<?= $bklasse ?>"
class="block px-4 py-2 text-m text-gray-700 hover:bg-gray-100"
target="_blank">B-Klasse</a>
<a href="/spielbetrieb/analyse"
@@ -203,9 +208,9 @@
</svg>
</button>
<div class="mobile-dropdown-content hidden space-y-1 pl-6">
<a href="https://www.ligamanager.schachbund-bayern.de/hof/ergebnisse/spielplan.htm?ligaId=2391"
<a href="https://www.ligamanager.schachbund-bayern.de/hof/ergebnisse/spielplan.htm?ligaId=<?= $aklasse ?>"
class="block px-3 py-2 text-sm text-gray-600 hover:text-blue-600">A-Klasse</a>
<a href="https://www.ligamanager.schachbund-bayern.de/hof/ergebnisse/spielplan.htm?ligaId=2392"
<a href="https://www.ligamanager.schachbund-bayern.de/hof/ergebnisse/spielplan.htm?ligaId=<?= $bklasse ?>"
class="block px-3 py-2 text-sm text-gray-600 hover:text-blue-600">B-Klasse</a>
<a href="/spielbetrieb/analyse"
class="block px-3 py-2 text-sm text-gray-600 hover:text-blue-600">Analyse</a>
+3 -1
View File
@@ -39,7 +39,9 @@
<?php if ($user = $post->author()->toUser()): ?>
<div class="mt-6 flex border-t border-gray-900/5 pt-6">
<div class="relative flex items-center gap-x-4">
<img src="<?= $user->avatar()->url() ?>" alt="" class="size-10 rounded-full bg-gray-50" />
<?php if ($user->avatar()): ?>
<img src="<?= $user->avatar()->url() ?>" alt="" class="size-10 rounded-full bg-gray-50" />
<?php endif; ?>
<div class="text-sm/6">
<p>
<span class="absolute inset-0"></span>
+3 -1
View File
@@ -49,7 +49,9 @@
<?php if ($user = $page->author()->toUser()): ?>
<div class="mt-6 flex border-t border-b-sf_grau-300 pt-6">
<div class="relative flex items-center gap-x-4">
<img src="<?= $user->avatar()->url() ?>" alt="" class="size-10 rounded-full" />
<?php if ($user->avatar()): ?>
<img src="<?= $user->avatar()->url() ?>" alt="" class="size-10 rounded-full" />
<?php endif ?>
<div class="text-sm/6">
<p>
<a href="#">