changes + fixes to collections related component + add filter by collection type
This commit is contained in:
1 parent
eba9721a3c
commit
776506b232
14 files changed
+219
-129
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
||||
<div class="card-coat">
|
||||
<div class="d-flex flex-column align-items-center collection-card" @fadeInOut>
|
||||
<img id="poster" [src]="getPostPath()" width="150" class="" alt="List poster" (click)="redirectTo()">
|
||||
<img id="poster" [src]="getCollectionPosterPath()" width="150" class="" alt="List poster" (click)="redirectTo()">
|
||||
<div class="list-item-1 mt-2 text-center">
|
||||
<h6 class="mb-0 list-title" (click)="redirectTo()">{{list.name}}</h6>
|
||||
<!-- <p class="mb-0">Created: {{getCreatedDate() | dateFormat}}</p> -->
|
||||
|
||||
+46
-8
@@ -3,6 +3,8 @@ import { UserCollection } from '../../../../shared/models/userCollection.model';
|
||||
import { UserCollectionService } from '../../../../core/services/userCollection.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { trigger, transition, style, animate } from '@angular/animations';
|
||||
import { environment } from '../../../../../environments/environment.prod';
|
||||
import { Entry } from '../../../../shared/models/entry.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-userCollections-list-item',
|
||||
@@ -30,15 +32,51 @@ export class UserCollectionsListItemComponent {
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
getPostPath() {
|
||||
if (this.list.poster_path == null) return 'https://pic.pnnet.dev/256x256';
|
||||
if (this.list.poster_path.startsWith('/'))
|
||||
return `https://image.tmdb.org/t/p/w500` + this.list.poster_path;
|
||||
getCollectionPosterPath() {
|
||||
if (this.list.isLocal) {
|
||||
if (this.list.posterPath == null)
|
||||
return 'assets/images/default/default-poster.png';
|
||||
|
||||
return (
|
||||
`http://localhost:4000/api/v1/media/collections/posters/` +
|
||||
this.list.poster_path
|
||||
);
|
||||
// * use the collection custom poster
|
||||
return (
|
||||
environment.API_URL +
|
||||
`/media/collections/posters/preview/` +
|
||||
this.list.posterPath
|
||||
);
|
||||
} else {
|
||||
// * use the poster of the first entry in the collection if its no empty
|
||||
if (this.list.entries.length != 0) {
|
||||
return this.getEntryPosterPath(this.list.entries[0]);
|
||||
}
|
||||
|
||||
// * if the collection is empty
|
||||
return 'assets/images/default/default-poster.png';
|
||||
}
|
||||
}
|
||||
|
||||
getEntryPosterPath(entry: Entry) {
|
||||
// * Is in library: use a local poster
|
||||
if (entry.medias) {
|
||||
const selectedPosters = entry.medias.filter(
|
||||
(m) => m.type == 'poster' && m.isSelected
|
||||
);
|
||||
|
||||
if (
|
||||
selectedPosters.length &&
|
||||
selectedPosters[0] &&
|
||||
selectedPosters[0].path
|
||||
) {
|
||||
const name = selectedPosters[0].path;
|
||||
return environment.API_URL + `/media/entries/posters/preview/${name}`;
|
||||
}
|
||||
}
|
||||
|
||||
// * No local poster available, Use TMDB poster
|
||||
if (entry.poster_path)
|
||||
return `https://image.tmdb.org/t/p/w300` + entry.poster_path;
|
||||
|
||||
// * No poster found, use default poster image as a last stand
|
||||
return 'assets/images/default/default-poster.png';
|
||||
}
|
||||
|
||||
getCreatedDate(): string {
|
||||
|
||||
Reference in new issue
Block a user