add redirect to entry page on click

This commit is contained in:
X4Lo committed 2024-04-28 22:04:28 +01:00
1 parent 4c665f005a
commit 33870be352
2 files changed
+14 -5

No files matched your search

@@ -18,12 +18,14 @@
<!-- <div class="info" *ngIf="entry.isInLibrary"> <!-- <div class="info" *ngIf="entry.isInLibrary">
<i class='bx bx-list-plus' (click)="showAddToListModal()"></i> <i class='bx bx-list-plus' (click)="showAddToListModal()"></i>
</div> --> </div> -->
</div> </div>
<!-- card body moved inside card head --> <!-- card body moved inside card head -->
<div class="card-body" (click)="cardClick()"> <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>
</a> -->
<a (click)="cardClick()" rel="noopener noreferrer">
<h3 class="card-title">{{ entry.title }}</h3> <h3 class="card-title">{{ entry.title }}</h3>
</a> </a>
<div class="card-info"> <div class="card-info">
@@ -4,6 +4,7 @@ import { LibraryService } from '../../../../core/services/library.service';
import { Entry } from '../../../../shared/models/entry.model'; import { Entry } from '../../../../shared/models/entry.model';
import { trigger, transition, style, animate } from '@angular/animations'; import { trigger, transition, style, animate } from '@angular/animations';
import { UserCollectionService } from '../../../../core/services/userCollection.service'; import { UserCollectionService } from '../../../../core/services/userCollection.service';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'app-userCollection-grid-card', selector: 'app-userCollection-grid-card',
@@ -27,7 +28,8 @@ export class UserCollectionGridCardComponent {
constructor( constructor(
private libraryService: LibraryService, private libraryService: LibraryService,
private listService: UserCollectionService, private listService: UserCollectionService,
public dialog: MatDialog public dialog: MatDialog,
private router: Router
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
@@ -79,7 +81,9 @@ export class UserCollectionGridCardComponent {
removeEntryFromList() { removeEntryFromList() {
// TODO: add confirm modal // TODO: add confirm modal
this.listService.removeEntryFromCollection(this.listId, this.entry.id).subscribe({ this.listService
.removeEntryFromCollection(this.listId, this.entry.id)
.subscribe({
next: (response) => { next: (response) => {
console.log('Entry successfully removed from list.', response); console.log('Entry successfully removed from list.', response);
this.entry.id = 0; this.entry.id = 0;
@@ -92,7 +96,10 @@ export class UserCollectionGridCardComponent {
} }
// ? EVENTS // ? EVENTS
cardClick() {} cardClick() {
if (this.entry.isInLibrary)
this.router.navigate([`/entry/${this.entry.id}`]);
}
// ? EVENT EMITTER // ? EVENT EMITTER
emitRefrechEvent() { emitRefrechEvent() {