mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
feat(multi-epg): redesign multi-EPG styles with modern dark theme
Revamp the Multi-EPG component stylesheet to introduce a polished, broadcast-control-room inspired dark theme and improved layout styling. - Add Google fonts (Outfit, JetBrains Mono) for a clean UI and mono date display. - Introduce color variables, gradients and accents for consistent theming and easier maintenance. - Rework base container (.parent) with subtle grid overlay and updated typography. - Implement a frosted glass navigation bar (#epg-navigation) with blur, glow, and accessible button styles. - Add today-date styling using a monospace font and glowing accent. - Expand channels column width, update background, borders, shadows, and hover transitions for clearer channel separation. - Replace many hard-coded colors with variables and add transitions for smoother interactions. - Add utility classes for navigation buttons and improved disabled/ hover states. These changes improve visual hierarchy, accessibility, and maintainabiity of the EPG UI while setting up a consistent design system for further enhancements.
This commit is contained in:
1 parent
9073bf1bb3
commit
6a8ea69492
4 files changed
+496
-155
No files matched your search
@@ -335,6 +335,13 @@ export class VideoPlayerComponent implements OnInit {
|
||||
selectChannels
|
||||
) as Observable<Channel[]>;
|
||||
|
||||
// Pass the active channel's tvg.id for highlighting
|
||||
this.activeChannel$.pipe(take(1)).subscribe((channel) => {
|
||||
if (channel) {
|
||||
componentRef.instance.activeChannelId = (channel as Channel).tvg?.id || null;
|
||||
}
|
||||
});
|
||||
|
||||
this.overlayRef.backdropClick().subscribe(() => {
|
||||
this.overlayRef.dispose();
|
||||
});
|
||||
|
||||
@@ -1,60 +1,41 @@
|
||||
<div id="epg-navigation">
|
||||
<button
|
||||
[matTooltip]="'CLOSE' | translate"
|
||||
mat-button
|
||||
mat-icon-button
|
||||
(click)="close()"
|
||||
color="accent"
|
||||
>
|
||||
<mat-icon>close</mat-icon> {{ 'CLOSE' | translate }}
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
[matTooltip]="'EPG.PREVIOUS_DAY' | translate"
|
||||
mat-icon-button
|
||||
(click)="switchDay('prev')"
|
||||
>
|
||||
<mat-icon>navigate_before</mat-icon>
|
||||
<mat-icon>chevron_left</mat-icon>
|
||||
</button>
|
||||
<div class="today-date">
|
||||
{{ today | momentDate: 'YYYYMMDD' : 'MMMM Do, dddd' }}
|
||||
</div>
|
||||
<button
|
||||
[matTooltip]="'EPG.NEXT_DAY' | translate"
|
||||
mat-icon-button
|
||||
(click)="switchDay('next')"
|
||||
>
|
||||
<mat-icon>navigate_next</mat-icon>
|
||||
<mat-icon>chevron_right</mat-icon>
|
||||
</button>
|
||||
<div class="today-date">
|
||||
{{ today | momentDate: 'YYYYMMDD' : 'MMMM Do, dddd' }}
|
||||
</div>
|
||||
<button mat-icon-button (click)="zoomIn()" [disabled]="(hourWidth$ | async)! >= 800">
|
||||
<mat-icon>zoom_in</mat-icon>
|
||||
<button mat-icon-button (click)="zoomOut()" [disabled]="(hourWidth$ | async)! <= 50" matTooltip="Zoom out">
|
||||
<mat-icon>remove</mat-icon>
|
||||
</button>
|
||||
<button mat-icon-button [disabled]="(hourWidth$ | async)! <= 50" (click)="zoomOut()">
|
||||
<mat-icon>zoom_out</mat-icon>
|
||||
<button mat-icon-button (click)="zoomIn()" [disabled]="(hourWidth$ | async)! >= 800" matTooltip="Zoom in">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<div class="navigation-buttons">
|
||||
<button
|
||||
mat-button
|
||||
(click)="previousChannels()"
|
||||
[disabled]="channelsLowerRange === 0"
|
||||
matTooltip="Previous channels"
|
||||
>
|
||||
<mat-icon>keyboard_arrow_up</mat-icon> Previous channels
|
||||
</button>
|
||||
<button
|
||||
mat-button
|
||||
(click)="nextChannels()"
|
||||
[disabled]="isLastPage"
|
||||
matTooltip="Next channels"
|
||||
>
|
||||
<mat-icon>keyboard_arrow_down</mat-icon> Next channels
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="parent" #epgContainer>
|
||||
<svg id="channels-column">
|
||||
<div class="parent" #epgContainer (scroll)="onScroll($event)">
|
||||
<svg id="channels-column" [attr.height]="(channels$ | async)!.length * barHeight + barHeight + 50">
|
||||
@for (item of channels$ | async; track item.id; let i = $index) {
|
||||
<g>
|
||||
<!-- channel name -->
|
||||
<g class="channel">
|
||||
<g class="channel" [class.active]="item.id === activeChannelId">
|
||||
<rect
|
||||
width="100"
|
||||
[attr.height]="barHeight"
|
||||
@@ -81,8 +62,8 @@
|
||||
</g>
|
||||
}
|
||||
</svg>
|
||||
<div id="epg-container">
|
||||
<svg [attr.width]="(hourWidth$ | async)! * 24" height="100%" id="epg-svg">
|
||||
<div id="epg-container" [style.height.px]="(channels$ | async)!.length * barHeight + barHeight + 50">
|
||||
<svg [attr.width]="(hourWidth$ | async)! * 24" [attr.height]="(channels$ | async)!.length * barHeight + barHeight + 50" id="epg-svg">
|
||||
<!-- time headline -->
|
||||
@for (hour of timeHeader; track hour) {
|
||||
<g>
|
||||
@@ -102,12 +83,20 @@
|
||||
>
|
||||
{{ hour }}:00
|
||||
</text>
|
||||
<!-- vertical hour separator line -->
|
||||
<line
|
||||
[attr.x1]="hour * (hourWidth$ | async)!"
|
||||
[attr.y1]="barHeight"
|
||||
[attr.x2]="hour * (hourWidth$ | async)!"
|
||||
[attr.y2]="(channels$ | async)!.length * barHeight + barHeight"
|
||||
class="hour-separator"
|
||||
></line>
|
||||
</g>
|
||||
}
|
||||
|
||||
<!-- epg channels with programs -->
|
||||
@for (item of channels$ | async; track item.id; let i = $index) {
|
||||
<g>
|
||||
<g [class.active-row]="item.id === activeChannelId">
|
||||
@for (program of item.programs; track trackByProgram($index, program)) {
|
||||
<g
|
||||
[attr.transform]="'translate(' + program.startPosition + ',' + (barHeight * i + barHeight) + ')'"
|
||||
|
||||
@@ -1,18 +1,340 @@
|
||||
// Import distinctive fonts
|
||||
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');
|
||||
|
||||
// Color palette - Broadcast control room aesthetic
|
||||
$bg-deep: #0a0a0f;
|
||||
$bg-surface: #12121a;
|
||||
$bg-elevated: #1a1a24;
|
||||
$bg-hover: #24243a;
|
||||
$border-subtle: rgba(255, 255, 255, 0.06);
|
||||
$border-medium: rgba(255, 255, 255, 0.12);
|
||||
|
||||
// Accent colors - TV broadcast vibes
|
||||
$accent-primary: #00d4aa; // Cyan/teal for time
|
||||
$accent-secondary: #8b5cf6; // Purple for programs
|
||||
$accent-tertiary: #f472b6; // Pink for highlights
|
||||
$accent-warning: #fbbf24;
|
||||
|
||||
// Text colors
|
||||
$text-primary: #f8fafc;
|
||||
$text-secondary: rgba(248, 250, 252, 0.7);
|
||||
$text-muted: rgba(248, 250, 252, 0.4);
|
||||
|
||||
// Gradients
|
||||
$gradient-program: linear-gradient(
|
||||
135deg,
|
||||
rgba(139, 92, 246, 0.15) 0%,
|
||||
rgba(139, 92, 246, 0.05) 100%
|
||||
);
|
||||
$gradient-program-hover: linear-gradient(
|
||||
135deg,
|
||||
rgba(139, 92, 246, 0.3) 0%,
|
||||
rgba(139, 92, 246, 0.15) 100%
|
||||
);
|
||||
$gradient-header: linear-gradient(
|
||||
180deg,
|
||||
rgba(0, 212, 170, 0.08) 0%,
|
||||
transparent 100%
|
||||
);
|
||||
|
||||
// Base container
|
||||
.parent {
|
||||
display: flex;
|
||||
background: $bg-deep;
|
||||
color: $text-primary;
|
||||
font-family: 'Outfit', sans-serif;
|
||||
position: relative;
|
||||
overflow-y: auto;
|
||||
height: calc(100vh - 56px);
|
||||
|
||||
// Custom scrollbar for vertical scroll
|
||||
&::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background: $bg-surface;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(139, 92, 246, 0.4);
|
||||
border-radius: 4px;
|
||||
|
||||
&:hover {
|
||||
background: rgba(139, 92, 246, 0.6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Navigation toolbar - Frosted glass effect
|
||||
#epg-navigation {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px 16px;
|
||||
background: rgba(18, 18, 26, 0.85);
|
||||
backdrop-filter: blur(20px);
|
||||
border-bottom: 1px solid $border-medium;
|
||||
gap: 8px;
|
||||
position: relative;
|
||||
|
||||
// Subtle glow at bottom
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
transparent 0%,
|
||||
rgba(0, 212, 170, 0.3) 20%,
|
||||
rgba(139, 92, 246, 0.3) 80%,
|
||||
transparent 100%
|
||||
);
|
||||
}
|
||||
|
||||
// Button styling
|
||||
button {
|
||||
font-family: 'Outfit', sans-serif;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.02em;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:not([disabled]):hover {
|
||||
background: rgba(139, 92, 246, 0.15);
|
||||
}
|
||||
|
||||
&[disabled] {
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
mat-icon {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Today's date display
|
||||
.today-date {
|
||||
flex: 1;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: $accent-primary;
|
||||
text-align: center;
|
||||
padding: 0 24px;
|
||||
letter-spacing: 0.05em;
|
||||
text-transform: uppercase;
|
||||
|
||||
// Glowing text effect
|
||||
text-shadow: 0 0 20px rgba(0, 212, 170, 0.3);
|
||||
}
|
||||
|
||||
// Channel column
|
||||
#channels-column {
|
||||
width: 140px;
|
||||
flex: none;
|
||||
border-right: 1px solid $border-medium;
|
||||
background: $bg-surface;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
min-height: calc(100vh - 6px);
|
||||
|
||||
// Subtle shadow for depth
|
||||
box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
|
||||
|
||||
.channel {
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
|
||||
rect {
|
||||
fill: $bg-surface;
|
||||
stroke: $border-subtle;
|
||||
transition: fill 0.15s ease;
|
||||
}
|
||||
|
||||
&:hover rect {
|
||||
fill: $bg-elevated;
|
||||
}
|
||||
|
||||
&.active rect {
|
||||
fill: rgba(139, 92, 246, 0.2);
|
||||
stroke: rgba(139, 92, 246, 0.4);
|
||||
}
|
||||
|
||||
&.active .channel-name {
|
||||
color: $accent-secondary;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
color: $text-primary;
|
||||
padding: 8px 12px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
letter-spacing: 0.02em;
|
||||
|
||||
img {
|
||||
border-radius: 4px;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
object-fit: contain;
|
||||
background: $bg-elevated;
|
||||
}
|
||||
}
|
||||
|
||||
// EPG container
|
||||
#epg-container {
|
||||
width: calc(100vw - 140px);
|
||||
overflow-x: scroll;
|
||||
overflow-y: clip;
|
||||
background: $bg-deep;
|
||||
min-height: calc(100vh - 6px);
|
||||
|
||||
// Custom scrollbar
|
||||
&::-webkit-scrollbar {
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background: $bg-surface;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(139, 92, 246, 0.4);
|
||||
border-radius: 4px;
|
||||
|
||||
&:hover {
|
||||
background: rgba(139, 92, 246, 0.6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EPG SVG container
|
||||
#epg-svg {
|
||||
// Time header styling
|
||||
g > rect[fill='#000'] {
|
||||
fill: $bg-surface !important;
|
||||
}
|
||||
|
||||
g > text {
|
||||
font-family: 'JetBrains Mono', monospace !important;
|
||||
font-size: 11px !important;
|
||||
font-weight: 500;
|
||||
fill: $text-secondary !important;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
|
||||
// Hour separator vertical lines
|
||||
.hour-separator {
|
||||
stroke: $border-subtle;
|
||||
stroke-width: 1px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
// Program blocks
|
||||
.program {
|
||||
cursor: pointer;
|
||||
|
||||
rect {
|
||||
fill: $bg-elevated;
|
||||
stroke: $border-subtle;
|
||||
rx: 4;
|
||||
ry: 4;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
&:hover rect {
|
||||
fill: $bg-hover;
|
||||
stroke: rgba(139, 92, 246, 0.4);
|
||||
filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.2));
|
||||
}
|
||||
}
|
||||
|
||||
// Active channel row highlighting
|
||||
.active-row .program rect {
|
||||
fill: rgba(139, 92, 246, 0.15);
|
||||
stroke: rgba(139, 92, 246, 0.3);
|
||||
}
|
||||
|
||||
.active-row .program:hover rect {
|
||||
fill: rgba(139, 92, 246, 0.25);
|
||||
}
|
||||
|
||||
.program-title {
|
||||
color: $text-primary;
|
||||
padding: 6px 10px;
|
||||
font-size: 11px;
|
||||
font-weight: 400;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
pointer-events: none;
|
||||
letter-spacing: 0.01em;
|
||||
line-height: 1.4;
|
||||
|
||||
// Subtle gradient text for depth
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
// Current time line - glowing effect
|
||||
line[stroke='red'] {
|
||||
stroke: $accent-primary !important;
|
||||
stroke-width: 2px;
|
||||
filter: drop-shadow(0 0 8px rgba(0, 212, 170, 0.6))
|
||||
drop-shadow(0 0 16px rgba(0, 212, 170, 0.3));
|
||||
|
||||
// Animated pulse
|
||||
animation: timePulse 2s ease-in-out infinite;
|
||||
}
|
||||
}
|
||||
|
||||
// Pulse animation for time line
|
||||
@keyframes timePulse {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
filter: drop-shadow(0 0 8px rgba(0, 212, 170, 0.6))
|
||||
drop-shadow(0 0 16px rgba(0, 212, 170, 0.3));
|
||||
}
|
||||
50% {
|
||||
opacity: 0.8;
|
||||
filter: drop-shadow(0 0 12px rgba(0, 212, 170, 0.8))
|
||||
drop-shadow(0 0 24px rgba(0, 212, 170, 0.4));
|
||||
}
|
||||
}
|
||||
|
||||
// Legacy classes cleanup
|
||||
.program-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
rect {
|
||||
stroke: #676767;
|
||||
stroke: $border-subtle;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.channel > rect {
|
||||
stroke: #676767;
|
||||
}
|
||||
|
||||
.program-item:hover > rect {
|
||||
fill: #333;
|
||||
stroke: $border-subtle;
|
||||
}
|
||||
|
||||
.program-name,
|
||||
@@ -23,112 +345,121 @@ rect {
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
padding: 6px 2px;
|
||||
}
|
||||
|
||||
#epg-container {
|
||||
width: calc(100vw - 100px);
|
||||
height: calc(100vh - 42px);
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.parent {
|
||||
display: flex;
|
||||
background-color: black;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#channels-column {
|
||||
width: 100px;
|
||||
flex: none;
|
||||
border-right: 2px solid #ccc;
|
||||
|
||||
.channel {
|
||||
cursor: pointer;
|
||||
|
||||
rect {
|
||||
fill: #2d2d2d;
|
||||
stroke: #3d3d3d;
|
||||
}
|
||||
|
||||
&:hover rect {
|
||||
fill: #3d3d3d;
|
||||
}
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
color: white;
|
||||
padding: 4px 8px;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
image {
|
||||
object-fit: contain;
|
||||
background: #2d2d2d;
|
||||
}
|
||||
}
|
||||
|
||||
/* .channel-name {
|
||||
margin: 0 5px;
|
||||
text-align: center;
|
||||
} */
|
||||
|
||||
#epg-navigation {
|
||||
display: flex;
|
||||
background-color: white;
|
||||
border-bottom: 2px solid #fff;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#epg-svg {
|
||||
.program {
|
||||
cursor: pointer;
|
||||
|
||||
rect {
|
||||
fill: #2d2d2d;
|
||||
stroke: #3d3d3d;
|
||||
}
|
||||
|
||||
&:hover rect {
|
||||
fill: #3d3d3d;
|
||||
}
|
||||
}
|
||||
|
||||
.program-title {
|
||||
color: white;
|
||||
padding: 4px 8px;
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.today-date {
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
line-height: 40px;
|
||||
height: 40px;
|
||||
padding: 0 20px;
|
||||
padding: 6px 8px;
|
||||
}
|
||||
|
||||
#current-time-line {
|
||||
stroke-width: 2px;
|
||||
stroke: white;
|
||||
stroke: $accent-primary;
|
||||
}
|
||||
|
||||
// Dark theme override (already dark, but ensure consistency)
|
||||
::ng-deep {
|
||||
.dark-theme {
|
||||
#epg-navigation {
|
||||
background-color: black;
|
||||
background: rgba(18, 18, 26, 0.85);
|
||||
}
|
||||
}
|
||||
|
||||
// Light theme adjustments
|
||||
.light-theme {
|
||||
#epg-navigation {
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
border-bottom-color: rgba(0, 0, 0, 0.1);
|
||||
|
||||
.today-date {
|
||||
color: #059669;
|
||||
text-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
.parent {
|
||||
background: #f8fafc;
|
||||
|
||||
&::before {
|
||||
background-image:
|
||||
linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
|
||||
linear-gradient(
|
||||
90deg,
|
||||
rgba(0, 0, 0, 0.03) 1px,
|
||||
transparent 1px
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#channels-column {
|
||||
background: #ffffff;
|
||||
border-right-color: rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
|
||||
|
||||
.channel rect {
|
||||
fill: #ffffff;
|
||||
stroke: rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.channel:hover rect {
|
||||
fill: #f1f5f9;
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
color: #1e293b;
|
||||
}
|
||||
}
|
||||
|
||||
#epg-container {
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
#epg-svg {
|
||||
g > rect[fill='#000'] {
|
||||
fill: #e2e8f0 !important;
|
||||
}
|
||||
|
||||
g > text {
|
||||
fill: #64748b !important;
|
||||
}
|
||||
|
||||
.program {
|
||||
rect {
|
||||
fill: #ffffff;
|
||||
stroke: rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
&:hover rect {
|
||||
fill: #f1f5f9;
|
||||
stroke: rgba(139, 92, 246, 0.4);
|
||||
}
|
||||
}
|
||||
|
||||
.program-title {
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
line[stroke='red'] {
|
||||
stroke: #059669 !important;
|
||||
filter: drop-shadow(0 0 6px rgba(5, 150, 105, 0.4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Responsive adjustments
|
||||
@media (max-width: 768px) {
|
||||
#channels-column {
|
||||
width: 100px;
|
||||
|
||||
.channel-name {
|
||||
font-size: 10px;
|
||||
padding: 6px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
#epg-container {
|
||||
width: calc(100vw - 100px);
|
||||
}
|
||||
|
||||
.today-date {
|
||||
font-size: 12px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
}
|
||||
@@ -62,12 +62,19 @@ export class MultiEpgContainerComponent
|
||||
|
||||
if (value) {
|
||||
this.playlistChannelsSubscription = value.subscribe(() => {
|
||||
// Reset data for new playlist
|
||||
this.channelsLowerRange = 0;
|
||||
this.originalEpgData = [];
|
||||
this.channels$.next([]);
|
||||
this.isLastPage = false;
|
||||
this.initializeVisibleChannels();
|
||||
this.requestPrograms();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Input() activeChannelId: string | null = null;
|
||||
|
||||
readonly timeHeader = Array.from({ length: 24 }, (_, i) => i);
|
||||
readonly hourWidth$ = new BehaviorSubject<number>(150);
|
||||
readonly barHeight = 50;
|
||||
@@ -85,6 +92,7 @@ export class MultiEpgContainerComponent
|
||||
private playlistChannelsSubscription?: Subscription;
|
||||
|
||||
isLastPage = false;
|
||||
isLoading = false;
|
||||
totalChannels = 0;
|
||||
|
||||
private readonly dialog = inject(MatDialog);
|
||||
@@ -161,6 +169,12 @@ export class MultiEpgContainerComponent
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isLoading || this.isLastPage) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isLoading = true;
|
||||
|
||||
try {
|
||||
const response = await window.electron.getEpgChannelsByRange(
|
||||
this.channelsLowerRange,
|
||||
@@ -168,35 +182,35 @@ export class MultiEpgContainerComponent
|
||||
);
|
||||
|
||||
if (response && Array.isArray(response)) {
|
||||
this.originalEpgData = response;
|
||||
// Append new data to existing data
|
||||
this.originalEpgData = [...this.originalEpgData, ...response];
|
||||
this.channels$.next(this.enrichProgramData());
|
||||
|
||||
// Update isLastPage based on the number of channels received
|
||||
this.isLastPage = response.length < this.visibleChannels;
|
||||
|
||||
// Update range for next fetch
|
||||
this.channelsLowerRange += response.length;
|
||||
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching EPG data:', error);
|
||||
} finally {
|
||||
this.isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
nextChannels(): void {
|
||||
this.channelsLowerRange += this.visibleChannels;
|
||||
this.channelsUpperRange =
|
||||
this.channelsLowerRange + this.visibleChannels;
|
||||
onScroll(event: Event): void {
|
||||
const target = event.target as HTMLElement;
|
||||
const scrollTop = target.scrollTop;
|
||||
const scrollHeight = target.scrollHeight;
|
||||
const clientHeight = target.clientHeight;
|
||||
|
||||
this.requestPrograms();
|
||||
}
|
||||
|
||||
previousChannels(): void {
|
||||
this.channelsLowerRange = Math.max(
|
||||
0,
|
||||
this.channelsLowerRange - this.visibleChannels
|
||||
);
|
||||
this.channelsUpperRange =
|
||||
this.channelsLowerRange + this.visibleChannels;
|
||||
this.requestPrograms();
|
||||
// Load more when user scrolls to within 200px of the bottom
|
||||
if (scrollHeight - scrollTop - clientHeight < 200) {
|
||||
this.requestPrograms();
|
||||
}
|
||||
}
|
||||
|
||||
private getCachedDate(dateStr: string): Date {
|
||||
|
||||
Reference in new issue
Block a user