diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.html b/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.html index 048d110..078e790 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.html +++ b/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.html @@ -18,12 +18,14 @@ -
- + +

{{ entry.title }}

diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts b/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts index be2af72..190bcf7 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts +++ b/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts @@ -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() {