Skip to content

Commit 99569c2

Browse files
committed
add: collection to similar page
1 parent da9ca8a commit 99569c2

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

app/Http/Livewire/SimilarTorrent.php

+14
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,19 @@ final public function playlists(): \Illuminate\Database\Eloquent\Collection
416416
->get();
417417
}
418418

419+
/**
420+
* @return ?\Illuminate\Database\Eloquent\Collection<int, TmdbMovie>
421+
*/
422+
#[Computed]
423+
final public function collectionMovies(): ?\Illuminate\Database\Eloquent\Collection
424+
{
425+
if (!$this->work instanceof TmdbMovie) {
426+
return null;
427+
}
428+
429+
return $this->work->collections->first()?->movies;
430+
}
431+
419432
final public function alertConfirm(): void
420433
{
421434
if (!auth()->user()->group->is_modo) {
@@ -563,6 +576,7 @@ final public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\C
563576
'regions' => $this->regions,
564577
'distributors' => $this->distributors,
565578
'playlists' => $this->playlists,
579+
'collectionMovies' => $this->collectionMovies,
566580
]);
567581
}
568582
}

lang/en/mediahub.php

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
return [
1717
'born' => 'Born:',
18+
'collection' => 'Collection',
1819
'collections' => 'Collections',
1920
'companies' => 'Companies',
2021
'disclaimer' => 'This product uses the TMDb API but is not endorsed or certified by TMDb.',

resources/views/livewire/similar-torrent.blade.php

+29
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,35 @@ class="form__button form__button--text"
10231023
</table>
10241024
</div>
10251025
</section>
1026+
@if ($collectionMovies?->isNotEmpty())
1027+
<section class="panelV2">
1028+
<header class="panel__header">
1029+
<h2 class="panel__heading">{{ __('mediahub.collection') }}</h2>
1030+
<div class="panel__actions" x-data="posterRow">
1031+
<div class="panel__action">
1032+
<button class="form__standard-icon-button" x-bind="scrollLeft">
1033+
<i class="{{ \config('other.font-awesome') }} fa-angle-left"></i>
1034+
</button>
1035+
</div>
1036+
<div class="panel__action">
1037+
<button class="form__standard-icon-button" x-bind="scrollRight">
1038+
<i class="{{ \config('other.font-awesome') }} fa-angle-right"></i>
1039+
</button>
1040+
</div>
1041+
</div>
1042+
</header>
1043+
<div
1044+
class="panel__body collection-posters"
1045+
x-ref="posters"
1046+
style="max-height: 330px !important"
1047+
>
1048+
@foreach ($collectionMovies as $collectionMovie)
1049+
<x-movie.poster :movie="$collectionMovie" :categoryId="$category->id" />
1050+
@endforeach
1051+
</div>
1052+
</section>
1053+
@endif
1054+
10261055
@if ($playlists->isNotEmpty())
10271056
<section class="panelV2">
10281057
<header class="panel__header">

0 commit comments

Comments
 (0)