From f05469cc4457b8a4498accc9332d606e3bdc49b5 Mon Sep 17 00:00:00 2001 From: 4gray Date: Thu, 27 Nov 2025 08:20:54 +0100 Subject: [PATCH] feat(ui): extract channel list item template and add EPG dialog --- .../channel-list-item.component.html | 80 +++++++++++++++++++ .../channel-list-item.component.scss | 31 +++++++ .../channel-list-item.component.ts | 79 ++++-------------- 3 files changed, 128 insertions(+), 62 deletions(-) create mode 100644 libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.html diff --git a/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.html b/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.html new file mode 100644 index 000000000..f9b43119e --- /dev/null +++ b/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.html @@ -0,0 +1,80 @@ +
+ @if (isDraggable) { + drag_indicator + } +
+ @if (logo) { + + } +
+
{{ name }}
+ @if (showEpg) { +
+
+ @if (epgProgram) { +
+ {{ epgProgram.title?.[0]?.value }} +
+
+ {{ formatTime(epgProgram.start) }} - + {{ formatTime(epgProgram.stop) }} +
+
+
+
+ } @else { +
+ {{ 'EPG.NO_PROGRAM_INFO' | translate }} +
+ } +
+ @if (epgProgram) { + + } +
+ } +
+
+ @if (showFavoriteButton) { + + } +
diff --git a/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.scss b/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.scss index 89fef133b..1e053113a 100644 --- a/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.scss +++ b/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.scss @@ -1,5 +1,6 @@ // Main channel list item container .channel-list-item { + width: 360px; display: flex; align-items: center; height: 68px; @@ -75,6 +76,7 @@ gap: 2px; flex: 1; min-width: 0; // Allow text truncation + overflow: visible; } // Channel name @@ -90,6 +92,25 @@ max-width: 100%; } +// EPG container - holds EPG content and info button +.epg-container { + display: flex; + align-items: center; + gap: 8px; + width: 100%; + overflow: visible; +} + +// EPG content area +.epg-content { + display: flex; + flex-direction: column; + gap: 2px; + flex: 1; + min-width: 0; + overflow: hidden; // Allow text truncation within content +} + // EPG title (program name) .epg-title { font-family: @@ -168,3 +189,13 @@ .favorite-button { flex-shrink: 0; } + +// Program info button +.program-info-button { + flex-shrink: 0; + opacity: 0.7; + + &:hover { + opacity: 1; + } +} diff --git a/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.ts b/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.ts index 43523658c..30f442de0 100644 --- a/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.ts +++ b/libs/ui/components/src/lib/channel-list-container/channel-list-item/channel-list-item.component.ts @@ -1,5 +1,5 @@ import { DragDropModule } from '@angular/cdk/drag-drop'; -import { NgIf, NgStyle } from '@angular/common'; +import { NgStyle } from '@angular/common'; import { ChangeDetectionStrategy, ChangeDetectorRef, @@ -14,87 +14,30 @@ import { SimpleChanges, } from '@angular/core'; import { MatIconButton } from '@angular/material/button'; +import { MatDialog } from '@angular/material/dialog'; import { MatIcon } from '@angular/material/icon'; -import { MatListModule } from '@angular/material/list'; import { MatTooltip } from '@angular/material/tooltip'; import { TranslatePipe } from '@ngx-translate/core'; import { EpgProgram } from 'shared-interfaces'; +import { EpgItemDescriptionComponent } from '../../epg-list/epg-item-description/epg-item-description.component'; @Component({ selector: 'app-channel-list-item', styleUrls: ['./channel-list-item.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, - template: `
- drag_indicator -
- -
-
{{ name }}
- @if (showEpg) { - @if (epgProgram) { -
- {{ epgProgram.title?.[0]?.value }} -
-
- {{ formatTime(epgProgram.start) }} - {{ formatTime(epgProgram.stop) }} -
-
-
-
- } @else { -
- {{ 'EPG.NO_PROGRAM_INFO' | translate }} -
- } - } -
-
- -
`, + templateUrl: './channel-list-item.component.html', imports: [ DragDropModule, MatIcon, MatIconButton, MatTooltip, - NgIf, NgStyle, TranslatePipe, ], }) export class ChannelListItemComponent implements OnInit, OnChanges, OnDestroy { private readonly cdr = inject(ChangeDetectorRef); + private readonly dialog = inject(MatDialog); @Input() isDraggable = false; @Input() logo!: string; @@ -165,4 +108,16 @@ export class ChannelListItemComponent implements OnInit, OnChanges, OnDestroy { hour12: false, }); } + + /** + * Opens the dialog with details about the current EPG program + * @param program EPG program to show details for + * @param event Mouse event to stop propagation + */ + showProgramDescription(program: EpgProgram, event: MouseEvent): void { + event.stopPropagation(); + this.dialog.open(EpgItemDescriptionComponent, { + data: program, + }); + } }