refactor: typings improvement

This commit is contained in:
4gray committed 2021-02-27 11:56:25 +01:00
1 parent f6d4bfb9cc
commit 78aa2f5bc0
3 files changed
+7 -12

No files matched your search

+4 -4
View File
@@ -7,6 +7,9 @@ import { MatSnackBar } from '@angular/material/snack-bar';
import { Playlist } from './playlist.interface';
import { ElectronService } from '../services/electron.service';
/** Type to describe meta data of a playlist */
export type PlaylistMeta = Pick<Playlist, 'count' | 'title' | 'filename' | '_id' | 'url' | 'importDate'>;
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
@@ -14,10 +17,7 @@ import { ElectronService } from '../services/electron.service';
})
export class HomeComponent {
/** Added playlists */
playlists: Pick<
Playlist,
'count' | 'title' | 'filename' | '_id' | 'url' | 'importDate'
>[] = [];
playlists: PlaylistMeta[] = [];
/** Loading spinner state */
isLoading = false;
/** IPC Renderer commands list with callbacks */
@@ -2,6 +2,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Playlist } from '../playlist.interface';
import { MatDialog } from '@angular/material/dialog';
import { PlaylistInfoComponent } from './playlist-info/playlist-info.component';
import { PlaylistMeta } from './../home.component';
@Component({
selector: 'app-recent-playlists',
@@ -10,7 +11,7 @@ import { PlaylistInfoComponent } from './playlist-info/playlist-info.component';
})
export class RecentPlaylistsComponent {
/** All available playlists */
@Input() playlists: Playlist[];
@Input() playlists: PlaylistMeta[];
/** Emits on playlist selection */
@Output() playlistClicked: EventEmitter<string> = new EventEmitter();
@@ -31,7 +32,7 @@ export class RecentPlaylistsComponent {
* Opens the details dialog with the information about the provided playlist
* @param data selected playlist
*/
openInfoDialog(data: Playlist): void {
openInfoDialog(data: PlaylistMeta): void {
this.dialog.open(PlaylistInfoComponent, {
data,
});
@@ -3,7 +3,6 @@ import { ChannelQuery, Channel, ChannelStore } from '../../../state';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
import { MatSidenav } from '@angular/material/sidenav';
import { ElectronService } from '../../../services/electron.service';
import { StorageMap } from '@ngx-pwa/local-storage';
import {
Settings,
@@ -47,21 +46,16 @@ export class VideoPlayerComponent implements OnInit {
/** Sidebar object */
@ViewChild('sidenav') sideNav: MatSidenav;
// DEV
epgPrograms = [];
/**
* Creates an instance of VideoPlayerComponent
* @param channelQuery akita's channel query
* @param channelStore akita's channel store
* @param electronService electron service
* @param storage browser storage service
* @param snackBar service to push snackbar notifications
*/
constructor(
private channelQuery: ChannelQuery,
private channelStore: ChannelStore,
private electronService: ElectronService,
private snackBar: MatSnackBar,
private storage: StorageMap
) {}