From 487b721d7c0c386464e8aeadb7cc9ddea76b77b2 Mon Sep 17 00:00:00 2001 From: 4gray Date: Tue, 11 Nov 2025 08:24:30 +0100 Subject: [PATCH] refactor: replace shared COMPONENT_OVERLAY_REF with local tokens --- .../home/video-player/video-player.component.ts | 16 +++++++++++++--- .../multi-epg/multi-epg-container.component.ts | 16 +++++++++------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/apps/web/src/app/home/video-player/video-player.component.ts b/apps/web/src/app/home/video-player/video-player.component.ts index c5f2a956b..19d2aaf7b 100644 --- a/apps/web/src/app/home/video-player/video-player.component.ts +++ b/apps/web/src/app/home/video-player/video-player.component.ts @@ -1,7 +1,14 @@ import { Overlay, OverlayRef } from '@angular/cdk/overlay'; import { ComponentPortal } from '@angular/cdk/portal'; import { AsyncPipe, CommonModule } from '@angular/common'; -import { Component, Injector, OnInit, effect, inject } from '@angular/core'; +import { + Component, + InjectionToken, + Injector, + OnInit, + effect, + inject, +} from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { MatSidenavModule } from '@angular/material/sidenav'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; @@ -27,7 +34,6 @@ import { import { Observable, combineLatestWith, filter, map, switchMap } from 'rxjs'; import { DataService, PlaylistsService } from 'services'; import { - COMPONENT_OVERLAY_REF, Channel, PLAYLIST_PARSE_BY_URL, STORE_KEY, @@ -67,6 +73,10 @@ export class VideoPlayerComponent implements OnInit { private readonly storage = inject(StorageMap); private readonly store = inject(Store); + private readonly COMPONENT_OVERLAY_REF = new InjectionToken( + 'COMPONENT_OVERLAY_REF' + ); + /** Active selected channel */ readonly activeChannel$ = this.store .select(selectActive) @@ -204,7 +214,7 @@ export class VideoPlayerComponent implements OnInit { const injector = Injector.create({ providers: [ { - provide: COMPONENT_OVERLAY_REF, + provide: this.COMPONENT_OVERLAY_REF, useValue: this.overlayRef, }, ], diff --git a/libs/ui/components/src/lib/multi-epg/multi-epg-container.component.ts b/libs/ui/components/src/lib/multi-epg/multi-epg-container.component.ts index 6ab402725..2bfe0b177 100644 --- a/libs/ui/components/src/lib/multi-epg/multi-epg-container.component.ts +++ b/libs/ui/components/src/lib/multi-epg/multi-epg-container.component.ts @@ -7,6 +7,7 @@ import { Component, ElementRef, inject, + InjectionToken, Input, OnDestroy, OnInit, @@ -20,12 +21,7 @@ import { MomentDatePipe } from '@iptvnator/pipes'; import { TranslatePipe } from '@ngx-translate/core'; import { addDays, differenceInMinutes, format, parse, subDays } from 'date-fns'; import { BehaviorSubject, Observable, Subscription } from 'rxjs'; -import { - Channel, - COMPONENT_OVERLAY_REF, - EpgChannel, - EpgProgram, -} from 'shared-interfaces'; +import { Channel, EpgChannel, EpgProgram } from 'shared-interfaces'; import { EpgItemDescriptionComponent } from '../epg-list/epg-item-description/epg-item-description.component'; interface EnrichedProgram extends EpgProgram { @@ -93,7 +89,13 @@ export class MultiEpgContainerComponent private readonly dialog = inject(MatDialog); private readonly cdr = inject(ChangeDetectorRef); - private readonly overlayRef = inject(COMPONENT_OVERLAY_REF); + private readonly COMPONENT_OVERLAY_REF = new InjectionToken( + 'COMPONENT_OVERLAY_REF' + ); + + private readonly overlayRef = inject( + this.COMPONENT_OVERLAY_REF + ); ngOnInit() { this.calculateCurrentTimeBar();