diff --git a/app/views/manga/edit.php b/app/views/manga/edit.php index 024dce2b..a1eef3c4 100644 --- a/app/views/manga/edit.php +++ b/app/views/manga/edit.php @@ -53,7 +53,7 @@ - checked="checked" /> diff --git a/public/css/base.css b/public/css/base.css index 2192edcb..475583b1 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -1316,4 +1316,9 @@ a:hover, a:active { .streaming-logo { width: 50px; height: 50px; +} + +.cover_streaming_link .streaming-logo { + width: 20px; + height: 20px; } \ No newline at end of file diff --git a/public/css/base.myth.css b/public/css/base.myth.css index eabbf71b..a70e419c 100644 --- a/public/css/base.myth.css +++ b/public/css/base.myth.css @@ -568,4 +568,9 @@ a:hover, a:active { .streaming-logo { width: 50px; height: 50px; +} + +.cover_streaming_link .streaming-logo { + width: 20px; + height: 20px; } \ No newline at end of file diff --git a/src/API/JsonAPI.php b/src/API/JsonAPI.php index 229aac35..c351373f 100644 --- a/src/API/JsonAPI.php +++ b/src/API/JsonAPI.php @@ -42,6 +42,16 @@ class JsonAPI { */ protected $data = []; + public static function inlineRawIncludes(array &$data, string $key): array + { + foreach($data['data'] as $i => &$item) + { + $item[$key] = $data['included'][$i]; + } + + return $data['data']; + } + /** * Take organized includes and inline them, where applicable * diff --git a/src/API/Kitsu/Model.php b/src/API/Kitsu/Model.php index fb2e90c3..cc7dd71f 100644 --- a/src/API/Kitsu/Model.php +++ b/src/API/Kitsu/Model.php @@ -270,13 +270,9 @@ class Model { if ( ! $cacheItem->isHit()) { $data = $this->getRequest('library-entries', $options); + $data = JsonAPI::inlineRawIncludes($data, 'manga'); - foreach($data['data'] as $i => &$item) - { - $item['manga'] = $data['included'][$i]; - } - - $transformed = $this->mangaListTransformer->transformCollection($data['data']); + $transformed = $this->mangaListTransformer->transformCollection($data); $cacheItem->set($transformed); $cacheItem->save(); diff --git a/src/API/Kitsu/Transformer/MangaListTransformer.php b/src/API/Kitsu/Transformer/MangaListTransformer.php index 2f9d3e0c..cd41809a 100644 --- a/src/API/Kitsu/Transformer/MangaListTransformer.php +++ b/src/API/Kitsu/Transformer/MangaListTransformer.php @@ -97,16 +97,10 @@ class MangaListTransformer extends AbstractTransformer { 'reconsuming' => $rereading, 'reconsumeCount' => (int)$item['reread_count'], 'notes' => $item['notes'], + 'rating' => $item['new_rating'] / 2 ], ]; - if ($item['new_rating'] !== $item['old_rating'] && $item['new_rating'] !== "") - { - $map['data']['rating'] = ($item['new_rating'] > 0) - ? $item['new_rating'] / 2 - : $item['old_rating'] / 2; - } - return $map; } } diff --git a/src/API/Kitsu/Transformer/MangaTransformer.php b/src/API/Kitsu/Transformer/MangaTransformer.php index c2b0784d..13de6d26 100644 --- a/src/API/Kitsu/Transformer/MangaTransformer.php +++ b/src/API/Kitsu/Transformer/MangaTransformer.php @@ -32,6 +32,18 @@ class MangaTransformer extends AbstractTransformer { */ public function transform($item) { + $genres = []; + + foreach($item['included'] as $included) + { + if ($included['type'] === 'genres') + { + $genres[] = $included['attributes']['name']; + } + } + + sort($genres); + return [ 'title' => $item['canonicalTitle'], 'en_title' => $item['titles']['en'], @@ -42,7 +54,7 @@ class MangaTransformer extends AbstractTransformer { 'volume_count' => $this->count($item['volumeCount']), 'synopsis' => $item['synopsis'], 'url' => "https://kitsu.io/manga/{$item['slug']}", - 'genres' => $item['genres'], + 'genres' => $genres, ]; }