mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-10 10:06:15 -08:00
refactor(xtream): update navigation-bar component
This commit is contained in:
1 parent
1e2ab0b8ed
commit
a749bec690
7 files changed
+57
-19
No files matched your search
@@ -0,0 +1,6 @@
|
||||
import { ContentType } from './content-type.enum';
|
||||
|
||||
export interface ContentTypeNavigationItem {
|
||||
contentType: ContentType;
|
||||
label: string;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
export enum ContentType {
|
||||
LIVE_STREAMS = 'LIVE_STREAMS',
|
||||
VODS = 'VODS',
|
||||
SERIES = 'SERIES',
|
||||
VODS = 'vod',
|
||||
SERIES = 'series',
|
||||
ITV = 'itv',
|
||||
}
|
||||
@@ -10,15 +10,15 @@
|
||||
[value]="contentType"
|
||||
(change)="contentTypeChanged.emit($event.value)"
|
||||
>
|
||||
<mat-button-toggle [value]="ContentTypeEnum.LIVE_STREAMS"
|
||||
>Live Streams</mat-button-toggle
|
||||
>
|
||||
<mat-button-toggle [value]="ContentTypeEnum.VODS"
|
||||
>VOD Streams</mat-button-toggle
|
||||
>
|
||||
<mat-button-toggle [value]="ContentTypeEnum.SERIES"
|
||||
>Series</mat-button-toggle
|
||||
<mat-button-toggle
|
||||
*ngFor="
|
||||
let item of contentTypeNavigationItems;
|
||||
trackBy: trackByValue
|
||||
"
|
||||
[value]="item.contentType"
|
||||
>
|
||||
{{ item.label }}
|
||||
</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Breadcrumb } from '../breadcrumb.interface';
|
||||
import { ContentTypeNavigationItem } from '../content-type-navigation-item.interface';
|
||||
import { ContentType } from '../content-type.enum';
|
||||
import { PortalStore } from '../portal.store';
|
||||
|
||||
@@ -28,6 +29,7 @@ export class NavigationBarComponent {
|
||||
@Input({ required: true }) breadcrumbs: Breadcrumb[];
|
||||
@Input({ required: true }) contentType: ContentType;
|
||||
@Input() searchVisible = true;
|
||||
@Input() contentTypeNavigationItems: ContentTypeNavigationItem[];
|
||||
|
||||
@Output() contentTypeChanged = new EventEmitter<ContentType>();
|
||||
@Output() breadcrumbClicked = new EventEmitter<Breadcrumb>();
|
||||
@@ -45,4 +47,8 @@ export class NavigationBarComponent {
|
||||
setSearchText(text: string) {
|
||||
this.portalStore.setSearchPhrase(text);
|
||||
}
|
||||
|
||||
trackByValue(_i: number, value: ContentTypeNavigationItem) {
|
||||
return value.contentType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// should represent the content of a card element - xtream category or VOD or any item from stalker, vportal etc
|
||||
export interface PortalCardItem {
|
||||
// TODO
|
||||
id: string;
|
||||
type: 'category' | 'vod' | 'serial' | 'live'; // TODO: enum
|
||||
name: string;
|
||||
coverUrl?: string;
|
||||
streamType?: 'live' | 'movie'; // TODO: maybe not needed, since type is there
|
||||
categoryId?: string;
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
[searchVisible]="
|
||||
currentLayout === 'category' || currentLayout === 'category_content'
|
||||
"
|
||||
[contentTypeNavigationItems]="navigationContentTypes"
|
||||
/>
|
||||
|
||||
<div class="container">
|
||||
|
||||
@@ -25,6 +25,7 @@ import { IpcCommand } from '../../../shared/ipc-command.class';
|
||||
import {
|
||||
ERROR,
|
||||
OPEN_MPV_PLAYER,
|
||||
OPEN_VLC_PLAYER,
|
||||
XTREAM_REQUEST,
|
||||
XTREAM_RESPONSE,
|
||||
} from '../../../shared/ipc-commands';
|
||||
@@ -55,24 +56,22 @@ import { PlaylistsService } from '../services/playlists.service';
|
||||
import { Settings, VideoPlayer } from '../settings/settings.interface';
|
||||
import { STORE_KEY } from '../shared/enums/store-keys.enum';
|
||||
import { Breadcrumb } from './breadcrumb.interface';
|
||||
import { ContentTypeNavigationItem } from './content-type-navigation-item.interface';
|
||||
import { PlayerDialogComponent } from './player-dialog/player-dialog.component';
|
||||
import { PortalStore } from './portal.store';
|
||||
import { SerialDetailsComponent } from './serial-details/serial-details.component';
|
||||
|
||||
const ContentTypes = {
|
||||
LIVE_STREAMS: {
|
||||
title: 'Live streams',
|
||||
[ContentType.ITV]: {
|
||||
getContentAction: XtreamCodeActions.GetLiveStreams,
|
||||
getCategoryAction: XtreamCodeActions.GetLiveCategories,
|
||||
},
|
||||
VODS: {
|
||||
title: 'VOD streams',
|
||||
[ContentType.VODS]: {
|
||||
getContentAction: XtreamCodeActions.GetVodStreams,
|
||||
getCategoryAction: XtreamCodeActions.GetVodCategories,
|
||||
getDetailsAction: XtreamCodeActions.GetVodInfo,
|
||||
},
|
||||
SERIES: {
|
||||
title: 'Series',
|
||||
[ContentType.SERIES]: {
|
||||
getContentAction: XtreamCodeActions.GetSeries,
|
||||
getCategoryAction: XtreamCodeActions.GetSeriesCategories,
|
||||
getDetailsAction: XtreamCodeActions.GetSeriesInfo,
|
||||
@@ -123,6 +122,20 @@ export class XtreamMainContainerComponent implements OnInit {
|
||||
storage = inject(StorageMap);
|
||||
store = inject(Store);
|
||||
currentPlaylist = this.store.selectSignal(selectCurrentPlaylist);
|
||||
navigationContentTypes: ContentTypeNavigationItem[] = [
|
||||
{
|
||||
contentType: ContentType.ITV,
|
||||
label: 'Live Streams',
|
||||
},
|
||||
{
|
||||
contentType: ContentType.VODS,
|
||||
label: 'VOD Streams',
|
||||
},
|
||||
{
|
||||
contentType: ContentType.SERIES,
|
||||
label: 'Series',
|
||||
},
|
||||
];
|
||||
|
||||
favorites$: Observable<any>;
|
||||
breadcrumbs: Breadcrumb[] = [];
|
||||
@@ -157,7 +170,6 @@ export class XtreamMainContainerComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.setInitialBreadcrumb();
|
||||
console.log(this.currentPlaylist()._id);
|
||||
this.favorites$ = this.playlistService.getPortalFavorites(
|
||||
this.currentPlaylist()._id
|
||||
);
|
||||
@@ -276,6 +288,10 @@ export class XtreamMainContainerComponent implements OnInit {
|
||||
this.dataService.sendIpcEvent(OPEN_MPV_PLAYER, {
|
||||
url: streamUrl,
|
||||
});
|
||||
} else if (player === VideoPlayer.VLC) {
|
||||
this.dataService.sendIpcEvent(OPEN_VLC_PLAYER, {
|
||||
url: streamUrl,
|
||||
});
|
||||
} else {
|
||||
this.dialog.open(PlayerDialogComponent, {
|
||||
data: { streamUrl, player, title },
|
||||
@@ -385,7 +401,6 @@ export class XtreamMainContainerComponent implements OnInit {
|
||||
}
|
||||
|
||||
setSearchPhrase(searchPhrase: string) {
|
||||
console.log(searchPhrase);
|
||||
this.searchPhrase = searchPhrase;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user