entry card: add redifrect to entry page + inlibrary badge
This commit is contained in:
1 parent
d695e6fa0f
commit
7dec0d6149
3 files changed
+56
-14
No files matched your search
@@ -11,6 +11,7 @@
|
||||
overflow: hidden;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.movie-card .card-img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
@@ -38,6 +39,7 @@
|
||||
.movie-card:hover .card-img {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.movie-card .card-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
@@ -54,10 +56,29 @@
|
||||
max-height: 100px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.movie-card:hover .card-title {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/* ! OVER LAY 2 */
|
||||
.movie-card:hover .card-overlay-2 {
|
||||
opacity: 0;
|
||||
transition: 0.3s ease;
|
||||
}
|
||||
|
||||
.movie-card .in-library {
|
||||
position: absolute;
|
||||
top: -7px;
|
||||
right: 11px;
|
||||
color: var(--white);
|
||||
}
|
||||
|
||||
.movie-card .in-library span {
|
||||
font-size: 37px;
|
||||
color: var(--shz-gold-1);
|
||||
}
|
||||
|
||||
/* ! HOVER END*/
|
||||
|
||||
/* * BUTTONS */
|
||||
@@ -77,6 +98,7 @@
|
||||
.movie-card .bookmark {
|
||||
left: 15px;
|
||||
}
|
||||
|
||||
.movie-card .info {
|
||||
left: 15px;
|
||||
top: 60px;
|
||||
@@ -94,9 +116,11 @@
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
transition: color 0.3s ease, background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.movie-card:hover :is(.bookmark, .rating, .info) {
|
||||
--mv-card-scale: 1;
|
||||
}
|
||||
|
||||
.bookmark,
|
||||
.info {
|
||||
display: flex;
|
||||
@@ -112,6 +136,7 @@
|
||||
/* color: var(--light-azure); */
|
||||
color: var(--white);
|
||||
}
|
||||
|
||||
.movie-card .rating span {
|
||||
/* color: var(--light-azure); */
|
||||
color: var(--white);
|
||||
@@ -148,6 +173,7 @@
|
||||
.movie-card:hover .card-title {
|
||||
color: var(--yellow);
|
||||
}
|
||||
|
||||
.movie-card .card-info {
|
||||
display: flex;
|
||||
font-family: -apple-system, "Segoe UI", BlinkMacSystemFont, sans-serif;
|
||||
@@ -173,4 +199,4 @@
|
||||
.movie-card .card-title,
|
||||
.movie-card .card-info {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,16 @@
|
||||
<div class="movie-card" @fadeInOut>
|
||||
<div class="card-head">
|
||||
<img class="card-img" [src]="getPostPath()" alt="Movie Poster">
|
||||
<img class="card-img" [src]="postPath" alt="Movie Poster">
|
||||
|
||||
<div class="card-overlay" (click)="cardClick()">
|
||||
<div class="card-overlay-2">
|
||||
<div class="in-library" *ngIf="entry.isInLibrary">
|
||||
<span class="material-symbols-outlined">
|
||||
beenhere
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-overlay">
|
||||
<div class="rating">
|
||||
<i class='bx bx-star'></i>
|
||||
<span>{{formattedRate}}</span>
|
||||
@@ -21,15 +29,15 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- card body moved inside card head -->
|
||||
<div class="card-body" (click)="cardClick()">
|
||||
<a [href]="getTmdbLink()" target="_blank" rel="noopener noreferrer">
|
||||
<!-- card body : title, -->
|
||||
<div class="card-body">
|
||||
<a (click)="cardClick()" rel="noopener noreferrer">
|
||||
<h3 class="card-title">{{ entry.title }}</h3>
|
||||
</a>
|
||||
<div class="card-info">
|
||||
<span class="Year">{{releaseYear}}</span>
|
||||
<i class="card-dot"></i>
|
||||
<span class="duration">137 min</span>
|
||||
<span class="duration">{{runtime}} min</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
import { trigger, transition, style, animate } from '@angular/animations';
|
||||
import { Entry } from '../../../models/entry.model';
|
||||
import { LibraryService } from '../../../../core/services/library.service';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main-card',
|
||||
@@ -28,7 +29,8 @@ export class MainCardComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private libraryService: LibraryService,
|
||||
public dialog: MatDialog
|
||||
public dialog: MatDialog,
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -59,6 +61,7 @@ export class MainCardComponent implements OnInit {
|
||||
entry.isInLibrary = true;
|
||||
this.entry = entry;
|
||||
this.libraryService.getAllEntries(true);
|
||||
console.log(entry);
|
||||
}
|
||||
},
|
||||
error: (error) => {
|
||||
@@ -77,9 +80,7 @@ export class MainCardComponent implements OnInit {
|
||||
this.entry.isInLibrary = false;
|
||||
},
|
||||
error: (error) => {
|
||||
// Handle error scenario
|
||||
console.error('Error deleting entry:', error);
|
||||
// Optionally, display an error message to the user using a service or a component
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -101,7 +102,8 @@ export class MainCardComponent implements OnInit {
|
||||
}
|
||||
|
||||
cardClick() {
|
||||
console.log(this.entry);
|
||||
if (this.entry.isInLibrary)
|
||||
this.router.navigate([`/entry/${this.entry.id}`]);
|
||||
}
|
||||
|
||||
getTmdbLink() {
|
||||
@@ -109,9 +111,15 @@ export class MainCardComponent implements OnInit {
|
||||
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';
|
||||
get postPath() {
|
||||
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;
|
||||
return `https://image.tmdb.org/t/p/w154` + this.entry.poster_path;
|
||||
}
|
||||
|
||||
get runtime() {
|
||||
if (this.entry.runtime == null) return '';
|
||||
return this.entry.runtime;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user