diff --git a/apps/web/src/assets/i18n/de.json b/apps/web/src/assets/i18n/de.json index 80c1e8dcc..fd7cd80bb 100644 --- a/apps/web/src/assets/i18n/de.json +++ b/apps/web/src/assets/i18n/de.json @@ -670,6 +670,8 @@ "CLEAR_COMPLETED_DOWNLOADS_THIS_PLAYLIST_ARIA": "Abgeschlossene Downloads für diese Playlist löschen", "CLEAR_RECENTLY_VIEWED_SECTION": "Zuletzt angesehen löschen", "CLEAR_RECENTLY_VIEWED_SECTION_ARIA": "Zuletzt angesehen für diesen Abschnitt löschen", + "CLEAR_RECENTLY_VIEWED_DIALOG_TITLE": "Zuletzt angesehen löschen?", + "CLEAR_RECENTLY_VIEWED_DIALOG_MESSAGE": "Alle zuletzt angesehenen Einträge in diesem Abschnitt werden entfernt. Diese Aktion kann nicht rückgängig gemacht werden.", "XTREAM_CODE": "Xtream Code", "STALKER_PORTAL": "Stalker-Portal", "CHANNELS_COUNT": "{{count}} Sender", diff --git a/apps/web/src/assets/i18n/en.json b/apps/web/src/assets/i18n/en.json index 865d09c53..d7d77c7ec 100644 --- a/apps/web/src/assets/i18n/en.json +++ b/apps/web/src/assets/i18n/en.json @@ -782,6 +782,8 @@ "CLEAR_COMPLETED_DOWNLOADS_THIS_PLAYLIST_ARIA": "Clear completed downloads for this playlist", "CLEAR_RECENTLY_VIEWED_SECTION": "Clear recently viewed", "CLEAR_RECENTLY_VIEWED_SECTION_ARIA": "Clear recently viewed for this section", + "CLEAR_RECENTLY_VIEWED_DIALOG_TITLE": "Clear recently viewed?", + "CLEAR_RECENTLY_VIEWED_DIALOG_MESSAGE": "All recently viewed items in this section will be removed. This action cannot be undone.", "XTREAM_CODE": "Xtream Code", "STALKER_PORTAL": "Stalker Portal", "CHANNELS_COUNT": "{{count}} channels", diff --git a/apps/web/src/assets/i18n/ru.json b/apps/web/src/assets/i18n/ru.json index 505f422ff..4c6086236 100644 --- a/apps/web/src/assets/i18n/ru.json +++ b/apps/web/src/assets/i18n/ru.json @@ -626,6 +626,8 @@ "CLEAR_COMPLETED_DOWNLOADS_THIS_PLAYLIST_ARIA": "Очистить завершенные загрузки для этого плейлиста", "CLEAR_RECENTLY_VIEWED_SECTION": "Очистить недавно просмотренное", "CLEAR_RECENTLY_VIEWED_SECTION_ARIA": "Очистить недавно просмотренное для этого раздела", + "CLEAR_RECENTLY_VIEWED_DIALOG_TITLE": "Очистить недавно просмотренное?", + "CLEAR_RECENTLY_VIEWED_DIALOG_MESSAGE": "Все недавно просмотренные элементы в этом разделе будут удалены. Это действие нельзя отменить.", "XTREAM_CODE": "Xtream Code", "STALKER_PORTAL": "Портал Stalker", "CHANNELS_COUNT": "{{count}} каналов", diff --git a/libs/portal/shared/ui/src/lib/components/unified-collection/unified-collection-page.component.ts b/libs/portal/shared/ui/src/lib/components/unified-collection/unified-collection-page.component.ts index 63b674001..4f11f685b 100644 --- a/libs/portal/shared/ui/src/lib/components/unified-collection/unified-collection-page.component.ts +++ b/libs/portal/shared/ui/src/lib/components/unified-collection/unified-collection-page.component.ts @@ -19,7 +19,8 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTooltip } from '@angular/material/tooltip'; import { ActivatedRoute, Router } from '@angular/router'; import { Store } from '@ngrx/store'; -import { TranslatePipe } from '@ngx-translate/core'; +import { TranslatePipe, TranslateService } from '@ngx-translate/core'; +import { DialogService } from 'components'; import { buildGlobalCollectionDetailNavigationTarget, buildCollectionViewState, @@ -83,6 +84,8 @@ export class UnifiedCollectionPageComponent implements AfterContentInit { private readonly scopeService = inject(ScopeToggleService); private readonly favoritesData = inject(UnifiedFavoritesDataService); private readonly recentData = inject(UnifiedRecentDataService); + private readonly dialogService = inject(DialogService); + private readonly translate = inject(TranslateService); readonly detailTemplate = contentChild(UnifiedCollectionDetailDirective); private readonly playlists = this.store.selectSignal( selectAllPlaylistsMeta @@ -357,12 +360,26 @@ export class UnifiedCollectionPageComponent implements AfterContentInit { ); } - async clearAllRecent(): Promise { - await this.recentData.clearRecentItems( - this.effectiveScope(), - this.playlistId() - ); - this.allItems.set([]); + clearAllRecent(): void { + if (this.allItems().length === 0) { + return; + } + + const scope = this.effectiveScope(); + const playlistId = this.playlistId(); + + this.dialogService.openConfirmDialog({ + title: this.translate.instant( + 'WORKSPACE.SHELL.CLEAR_RECENTLY_VIEWED_DIALOG_TITLE' + ), + message: this.translate.instant( + 'WORKSPACE.SHELL.CLEAR_RECENTLY_VIEWED_DIALOG_MESSAGE' + ), + onConfirm: () => { + this.allItems.set([]); + void this.recentData.clearRecentItems(scope, playlistId); + }, + }); } async onReorder(items: UnifiedCollectionItem[]): Promise {