/* Copyright 2024 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import { forwardRef, useMemo } from "react"; import { useObservableEagerState } from "observable-hooks"; import classNames from "classnames"; import { CallLayout, GridTileModel, TileModel } from "./CallLayout"; import { SpotlightLandscapeLayout as SpotlightLandscapeLayoutModel } from "../state/CallViewModel"; import styles from "./SpotlightLandscapeLayout.module.css"; import { useLayout } from "./Grid"; /** * An implementation of the "spotlight landscape" layout, in which the spotlight * tile takes up most of the space on the left, and the grid of participants is * shown as a scrolling rail on the right. */ export const makeSpotlightLandscapeLayout: CallLayout< SpotlightLandscapeLayoutModel > = ({ minBounds }) => ({ scrollingOnTop: false, fixed: forwardRef(function SpotlightLandscapeLayoutFixed( { model, Slot }, ref, ) { useLayout(); useObservableEagerState(minBounds); const tileModel: TileModel = useMemo( () => ({ type: "spotlight", vms: model.spotlight, maximised: false, }), [model.spotlight], ); return (
); }), scrolling: forwardRef(function SpotlightLandscapeLayoutScrolling( { model, Slot }, ref, ) { useLayout(); useObservableEagerState(minBounds); const tileModels: GridTileModel[] = useMemo( () => model.grid.map((vm) => ({ type: "grid", vm })), [model.grid], ); return (
1, })} />
{tileModels.map((m) => ( ))}
); }), });