add redirect to entry page on click
This commit is contained in:
1 parent
4c665f005a
commit
33870be352
2 files changed
+23
-14
No files matched your search
+4
-2
@@ -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">
|
||||||
|
|||||||
+19
-12
@@ -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,20 +81,25 @@ export class UserCollectionGridCardComponent {
|
|||||||
|
|
||||||
removeEntryFromList() {
|
removeEntryFromList() {
|
||||||
// TODO: add confirm modal
|
// TODO: add confirm modal
|
||||||
this.listService.removeEntryFromCollection(this.listId, this.entry.id).subscribe({
|
this.listService
|
||||||
next: (response) => {
|
.removeEntryFromCollection(this.listId, this.entry.id)
|
||||||
console.log('Entry successfully removed from list.', response);
|
.subscribe({
|
||||||
this.entry.id = 0;
|
next: (response) => {
|
||||||
this.entry.isInLibrary = false;
|
console.log('Entry successfully removed from list.', response);
|
||||||
},
|
this.entry.id = 0;
|
||||||
error: (error) => {
|
this.entry.isInLibrary = false;
|
||||||
console.error('Error removing entry from list:', error);
|
},
|
||||||
},
|
error: (error) => {
|
||||||
});
|
console.error('Error removing entry from list:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ? EVENTS
|
// ? EVENTS
|
||||||
cardClick() {}
|
cardClick() {
|
||||||
|
if (this.entry.isInLibrary)
|
||||||
|
this.router.navigate([`/entry/${this.entry.id}`]);
|
||||||
|
}
|
||||||
|
|
||||||
// ? EVENT EMITTER
|
// ? EVENT EMITTER
|
||||||
emitRefrechEvent() {
|
emitRefrechEvent() {
|
||||||
|
|||||||
Reference in new issue
Block a user