Skip to content
Snippets Groups Projects
Commit 2d2510e3 authored by jojohoch's avatar jojohoch
Browse files

[player] Change type of validPages

see Verona Api
parent 91ef1ff7
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ export class LayoutComponent implements OnInit, OnDestroy {
@Input() playerConfig!: PlayerConfig;
@Output() selectedIndexChange = new EventEmitter<number>();
@Output() validPagesDetermined = new EventEmitter<Record<string, string>[]>();
@Output() validPagesDetermined = new EventEmitter<Record<string, string>>();
private ngUnsubscribe = new Subject<void>();
......@@ -65,12 +65,15 @@ export class LayoutComponent implements OnInit, OnDestroy {
this.scrollPagesIndices = this.scrollPages.map(
(scrollPage: Page): number => this.pages.indexOf(scrollPage)
);
this.validPagesDetermined.emit(this.scrollPages.map((page: Page, index: number): Record<string, string> => (
{
[index.toString(10)]: `${this.translateService.instant('pageIndication', {
index: index + 1
})}`
})));
this.validPagesDetermined
.emit(this.scrollPages.reduce(
(validPages: Record<string, string>, page: Page, index: number) => ({
...validPages,
[`page${index + 1}`]: `${this.translateService.instant(
'pageIndication', { index: index + 1 }
)}`
}), {}
));
}
private initLayout(): void {
......
......@@ -25,7 +25,7 @@ export class PlayerStateComponent implements OnInit, OnDestroy {
currentPlayerPageIndex: number = 0;
selectIndex: Subject<number> = new Subject();
running: boolean = true;
validPages!: Record<string, string> [];
validPages!: Record<string, string>;
private ngUnsubscribe = new Subject<void>();
......@@ -60,7 +60,7 @@ export class PlayerStateComponent implements OnInit, OnDestroy {
this.sendVopStateChangedNotification();
}
onValidPagesDetermined(validPages: Record<string, string>[]): void {
onValidPagesDetermined(validPages: Record<string, string>): void {
this.validPages = validPages;
this.sendVopStateChangedNotification();
}
......@@ -100,6 +100,8 @@ export class PlayerStateComponent implements OnInit, OnDestroy {
currentPage: this.currentPlayerPageIndex.toString(10),
validPages: this.validPages
};
// eslint-disable-next-line no-console
console.log('player: playerState sendVopStateChangedNotification', playerState);
this.veronaPostService.sendVopStateChangedNotification({ playerState }, requested);
}
......
......@@ -43,7 +43,7 @@ export interface UnitState {
export interface PlayerState {
state: RunningState;
validPages?: Record<string, string>[];
validPages?: Record<string, string>;
currentPage?: string;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment