diff --git a/src/room/GridLayoutMenu.tsx b/src/room/GridLayoutMenu.tsx index 6c9fa5a..6b00c44 100644 --- a/src/room/GridLayoutMenu.tsx +++ b/src/room/GridLayoutMenu.tsx @@ -26,7 +26,7 @@ import menuStyles from "../Menu.module.css"; import { Menu } from "../Menu"; import { TooltipTrigger } from "../Tooltip"; -type Layout = "freedom" | "spotlight"; +export type Layout = "freedom" | "spotlight"; interface Props { layout: Layout; setLayout: (layout: Layout) => void; diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index d9598f2..aa98c86 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -16,7 +16,7 @@ limitations under the License. import React, { useCallback, useMemo, useRef } from "react"; import { usePreventScroll } from "@react-aria/overlays"; -import { GroupCall, MatrixClient } from "matrix-js-sdk"; +import { GroupCall, MatrixClient, RoomMember } from "matrix-js-sdk"; import { CallFeed } from "matrix-js-sdk/src/webrtc/callFeed"; import classNames from "classnames"; @@ -77,10 +77,10 @@ interface Props { export interface Participant { id: string; - callFeed: CallFeed; focused: boolean; - isLocal: boolean; presenter: boolean; + callFeed?: CallFeed; + isLocal?: boolean; } export function InCallView({ @@ -104,7 +104,7 @@ export function InCallView({ }: Props) { usePreventScroll(); const elementRef = useRef(); - const [layout, setLayout] = useVideoGridLayout(screenshareFeeds.length > 0); + const { layout, setLayout } = useVideoGridLayout(screenshareFeeds.length > 0); const { toggleFullscreen, fullscreenParticipant } = useFullscreen(elementRef); const [audioContext, audioDestination, audioRef] = useAudioContext(); @@ -151,20 +151,23 @@ export function InCallView({ return participants; }, [userMediaFeeds, activeSpeaker, screenshareFeeds, layout]); - const renderAvatar = useCallback((roomMember, width, height) => { - const avatarUrl = roomMember.user?.avatarUrl; - const size = Math.round(Math.min(width, height) / 2); + const renderAvatar = useCallback( + (roomMember: RoomMember, width: number, height: number) => { + const avatarUrl = roomMember.user?.avatarUrl; + const size = Math.round(Math.min(width, height) / 2); - return ( - - ); - }, []); + return ( + + ); + }, + [] + ); const renderContent = useCallback((): JSX.Element => { if (items.length === 0) { @@ -184,7 +187,7 @@ export function InCallView({ audioContext={audioContext} audioDestination={audioDestination} disableSpeakingIndicator={true} - isFullscreen={fullscreenParticipant} + isFullscreen={!!fullscreenParticipant} onFullscreen={toggleFullscreen} /> ); @@ -201,7 +204,7 @@ export function InCallView({ audioContext={audioContext} audioDestination={audioDestination} disableSpeakingIndicator={items.length < 3} - isFullscreen={fullscreenParticipant} + isFullscreen={!!fullscreenParticipant} onFullscreen={toggleFullscreen} {...rest} /> diff --git a/src/video-grid/VideoGrid.stories.jsx b/src/video-grid/VideoGrid.stories.tsx similarity index 90% rename from src/video-grid/VideoGrid.stories.jsx rename to src/video-grid/VideoGrid.stories.tsx index 3a62440..916ba68 100644 --- a/src/video-grid/VideoGrid.stories.jsx +++ b/src/video-grid/VideoGrid.stories.tsx @@ -15,10 +15,12 @@ limitations under the License. */ import React, { useState } from "react"; +import { useMemo } from "react"; + import { VideoGrid, useVideoGridLayout } from "./VideoGrid"; import { VideoTile } from "./VideoTile"; -import { useMemo } from "react"; import { Button } from "../button"; +import { Participant } from "../room/InCallView"; export default { title: "VideoGrid", @@ -28,10 +30,10 @@ export default { }; export const ParticipantsTest = () => { - const [layout, setLayout] = useVideoGridLayout(false); + const { layout, setLayout } = useVideoGridLayout(false); const [participantCount, setParticipantCount] = useState(1); - const items = useMemo( + const items: Participant[] = useMemo( () => new Array(participantCount).fill(undefined).map((_, i) => ({ id: (i + 1).toString(), @@ -46,9 +48,7 @@ export const ParticipantsTest = () => {