Files
element-call/src/state/TileViewModel.ts
T

45 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-11-06 04:36:48 -05:00
/*
Copyright 2024 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
2024-11-06 04:36:48 -05:00
Please see LICENSE in the repository root for full details.
*/
2026-06-19 14:49:59 +02:00
import { BehaviorSubject } from "rxjs";
import { type Behavior } from "./Behavior";
2026-02-25 22:34:07 +01:00
import { type MediaViewModel } from "./media/MediaViewModel";
2026-03-16 13:12:49 +01:00
import { type RingingMediaViewModel } from "./media/RingingMediaViewModel";
2026-02-25 22:34:07 +01:00
import { type UserMediaViewModel } from "./media/UserMediaViewModel";
2024-11-06 04:36:48 -05:00
let nextId = 0;
function createId(): string {
return (nextId++).toString();
}
export class GridTileViewModel {
2024-11-06 04:36:48 -05:00
public readonly id = createId();
2026-06-19 14:49:59 +02:00
private readonly _showOutline$ = new BehaviorSubject(false);
public readonly showOutline$: Behavior<boolean> = this._showOutline$;
2024-11-06 04:36:48 -05:00
2026-03-16 13:12:49 +01:00
public constructor(
public readonly media$: Behavior<
UserMediaViewModel | RingingMediaViewModel
>,
) {}
2026-06-19 14:49:59 +02:00
public setShowOutline(value: boolean): void {
this._showOutline$.next(value);
}
2024-11-06 04:36:48 -05:00
}
export class SpotlightTileViewModel {
2024-11-06 04:36:48 -05:00
public constructor(
public readonly media$: Behavior<MediaViewModel[]>,
public readonly maximised$: Behavior<boolean>,
2026-07-08 14:01:38 +02:00
public readonly background$: Behavior<"solid" | "transparent">,
) {}
2024-11-06 04:36:48 -05:00
}
export type TileViewModel = GridTileViewModel | SpotlightTileViewModel;