diff --git a/src/app/xtream-tauri/xtream-main-container.component.ts b/src/app/xtream-tauri/xtream-main-container.component.ts index 45535ca81..120e4de86 100644 --- a/src/app/xtream-tauri/xtream-main-container.component.ts +++ b/src/app/xtream-tauri/xtream-main-container.component.ts @@ -1,4 +1,4 @@ -import { Component, inject } from '@angular/core'; +import { Component, inject, OnInit } from '@angular/core'; import { CategoryViewComponent } from './category-view/category-view.component'; import { MatIconButton } from '@angular/material/button'; @@ -20,15 +20,22 @@ import { XtreamStore } from './xtream.store'; MpvPlayerBarComponent, MatIcon, MatIconButton, - ] + ], }) -export class XtreamMainContainerComponent { +export class XtreamMainContainerComponent implements OnInit { + readonly router = inject(Router); + readonly route = inject(ActivatedRoute); readonly xtreamStore = inject(XtreamStore); - constructor( - private router: Router, - private route: ActivatedRoute - ) {} + readonly categories = this.xtreamStore.getCategoriesBySelectedType; + + readonly selectedCategoryId = this.xtreamStore.selectedCategoryId; + + ngOnInit(): void { + const { categoryId } = this.route.snapshot.params; + if (categoryId) + this.xtreamStore.setSelectedCategory(Number(categoryId)); + } categoryClicked(category: XtreamCategory) { const categoryId = (category as any).category_id ?? category.id; diff --git a/src/app/xtream-tauri/xtream-shell/xtream-shell.component.html b/src/app/xtream-tauri/xtream-shell/xtream-shell.component.html index a2d613ca1..10fa6fb8c 100644 --- a/src/app/xtream-tauri/xtream-shell/xtream-shell.component.html +++ b/src/app/xtream-tauri/xtream-shell/xtream-shell.component.html @@ -6,6 +6,11 @@ }
- +
diff --git a/src/app/xtream-tauri/xtream-shell/xtream-shell.component.ts b/src/app/xtream-tauri/xtream-shell/xtream-shell.component.ts index 8ed41dc79..ab65a5b2b 100644 --- a/src/app/xtream-tauri/xtream-shell/xtream-shell.component.ts +++ b/src/app/xtream-tauri/xtream-shell/xtream-shell.component.ts @@ -1,5 +1,5 @@ import { Component, effect, inject } from '@angular/core'; -import { ActivatedRoute, RouterOutlet } from '@angular/router'; +import { ActivatedRoute, Router, RouterOutlet } from '@angular/router'; import { Store } from '@ngrx/store'; import { TranslateModule } from '@ngx-translate/core'; import * as PlaylistActions from '../../state/actions'; @@ -16,16 +16,18 @@ import { XtreamStore } from '../xtream.store'; RouterOutlet, TranslateModule, ], - providers: [XtreamStore] + providers: [XtreamStore], }) export class XtreamShellComponent { private readonly route = inject(ActivatedRoute); + private readonly router = inject(Router); private readonly store = inject(Store); private readonly xtreamStore = inject(XtreamStore); readonly getImportCount = this.xtreamStore.getImportCount; readonly isImporting = this.xtreamStore.isImporting; readonly itemsToImport = this.xtreamStore.itemsToImport; + readonly portalStatus = this.xtreamStore.portalStatus; constructor() { effect( @@ -39,10 +41,25 @@ export class XtreamShellComponent { } ngOnInit() { + this.xtreamStore.checkPortalStatus(); this.store.dispatch( PlaylistActions.setActivePlaylist({ playlistId: this.route.snapshot.params.id, }) ); } + + handleCategoryClick(category: 'vod' | 'live' | 'series') { + this.xtreamStore.setSelectedContentType(category); + this.router.navigate([category], { + relativeTo: this.route, + }); + } + + handlePageClick(page: 'search' | 'recent' | 'favorites') { + this.xtreamStore.setSelectedContentType(undefined); + this.router.navigate([page], { + relativeTo: this.route, + }); + } }