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
+23 -14

No files matched your search

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