Major rework of media handelling, and collections
This commit is contained in:
1 parent
b42e055691
commit
f7cb2bed53
37 files changed
+1120
-411
No files matched your search
@@ -31,11 +31,9 @@
|
||||
|
||||
.content-wrapper {
|
||||
color: #212529;
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
rgba(255, 255, 255, 0.461) 10%,
|
||||
#eff1f3 100%
|
||||
);
|
||||
background: linear-gradient(to bottom,
|
||||
rgba(255, 255, 255, 0.461) 10%,
|
||||
#eff1f3 100%);
|
||||
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 20px;
|
||||
@@ -46,11 +44,9 @@
|
||||
|
||||
[data-bs-theme="dark"] .content-wrapper {
|
||||
color: #a7acb1;
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
rgba(33, 37, 41, 0.7) 50%,
|
||||
#181c1f 100%
|
||||
);
|
||||
background: linear-gradient(to bottom,
|
||||
rgba(33, 37, 41, 0.7) 50%,
|
||||
#181c1f 100%);
|
||||
|
||||
background-color: rgba(33, 37, 41, 0.7);
|
||||
border: 1px solid #181c1f;
|
||||
@@ -181,3 +177,17 @@
|
||||
background-color: transparent;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
|
||||
/* ! collection */
|
||||
.card-img-overlay:hover h5 {
|
||||
color: var(--shz-blue-default) !important;
|
||||
}
|
||||
|
||||
.card-img-overlay {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.card-img-overlay img {
|
||||
height: 100%;
|
||||
}
|
||||
@@ -219,6 +219,12 @@
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h3>Watch History</h3>
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-sm btn-filter bg-transparent" type="button" style="cursor: pointer;"
|
||||
(click)="addEpisodeSeen()">
|
||||
<i class="bi bi-check2"></i>
|
||||
</button>
|
||||
</div>
|
||||
<!-- <div class="dropdown">
|
||||
<button class="btn btn-sm btn-filter dropdown-toggle dropdown-toggle-nocaret bg-transparent" type="button"
|
||||
data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="bi bi-three-dots"></i>
|
||||
@@ -226,7 +232,7 @@
|
||||
<ul class="dropdown-menu" style="cursor: pointer;">
|
||||
<li (click)="addEpisodeSeen()"><a class="dropdown-item">Add a watch date</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="card-body p-3">
|
||||
@@ -280,6 +286,33 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" *ngIf="this.entry.collections.length != 0">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h3>Belong to Collection(s)</h3>
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-sm btn-filter bg-transparent" type="button" style="cursor: pointer;"
|
||||
(click)="showAddToListModal()">
|
||||
<i class="bi bi-collection"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body p-3 pb-0">
|
||||
<!-- Iterate through each collection in the entry.collections array -->
|
||||
<div class="row g-3">
|
||||
<div class="col-md-4" *ngFor="let collection of entry.collections">
|
||||
<div class="card h-100 mb-0 collection-card" [routerLink]="['/collections', collection.id]">
|
||||
<div class="card-img-overlay d-flex align-items-start justify-content-center"
|
||||
style="background-color: rgba(0, 0, 0, 0.5);">
|
||||
<h5 class="text-white">{{ collection.name }}</h5>
|
||||
</div>
|
||||
<img [src]="collection.selectedBackdrop" alt="{{ collection.name }}" class="card-img">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import { EntrySeen } from '../../../shared/models/entrySeen.model';
|
||||
import { EpisodeSeenModalComponent } from '../../../shared/components/modals/episode-seen-modal/episode-seen-modal.component';
|
||||
import { MediaModalComponent } from '../media-modal/media-modal.component';
|
||||
import { environment } from '../../../../environments/environment.prod';
|
||||
import { UserCollection } from '../../../shared/models/userCollection.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-entry-page',
|
||||
@@ -76,6 +77,14 @@ export class EntryPageComponent implements OnInit {
|
||||
this.entry = data['entry'] as Entry;
|
||||
this.entry.isInLibrary = true;
|
||||
|
||||
this.entry.collections = this.entry.collections.map((c) => {
|
||||
c.mediasCount = c.medias.length;
|
||||
c.selectedBackdrop = this.getCollectionBackdropPath(c);
|
||||
|
||||
c.medias = [];
|
||||
return c;
|
||||
});
|
||||
|
||||
if (this.entry.is_tvseries) {
|
||||
// ? sorting seasons
|
||||
this.entry.seasons = this.entry.seasons.sort((a, b) => {
|
||||
@@ -316,6 +325,50 @@ export class EntryPageComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
getCollectionBackdropPath(collection: UserCollection) {
|
||||
console.log(`collection media:`, collection.medias);
|
||||
if (collection.medias && collection.medias.length != 0) {
|
||||
const backdrops = collection.medias.filter((m) => m.type == 'backdrop');
|
||||
if (backdrops.length != 0) {
|
||||
const selectedBackdrops = backdrops.filter(
|
||||
(m) => m.type == 'backdrop' && m.isSelected
|
||||
);
|
||||
|
||||
console.log(selectedBackdrops);
|
||||
let selectedBackdrop;
|
||||
if (selectedBackdrops.length != 0) {
|
||||
selectedBackdrop = selectedBackdrops[0].path;
|
||||
} else {
|
||||
selectedBackdrop = backdrops[0].path;
|
||||
}
|
||||
|
||||
return (
|
||||
environment.API_URL +
|
||||
`/media/collections/backdrops/preview/${selectedBackdrop}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// if (collection.entries && collection.entries.length != 0) {
|
||||
// // * use the poster of the first entry in the collection
|
||||
// // * if the collection is empty
|
||||
// return this.getEntryBackdropPath(collection.entries[0]);
|
||||
// } else
|
||||
if (collection.backdropPath) {
|
||||
// * use first remote tmdb poster
|
||||
// * if collection has none and has no entry
|
||||
return `https://image.tmdb.org/t/p/w1280/${collection.backdropPath}`;
|
||||
} else {
|
||||
// * use default poster
|
||||
// * if collection has totaly no poster
|
||||
return 'assets/images/default/default-backdrop.png';
|
||||
}
|
||||
}
|
||||
|
||||
getEntryBackdropPath(entry: Entry) {
|
||||
return '';
|
||||
}
|
||||
|
||||
refrechEntry() {
|
||||
this.lockActions = true;
|
||||
this.entryService.refrechEntryById(this.entry.id).subscribe({
|
||||
@@ -417,7 +470,7 @@ export class EntryPageComponent implements OnInit {
|
||||
addEpisodeSeen() {
|
||||
if (!this.entry) return;
|
||||
|
||||
this.seenHistory[0]
|
||||
this.seenHistory[0];
|
||||
|
||||
const dialogRef = this.dialog.open(EpisodeSeenModalComponent, {
|
||||
width: '360px',
|
||||
|
||||
Reference in new issue
Block a user