diff --git a/frontend-angular/src/app/search/search.component.html b/frontend-angular/src/app/search/search.component.html index e17172b25..a833d01a2 100644 --- a/frontend-angular/src/app/search/search.component.html +++ b/frontend-angular/src/app/search/search.component.html @@ -55,10 +55,14 @@ - + diff --git a/frontend-angular/src/app/search/search.component.ts b/frontend-angular/src/app/search/search.component.ts index 7eb8d7628..a4ee28f12 100644 --- a/frontend-angular/src/app/search/search.component.ts +++ b/frontend-angular/src/app/search/search.component.ts @@ -14,6 +14,8 @@ import { Search } from './search.actions'; import { selectResults } from './search.reducer'; import { CompanionComponent } from '@davinkevin/companion-component'; import { PlayAction } from '#app/floating-player/floating-player.actions'; +import { isDownloadable as IsDownloadable, isPlayable as IsPlayable } from '#app/shared/service/item/item.service'; +import { DownloadItemAction } from '#app/app.actions'; interface SearchItemRequestViewModel { q?: string; @@ -55,6 +57,9 @@ export class SearchComponent implements OnInit, OnDestroy { form: FormGroup; items: Page; + isDownloadable: (item: Item) => boolean = IsDownloadable; + isPlayable: (item: Item) => boolean = IsPlayable; + companion = new CompanionComponent(); constructor(private route: ActivatedRoute, private store: Store, private formBuilder: FormBuilder) {} @@ -104,14 +109,14 @@ export class SearchComponent implements OnInit, OnDestroy { this.form.updateValueAndValidity({ onlySelf: false, emitEvent: true }); } - openSideNav() { - this.store.dispatch(new OpenSideNavAction()); - } - play(item: Item) { this.store.dispatch(new PlayAction(item)); } + download(item: Item): void { + this.store.dispatch(new DownloadItemAction(item.id, item.podcastId)); + } + ngOnDestroy(): void { this.companion.destroy(); }