import { ChangeDetectionStrategy, Component, computed, input, signal } from '@angular/core'; import { AsyncPipe } from '@angular/common'; import { startWith, switchMap } from 'rxjs'; import { injectWebsocketService, WSEvents } from '@/core/services/websocket.service'; import { Live } from '@/features/live/live.models'; import { ButtonDirective } from '@/shared/ui/button.directive'; import { ModalComponent } from '@/shared/ui/modal/modal.component'; import { SurveyModalComponent } from '../../survey/survey-modal/survey-modal.component'; import { Survey } from '../../survey/survey.models'; import { injectSurveyService, SurveyService } from '../../survey/survey.service'; import { VimeoStreamComponent } from '../vimeo-stream/vimeo-stream.component'; @Component({ selector: 'app-plenary', templateUrl: './plenary.component.html', styleUrls: ['./plenary.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, providers: [SurveyService], imports: [AsyncPipe, VimeoStreamComponent, ModalComponent, SurveyModalComponent, ButtonDirective], }) export class PlenaryComponent { private surveyServ = injectSurveyService(); activity = input.required(); surveys$ = injectWebsocketService() .listen(WSEvents.SURVEY) .pipe( startWith(0), switchMap(() => this.surveyServ.getActiveSurveys()) ); selectedSurvey = signal(null); openSurvey = computed(() => this.selectedSurvey() !== null); }