refactor: some cosmetic improvements

This commit is contained in:
4gray committed 2020-11-28 18:30:52 +01:00
1 parent 1bc75d93a8
commit a4ed0a07f4
3 files changed
+7 -11

No files matched your search

@@ -40,7 +40,7 @@
</mat-tab>
<mat-tab label="Groups">
<mat-nav-list id="channels-list">
<mat-nav-list id="groups-list">
<mat-accordion multi>
<ng-container *ngFor="let groups of groupedChannels | keyvalue">
<mat-expansion-panel>
@@ -73,7 +73,10 @@
</mat-tab>
<mat-tab label="Favorites">
<mat-nav-list *ngIf="favorites$ | async as favorites">
<mat-nav-list
*ngIf="favorites$ | async as favorites"
id="favorites-list"
>
<mat-list-item
*ngFor="
let channel of favorites | filterBy: searchTerm;
+1 -1
View File
@@ -129,7 +129,7 @@ export class HomeComponent {
this.channelStore.reset();
const favorites = playlist.favorites || [];
const channels = playlist.playlist.items.map((element) =>
createChannel(element, favorites)
createChannel(element)
);
this.channelStore.upsertMany(channels);
this.channelStore.update(() => ({
+1 -8
View File
@@ -1,5 +1,3 @@
import { ID, guid } from '@datorama/akita';
/**
* Represents channel object
* TODO: define channel interface in iptv-parser library
@@ -11,22 +9,17 @@ export interface Channel {
group: {
title: string;
};
fav: boolean;
}
/**
* Creates new channel object based on the given fields
* @param params partial channel object
*/
export function createChannel(
params: Partial<Channel>,
favoritesList: string[]
) {
export function createChannel(params: Partial<Channel>): Channel {
return {
id: params.url,
name: params.name,
group: params.group,
url: params.url,
fav: favoritesList.includes(params.url),
} as Channel;
}