mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
feat: enhance global collection route with playlist context and portal type handling
This commit is contained in:
1 parent
7caa18308d
commit
d88979e666
2 files changed
+28
-4
No files matched your search
@@ -42,7 +42,7 @@ export const routes: Routes = [
|
||||
canActivate: [dashboardAccessGuard],
|
||||
loadComponent: () =>
|
||||
import('workspace-dashboard-feature').then(
|
||||
(c) => c.WorkspaceDashboardComponent
|
||||
(c) => c.WorkspaceDashboardRailsComponent
|
||||
),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
||||
import { PlaylistContextFacade } from '@iptvnator/playlist/shared/util';
|
||||
import {
|
||||
UnifiedCollectionDetailDirective,
|
||||
UnifiedCollectionPageComponent,
|
||||
} from '@iptvnator/portal/shared/ui';
|
||||
import { CollectionScope } from '@iptvnator/portal/shared/util';
|
||||
import { CollectionScope, PortalProvider } from '@iptvnator/portal/shared/util';
|
||||
import { StalkerCollectionDetailComponent } from '@iptvnator/portal/stalker/feature';
|
||||
import { XtreamCollectionDetailComponent } from '@iptvnator/portal/xtream/feature';
|
||||
|
||||
type UnifiedPortalType = 'm3u' | 'xtream' | 'stalker';
|
||||
|
||||
function providerToPortalType(provider: PortalProvider): UnifiedPortalType {
|
||||
if (provider === 'playlists') return 'm3u';
|
||||
if (provider === 'xtreams') return 'xtream';
|
||||
return 'stalker';
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-global-collection-route',
|
||||
imports: [
|
||||
@@ -18,7 +27,9 @@ import { XtreamCollectionDetailComponent } from '@iptvnator/portal/xtream/featur
|
||||
template: `
|
||||
<app-unified-collection-page
|
||||
[mode]="mode()"
|
||||
[defaultScope]="defaultScope()"
|
||||
[playlistId]="activePlaylistId() ?? undefined"
|
||||
[portalType]="activePortalType() ?? undefined"
|
||||
[defaultScope]="effectiveDefaultScope()"
|
||||
>
|
||||
<ng-template unifiedCollectionDetail let-item let-close="close">
|
||||
@if (item.sourceType === 'xtream') {
|
||||
@@ -35,6 +46,19 @@ import { XtreamCollectionDetailComponent } from '@iptvnator/portal/xtream/featur
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class GlobalCollectionRouteComponent {
|
||||
private readonly playlistContext = inject(PlaylistContextFacade);
|
||||
|
||||
readonly mode = input<'favorites' | 'recent'>('favorites');
|
||||
readonly defaultScope = input<CollectionScope | undefined>(undefined);
|
||||
|
||||
readonly activePlaylistId = computed(
|
||||
() => this.playlistContext.activePlaylist()?._id ?? null
|
||||
);
|
||||
readonly activePortalType = computed<UnifiedPortalType | null>(() => {
|
||||
const provider = this.playlistContext.activeProvider();
|
||||
return provider ? providerToPortalType(provider) : null;
|
||||
});
|
||||
readonly effectiveDefaultScope = computed<CollectionScope | undefined>(() =>
|
||||
this.activePlaylistId() ? 'playlist' : (this.defaultScope() ?? 'all')
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user