From 882bb5ad604e9dbabcb6b385323d3437c12501fe Mon Sep 17 00:00:00 2001 From: 4gray Date: Sat, 4 Feb 2023 22:35:44 +0100 Subject: [PATCH] refactor: extract channel-list-item to own component --- .../channel-list-container.component.html | 113 +++++++----------- .../channel-list-container.component.scss | 23 ---- .../channel-list-item.component.scss | 26 ++++ .../channel-list-item.component.ts | 37 ++++++ src/app/player/player.module.ts | 2 + 5 files changed, 109 insertions(+), 92 deletions(-) create mode 100644 src/app/player/components/channel-list-container/channel-list-item/channel-list-item.component.scss create mode 100644 src/app/player/components/channel-list-container/channel-list-item/channel-list-item.component.ts diff --git a/src/app/player/components/channel-list-container/channel-list-container.component.html b/src/app/player/components/channel-list-container/channel-list-container.component.html index ba1ccfb41..49a7e83e5 100644 --- a/src/app/player/components/channel-list-container/channel-list-container.component.html +++ b/src/app/player/components/channel-list-container/channel-list-container.component.html @@ -20,32 +20,26 @@ - - -

- {{ - i + 1 + '. ' + channel?.name || - ('CHANNELS.UNNAMED_CHANNEL' | translate) - }} -

- -
+ +
@@ -71,30 +65,22 @@ ({{ groups.value.length }}) - - -

- {{ - i + 1 + '. ' + channel?.name || - ('CHANNELS.UNNAMED_CHANNEL' - | translate) - }} -

- -
+ +
@@ -114,34 +100,23 @@ id="favorites-list" > - - -

- {{ - i + 1 + '. ' + channel?.name || - ('CHANNELS.UNNAMED_CHANNEL' | translate) - }} -

- - -
+ + +
+ +

+ {{ name }} +

+ +
`, +}) +export class ChannelListItemComponent { + @Input() logo!: string; + @Input() name = ''; + @Input() showFavoriteButton = false; + @Input() selected = false; + + @Output() clicked = new EventEmitter(); + @Output() favoriteToggled = new EventEmitter(); +} diff --git a/src/app/player/player.module.ts b/src/app/player/player.module.ts index ae7114834..f47a1c0d9 100644 --- a/src/app/player/player.module.ts +++ b/src/app/player/player.module.ts @@ -4,6 +4,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { SharedModule } from '../shared/shared.module'; import { ChannelListContainerComponent } from './components/channel-list-container/channel-list-container.component'; +import { ChannelListItemComponent } from './components/channel-list-container/channel-list-item/channel-list-item.component'; import { EpgItemDescriptionComponent } from './components/epg-list/epg-item-description/epg-item-description.component'; import { EpgListItemComponent } from './components/epg-list/epg-list-item/epg-list-item.component'; import { EpgListComponent } from './components/epg-list/epg-list.component'; @@ -24,6 +25,7 @@ const routes: Routes = [{ path: '', component: VideoPlayerComponent }]; ], declarations: [ ChannelListContainerComponent, + ChannelListItemComponent, EpgItemDescriptionComponent, EpgListComponent, EpgListItemComponent,