Implemented add to list into main card component
This commit is contained in:
1 parent
3d8c688bc8
commit
3ea844d3fd
2 files changed
+28
-5
No files matched your search
@@ -15,8 +15,8 @@
|
||||
</div>
|
||||
|
||||
<!-- <div [ngClass]="{'info': !entry.isInLibrary, 'bookmark': entry.isInLibrary}"> -->
|
||||
<div class="info">
|
||||
<i class='bx bx-info-circle'></i>
|
||||
<div class="info" *ngIf="entry.isInLibrary">
|
||||
<i class='bx bx-list-plus' (click)="showAddToListModal()"></i>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,8 @@ import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Entry } from '../../../shared/models/entry.model';
|
||||
import { EntryService } from '../../../core/services/entry.service';
|
||||
import { LibraryService } from '../../../core/services/library.service';
|
||||
import { ListSelectionModalComponent } from '../../../list-selection-modal/list-selection-modal.component';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main-card',
|
||||
@@ -11,7 +13,10 @@ import { LibraryService } from '../../../core/services/library.service';
|
||||
export class MainCardComponent implements OnInit {
|
||||
@Input() entry!: Entry;
|
||||
|
||||
constructor(private libraryService: LibraryService) {}
|
||||
constructor(
|
||||
private libraryService: LibraryService,
|
||||
public dialog: MatDialog
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.libraryService.isInLibrary(this.entry.entryId.tmdb_id).subscribe({
|
||||
@@ -21,6 +26,7 @@ export class MainCardComponent implements OnInit {
|
||||
this.entry = e;
|
||||
}
|
||||
},
|
||||
error: (error) => {},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,7 +45,7 @@ export class MainCardComponent implements OnInit {
|
||||
if (entry != null) {
|
||||
entry.isInLibrary = true;
|
||||
this.entry = entry;
|
||||
console.log(entry);
|
||||
this.libraryService.getAllEntries(true);
|
||||
}
|
||||
},
|
||||
error: (error) => {
|
||||
@@ -68,5 +74,22 @@ export class MainCardComponent implements OnInit {
|
||||
logEntry() {
|
||||
console.log(this.entry);
|
||||
}
|
||||
openInfo() {}
|
||||
|
||||
showAddToListModal() {
|
||||
if (this.entry) {
|
||||
console.log("entry exist");
|
||||
const dialogRef = this.dialog.open(ListSelectionModalComponent, {
|
||||
width: '500px',
|
||||
height: '300px',
|
||||
data: {
|
||||
/* données que vous pourriez vouloir passer */
|
||||
},
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((result) => {
|
||||
console.log('Le dialogue a été fermé', result);
|
||||
// Traitez le résultat ici (par exemple, ajoutez la sélection à une liste)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user