add default movie poster
This commit is contained in:
1 parent
605dd762ff
commit
c2da54a641
3 files changed
+25
-5
No files matched your search
@@ -1,8 +1,8 @@
|
||||
<div class="movie-card">
|
||||
<div class="movie-card" @fadeInOut>
|
||||
<div class="card-head">
|
||||
<img class="card-img" [src]="'https://image.tmdb.org/t/p/w500' + entry.poster_path" alt="Movie Poster">
|
||||
<img class="card-img" [src]="getPostPath()" alt="Movie Poster">
|
||||
|
||||
<div class="card-overlay" (click)="logEntry">
|
||||
<div class="card-overlay" (click)="cardClick()">
|
||||
<div class="rating">
|
||||
<i class='bx bx-star'></i>
|
||||
<span>{{formattedRate}}</span>
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
|
||||
<!-- card body moved inside card head -->
|
||||
<div class="card-body" (click)="logEntry()">
|
||||
<div class="card-body" (click)="cardClick()">
|
||||
<a [href]="getTmdbLink()" target="_blank" rel="noopener noreferrer">
|
||||
<h3 class="card-title">{{ entry.title }}</h3>
|
||||
</a>
|
||||
|
||||
@@ -3,11 +3,25 @@ import { Entry } from '../../../shared/models/entry.model';
|
||||
import { LibraryService } from '../../../core/services/library.service';
|
||||
import { ListSelectionModalComponent } from '../../modals/list-selection-modal/list-selection-modal.component';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { trigger, transition, style, animate } from '@angular/animations';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main-card',
|
||||
templateUrl: './main-card.component.html',
|
||||
styleUrls: ['./main-card.component.css'],
|
||||
animations: [
|
||||
trigger('fadeInOut', [
|
||||
transition(':enter', [
|
||||
// :enter is alias for 'void => *'
|
||||
style({ opacity: 0 }),
|
||||
animate('0.5s ease-out', style({ opacity: 1 })),
|
||||
]),
|
||||
transition(':leave', [
|
||||
// :leave is alias for '* => void'
|
||||
animate('0.5s ease-in', style({ opacity: 0 })),
|
||||
]),
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class MainCardComponent implements OnInit {
|
||||
@Input() entry!: Entry;
|
||||
@@ -86,7 +100,7 @@ export class MainCardComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
logEntry() {
|
||||
cardClick() {
|
||||
console.log(this.entry);
|
||||
}
|
||||
|
||||
@@ -94,4 +108,10 @@ export class MainCardComponent implements OnInit {
|
||||
let type = this.entry.is_tvseries ? 'tv' : 'movie';
|
||||
return `https://www.themoviedb.org/${type}/${this.entry.entryId.tmdb_id}`;
|
||||
}
|
||||
|
||||
getPostPath() {
|
||||
if (this.entry.poster_path == null) return 'assets/images/default/default-poster.png';
|
||||
|
||||
return `https://image.tmdb.org/t/p/w500` + this.entry.poster_path;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user