Version 5.1 - All the GraphQL #32
@ -33,61 +33,20 @@ use Aviat\AnimeClient\API\Kitsu;
|
||||
|
||||
<?php if ( ! (empty($data['media']['anime']) || empty($data['media']['manga']))): ?>
|
||||
<h3>Media</h3>
|
||||
<div class="tabs">
|
||||
<?php if ( ! empty($data['media']['anime'])): ?>
|
||||
<input checked="checked" type="radio" id="media-anime" name="media-tabs" />
|
||||
<label for="media-anime">Anime</label>
|
||||
|
||||
<section class="media-wrap content">
|
||||
<?php foreach ($data['media']['anime'] as $id => $anime): ?>
|
||||
<article class="media">
|
||||
<?php
|
||||
$link = $url->generate('anime.details', ['id' => $anime['slug']]);
|
||||
?>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture("images/anime/{$anime['id']}.webp") ?>
|
||||
</a>
|
||||
<div class="name">
|
||||
<a href="<?= $link ?>">
|
||||
<?= $anime['title'] ?>
|
||||
<?php foreach ($anime['titles'] as $title): ?>
|
||||
<br />
|
||||
<small><?= $title ?></small>
|
||||
<?php endforeach ?>
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
<?php endif ?>
|
||||
<?= $component->tabs('character-media', $data['media'], static function ($media, $mediaType) use ($url, $component, $helper) {
|
||||
$rendered = [];
|
||||
foreach ($media as $id => $item)
|
||||
{
|
||||
$rendered[] = $component->media(
|
||||
array_merge([$item['title']], $item['titles']),
|
||||
$url->generate("{$mediaType}.details", ['id' => $item['slug']]),
|
||||
$helper->picture("images/{$mediaType}/{$item['id']}.webp")
|
||||
);
|
||||
}
|
||||
|
||||
<?php if ( ! empty($data['media']['manga'])): ?>
|
||||
<input type="radio" id="media-manga" name="media-tabs" />
|
||||
<label for="media-manga">Manga</label>
|
||||
|
||||
<section class="media-wrap content">
|
||||
<?php foreach ($data['media']['manga'] as $id => $manga): ?>
|
||||
<article class="media">
|
||||
<?php
|
||||
$link = $url->generate('manga.details', ['id' => $manga['slug']]);
|
||||
?>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture("images/manga/{$manga['id']}.webp") ?>
|
||||
</a>
|
||||
<div class="name">
|
||||
<a href="<?= $link ?>">
|
||||
<?= $manga['title'] ?>
|
||||
<?php foreach ($manga['titles'] as $title): ?>
|
||||
<br />
|
||||
<small><?= $title ?></small>
|
||||
<?php endforeach ?>
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
return implode('', array_map('mb_trim', $rendered));
|
||||
}, 'media-wrap content') ?>
|
||||
<?php endif ?>
|
||||
|
||||
<section>
|
||||
|
@ -60,61 +60,34 @@
|
||||
<?php if (count($data['characters']) > 0): ?>
|
||||
<h2>Characters</h2>
|
||||
|
||||
<div class="tabs">
|
||||
<?php $i = 0 ?>
|
||||
<?php foreach ($data['characters'] as $role => $list): ?>
|
||||
<input
|
||||
type="radio" name="character-role-tabs"
|
||||
id="character-tabs<?= $i ?>" <?= $i === 0 ? 'checked' : '' ?> />
|
||||
<label for="character-tabs<?= $i ?>"><?= ucfirst($role) ?></label>
|
||||
<section class="content media-wrap flex flex-wrap flex-justify-start">
|
||||
<?php foreach ($list as $id => $char): ?>
|
||||
<?php if ( ! empty($char['image']['original'])): ?>
|
||||
<article class="<?= $role === 'supporting' ? 'small-' : '' ?>character">
|
||||
<?php $link = $url->generate('character', ['slug' => $char['slug']]) ?>
|
||||
<div class="name">
|
||||
<?= $helper->a($link, $char['name']); ?>
|
||||
</div>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture("images/characters/{$id}.webp") ?>
|
||||
</a>
|
||||
</article>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
<?php $i++ ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?= $component->tabs('manga-characters', $data['characters'], static function($list, $role) use ($component, $helper, $url) {
|
||||
$rendered = [];
|
||||
foreach ($list as $id => $char)
|
||||
{
|
||||
$rendered[] = $component->character(
|
||||
$char['name'],
|
||||
$url->generate('character', ['slug' => $char['slug']]),
|
||||
$helper->picture("images/characters/{$id}.webp"),
|
||||
($role !== 'main') ? 'small-character' : 'character'
|
||||
);
|
||||
}
|
||||
|
||||
return implode('', array_map('mb_trim', $rendered));
|
||||
}) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (count($data['staff']) > 0): ?>
|
||||
<h2>Staff</h2>
|
||||
|
||||
<div class="vertical-tabs">
|
||||
<?php $i = 0 ?>
|
||||
<?php foreach ($data['staff'] as $role => $people): ?>
|
||||
<div class="tab">
|
||||
<input
|
||||
type="radio" name="staff-roles" id="staff-role<?= $i ?>" <?= $i === 0 ? 'checked' : '' ?> />
|
||||
<label for="staff-role<?= $i ?>"><?= $role ?></label>
|
||||
<section class='content media-wrap flex flex-wrap flex-justify-start'>
|
||||
<?php foreach ($people as $person): ?>
|
||||
<article class='character person'>
|
||||
<?php $link = $url->generate('person', ['id' => $person['id'], 'slug' => $person['slug']]) ?>
|
||||
<div class="name">
|
||||
<a href="<?= $link ?>">
|
||||
<?= $person['name'] ?>
|
||||
</a>
|
||||
</div>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture("images/people/{$person['id']}.webp") ?>
|
||||
</a>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
</div>
|
||||
<?php $i++ ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?= $component->verticalTabs('manga-staff', $data['staff'],
|
||||
fn($people) => implode('', array_map(
|
||||
fn ($person) => $component->character(
|
||||
$person['name'],
|
||||
$url->generate('person', ['id' => $person['id'], 'slug' => $person['slug']]),
|
||||
$helper->picture("images/people/{$person['id']}.webp")
|
||||
),
|
||||
$people
|
||||
))
|
||||
) ?>
|
||||
<?php endif ?>
|
||||
</main>
|
@ -1,67 +0,0 @@
|
||||
<?php
|
||||
use function Aviat\AnimeClient\getLocalImg;
|
||||
use Aviat\AnimeClient\API\Kitsu;
|
||||
?>
|
||||
<h3>Voice Acting Roles</h3>
|
||||
<div class="tabs">
|
||||
<?php $i = 0; ?>
|
||||
<?php foreach($data['characters'] as $role => $characterList): ?>
|
||||
<input <?= $i === 0 ? 'checked="checked"' : '' ?> type="radio" name="character-type-tabs" id="character-type-<?= $i ?>" />
|
||||
<label for="character-type-<?= $i ?>"><h5><?= ucfirst($role) ?></h5></label>
|
||||
<section class="content">
|
||||
<table class="borderless max-table">
|
||||
<tr>
|
||||
<th>Character</th>
|
||||
<th>Series</th>
|
||||
</tr>
|
||||
<?php foreach ($characterList as $cid => $character): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<article class="character">
|
||||
<?php
|
||||
$link = $url->generate('character', ['slug' => $character['character']['slug']]);
|
||||
?>
|
||||
<a href="<?= $link ?>">
|
||||
<?php $imgPath = ($character['character']['image'] === NULL)
|
||||
? 'images/characters/empty.png'
|
||||
: getLocalImg($character['character']['image']['original']);
|
||||
|
||||
echo $helper->picture($imgPath);
|
||||
?>
|
||||
<div class="name">
|
||||
<?= $character['character']['canonicalName'] ?>
|
||||
</div>
|
||||
</a>
|
||||
</article>
|
||||
</td>
|
||||
<td>
|
||||
<section class="align-left media-wrap">
|
||||
<?php foreach ($character['media'] as $sid => $series): ?>
|
||||
<article class="media">
|
||||
<?php
|
||||
$link = $url->generate('anime.details', ['id' => $series['slug']]);
|
||||
$titles = Kitsu::filterTitles($series);
|
||||
?>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture("images/anime/{$sid}.webp") ?>
|
||||
</a>
|
||||
<div class="name">
|
||||
<a href="<?= $link ?>">
|
||||
<?= array_shift($titles) ?>
|
||||
<?php foreach ($titles as $title): ?>
|
||||
<br />
|
||||
<small><?= $title ?></small>
|
||||
<?php endforeach ?>
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</section>
|
||||
<?php $i++ ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use function Aviat\AnimeClient\getLocalImg;
|
||||
use Aviat\AnimeClient\API\Kitsu;
|
||||
|
||||
?>
|
||||
<main class="details fixed">
|
||||
<section class="flex flex-no-wrap">
|
||||
@ -16,6 +15,7 @@ use Aviat\AnimeClient\API\Kitsu;
|
||||
<?php if ( ! empty($data['staff'])): ?>
|
||||
<section>
|
||||
<h3>Castings</h3>
|
||||
|
||||
<div class="vertical-tabs">
|
||||
<?php $i = 0 ?>
|
||||
<?php foreach ($data['staff'] as $role => $entries): ?>
|
||||
@ -25,30 +25,17 @@ use Aviat\AnimeClient\API\Kitsu;
|
||||
<label for="staff-role<?= $i ?>"><?= $role ?></label>
|
||||
<?php foreach ($entries as $type => $casting): ?>
|
||||
<?php if ($type === 'characters') continue; ?>
|
||||
<?php if ( ! (empty($entries['manga']) || empty($entries['anime']))): ?>
|
||||
<?php if (isset($entries['manga'], $entries['anime'])): ?>
|
||||
<h4><?= ucfirst($type) ?></h4>
|
||||
<?php endif ?>
|
||||
<section class="content">
|
||||
<section class="content media-wrap flex flex-wrap flex-justify-start">
|
||||
<?php foreach ($casting as $sid => $series): ?>
|
||||
<article class="media">
|
||||
<?php
|
||||
$mediaType = in_array($type, ['anime', 'manga'], TRUE) ? $type : 'anime';
|
||||
$link = $url->generate("{$mediaType}.details", ['id' => $series['slug']]);
|
||||
$titles = Kitsu::filterTitles($series);
|
||||
?>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture("images/{$type}/{$sid}.webp") ?>
|
||||
</a>
|
||||
<div class="name">
|
||||
<a href="<?= $link ?>">
|
||||
<?= array_shift($titles) ?>
|
||||
<?php foreach ($titles as $title): ?>
|
||||
<br />
|
||||
<small><?= $title ?></small>
|
||||
<?php endforeach ?>
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
<?php $mediaType = in_array($type, ['anime', 'manga'], TRUE) ? $type : 'anime'; ?>
|
||||
<?= $component->media(
|
||||
Kitsu::filterTitles($series),
|
||||
$url->generate("{$mediaType}.details", ['id' => $series['slug']]),
|
||||
$helper->picture("images/{$type}/{$sid}.webp")
|
||||
) ?>
|
||||
<?php endforeach; ?>
|
||||
</section>
|
||||
<?php endforeach ?>
|
||||
@ -61,7 +48,51 @@ use Aviat\AnimeClient\API\Kitsu;
|
||||
|
||||
<?php if ( ! (empty($data['characters']['main']) || empty($data['characters']['supporting']))): ?>
|
||||
<section>
|
||||
<?php include 'character-mapping.php' ?>
|
||||
<h3>Voice Acting Roles</h3>
|
||||
<?= $component->tabs('voice-acting-roles', $data['characters'], static function ($characterList) use ($component, $helper, $url) {
|
||||
$voiceRoles = [];
|
||||
foreach ($characterList as $cid => $item):
|
||||
$character = $component->character(
|
||||
$item['character']['canonicalName'],
|
||||
$url->generate('character', ['slug' => $item['character']['slug']]),
|
||||
$helper->picture(getLocalImg($item['character']['image']['original']))
|
||||
);
|
||||
$medias = [];
|
||||
foreach ($item['media'] as $sid => $series)
|
||||
{
|
||||
$medias[] = $component->media(
|
||||
Kitsu::filterTitles($series),
|
||||
$url->generate('anime.details', ['id' => $series['slug']]),
|
||||
$helper->picture("images/anime/{$sid}.webp")
|
||||
);
|
||||
}
|
||||
$media = implode('', array_map('mb_trim', $medias));
|
||||
|
||||
$voiceRoles[] = <<<HTML
|
||||
<tr>
|
||||
<td>{$character}</td>
|
||||
<td>
|
||||
<section class="align-left media-wrap">{$media}</section>
|
||||
</td>
|
||||
</tr>
|
||||
HTML;
|
||||
endforeach;
|
||||
|
||||
$roles = implode('', array_map('mb_trim', $voiceRoles));
|
||||
|
||||
return <<<HTML
|
||||
<table class="borderless max-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Character</th>
|
||||
<th>Series</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{$roles}</tbody>
|
||||
</table>
|
||||
HTML;
|
||||
|
||||
}) ?>
|
||||
</section>
|
||||
<?php endif ?>
|
||||
</main>
|
||||
|
@ -28,9 +28,7 @@ $nestedPrefix = 'config';
|
||||
/>
|
||||
<label for="settings-tab<?= $i ?>"><h3><?= $sectionMapping[$section] ?></h3></label>
|
||||
<section class="content">
|
||||
<?php require __DIR__ . '/_form.php' ?>
|
||||
<?php if ($section === 'anilist'): ?>
|
||||
<hr />
|
||||
<?php $auth = $anilistModel->checkAuth(); ?>
|
||||
<?php if (array_key_exists('errors', $auth)): ?>
|
||||
<p class="static-message error">Not Authorized.</p>
|
||||
@ -43,11 +41,15 @@ $nestedPrefix = 'config';
|
||||
<p class="static-message info">
|
||||
Linked to Anilist. Your access token will expire around <?= date('F j, Y, g:i a T', $expires) ?>
|
||||
</p>
|
||||
<?php require __DIR__ . '/_form.php' ?>
|
||||
<?= $helper->a(
|
||||
$url->generate('anilist-redirect'),
|
||||
'Update Access Token'
|
||||
'Update Access Token',
|
||||
['class' => 'bracketed user-btn']
|
||||
) ?>
|
||||
<?php endif ?>
|
||||
<?php else: ?>
|
||||
<?php require __DIR__ . '/_form.php' ?>
|
||||
<?php endif ?>
|
||||
</section>
|
||||
<?php $i++; ?>
|
||||
|
@ -57,79 +57,40 @@ use Aviat\AnimeClient\API\Kitsu;
|
||||
<article>
|
||||
<?php if ( ! empty($data['favorites'])): ?>
|
||||
<h3>Favorites</h3>
|
||||
<div class="tabs">
|
||||
<?php $i = 0 ?>
|
||||
<?php if ( ! empty($data['favorites']['characters'])): ?>
|
||||
<input type="radio" name="user-favorites" id="user-fav-chars" <?= $i === 0 ? 'checked' : '' ?> />
|
||||
<label for="user-fav-chars">Characters</label>
|
||||
<section class="content full-width media-wrap">
|
||||
<?php foreach($data['favorites']['characters'] as $id => $char): ?>
|
||||
<?php if ( ! empty($char['image']['original'])): ?>
|
||||
<article class="character">
|
||||
<?php $link = $url->generate('character', ['slug' => $char['slug']]) ?>
|
||||
<div class="name"><?= $helper->a($link, $char['canonicalName']); ?></div>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture("images/characters/{$char['id']}.webp") ?>
|
||||
</a>
|
||||
</article>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
<?php $i++; ?>
|
||||
<?php endif ?>
|
||||
<?php if ( ! empty($data['favorites']['anime'])): ?>
|
||||
<input type="radio" name="user-favorites" id="user-fav-anime" <?= $i === 0 ? 'checked' : '' ?> />
|
||||
<label for="user-fav-anime">Anime</label>
|
||||
<section class="content full-width media-wrap">
|
||||
<?php foreach($data['favorites']['anime'] as $anime): ?>
|
||||
<article class="media">
|
||||
<?php
|
||||
$link = $url->generate('anime.details', ['id' => $anime['slug']]);
|
||||
$titles = Kitsu::filterTitles($anime);
|
||||
?>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture("images/anime/{$anime['id']}.webp") ?>
|
||||
</a>
|
||||
<div class="name">
|
||||
<a href="<?= $link ?>">
|
||||
<?= array_shift($titles) ?>
|
||||
<?php foreach ($titles as $title): ?>
|
||||
<br /><small><?= $title ?></small>
|
||||
<?php endforeach ?>
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
<?php $i++; ?>
|
||||
<?php endif ?>
|
||||
<?php if ( ! empty($data['favorites']['manga'])): ?>
|
||||
<input type="radio" name="user-favorites" id="user-fav-manga" <?= $i === 0 ? 'checked' : '' ?> />
|
||||
<label for="user-fav-manga">Manga</label>
|
||||
<section class="content full-width media-wrap">
|
||||
<?php foreach($data['favorites']['manga'] as $manga): ?>
|
||||
<article class="media">
|
||||
<?php
|
||||
$link = $url->generate('manga.details', ['id' => $manga['slug']]);
|
||||
$titles = Kitsu::filterTitles($manga);
|
||||
?>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture("images/manga/{$manga['id']}.webp") ?>
|
||||
</a>
|
||||
<div class="name">
|
||||
<a href="<?= $link ?>">
|
||||
<?= array_shift($titles) ?>
|
||||
<?php foreach ($titles as $title): ?>
|
||||
<br /><small><?= $title ?></small>
|
||||
<?php endforeach ?>
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
<?php $i++; ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?= $component->tabs('user-favorites', $data['favorites'], static function ($items, $type) use ($component, $helper, $url) {
|
||||
$rendered = [];
|
||||
if ($type === 'characters')
|
||||
{
|
||||
uasort($items, fn ($a, $b) => $a['canonicalName'] <=> $b['canonicalName']);
|
||||
}
|
||||
else
|
||||
{
|
||||
uasort($items, fn ($a, $b) => Kitsu::filterTitles($a)[0] <=> Kitsu::filterTitles($b)[0]);
|
||||
}
|
||||
|
||||
foreach ($items as $id => $item)
|
||||
{
|
||||
if ($type === 'characters')
|
||||
{
|
||||
$rendered[] = $component->character(
|
||||
$item['canonicalName'],
|
||||
$url->generate('character', ['slug', $item['slug']]),
|
||||
$helper->picture("images/characters/{$item['id']}.webp")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$rendered[] = $component->media(
|
||||
Kitsu::filterTitles($item),
|
||||
$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 ?>
|
||||
</article>
|
||||
</section>
|
||||
|
Loading…
Reference in New Issue
Block a user