From ee1819a0b69649f38e8bf06e09563c23ab391a3b Mon Sep 17 00:00:00 2001 From: Daniel Abramov Date: Fri, 2 Jun 2023 14:49:11 +0200 Subject: [PATCH] Quick way to replace matrix JS SDK with LiveKit --- src/button/Button.tsx | 45 ---- src/button/VolumeIcon.tsx | 35 --- src/room/GroupCallView.tsx | 34 +-- src/room/InCallView.tsx | 232 ++++++++---------- src/room/useLiveKit.ts | 23 +- src/video-grid/AudioSink.tsx | 47 ---- src/video-grid/TileDescriptor.tsx | 4 +- src/video-grid/VideoGrid.stories.tsx | 39 +-- src/video-grid/VideoTile.tsx | 129 +++------- src/video-grid/VideoTileContainer.tsx | 108 ++------ .../VideoTileSettingsModal.module.css | 120 --------- src/video-grid/VideoTileSettingsModal.tsx | 82 ------- src/video-grid/useFullscreen.tsx | 79 ------ 13 files changed, 177 insertions(+), 800 deletions(-) delete mode 100644 src/button/VolumeIcon.tsx delete mode 100644 src/video-grid/AudioSink.tsx delete mode 100644 src/video-grid/VideoTileSettingsModal.module.css delete mode 100644 src/video-grid/VideoTileSettingsModal.tsx delete mode 100644 src/video-grid/useFullscreen.tsx diff --git a/src/button/Button.tsx b/src/button/Button.tsx index 78b8299b..c4741f7f 100644 --- a/src/button/Button.tsx +++ b/src/button/Button.tsx @@ -30,10 +30,7 @@ import { ReactComponent as ScreenshareIcon } from "../icons/Screenshare.svg"; import { ReactComponent as SettingsIcon } from "../icons/Settings.svg"; import { ReactComponent as AddUserIcon } from "../icons/AddUser.svg"; import { ReactComponent as ArrowDownIcon } from "../icons/ArrowDown.svg"; -import { ReactComponent as Fullscreen } from "../icons/Fullscreen.svg"; -import { ReactComponent as FullscreenExit } from "../icons/FullscreenExit.svg"; import { TooltipTrigger } from "../Tooltip"; -import { VolumeIcon } from "./VolumeIcon"; export type ButtonVariant = | "default" @@ -263,45 +260,3 @@ export function InviteButton({ ); } - -interface AudioButtonProps extends Omit { - /** - * A number between 0 and 1 - */ - volume: number; -} - -export function AudioButton({ volume, ...rest }: AudioButtonProps) { - const { t } = useTranslation(); - const tooltip = useCallback(() => t("Local volume"), [t]); - - return ( - - - - ); -} - -interface FullscreenButtonProps extends Omit { - fullscreen?: boolean; -} - -export function FullscreenButton({ - fullscreen, - ...rest -}: FullscreenButtonProps) { - const { t } = useTranslation(); - const tooltip = useCallback(() => { - return fullscreen ? t("Exit full screen") : t("Full screen"); - }, [fullscreen, t]); - - return ( - - - - ); -} diff --git a/src/button/VolumeIcon.tsx b/src/button/VolumeIcon.tsx deleted file mode 100644 index d4958e48..00000000 --- a/src/button/VolumeIcon.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2022 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 React from "react"; - -import { ReactComponent as AudioMuted } from "../icons/AudioMuted.svg"; -import { ReactComponent as AudioLow } from "../icons/AudioLow.svg"; -import { ReactComponent as Audio } from "../icons/Audio.svg"; - -interface Props { - /** - * Number between 0 and 1 - */ - volume: number; -} - -export function VolumeIcon({ volume }: Props) { - if (volume <= 0) return ; - if (volume <= 0.5) return ; - return