From 69e6ba93c18585ea190eee6cbb1c68e5f75abf9a Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Mon, 13 Feb 2023 20:36:42 -0500 Subject: [PATCH] Add a switch to toggle between the new and old grids --- src/room/InCallView.tsx | 12 +++++++++--- src/settings/SettingsModal.tsx | 13 +++++++++++++ src/settings/useSetting.ts | 1 + src/video-grid/VideoGrid.module.css | 1 + src/video-grid/VideoGrid.tsx | 18 ++++++++---------- src/video-grid/VideoTileContainer.tsx | 4 ++-- 6 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index a0f7917f..d4717c1b 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -51,7 +51,11 @@ import { UserMenuContainer } from "../UserMenuContainer"; import { useRageshakeRequestModal } from "../settings/submit-rageshake"; import { RageshakeRequestModal } from "./RageshakeRequestModal"; import { useMediaHandler } from "../settings/useMediaHandler"; -import { useShowInspector, useSpatialAudio } from "../settings/useSetting"; +import { + useNewGrid, + useShowInspector, + useSpatialAudio, +} from "../settings/useSetting"; import { useModalTriggerState } from "../Modal"; import { useAudioContext } from "../video-grid/useMediaStream"; import { useFullscreen } from "../video-grid/useFullscreen"; @@ -277,6 +281,8 @@ export function InCallView({ [] ); + const [newGrid] = useNewGrid(); + const Grid = newGrid ? NewVideoGrid : VideoGrid; const prefersReducedMotion = usePrefersReducedMotion(); const renderContent = (): JSX.Element => { @@ -306,7 +312,7 @@ export function InCallView({ } return ( - )} - + ); }; diff --git a/src/settings/SettingsModal.tsx b/src/settings/SettingsModal.tsx index 106ef9e0..244d1d15 100644 --- a/src/settings/SettingsModal.tsx +++ b/src/settings/SettingsModal.tsx @@ -33,6 +33,7 @@ import { useShowInspector, useOptInAnalytics, canEnableSpatialAudio, + useNewGrid, } from "./useSetting"; import { FieldRow, InputField } from "../input/Input"; import { Button } from "../button"; @@ -62,6 +63,7 @@ export const SettingsModal = (props: Props) => { const [showInspector, setShowInspector] = useShowInspector(); const [optInAnalytics, setOptInAnalytics] = useOptInAnalytics(); const [keyboardShortcuts, setKeyboardShortcuts] = useKeyboardShortcuts(); + const [newGrid, setNewGrid] = useNewGrid(); const downloadDebugLog = useDownloadDebugLog(); @@ -216,6 +218,17 @@ export const SettingsModal = (props: Props) => { } /> + + ) => + setNewGrid(e.target.checked) + } + /> +