Merge pull request #659 from 4gray/feat-info-overlay-no-epg-layout

feat-info-overlay-no-epg-layout
This commit is contained in:
4gray authored and GitHub committed 2025-11-23 19:50:27 +01:00
commit 97aa1d4a59
31 files changed
+1706 -478

No files matched your search

+5 -1
View File
@@ -9,5 +9,9 @@
],
"deny": [],
"ask": []
}
},
"enabledMcpjsonServers": [
"nx-mcp"
],
"enableAllProjectMcpServers": true
}
+1 -1
View File
@@ -41,7 +41,7 @@ jobs:
run: pnpm install --no-frozen-lockfile
- name: Build frontend
run: npm run build:frontend
run: npx nx build web --skip-nx-cache
- name: Build backend
run: npm run build:backend
+9
View File
@@ -0,0 +1,9 @@
{
"mcpServers": {
"nx-mcp": {
"type": "stdio",
"command": "npx",
"args": ["nx", "mcp"]
}
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"recommendations": ["ms-playwright.playwright", "esbenp.prettier-vscode"]
}
+83 -45
View File
@@ -94,23 +94,25 @@ This is an Nx monorepo with the following structure:
- **apps/electron-backend** - Electron main process
- **apps/web-e2e** - Playwright end-to-end tests
- **libs/** - Shared libraries:
- **m3u-state** - NgRx state management for playlists
- **services** - Abstract DataService and implementations
- **shared/interfaces** - TypeScript interfaces and types
- **shared/m3u-utils** - M3U playlist utilities
- **ui/components** - Reusable UI components
- **ui/pipes** - Angular pipes
- **ui/shared-portals** - Portal-related UI components
- **m3u-state** - NgRx state management for playlists
- **services** - Abstract DataService and implementations
- **shared/interfaces** - TypeScript interfaces and types
- **shared/m3u-utils** - M3U playlist utilities
- **ui/components** - Reusable UI components
- **ui/pipes** - Angular pipes
- **ui/shared-portals** - Portal-related UI components
### Frontend Architecture (Angular)
**State Management**: Uses NgRx for playlist state management:
- Store configuration in `apps/web/src/app/app.config.ts`
- Playlist state, actions, effects, and reducers in `libs/m3u-state/`
- Entity adapter pattern for managing playlists collection
- Router store integration for route-based state
**Routing**: Lazy-loaded routes in `apps/web/src/app/app.routes.ts`
- Home/playlists overview: `/`
- Video player: `/playlists/:id` or `/iptv`
- Xtream Codes: `/xtreams/:id` (different routes for Electron vs web)
@@ -118,85 +120,96 @@ This is an Nx monorepo with the following structure:
- Settings: `/settings`
**Service Architecture** (Factory Pattern):
- Abstract `DataService` class in `libs/services/src/lib/data.service.ts` defines the contract
- Two environment-specific implementations:
- `ElectronService` (`apps/web/src/app/services/electron.service.ts`) - Uses IPC to communicate with Electron backend
- `PwaService` (`apps/web/src/app/services/pwa.service.ts`) - Uses HTTP API and IndexedDB for standalone web version
- `ElectronService` (`apps/web/src/app/services/electron.service.ts`) - Uses IPC to communicate with Electron backend
- `PwaService` (`apps/web/src/app/services/pwa.service.ts`) - Uses HTTP API and IndexedDB for standalone web version
- Factory function `DataFactory()` in `apps/web/src/app/app.config.ts` determines which implementation to inject:
```typescript
if (window.electron) {
return new ElectronService();
}
return new PwaService();
```
```typescript
if (window.electron) {
return new ElectronService();
}
return new PwaService();
```
**Data Storage (Environment-Specific)**:
- **Electron**: libSQL/SQLite database via Drizzle ORM
- Location: `~/.iptvnator/databases/iptvnator.db`
- Full-featured relational database with foreign keys and indexes
- Supports local file or remote Turso instance via env vars
- Location: `~/.iptvnator/databases/iptvnator.db`
- Full-featured relational database with foreign keys and indexes
- Supports local file or remote Turso instance via env vars
- **PWA (Web)**: IndexedDB via `ngx-indexed-db`
- Browser-based NoSQL storage
- Same schema structure but implemented in IndexedDB
- Limited by browser storage quotas
- Browser-based NoSQL storage
- Same schema structure but implemented in IndexedDB
- Limited by browser storage quotas
### Backend Architecture (Electron)
**Main Entry**: `apps/electron-backend/src/main.ts`
- Bootstraps Electron app and initializes database
- Registers event handlers for IPC communication
**Database**:
- **ORM**: Drizzle ORM with libSQL (local SQLite file or remote Turso)
- **Location**: `~/.iptvnator/databases/iptvnator.db` (avoids spaces in path)
- **Schema** (`apps/electron-backend/src/app/database/schema.ts`):
- `playlists` - Playlist metadata (M3U, Xtream, Stalker)
- `categories` - Content categories (live, movies, series)
- `content` - Streams/VOD/series items
- `favorites` - User favorites
- `recentlyViewed` - Watch history
- `playlists` - Playlist metadata (M3U, Xtream, Stalker)
- `categories` - Content categories (live, movies, series)
- `content` - Streams/VOD/series items
- `favorites` - User favorites
- `recentlyViewed` - Watch history
- **Connection**: `apps/electron-backend/src/app/database/connection.ts`
- Auto-creates tables on init
- Supports local file or remote via env vars (`LIBSQL_URL`, `LIBSQL_AUTH_TOKEN`)
- Auto-creates tables on init
- Supports local file or remote via env vars (`LIBSQL_URL`, `LIBSQL_AUTH_TOKEN`)
**IPC Communication**:
- **Preload script**: `apps/electron-backend/src/app/api/main.preload.ts`
- Exposes `window.electron` API via `contextBridge`
- All IPC channels defined here (playlist operations, EPG, database CRUD, external players, etc.)
- Exposes `window.electron` API via `contextBridge`
- All IPC channels defined here (playlist operations, EPG, database CRUD, external players, etc.)
- **Event handlers**: `apps/electron-backend/src/app/events/`
- `database.events.ts` - Database CRUD operations
- `playlist.events.ts` - Playlist import/update
- `epg.events.ts` - EPG fetch and parsing (uses worker)
- `xtream.events.ts` - Xtream Codes API
- `stalker.events.ts` - Stalker portal API
- `player.events.ts` - External player (MPV, VLC) integration
- `settings.events.ts` - App settings
- `electron.events.ts` - App version, etc.
- `database.events.ts` - Database CRUD operations
- `playlist.events.ts` - Playlist import/update
- `epg.events.ts` - EPG fetch and parsing (uses worker)
- `xtream.events.ts` - Xtream Codes API
- `stalker.events.ts` - Stalker portal API
- `player.events.ts` - External player (MPV, VLC) integration
- `settings.events.ts` - App settings
- `electron.events.ts` - App version, etc.
**Workers**:
- EPG parsing runs in worker thread: `apps/electron-backend/src/app/workers/epg-parser.worker.ts`
### Key Features
**Playlist Support**:
- M3U/M3U8 files (local or URL)
- Xtream Codes API (`username`, `password`, `serverUrl`)
- Stalker portal (`macAddress`, `url`)
**Video Players**:
- Built-in HTML5 player with HLS.js or Video.js
- External players: MPV, VLC (via IPC to Electron backend)
**EPG (Electronic Program Guide)**:
- XMLTV format support
- Background parsing in worker thread
- Stored in database for quick lookup
**Favorites and Recently Viewed**:
- Per-playlist favorites and global favorites
- Recently viewed tracks watch history
**Internationalization**:
- Uses `@ngx-translate` with 16 language files in `apps/web/src/assets/i18n/`
## Development Notes
@@ -204,34 +217,39 @@ This is an Nx monorepo with the following structure:
### Environment Detection and Dual-Mode Architecture
The app determines whether it's running in Electron or as a PWA by checking:
```typescript
window.electron // truthy in Electron, undefined in browser
window.electron; // truthy in Electron, undefined in browser
```
**Why Dual Mode?**
IPTVnator supports both Electron (desktop app) and PWA (web browser) to provide flexibility:
- **Electron**: Full-featured desktop experience with local database, external player support (MPV/VLC), and native file system access
- **PWA**: Lightweight web version that runs in any browser without installation
**Environment-Specific Behavior**:
- `app.config.ts` - `DataFactory()` selects DataService implementation based on environment
- `app.routes.ts` - Different routes for Xtream portals (Electron uses Tauri-based routes, PWA uses standard routes)
- Storage layer switches automatically:
- Electron → libSQL/Drizzle ORM → `~/.iptvnator/databases/iptvnator.db`
- PWA → IndexedDB → Browser storage
- Electron → libSQL/Drizzle ORM → `~/.iptvnator/databases/iptvnator.db`
- PWA → IndexedDB → Browser storage
- External player support (MPV/VLC) only available in Electron
- File system operations only available in Electron (uploading playlists from disk)
**Base Href Configuration**:
The app uses different base href values depending on the build target:
- **Development & PWA**: `baseHref="/"` (from `index.html`)
- Used by: `npm run serve:frontend`, `npm run build:frontend:pwa`
- For web servers with proper routing
- Used by: `npm run serve:frontend`, `npm run build:frontend:pwa`
- For web servers with proper routing
- **Electron Production**: `baseHref="./"` (overridden in build config)
- Used by: `npm run build:backend`, `npm run make:app`
- Required for `file://` protocol in Electron
- Used by: `npm run build:backend`, `npm run make:app`
- Required for `file://` protocol in Electron
Build configurations in `apps/web/project.json`:
- `production`: Electron build with `baseHref="./"`
- `pwa`: Web deployment with `baseHref="/"`
- `development`: Dev mode with `baseHref="/"` from index.html
@@ -248,6 +266,7 @@ The factory pattern ensures a single codebase works in both environments without
### Nx Commands
Use `nx` CLI for better performance:
```bash
nx run <project>:<target>
# Example: nx run web:build
@@ -255,6 +274,7 @@ nx run <project>:<target>
```
To run multiple projects:
```bash
nx run-many --target=test --all
```
@@ -262,6 +282,7 @@ nx run-many --target=test --all
### Electron Build Process
The Electron backend depends on the web app being built first:
- `electron-backend:build` depends on `web:build`
- Output goes to `dist/apps/electron-backend` (backend) and `dist/apps/web` (frontend)
- Packaging combines both into distributable
@@ -273,18 +294,35 @@ No formal migration system yet. Schema changes are applied via raw SQL in `conne
### Common Patterns
**IPC Communication**:
1. Define handler in appropriate events file (e.g., `database.events.ts`)
2. Register with `ipcMain.handle()` in the event bootstrap function
3. Expose in preload script via `contextBridge.exposeInMainWorld()`
4. Call from Angular via `window.electron.<methodName>()`
**Adding New Playlist Source**:
1. Add type to `libs/shared/interfaces/src/lib/playlist.interface.ts`
2. Create event handler in `apps/electron-backend/src/app/events/`
3. Add UI in `apps/web/src/app/home/`
4. Update database schema if needed
**State Management**:
- Use NgRx for global application state (playlists)
- Use component stores (`@ngrx/component-store`) for feature-specific state
- Use NgRx signals for reactive data streams
<!-- nx configuration start-->
<!-- Leave the start & end comments to automatically receive updates. -->
# General Guidelines for working with Nx
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through `nx` (i.e. `nx run`, `nx run-many`, `nx affected`) instead of using the underlying tooling directly
- You have access to the Nx MCP server and its tools, use them to help the user
- When answering questions about the repository, use the `nx_workspace` tool first to gain an understanding of the workspace architecture where applicable.
- When working in individual projects, use the `nx_project_details` mcp tool to analyze and understand the specific project structure and dependencies
- For questions around nx configuration, best practices or if you're unsure, use the `nx_docs` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
- If the user needs help with an Nx configuration or project graph error, use the `nx_workspace` tool to get any errors
<!-- nx configuration end-->
+2 -12
View File
@@ -1,6 +1,5 @@
import { BrowserWindow, screen, shell } from 'electron';
import { join } from 'path';
import { format } from 'url';
import { environment } from '../environments/environment';
import { rendererAppName, rendererAppPort } from './constants';
import { store, WINDOW_BOUNDS } from './services/store.service';
@@ -118,17 +117,8 @@ export default class App {
App.mainWindow.loadURL(`http://localhost:${rendererAppPort}`);
App.mainWindow.webContents.openDevTools();
} else {
App.mainWindow.loadURL(
format({
pathname: join(
__dirname,
'..',
rendererAppName,
'index.html'
),
protocol: 'file:',
slashes: true,
})
App.mainWindow.loadFile(
join(__dirname, '..', rendererAppName, 'index.html')
);
}
}
@@ -151,11 +151,13 @@ ipcMain.handle(AUTO_UPDATE_PLAYLISTS, async (event, playlists) => {
continue;
}
// Preserve the original _id and autoRefresh setting
// Preserve user data when updating playlist
updatedPlaylists.push({
...playlistObject,
_id: playlist._id,
autoRefresh: playlist.autoRefresh,
favorites: playlist.favorites || [], // Preserve favorites
userAgent: playlist.userAgent, // Preserve custom user agent
});
console.log(`Successfully updated playlist "${playlist.title}"`);
@@ -16,7 +16,9 @@
(toggleLeftDrawerClicked)="drawer.toggle()"
(toggleRightDrawerClicked)="drawerRight.toggle()"
(multiEpgClicked)="openMultiEpgView()"
(infoOverlayClicked)="toggleInfoOverlay()"
[activeChannel]="activeChannel"
[isLeftDrawerOpened]="drawer.opened"
(settingsClicked)="openSettings()"
/>
@if (activeChannel.radio === 'true') {
@@ -98,6 +100,15 @@
[channel]="activeChannel"
[epgProgram]="(epgProgram$ | async)!"
/>
<!-- channel number overlay -->
@if (showChannelNumberOverlay) {
<div class="channel-number-overlay">
<div class="channel-number-display">
{{ channelNumberInput }}
</div>
</div>
}
}
}
</mat-drawer-content>
@@ -54,3 +54,39 @@
}
}
}
.channel-number-overlay {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1000;
pointer-events: none;
}
.channel-number-display {
background: rgba(0, 0, 0, 0.85);
color: #fff;
font-size: 6rem;
font-weight: 700;
font-family: 'DM Sans', sans-serif;
padding: 2rem 3rem;
border-radius: 16px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
border: 2px solid rgba(255, 255, 255, 0.1);
min-width: 120px;
text-align: center;
letter-spacing: 0.05em;
animation: scaleIn 0.15s ease-out;
}
@keyframes scaleIn {
from {
opacity: 0;
transform: scale(0.8);
}
to {
opacity: 1;
transform: scale(1);
}
}
@@ -3,10 +3,12 @@ import { ComponentPortal } from '@angular/cdk/portal';
import { AsyncPipe, CommonModule } from '@angular/common';
import {
Component,
HostListener,
Injector,
OnInit,
effect,
inject,
viewChild,
} from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSidenavModule } from '@angular/material/sidenav';
@@ -31,7 +33,15 @@ import {
selectChannels,
selectCurrentEpgProgram,
} from 'm3u-state';
import { Observable, combineLatest, combineLatestWith, filter, map, switchMap, take } from 'rxjs';
import {
Observable,
combineLatest,
combineLatestWith,
filter,
map,
switchMap,
take,
} from 'rxjs';
import { DataService, PlaylistsService } from 'services';
import {
Channel,
@@ -97,6 +107,14 @@ export class VideoPlayerComponent implements OnInit {
/** EPG overlay reference */
private overlayRef!: OverlayRef;
/** Info overlay component reference for manual triggering */
readonly infoOverlay = viewChild(InfoOverlayComponent);
/** Channel number input state */
channelNumberInput = '';
showChannelNumberOverlay = false;
private channelNumberTimeout?: number;
volume = 1;
constructor() {
@@ -124,9 +142,11 @@ export class VideoPlayerComponent implements OnInit {
// Setup remote control channel change listener (Electron only)
if (this.isDesktop && window.electron?.onChannelChange) {
window.electron.onChannelChange((data: { direction: 'up' | 'down' }) => {
this.handleRemoteChannelChange(data.direction);
});
window.electron.onChannelChange(
(data: { direction: 'up' | 'down' }) => {
this.handleRemoteChannelChange(data.direction);
}
);
}
this.channels$ = this.activatedRoute.params.pipe(
@@ -153,6 +173,26 @@ export class VideoPlayerComponent implements OnInit {
channels: playlist.playlist.items,
})
);
// Load favorites from the playlist
if (
playlist.favorites &&
playlist.favorites.length > 0
) {
this.store.dispatch(
PlaylistActions.setFavorites({
channelIds: playlist.favorites,
})
);
} else {
// Clear favorites if playlist has none
this.store.dispatch(
PlaylistActions.setFavorites({
channelIds: [],
})
);
}
return playlist.playlist.items as Channel[];
})
);
@@ -179,18 +219,20 @@ export class VideoPlayerComponent implements OnInit {
}),
take(1),
map(([channels, activeChannel]) => {
return { channels, activeChannel: activeChannel as Channel };
return {
channels,
activeChannel: activeChannel as Channel,
};
})
)
.subscribe({
next: ({ channels, activeChannel }) => {
// Find current channel index
const currentIndex = channels.findIndex(
ch => ch.url === activeChannel.url
(ch) => ch.url === activeChannel.url
);
if (currentIndex === -1) {
console.warn('Current channel not found in channel list');
return;
}
@@ -198,20 +240,29 @@ export class VideoPlayerComponent implements OnInit {
let nextIndex: number;
if (direction === 'up') {
// Up = previous channel (decrease index)
nextIndex = currentIndex - 1 < 0 ? channels.length - 1 : currentIndex - 1;
nextIndex =
currentIndex - 1 < 0
? channels.length - 1
: currentIndex - 1;
} else {
// Down = next channel (increase index)
nextIndex = currentIndex + 1 >= channels.length ? 0 : currentIndex + 1;
nextIndex =
currentIndex + 1 >= channels.length
? 0
: currentIndex + 1;
}
// Dispatch action to change channel
const nextChannel = channels[nextIndex];
console.log(`Switching to channel: ${nextChannel.name}`);
this.store.dispatch(PlaylistActions.setActiveChannel({ channel: nextChannel }));
this.store.dispatch(
PlaylistActions.setActiveChannel({
channel: nextChannel,
})
);
},
error: (err) => {
console.error('Error changing channel:', err);
}
},
});
}
@@ -284,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();
});
@@ -304,4 +362,95 @@ export class VideoPlayerComponent implements OnInit {
data: { isDialog: true },
});
}
/**
* Keyboard shortcut: Press 'I' to toggle EPG info overlay
*/
@HostListener('document:keydown.i', ['$event'])
handleInfoKeyPress(event: Event): void {
// Prevent default behavior and show info overlay
event.preventDefault();
this.toggleInfoOverlay();
}
/**
* Handle digit key presses for channel number input
*/
@HostListener('document:keydown', ['$event'])
handleKeyPress(event: KeyboardEvent): void {
// Only handle digit keys (0-9)
if (event.key >= '0' && event.key <= '9') {
event.preventDefault();
this.handleChannelNumberInput(event.key);
}
}
/**
* Toggles the EPG info overlay visibility
* Called by 'I' keyboard shortcut or info button
*/
toggleInfoOverlay(): void {
const overlay = this.infoOverlay();
if (overlay) {
overlay.showOverlay();
}
}
/**
* Handle channel number input from keyboard
* Debounces input to allow multi-digit channel numbers
*/
handleChannelNumberInput(digit: string): void {
// Clear existing timeout
if (this.channelNumberTimeout) {
clearTimeout(this.channelNumberTimeout);
}
// Add digit to current input
this.channelNumberInput += digit;
this.showChannelNumberOverlay = true;
// Set timeout to switch channel after 2 seconds of no input
this.channelNumberTimeout = window.setTimeout(() => {
this.switchToChannelByNumber(parseInt(this.channelNumberInput, 10));
this.clearChannelNumberInput();
}, 2000);
}
/**
* Switch to channel by number (1-based index)
*/
switchToChannelByNumber(channelNumber: number): void {
this.channels$
.pipe(
take(1),
map((channels) => {
// Channel numbers are 1-based, array is 0-based
const channelIndex = channelNumber - 1;
if (channelIndex >= 0 && channelIndex < channels.length) {
return channels[channelIndex];
}
return null;
})
)
.subscribe((channel) => {
if (channel) {
this.store.dispatch(
PlaylistActions.setActiveChannel({ channel })
);
}
});
}
/**
* Clear channel number input and hide overlay
*/
clearChannelNumberInput(): void {
this.channelNumberInput = '';
this.showChannelNumberOverlay = false;
if (this.channelNumberTimeout) {
clearTimeout(this.channelNumberTimeout);
this.channelNumberTimeout = undefined;
}
}
}
+3 -1
View File
@@ -198,7 +198,8 @@
"OPEN_CHANNELS_LIST": "Open channel list",
"TOGGLE_FAVORITE_FLAG": "Toggle favorite flag",
"OPEN_EPG_LIST": "Open EPG list",
"OPEN_MULTI_EPG": "Open Multi-EPG view"
"OPEN_MULTI_EPG": "Open Multi-EPG view",
"SHOW_INFO": "Show program info (Press I)"
},
"EPG": {
"TITLE": "Electronic Program Guide",
@@ -213,6 +214,7 @@
"FETCH_EPG": "Fetching EPG data...",
"ERROR": "Ooops, EPG could not be loaded.",
"DOWNLOAD_SUCCESS": "EPG was successfully downloaded.",
"NO_PROGRAM_INFO": "No program information available",
"PROGRAM_DIALOG": {
"PROGRAM_DETAILS": "Details about the TV program",
"TITLE": "Title",
+2 -6
View File
@@ -20,13 +20,9 @@
<link rel="manifest" href="manifest.webmanifest" />
<link rel="apple-touch-icon" href="assets/icons/apple-touch-icon.png" />
<link rel="icon" type="image/x-icon" href="assets/icons/favicon.ico" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Material+Icons"
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&family=JetBrains+Mono:wght@400;500&family=Crimson+Pro:wght@400;600;700&family=DM+Sans:wght@400;500;600&family=Material+Icons&display=swap"
rel="stylesheet"
/>
<script>
-50
View File
@@ -73,39 +73,6 @@ textarea,
}
}
.cet-container {
.video-js {
height: calc(100vh - 93px) !important;
}
app-web-player-view > app-vjs-player > .video-js {
height: 100% !important;
}
#video-player {
width: 100%;
height: calc(100vh - 80px) !important;
}
.recent-playlists {
height: calc(100vh - 106px - 28px) !important;
}
#groups-list,
#favorites-list {
height: calc(100vh - 148px) !important;
}
.scroll-viewport {
min-height: calc(100vh - 210px) !important;
}
.scroll-viewport-portals {
min-height: calc(100vh - 170px) !important;
overflow-x: hidden !important;
}
}
.scroll-viewport-portals {
min-height: calc(100vh - 170px) !important;
overflow-x: hidden !important;
@@ -114,20 +81,3 @@ textarea,
.mat-drawer-inner-container {
overflow: hidden !important;
}
@media only screen and (max-width: 599px) {
.cet-container {
.video-js {
height: calc(50vh - 70px) !important;
}
#video-player {
height: calc(50vh - 80px) !important;
}
.scroll-viewport {
min-height: calc(50vh - 159px) !important
}
}
}
+3
View File
@@ -8,6 +8,7 @@ import { TranslateService } from '@ngx-translate/core';
import {
combineLatestWith,
EMPTY,
filter,
firstValueFrom,
map,
switchMap,
@@ -130,6 +131,8 @@ export class PlaylistEffects {
setActiveChannel$ = createEffect(() => {
return this.actions$.pipe(
ofType(PlaylistActions.setActiveChannel),
// Skip the effect entirely when channel is falsy
filter((action) => !!action.channel),
map((action) => {
const { channel } = action;
+136 -2
View File
@@ -1,10 +1,15 @@
import { inject, Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject, from, of } from 'rxjs';
import { catchError, map, tap } from 'rxjs/operators';
import { BehaviorSubject, forkJoin, from, Observable, of } from 'rxjs';
import { catchError, map, tap, timeout } from 'rxjs/operators';
import { EpgProgram } from 'shared-interfaces';
interface CachedProgram {
program: EpgProgram | null;
timestamp: number;
}
@Injectable({
providedIn: 'root',
})
@@ -15,6 +20,10 @@ export class EpgService {
private epgAvailable = new BehaviorSubject<boolean>(false);
private currentEpgPrograms = new BehaviorSubject<EpgProgram[]>([]);
// Cache for channel programs with 60-second TTL
private programCache = new Map<string, CachedProgram>();
private readonly CACHE_TTL = 60000; // 60 seconds
private readonly isDesktop = !!window.electron;
readonly epgAvailable$ = this.epgAvailable.asObservable();
@@ -116,4 +125,129 @@ export class EpgService {
horizontalPosition: 'start',
});
}
/**
* Gets the current EPG program for a specific channel (with caching)
* @param channelId Channel ID (tvg-id or channel name)
* @returns Observable of current program or null
*/
getCurrentProgramForChannel(channelId: string): Observable<EpgProgram | null> {
if (!this.isDesktop || !channelId) {
return of(null);
}
// Check cache first
const cached = this.programCache.get(channelId);
const now = Date.now();
if (cached && (now - cached.timestamp) < this.CACHE_TTL) {
return of(cached.program);
}
// Fetch from backend
return from(window.electron.getChannelPrograms(channelId)).pipe(
map((programs: EpgProgram[]) => {
if (!programs || programs.length === 0) {
this.programCache.set(channelId, { program: null, timestamp: now });
return null;
}
// Normalize date formats to ISO strings for consistency
const transformedPrograms = programs.map((program) => ({
...program,
start: new Date(program.start).toISOString(),
stop: new Date(program.stop).toISOString(),
}));
// Find current program from transformed programs
const currentProgram = this.findCurrentProgram(transformedPrograms);
// Cache the result
this.programCache.set(channelId, {
program: currentProgram,
timestamp: now
});
return currentProgram;
}),
catchError((err) => {
console.error('EPG get current program error:', err);
this.programCache.set(channelId, { program: null, timestamp: now });
return of(null);
})
);
}
/**
* Finds the current program from a list of programs
*/
private findCurrentProgram(programs: EpgProgram[]): EpgProgram | null {
const now = new Date();
return programs.find(program => {
const start = new Date(program.start);
const stop = new Date(program.stop);
return start <= now && now <= stop;
}) || null;
}
/**
* Gets current programs for multiple channels (batch operation)
* @param channelIds Array of channel IDs
* @returns Observable of Map with channelId -> current program
*/
getCurrentProgramsForChannels(channelIds: string[]): Observable<Map<string, EpgProgram | null>> {
if (!this.isDesktop) {
return of(new Map());
}
if (!channelIds || channelIds.length === 0) {
return of(new Map());
}
const resultMap = new Map<string, EpgProgram | null>();
const channelsToFetch: string[] = [];
const now = Date.now();
// Check cache for each channel
channelIds.forEach(channelId => {
const cached = this.programCache.get(channelId);
if (cached && (now - cached.timestamp) < this.CACHE_TTL) {
resultMap.set(channelId, cached.program);
} else {
channelsToFetch.push(channelId);
}
});
// If all channels were cached, return immediately
if (channelsToFetch.length === 0) {
return of(resultMap);
}
// Fetch uncached channels with timeout and error handling per request
const fetchObservables = channelsToFetch.map(channelId =>
this.getCurrentProgramForChannel(channelId).pipe(
timeout(5000), // 5 second timeout per request
map(program => ({ channelId, program })),
catchError(() => of({ channelId, program: null }))
)
);
// Combine all fetches using forkJoin
return forkJoin(fetchObservables).pipe(
map(results => {
results.forEach(result => {
resultMap.set(result.channelId, result.program);
});
return resultMap;
})
);
}
/**
* Clears the program cache (useful when EPG is refreshed)
*/
clearCache(): void {
this.programCache.clear();
}
}
@@ -21,9 +21,9 @@
/>
</mat-form-field>
</div>
<mat-nav-list id="all-channels">
<div id="all-channels" class="channel-list">
<cdk-virtual-scroll-viewport
itemSize="50"
[itemSize]="itemSize"
class="scroll-viewport"
>
<app-channel-list-item
@@ -41,11 +41,13 @@
| translate)
"
[logo]="channel?.tvg?.logo"
[showEpg]="shouldShowEpg"
[epgProgram]="getEpgForChannel(channel)"
(clicked)="selectChannel(channel)"
[selected]="activeChannel()?.url === channel?.url"
/>
</cdk-virtual-scroll-viewport>
</mat-nav-list>
</div>
</mat-tab>
<mat-tab>
@@ -55,7 +57,7 @@
{{ 'CHANNELS.GROUPS' | translate }}
</div>
</ng-template>
<mat-nav-list id="groups-list">
<div id="groups-list" class="channel-list">
<mat-accordion multi>
@for (
groups of groupedChannels | keyvalue: groupsComparator;
@@ -73,33 +75,37 @@
</mat-expansion-panel-header>
<ng-template matExpansionPanelContent>
@for (
channel of groups.value;
track trackByFn($index, channel);
let i = $index
) {
<app-channel-list-item
[name]="
i +
1 +
'. ' +
(channel?.name ||
'CHANNELS.UNNAMED_CHANNEL'
| translate)
"
[logo]="channel?.tvg?.logo"
(clicked)="selectChannel(channel)"
[selected]="
activeChannel()?.url === channel.url
"
></app-channel-list-item>
}
<div class="group-channels">
@for (
channel of groups.value;
track trackByFn($index, channel);
let i = $index
) {
<app-channel-list-item
[name]="
i +
1 +
'. ' +
(channel?.name ||
'CHANNELS.UNNAMED_CHANNEL'
| translate)
"
[logo]="channel?.tvg?.logo"
[showEpg]="shouldShowEpg"
[epgProgram]="getEpgForChannel(channel)"
(clicked)="selectChannel(channel)"
[selected]="
activeChannel()?.url === channel?.url
"
></app-channel-list-item>
}
</div>
</ng-template>
</mat-expansion-panel>
}
}
</mat-accordion>
</mat-nav-list>
</div>
</mat-tab>
@let showFavorites = (playlistId$ | async) !== 'GLOBAL_FAVORITES';
@@ -113,7 +119,8 @@
</ng-template>
@let favorites = favorites$ | async;
@if (favorites) {
<mat-nav-list
<div
class="channel-list"
cdkDropList
(cdkDropListDropped)="drop($event, favorites)"
id="favorites-list"
@@ -135,6 +142,8 @@
"
[isDraggable]="true"
[logo]="channel?.tvg?.logo"
[showEpg]="shouldShowEpg"
[epgProgram]="getEpgForChannel(channel)"
(clicked)="selectChannel(channel)"
[selected]="activeChannel()?.url === channel?.url"
[showFavoriteButton]="true"
@@ -144,18 +153,18 @@
/>
}
} @else {
<mat-list-item
><strong>{{
<div class="empty-favorites">
<strong>{{
'CHANNELS.NO_FAVORITES' | translate
}}</strong></mat-list-item
>
<mat-list-item>
}}</strong>
</div>
<div class="empty-favorites-hint">
{{
'CHANNELS.USE_STAR_TO_FAVORITE' | translate
}}</mat-list-item
>
}}
</div>
}
</mat-nav-list>
</div>
}
</mat-tab>
}
@@ -1,11 +1,8 @@
@use '@angular/material' as mat;
.mat-list-base {
padding-top: 0;
}
.scroll-viewport {
min-height: calc(100vh - 159px);
overflow-x: hidden;
}
.search-panel {
@@ -22,15 +19,16 @@
}
}
mat-nav-list {
overflow: scroll;
}
#all-channels {
overflow: hidden;
overflow-x: hidden;
max-height: calc(100vh - 167px);
}
.channel-list {
overflow-x: hidden;
}
::ng-deep {
.search-bar {
div {
@@ -71,6 +69,22 @@ mat-nav-list {
height: calc(100vh - 105px);
}
.empty-favorites,
.empty-favorites-hint {
padding: 16px 24px;
text-align: center;
}
.empty-favorites {
margin-top: 40px;
font-size: 1rem;
}
.empty-favorites-hint {
opacity: 0.7;
font-size: 0.9rem;
}
@media only screen and (max-width: 599px) {
.channel-name {
max-width: 100px;
@@ -12,6 +12,7 @@ import {
inject,
Input,
OnDestroy,
OnInit,
viewChild,
} from '@angular/core';
import { FormsModule } from '@angular/forms';
@@ -20,11 +21,11 @@ import { MatExpansionModule } from '@angular/material/expansion';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import { MatSnackBar } from '@angular/material/snack-bar';
import { MatTabsModule } from '@angular/material/tabs';
import { FilterPipe } from '@iptvnator/pipes';
import { Store } from '@ngrx/store';
import { StorageMap } from '@ngx-pwa/local-storage';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import * as _ from 'lodash';
import * as PlaylistActions from 'm3u-state';
@@ -33,9 +34,9 @@ import {
selectActivePlaylistId,
selectFavorites,
} from 'm3u-state';
import { map, skipWhile } from 'rxjs';
import { BehaviorSubject, combineLatest, map, skipWhile } from 'rxjs';
import { EpgService } from 'services';
import { Channel } from 'shared-interfaces';
import { Channel, EpgProgram, Settings, STORE_KEY } from 'shared-interfaces';
import { ChannelListItemComponent } from './channel-list-item/channel-list-item.component';
@Component({
@@ -53,24 +54,40 @@ import { ChannelListItemComponent } from './channel-list-item/channel-list-item.
MatFormFieldModule,
MatIconModule,
MatInputModule,
MatListModule,
MatTabsModule,
ScrollingModule,
TitleCasePipe,
TranslatePipe,
],
})
export class ChannelListContainerComponent implements OnDestroy {
export class ChannelListContainerComponent implements OnInit, OnDestroy {
private readonly epgService = inject(EpgService);
private readonly snackBar = inject(MatSnackBar);
private readonly storage = inject(StorageMap);
private readonly store = inject(Store);
private readonly translateService = inject(TranslateService);
/** Map of channel ID to current EPG program */
channelEpgMap = new Map<string, EpgProgram | null>();
/** Interval for refreshing EPG data */
private epgRefreshInterval?: number;
/** Whether to show EPG data in channel items (false in PWA mode or when EPG is not configured) */
shouldShowEpg = false;
/** Item size for virtual scroll - compact when no EPG */
get itemSize(): number {
return this.shouldShowEpg ? 68 : 48;
}
/**
* Channels array
* Create local copy of the store for local manipulations without updates in the store
*/
_channelList: Channel[] = [];
private channelList$ = new BehaviorSubject<Channel[]>([]);
get channelList(): Channel[] {
return this._channelList;
}
@@ -78,7 +95,10 @@ export class ChannelListContainerComponent implements OnDestroy {
@Input()
set channelList(value: Channel[]) {
this._channelList = value;
this.channelList$.next(value); // Emit to observable
this.groupedChannels = _.default.groupBy(value, 'group.title');
// Fetch EPG for new channel list
this.fetchEpgForChannels(value);
}
/** Object with channels sorted by groups */
@@ -112,18 +132,32 @@ export class ChannelListContainerComponent implements OnDestroy {
)
);
/** List with favorites */
favorites$ = this.store.select(selectFavorites).pipe(
map(
(
favoriteChannelIds // TODO: move to selector
) =>
favoriteChannelIds.map((favoriteChannelId) =>
this.channelList.find(
/** List with favorites - combines favorites from store with current channel list */
favorites$ = combineLatest([
this.store.select(selectFavorites),
this.channelList$,
]).pipe(
map(([favoriteChannelIds, channelList]) => {
console.log(
'[ChannelList] favorites$ emit - IDs:',
favoriteChannelIds.length,
'Channels:',
channelList.length
);
const favorites = favoriteChannelIds
.map((favoriteChannelId) =>
channelList.find(
(channel) => channel.url === favoriteChannelId
)
)
)
.filter((channel): channel is Channel => channel !== undefined); // Filter out undefined channels
console.log(
'[ChannelList] favorites$ result:',
favorites.length,
'favorites'
);
return favorites;
})
);
/**
@@ -169,8 +203,71 @@ export class ChannelListContainerComponent implements OnDestroy {
);
}
ngOnInit(): void {
// Check if EPG should be shown (only in Electron with configured EPG URL)
const isElectron = !!window['electron'];
if (isElectron) {
this.storage
.get(STORE_KEY.Settings)
.subscribe((settings: unknown) => {
if (
settings &&
Object.keys(settings as Settings).length > 0
) {
const epgUrl = (settings as Settings).epgUrl;
this.shouldShowEpg = !!(epgUrl && epgUrl.length > 0);
}
});
} else {
// PWA mode - don't show EPG
this.shouldShowEpg = false;
}
// Set up EPG refresh interval (every 60 seconds)
this.epgRefreshInterval = window.setInterval(() => {
this.fetchEpgForChannels(this._channelList);
}, 60000);
}
ngOnDestroy() {
this.store.dispatch(PlaylistActions.setChannels({ channels: [] }));
if (this.epgRefreshInterval) {
clearInterval(this.epgRefreshInterval);
}
// Clean up BehaviorSubject
this.channelList$.complete();
}
/**
* Fetches EPG data for all channels
*/
private fetchEpgForChannels(channels: Channel[]): void {
if (!channels || channels.length === 0) {
console.log('[EPG] No channels to fetch EPG for');
return;
}
// Get channel IDs (prefer tvg-id, fallback to name)
const channelIds = channels
.map((channel) => channel?.tvg?.id?.trim() || channel?.name?.trim())
.filter((id) => !!id);
// Batch fetch EPG programs
this.epgService
.getCurrentProgramsForChannels(channelIds)
.subscribe((epgMap) => {
this.channelEpgMap = epgMap;
});
}
/**
* Gets EPG program for a specific channel
*/
getEpgForChannel(channel: Channel): EpgProgram | null | undefined {
const channelId = channel?.tvg?.id?.trim() || channel?.name?.trim();
return channelId ? this.channelEpgMap.get(channelId) : null;
}
groupsComparator = (
@@ -1,38 +1,170 @@
.channel-name {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
font-size: 0.9em;
max-width: 290px;
transition: color 0.2s ease;
width: 100%;
position: relative;
overflow: hidden;
// Main channel list item container
.channel-list-item {
display: flex;
align-items: center;
height: 68px;
padding: 8px 12px;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.2s ease;
gap: 12px;
&:hover {
overflow: visible;
text-overflow: clip;
animation: marquee 6s linear infinite;
background-color: rgba(0, 0, 0, 0.04);
}
&.active {
background-color: rgba(0, 0, 0, 0.08);
}
// Compact mode when EPG is not shown
&.compact {
height: 48px;
padding: 6px 12px;
}
}
.active {
background: #ddd;
}
// Dark theme support
::ng-deep .dark-theme {
.channel-list-item {
&:hover {
background-color: rgba(255, 255, 255, 0.04);
}
::ng-deep {
.dark-theme {
.active {
background: #000;
&.active {
background-color: rgba(255, 255, 255, 0.08);
}
}
}
// Drag handle icon
.drag-icon {
cursor: move;
margin-left: 0;
margin-right: 0;
margin-right: 4px;
opacity: 0.5;
}
// Main content area
.channel-content {
display: flex;
align-items: center;
flex: 1;
gap: 12px;
min-width: 0; // Allow text truncation
}
// Channel logo
.channel-logo {
width: 42px;
height: 42px;
border-radius: 4px;
object-fit: contain;
flex-shrink: 0;
// Smaller logo in compact mode
.compact & {
width: 32px;
height: 32px;
}
}
// Channel details (name + EPG)
.channel-details {
display: flex;
flex-direction: column;
gap: 2px;
flex: 1;
min-width: 0; // Allow text truncation
}
// Channel name
.channel-name {
font-family: 'DM Sans', sans-serif;
font-weight: 500;
font-size: 0.9rem;
line-height: 1.3;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
max-width: 100%;
}
// EPG title (program name)
.epg-title {
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
Arial, sans-serif;
font-size: 0.8rem;
font-weight: 500;
opacity: 0.85;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 1.2;
min-width: 0;
max-width: 100%;
}
// EPG timeline container
.epg-timeline {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
max-width: 100%;
}
// EPG time display
.epg-time {
font-family: 'DM Sans', sans-serif;
font-size: 0.7rem;
opacity: 0.6;
letter-spacing: 0.02em;
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
max-width: 100%;
}
// EPG placeholder (when no data available)
.epg-placeholder {
font-family: 'DM Sans', sans-serif;
font-size: 0.75rem;
opacity: 0.5;
font-style: italic;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
max-width: 100%;
}
// Progress track
.epg-progress-track {
position: relative;
width: 100%;
height: 3px;
background: rgba(128, 128, 128, 0.2);
border-radius: 2px;
overflow: hidden;
}
// Progress fill
.epg-progress-fill {
position: absolute;
left: 0;
top: 0;
height: 100%;
background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
border-radius: 2px;
transition: width 0.5s ease-out;
box-shadow: 0 0 6px rgba(124, 58, 237, 0.4);
}
// Favorite button
.favorite-button {
flex-shrink: 0;
}
@@ -1,16 +1,32 @@
import { DragDropModule } from '@angular/cdk/drag-drop';
import { NgIf } from '@angular/common';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { NgIf, NgStyle } from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
EventEmitter,
inject,
Input,
OnChanges,
OnDestroy,
OnInit,
Output,
SimpleChanges,
} from '@angular/core';
import { MatIconButton } from '@angular/material/button';
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';
@Component({
selector: 'app-channel-list-item',
styleUrls: ['./channel-list-item.component.scss'],
template: `<mat-list-item
changeDetection: ChangeDetectionStrategy.OnPush,
template: `<div
class="channel-list-item"
[class.compact]="!showEpg"
cdkDrag
[cdkDragDisabled]="!isDraggable"
cdkDragPreviewContainer="parent"
@@ -20,51 +36,133 @@ import { TranslatePipe } from '@ngx-translate/core';
>
<mat-icon
*ngIf="isDraggable"
matListItemIcon
cdkDragHandle
class="drag-icon"
>drag_indicator</mat-icon
>
<img
matListItemMeta
class="channel-logo"
*ngIf="logo"
[src]="logo"
width="42"
onerror="this.style.display='none'"
alt="Channel Logo"
/>
<p matListItemTitle class="channel-name">
{{ name }}
</p>
<div class="channel-content">
<img
class="channel-logo"
*ngIf="logo"
[src]="logo"
onerror="this.style.display='none'"
alt="Channel Logo"
/>
<div class="channel-details">
<div class="channel-name">{{ name }}</div>
@if (showEpg) {
@if (epgProgram) {
<div class="epg-title">
{{ epgProgram.title?.[0]?.value }}
</div>
<div class="epg-timeline">
<span class="epg-time">{{ formatTime(epgProgram.start) }} - {{ formatTime(epgProgram.stop) }}</span>
<div class="epg-progress-track">
<div
class="epg-progress-fill"
[ngStyle]="{ width: progressPercentage + '%' }"
></div>
</div>
</div>
} @else {
<div class="epg-placeholder">
{{ 'EPG.NO_PROGRAM_INFO' | translate }}
</div>
}
}
</div>
</div>
<button
*ngIf="showFavoriteButton"
mat-icon-button
matListItemMeta
class="favorite-button"
color="primary"
[matTooltip]="'CHANNELS.REMOVE_FAVORITE' | translate"
(click)="favoriteToggled.emit($event)"
>
<mat-icon color="accent">star</mat-icon>
</button>
</mat-list-item>`,
</div>`,
imports: [
DragDropModule,
MatIcon,
MatIconButton,
MatListModule,
MatTooltip,
NgIf,
NgStyle,
TranslatePipe,
],
})
export class ChannelListItemComponent {
export class ChannelListItemComponent implements OnInit, OnChanges, OnDestroy {
private readonly cdr = inject(ChangeDetectorRef);
@Input() isDraggable = false;
@Input() logo!: string;
@Input() name = '';
@Input() showFavoriteButton = false;
@Input() selected = false;
@Input() showEpg = true;
@Input() epgProgram?: EpgProgram | null;
@Output() clicked = new EventEmitter<void>();
@Output() favoriteToggled = new EventEmitter();
@Output() favoriteToggled = new EventEmitter<MouseEvent>();
progressPercentage = 0;
private progressInterval?: number;
ngOnInit(): void {
this.calculateProgress();
// Update progress every 30 seconds
this.progressInterval = window.setInterval(() => {
this.calculateProgress();
}, 30000);
}
ngOnChanges(changes: SimpleChanges): void {
// Recalculate progress when epgProgram changes
if (changes['epgProgram']) {
this.calculateProgress();
}
}
ngOnDestroy(): void {
if (this.progressInterval) {
clearInterval(this.progressInterval);
}
}
/**
* Calculates the progress percentage for the EPG program
*/
private calculateProgress(): void {
if (!this.epgProgram) {
this.progressPercentage = 0;
return;
}
const now = new Date().getTime();
const start = new Date(this.epgProgram.start).getTime();
const stop = new Date(this.epgProgram.stop).getTime();
const total = stop - start;
const elapsed = now - start;
this.progressPercentage = Math.min(
100,
Math.max(0, (elapsed / total) * 100)
);
this.cdr.markForCheck();
}
/**
* Formats time for display (HH:mm)
*/
formatTime(dateString: string | number): string {
const date = new Date(dateString);
return date.toLocaleTimeString('en-US', {
hour: '2-digit',
minute: '2-digit',
hour12: false,
});
}
}
@@ -219,11 +219,11 @@ export class EpgListComponent implements OnInit {
)
.subscribe((playingNow) => {
this.playingNow = playingNow!;
if (this.playingNow) {
this.store.dispatch(
setCurrentEpgProgram({ program: this.playingNow })
);
}
// Always dispatch the action, even when playingNow is null/undefined
// This ensures the store is updated and old EPG data is cleared
this.store.dispatch(
setCurrentEpgProgram({ program: this.playingNow })
);
});
}
@@ -1,37 +1,71 @@
@if (channel && epgProgram) {
@if (channel) {
<div
class="channel-overlay"
[class.visible]="isVisible"
[class.hidden]="!isVisible"
>
<div class="channel-logo">
<img
[src]="epgProgram?.icon?.[0]?.src || channel?.tvg?.logo"
width="68"
onerror="this.style.display='none'"
alt="channel icon"
/>
</div>
<div class="content">
<div class="program-name">
{{ epgProgram?.title?.[0]?.value }} | {{ channel.name }}
</div>
<div class="program-description">
{{ epgProgram?.desc?.[0]?.value }}
</div>
<div class="program-progress">
<div
class="program-finished"
[ngStyle]="{
width: (finishedDuration * 100) / generalDuration + '%',
}"
></div>
<div class="duration">
{{ start | momentDate: 'YYYYMMDDHHmm ZZ' : 'HH:mm' }}
-
{{ stop | momentDate: 'YYYYMMDDHHmm ZZ' : 'HH:mm' }}
@if (epgProgram) {
<!-- Layout with EPG data -->
<div class="epg-layout">
<div class="channel-logo">
<img
[src]="epgProgram?.icon?.[0]?.src || channel?.tvg?.logo"
onerror="this.style.display='none'"
alt="channel icon"
/>
</div>
<div class="content">
<div class="content-header">
<div class="program-title">
{{ epgProgram?.title?.[0]?.value }}
</div>
<div class="channel-name">
{{ channel.name }}
</div>
</div>
@if (epgProgram?.desc?.[0]?.value) {
<div class="program-description">
{{ epgProgram?.desc?.[0]?.value }}
</div>
}
<div class="program-timeline">
<div class="timeline-info">
<span class="time-start">{{ start | momentDate: 'YYYYMMDDHHmm ZZ' : 'HH:mm' }}</span>
<span class="time-separator">—</span>
<span class="time-end">{{ stop | momentDate: 'YYYYMMDDHHmm ZZ' : 'HH:mm' }}</span>
</div>
<div class="progress-track">
<div
class="progress-fill"
[ngStyle]="{
width: (finishedDuration * 100) / generalDuration + '%',
}"
></div>
</div>
</div>
</div>
</div>
</div>
} @else {
<!-- Layout without EPG data - same structure, minimal content -->
<div class="epg-layout">
<div class="channel-logo">
<img
[src]="channel?.tvg?.logo"
onerror="this.style.display='none'"
alt="channel icon"
/>
</div>
<div class="content">
<div class="content-header">
<div class="program-title no-epg-title">
{{ channel.name }}
</div>
<div class="channel-name no-epg-subtitle">
{{ 'EPG.NO_PROGRAM_INFO' | translate }}
</div>
</div>
</div>
</div>
}
</div>
}
@@ -3,76 +3,210 @@
bottom: 35px;
width: 100%;
min-height: 130px;
max-height: 165px;
max-height: 200px;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
backdrop-filter: blur(10px);
flex-direction: row;
box-sizing: border-box;
display: flex;
isolation: isolate;
padding: 0 40px;
// Gradient blur effect using pseudo-element
&::before {
content: '';
position: absolute;
inset: 0;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
mask-image: linear-gradient(
to bottom,
transparent 0%,
rgba(0, 0, 0, 0.3) 20%,
rgba(0, 0, 0, 0.8) 60%,
black 100%
);
-webkit-mask-image: linear-gradient(
to bottom,
transparent 0%,
rgba(0, 0, 0, 0.3) 20%,
rgba(0, 0, 0, 0.8) 60%,
black 100%
);
z-index: -1;
}
}
.program-name,
.program-description {
margin: 20px 0;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
// EPG Layout with data
.epg-layout {
display: flex;
gap: 28px;
width: 100%;
align-items: flex-start;
padding: 24px 0;
animation: fadeInUp 0.5s ease-out;
}
.channel-logo {
margin-top: 20px;
place-content: flex-start center;
align-items: flex-start;
flex-direction: row;
box-sizing: border-box;
flex-shrink: 0;
display: flex;
flex: 1 1 100px;
max-width: 100px;
min-width: 100px;
align-items: center;
justify-content: center;
width: 90px;
height: 90px;
img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}
}
.content {
width: 100%;
flex: 1;
display: flex;
flex-direction: column;
gap: 12px;
min-width: 0; // Allow text truncation
}
.program-progress {
width: 96%;
background: #ccc;
height: 20px;
margin-bottom: 8px;
.content-header {
display: flex;
flex-direction: column;
gap: 6px;
animation: fadeIn 0.6s ease-out 0.1s backwards;
}
.program-name {
width: 96%;
max-height: 20px;
-webkit-line-clamp: 1;
.program-title {
font-family: 'Crimson Pro', serif;
font-size: 2.25rem;
font-weight: 700;
line-height: 1.2;
color: #ffffff;
text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
letter-spacing: -0.02em;
}
.channel-name {
font-family: 'DM Sans', sans-serif;
font-size: 0.95rem;
font-weight: 500;
color: rgba(255, 255, 255, 0.75);
text-transform: uppercase;
letter-spacing: 0.08em;
text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.program-description {
width: 96%;
max-height: 55px;
-webkit-line-clamp: 3;
font-family: 'DM Sans', sans-serif;
font-size: 1.05rem;
line-height: 1.5;
color: rgba(255, 255, 255, 0.88);
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
animation: fadeIn 0.6s ease-out 0.2s backwards;
}
.program-finished {
background: #717171;
height: 20px;
font-size: 0.8em;
padding-left: 10px;
color: #000;
line-height: 20px;
.program-timeline {
display: flex;
flex-direction: column;
gap: 10px;
margin-top: 4px;
animation: fadeIn 0.6s ease-out 0.3s backwards;
}
.duration {
.timeline-info {
display: flex;
align-items: center;
gap: 8px;
font-family: 'DM Sans', sans-serif;
font-size: 0.875rem;
font-weight: 500;
color: rgba(255, 255, 255, 0.9);
letter-spacing: 0.02em;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.time-separator {
opacity: 0.5;
margin: 0 2px;
}
.progress-track {
position: relative;
top: -18px;
font-size: 0.8em;
color: #000;
left: 10px;
width: 100%;
height: 4px;
background: rgba(255, 255, 255, 0.15);
border-radius: 2px;
overflow: hidden;
backdrop-filter: blur(4px);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
.progress-fill {
position: absolute;
left: 0;
top: 0;
height: 100%;
background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
border-radius: 2px;
transition: width 0.3s ease-out;
box-shadow: 0 0 12px rgba(124, 58, 237, 0.6);
&::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(
90deg,
transparent 0%,
rgba(255, 255, 255, 0.3) 50%,
transparent 100%
);
animation: shimmer 2s ease-in-out infinite;
}
}
// Animations
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes shimmer {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(100%);
}
}
.visible {
@@ -83,5 +217,19 @@
.hidden {
visibility: hidden;
opacity: 0;
transition: visibility 0s 2s, opacity 2s linear;
transition:
visibility 0s 2s,
opacity 2s linear;
}
// No EPG state variations
.no-epg-title {
// When there's no EPG, the channel name becomes the main title
font-size: 2.5rem; // Slightly larger since it's the only content
}
.no-epg-subtitle {
// Subtle message indicating no EPG data
font-style: italic;
opacity: 0.6;
}
@@ -1,11 +1,12 @@
import { NgStyle } from '@angular/common';
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { MomentDatePipe } from '@iptvnator/pipes';
import { TranslatePipe } from '@ngx-translate/core';
import moment from 'moment';
import { Channel, EpgProgram } from 'shared-interfaces';
@Component({
imports: [MomentDatePipe, NgStyle],
imports: [MomentDatePipe, NgStyle, TranslatePipe],
selector: 'app-info-overlay',
templateUrl: './info-overlay.component.html',
styleUrls: ['./info-overlay.component.scss'],
@@ -45,11 +46,19 @@ export class InfoOverlayComponent implements OnChanges {
this.isVisible = true;
this.currentTimeout = setTimeout(() => {
this.isVisible = false;
}, 4000);
}, 10000);
}
if (changes['epgProgram'] && changes['epgProgram'].currentValue) {
const { stop, start } = changes['epgProgram'].currentValue;
this.setProgramDuration(start, stop);
if (changes['epgProgram']) {
if (changes['epgProgram'].currentValue) {
const { stop, start } = changes['epgProgram'].currentValue;
this.setProgramDuration(start, stop);
} else {
// Reset EPG data when no program is available
this.start = undefined;
this.stop = undefined;
this.generalDuration = 0;
this.finishedDuration = 0;
}
}
}
@@ -71,4 +80,23 @@ export class InfoOverlayComponent implements OnChanges {
.duration(this.stop.diff(timeNow))
.asMilliseconds();
}
/**
* Manually shows the overlay (triggered by user action like 'I' key or info button)
* Toggles visibility if already shown, or shows for 10 seconds if hidden
*/
showOverlay(): void {
if (this.isVisible) {
// If already visible, hide it (toggle behavior)
clearTimeout(this.currentTimeout);
this.isVisible = false;
} else {
// Show overlay for 10 seconds
clearTimeout(this.currentTimeout);
this.isVisible = true;
this.currentTimeout = setTimeout(() => {
this.isVisible = false;
}, 10000);
}
}
}
@@ -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,337 @@
// 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: Roboto, 'Helvetica Neue', 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: Roboto, 'Helvetica Neue', 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 +342,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 {
@@ -5,7 +5,7 @@
[matTooltip]="'TOP_MENU.OPEN_CHANNELS_LIST' | translate"
class="sidenav-toggle-button"
>
<mat-icon>menu</mat-icon>
<mat-icon>{{ isLeftDrawerOpened ? 'menu' : 'menu_open' }}</mat-icon>
</button>
@if ((playlistId$ | async) !== 'GLOBAL_FAVORITES') {
<button
@@ -22,6 +22,13 @@
>
</button>
}
<button
mat-icon-button
(click)="infoOverlayClicked.emit()"
[matTooltip]="'TOP_MENU.SHOW_INFO' | translate"
>
<mat-icon>info</mat-icon>
</button>
{{ activeChannel?.name }}
<div class="spacer"></div>
<button
@@ -32,6 +32,8 @@ import { Channel } from 'shared-interfaces';
})
export class ToolbarComponent {
@Input() activeChannel!: Channel;
@Input() isLeftDrawerOpened = true;
readonly infoOverlayClicked = output<void>();
readonly multiEpgClicked = output<void>();
readonly settingsClicked = output<void>();
readonly toggleLeftDrawerClicked = output<void>();
@@ -56,11 +56,9 @@ export class VjsPlayerComponent implements OnInit, OnChanges, OnDestroy {
});
}
);
/* this.player.hlsQualitySelector({
this.player.hlsQualitySelector({
displayCurrentQuality: true,
});
// this one produces warning in console
*/
this.player['aspectRatioPanel']();
}
+6 -3
View File
@@ -36,7 +36,8 @@
"gatekeeperAssess": false,
"hardenedRuntime": false,
"entitlements": null,
"entitlementsInherit": null
"entitlementsInherit": null,
"icon": "apps/web/src/assets/icons/favicon.icns"
},
"linux": {
"category": "Video",
@@ -46,7 +47,8 @@
"deb",
"rpm"
],
"artifactName": "${name}-${version}-${os}-${arch}.${ext}"
"artifactName": "${name}-${version}-${os}-${arch}.${ext}",
"icon": "apps/web/src/assets/icons"
},
"win": {
"compression": "maximum",
@@ -59,7 +61,8 @@
]
}
],
"artifactName": "${name}-${version}-windows-${arch}-setup.${ext}"
"artifactName": "${name}-${version}-windows-${arch}-setup.${ext}",
"icon": "apps/web/src/assets/icons/icon.png"
},
"nsis": {
"artifactName": "${name}-${version}-windows-${arch}-setup.${ext}"