diff --git a/app/views/character/details.php b/app/views/character/details.php index 8e513f61..b047b6cb 100644 --- a/app/views/character/details.php +++ b/app/views/character/details.php @@ -33,61 +33,20 @@ use Aviat\AnimeClient\API\Kitsu;

Media

-
- - - -
- $anime): ?> - - -
- + 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") + ); + } - - - - -
- $manga): ?> - - -
- -
+ return implode('', array_map('mb_trim', $rendered)); + }, 'media-wrap content') ?>
diff --git a/app/views/manga/details.php b/app/views/manga/details.php index 3fb449c7..6b21901a 100644 --- a/app/views/manga/details.php +++ b/app/views/manga/details.php @@ -60,61 +60,34 @@ 0): ?>

Characters

-
- - $list): ?> - /> - -
- $char): ?> - - - - -
- - -
+ 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)); + }) ?> 0): ?>

Staff

-
- - $people): ?> -
- /> - -
- - - -
-
- - -
+ 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 + )) + ) ?> \ No newline at end of file diff --git a/app/views/person/character-mapping.php b/app/views/person/character-mapping.php deleted file mode 100644 index 077d0c2b..00000000 --- a/app/views/person/character-mapping.php +++ /dev/null @@ -1,67 +0,0 @@ - -

Voice Acting Roles

-
- - $characterList): ?> - type="radio" name="character-type-tabs" id="character-type-" /> - -
- - - - - - $character): ?> - - - - - -
CharacterSeries
- - -
- $series): ?> - - -
-
-
- - -
diff --git a/app/views/person/details.php b/app/views/person/details.php index 98c6282d..1356d23d 100644 --- a/app/views/person/details.php +++ b/app/views/person/details.php @@ -1,7 +1,6 @@
@@ -16,6 +15,7 @@ use Aviat\AnimeClient\API\Kitsu;

Castings

+
$entries): ?> @@ -25,30 +25,17 @@ use Aviat\AnimeClient\API\Kitsu; $casting): ?> - +

-
+
$series): ?> - + + media( + Kitsu::filterTitles($series), + $url->generate("{$mediaType}.details", ['id' => $series['slug']]), + $helper->picture("images/{$type}/{$sid}.webp") + ) ?>
@@ -61,7 +48,51 @@ use Aviat\AnimeClient\API\Kitsu;
- +

Voice Acting Roles

+ 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[] = << + {$character} + +
{$media}
+ + +HTML; + endforeach; + + $roles = implode('', array_map('mb_trim', $voiceRoles)); + + return << + + + Character + Series + + + {$roles} + +HTML; + + }) ?>
diff --git a/app/views/settings/settings.php b/app/views/settings/settings.php index b51319aa..16fef5f0 100644 --- a/app/views/settings/settings.php +++ b/app/views/settings/settings.php @@ -28,9 +28,7 @@ $nestedPrefix = 'config'; />
- -
checkAuth(); ?>

Not Authorized.

@@ -43,11 +41,15 @@ $nestedPrefix = 'config';

Linked to Anilist. Your access token will expire around

+ a( - $url->generate('anilist-redirect'), - 'Update Access Token' - ) ?> + $url->generate('anilist-redirect'), + 'Update Access Token', + ['class' => 'bracketed user-btn'] + ) ?> + +
diff --git a/app/views/user/details.php b/app/views/user/details.php index f47bb675..f31d7a79 100644 --- a/app/views/user/details.php +++ b/app/views/user/details.php @@ -57,79 +57,40 @@ use Aviat\AnimeClient\API\Kitsu;

Favorites

-
- - - /> - -
- $char): ?> - - - - -
- - - - /> - -
- - - -
- - - - /> - -
- - - -
- - -
+ 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') ?>