Added ability to favorite a file

Moved file filter options above the list of files, and added option to filter for favorites
This commit is contained in:
Isaac Abadi
2022-12-28 21:48:24 -06:00
parent c45e0f04be
commit 665bcc04a7
15 changed files with 173 additions and 40 deletions

View File

@@ -19,6 +19,7 @@ export class VideoInfoDialogComponent implements OnInit {
category: Category;
editing = false;
initialized = false;
retrieving_file = false;
constructor(@Inject(MAT_DIALOG_DATA) public data: any, public postsService: PostsService, private datePipe: DatePipe) { }
@@ -58,9 +59,14 @@ export class VideoInfoDialogComponent implements OnInit {
}
getFile(): void {
this.retrieving_file = true;
this.postsService.getFile(this.file.uid).subscribe(res => {
this.retrieving_file = false;
this.file = res['file'];
this.initializeFile(this.file);
}, err => {
this.retrieving_file = false;
console.error(err);
});
}
@@ -85,4 +91,12 @@ export class VideoInfoDialogComponent implements OnInit {
return JSON.stringify(this.file) !== JSON.stringify(this.new_file);
}
toggleFavorite(): void {
this.file.favorite = !this.file.favorite;
this.retrieving_file = true;
this.postsService.updateFile(this.file.uid, {favorite: this.file.favorite}).subscribe(res => {
this.getFile();
});
}
}