HummingBirdAnimeClient/app/views/user/details.php

100 lines
2.5 KiB
PHP
Raw Normal View History

2018-10-30 11:42:32 -04:00
<?php
2020-08-26 15:22:14 -04:00
use Aviat\AnimeClient\Kitsu;
2018-10-30 11:42:32 -04:00
?>
<main class="user-page details">
2018-11-05 09:56:38 -05:00
<h2 class="toph">
<?= $helper->a(
"https://kitsu.io/users/{$data['slug']}",
$data['name'], [
2018-11-05 09:56:38 -05:00
'title' => 'View profile on Kitsu'
])
?>
</h2>
<p><?= $escape->html($data['about']) ?></p>
2018-11-05 09:56:38 -05:00
2017-03-08 13:46:50 -05:00
<section class="flex flex-no-wrap">
2018-11-05 09:56:38 -05:00
<aside class="info">
2017-03-31 17:01:53 -04:00
<center>
<?= $helper->img($urlGenerator->assetUrl($data['avatar']), ['alt' => '']); ?>
2017-03-31 17:01:53 -04:00
</center>
2017-03-08 13:46:50 -05:00
<br />
<table class="media-details">
2017-03-08 13:46:50 -05:00
<tr>
<td>Location</td>
<td><?= $data['location'] ?></td>
2017-03-08 13:46:50 -05:00
</tr>
2017-03-08 16:21:01 -05:00
<tr>
<td>Website</td>
<td><?= $helper->a($data['website'], $data['website']) ?></td>
2017-03-08 16:21:01 -05:00
</tr>
<?php if ( ! empty($data['waifu'])): ?>
2017-03-08 16:21:01 -05:00
<tr>
<td><?= $escape->html($data['waifu']['label']) ?></td>
2017-03-08 16:21:01 -05:00
<td>
<?php
$character = $data['waifu']['character'];
2017-03-08 16:21:01 -05:00
echo $helper->a(
$url->generate('character', ['slug' => $character['slug']]),
$character['names']['canonical']
2017-03-08 16:21:01 -05:00
);
?>
</td>
</tr>
<?php endif ?>
2018-11-05 09:56:38 -05:00
</table>
<h3>User Stats</h3><br />
<table class="media-details">
<?php foreach($data['stats'] as $label => $stat): ?>
2018-10-30 11:42:32 -04:00
<tr>
<td><?= $label ?></td>
<td><?= $stat ?></td>
</tr>
<?php endforeach ?>
2017-03-08 13:46:50 -05:00
</table>
2018-11-05 09:56:38 -05:00
</aside>
<article>
<?php if ( ! empty($data['favorites'])): ?>
2018-10-30 11:42:32 -04:00
<h3>Favorites</h3>
<?= $component->tabs('user-favorites', $data['favorites'], static function ($items, $type) use ($component, $helper, $url) {
$rendered = [];
if ($type === 'character')
{
uasort($items, fn ($a, $b) => $a['names']['canonical'] <=> $b['names']['canonical']);
}
else
{
uasort($items, fn ($a, $b) => $a['titles']['canonical'] <=> $b['titles']['canonical']);
}
foreach ($items as $id => $item)
{
if ($type === 'character')
{
$rendered[] = $component->character(
$item['names']['canonical'],
$url->generate('character', ['slug' => $item['slug']]),
$helper->picture("images/characters/{$item['id']}.webp")
);
}
else
{
$rendered[] = $component->media(
array_merge(
[$item['titles']['canonical']],
Kitsu::getFilteredTitles($item['titles']),
),
$url->generate("{$type}.details", ['id' => $item['slug']]),
$helper->picture("images/{$type}/{$item['id']}.webp"),
);
}
}
return implode('', array_map('mb_trim', $rendered));
}, 'content full-width media-wrap') ?>
<?php endif ?>
2018-11-05 09:56:38 -05:00
</article>
2017-03-08 13:46:50 -05:00
</section>
</main>