Files
tfeigel 3cf8dc6ed7 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.
2025-09-06 19:03:13 +02:00

69 lines
2.3 KiB
PHP

<?php
// FEN in Array umwandeln
function fenToBoard($fen) {
$rows = explode('/', explode(' ', $fen)[0]);
$board = [];
foreach ($rows as $row) {
$boardRow = [];
$chars = str_split($row);
foreach ($chars as $char) {
if (is_numeric($char)) {
for ($i = 0; $i < intval($char); $i++) {
$boardRow[] = '';
}
} else {
$boardRow[] = $char;
}
}
$board[] = $boardRow;
}
return $board;
}?>
<?php snippet('layout', slots: true) ?>
<div class="text-right pb-2">
<?php foreach($page->tags()->split() as $tag): ?>
<a href="<?= page('news')->url(['params' => ['tag' => $tag]]) ?>" class="relative z-10 rounded-full bg-gray-50 px-3 py-1.5 font-medium text-gray-600 hover:bg-gray-100"><?= $tag ?></a>
<?php endforeach; ?>
</div>
<p>
<?= $page->date()->toDate("d.m.Y") ?>
<?php if ($page->subheadline()->isNotEmpty()): ?>
- <?= $page->subheadline() ?>
<?php endif ?>
</p>
<h1><?= $page->headline() ?></h1>
<div>
<img class="w-full rounded-xl object-cover" src="<?= $page->image()->url() ?>" alt="">
</div>
<div class="blockpage">
<?= $page->blocks()->toBlocks() ?>
</div>
<?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">
<?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="#">
<span class="absolute inset-0"></span>
<div class="text-xl">
<?= $user->username() ?>
</div>
</a>
</p>
<p class="text-sm"><?= $user->role()->title() ?></p>
</div>
</div>
</div>
<?php endif ?>
<?php endsnippet() ?>