From 7177b46ca1b35aa9d7ed39a06c1dcf41a4fc6180 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 18 Jan 2022 11:23:41 +0100 Subject: Add ability to delete history element --- .../app/+my-library/my-history/my-history.component.html | 12 +++++++++--- .../app/+my-library/my-history/my-history.component.scss | 5 +++++ .../app/+my-library/my-history/my-history.component.ts | 15 +++++++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) (limited to 'client/src/app/+my-library/my-history') diff --git a/client/src/app/+my-library/my-history/my-history.component.html b/client/src/app/+my-library/my-history/my-history.component.html index 8e564cf93..14bf01804 100644 --- a/client/src/app/+my-library/my-history/my-history.component.html +++ b/client/src/app/+my-library/my-history/my-history.component.html @@ -13,9 +13,9 @@ - @@ -30,4 +30,10 @@ [enableSelection]="false" [disabled]="disabled" #videosSelection -> +> + +
+ +
+
+ diff --git a/client/src/app/+my-library/my-history/my-history.component.scss b/client/src/app/+my-library/my-history/my-history.component.scss index cb8507569..3257b2215 100644 --- a/client/src/app/+my-library/my-history/my-history.component.scss +++ b/client/src/app/+my-library/my-history/my-history.component.scss @@ -53,6 +53,11 @@ @include row-blocks($column-responsive: false); } +.action-button { + display: flex; + align-self: flex-end; +} + @media screen and (max-width: $small-view) { .top-buttons { grid-template-columns: auto 1fr auto; diff --git a/client/src/app/+my-library/my-history/my-history.component.ts b/client/src/app/+my-library/my-history/my-history.component.ts index 95cfaee41..34efe5558 100644 --- a/client/src/app/+my-library/my-history/my-history.component.ts +++ b/client/src/app/+my-library/my-history/my-history.component.ts @@ -123,14 +123,25 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook { }) } - async deleteHistory () { + deleteHistoryElement (video: Video) { + this.userHistoryService.deleteUserVideoHistoryElement(video) + .subscribe({ + next: () => { + this.videos = this.videos.filter(v => v.id !== video.id) + }, + + error: err => this.notifier.error(err.message) + }) + } + + async clearAllHistory () { const title = $localize`Delete videos history` const message = $localize`Are you sure you want to delete all your videos history?` const res = await this.confirmService.confirm(message, title) if (res !== true) return - this.userHistoryService.deleteUserVideosHistory() + this.userHistoryService.clearAllUserVideosHistory() .subscribe({ next: () => { this.notifier.success($localize`Videos history deleted`) -- cgit v1.2.3