Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
4 changed files with 11 additions and 6 deletions
Showing only changes of commit 7cd0c486bd - Show all commits

View File

@ -16,7 +16,7 @@
<tbody> <tbody>
<tr> <tr>
<td rowspan="9"> <td rowspan="9">
<?= $helper->picture("images/anime/{$item['anime']['id']}-original.webp", "jpg", [], ["width" => "390"]) ?> <?= $helper->picture($item['anime']['cover_image'], "jpg", [], ["width" => "390"]) ?>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -19,6 +19,11 @@ query ($slug: String!) {
id id
slug slug
posterImage { posterImage {
original {
width
height
url
}
views { views {
width width
height height

View File

@ -184,10 +184,9 @@ abstract class HistoryTransformer {
protected function transformProgress (array $entry): ?HistoryItem protected function transformProgress (array $entry): ?HistoryItem
{ {
$id = $entry['media']['id'];
$data = $entry['media']; $data = $entry['media'];
$title = $this->linkTitle($data); $title = $this->linkTitle($data);
$imgUrl = "images/{$this->type}/{$id}.webp"; $imgUrl = $data['posterImage']['views'][0]['url'] ?? $data['posterImage']['original']['url'];
$item = end($entry['changedData']['progress']); $item = end($entry['changedData']['progress']);
// No showing episode 0 nonsense // No showing episode 0 nonsense
@ -226,10 +225,9 @@ abstract class HistoryTransformer {
protected function transformUpdated(array $entry): HistoryItem protected function transformUpdated(array $entry): HistoryItem
{ {
$id = $entry['media']['id'];
$data = $entry['media']; $data = $entry['media'];
$title = $this->linkTitle($data); $title = $this->linkTitle($data);
$imgUrl = "images/{$this->type}/{$id}.webp"; $imgUrl = $data['posterImage']['views'][0]['url'] ?? $data['posterImage']['original']['url'];
$kind = array_key_first($entry['changedData']); $kind = array_key_first($entry['changedData']);

View File

@ -102,7 +102,9 @@ final class LibraryEntryTransformer extends AbstractTransformer
'titles' => $titles, 'titles' => $titles,
'slug' => $anime['slug'], 'slug' => $anime['slug'],
'show_type' => (string)StringType::from($anime['subtype'])->upperCaseFirst(), 'show_type' => (string)StringType::from($anime['subtype'])->upperCaseFirst(),
'cover_image' => $anime['posterImage']['views'][1]['url'], 'cover_image' => $anime['posterImage']['views'][1]['url']
?? $anime['posterImage']['original']['url']
?? '/public/images/placeholder.png',
'genres' => $genres, 'genres' => $genres,
'streaming_links' => $streamingLinks, 'streaming_links' => $streamingLinks,
], ],