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">
|
<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">
|
<div class="rating">
|
||||||
<i class='bx bx-star'></i>
|
<i class='bx bx-star'></i>
|
||||||
<span>{{formattedRate}}</span>
|
<span>{{formattedRate}}</span>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- card body moved inside card head -->
|
<!-- 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">
|
<a [href]="getTmdbLink()" target="_blank" rel="noopener noreferrer">
|
||||||
<h3 class="card-title">{{ entry.title }}</h3>
|
<h3 class="card-title">{{ entry.title }}</h3>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -3,11 +3,25 @@ import { Entry } from '../../../shared/models/entry.model';
|
|||||||
import { LibraryService } from '../../../core/services/library.service';
|
import { LibraryService } from '../../../core/services/library.service';
|
||||||
import { ListSelectionModalComponent } from '../../modals/list-selection-modal/list-selection-modal.component';
|
import { ListSelectionModalComponent } from '../../modals/list-selection-modal/list-selection-modal.component';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { trigger, transition, style, animate } from '@angular/animations';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-main-card',
|
selector: 'app-main-card',
|
||||||
templateUrl: './main-card.component.html',
|
templateUrl: './main-card.component.html',
|
||||||
styleUrls: ['./main-card.component.css'],
|
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 {
|
export class MainCardComponent implements OnInit {
|
||||||
@Input() entry!: Entry;
|
@Input() entry!: Entry;
|
||||||
@@ -86,7 +100,7 @@ export class MainCardComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logEntry() {
|
cardClick() {
|
||||||
console.log(this.entry);
|
console.log(this.entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,4 +108,10 @@ export class MainCardComponent implements OnInit {
|
|||||||
let type = this.entry.is_tvseries ? 'tv' : 'movie';
|
let type = this.entry.is_tvseries ? 'tv' : 'movie';
|
||||||
return `https://www.themoviedb.org/${type}/${this.entry.entryId.tmdb_id}`;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Reference in new issue
Block a user