From d2aa6d561f540c0b8e3e1cc8545d2584110e5e8f Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 28 Oct 2024 15:15:02 -0400 Subject: [PATCH] Hide the 'profile' menu option in widget mode The profile settings tab is non-functional in widget mode so we need to hide its other points of entry. --- src/room/InCallView.tsx | 15 +++++++++++---- src/tile/GridTile.tsx | 16 +++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index d50be3c9..ec981c45 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -260,10 +260,17 @@ export const InCallView: FC = ({ [setSettingsModalOpen], ); - const openProfile = useCallback(() => { - setSettingsTab("profile"); - setSettingsModalOpen(true); - }, [setSettingsTab, setSettingsModalOpen]); + const openProfile = useMemo( + () => + // Profile settings are unavailable in widget mode + widget === null + ? (): void => { + setSettingsTab("profile"); + setSettingsModalOpen(true); + } + : null, + [setSettingsTab, setSettingsModalOpen], + ); const [headerRef, headerBounds] = useMeasure(); const [footerRef, footerBounds] = useMeasure(); diff --git a/src/tile/GridTile.tsx b/src/tile/GridTile.tsx index a85abe23..1eb0b933 100644 --- a/src/tile/GridTile.tsx +++ b/src/tile/GridTile.tsx @@ -160,7 +160,7 @@ UserMediaTile.displayName = "UserMediaTile"; interface LocalUserMediaTileProps extends TileProps { vm: LocalUserMediaViewModel; - onOpenProfile: () => void; + onOpenProfile: (() => void) | null; } const LocalUserMediaTile = forwardRef( @@ -191,11 +191,13 @@ const LocalUserMediaTile = forwardRef( /> } menuEnd={ - + onOpenProfile && ( + + ) } {...props} /> @@ -268,7 +270,7 @@ RemoteUserMediaTile.displayName = "RemoteUserMediaTile"; interface GridTileProps { vm: UserMediaViewModel; - onOpenProfile: () => void; + onOpenProfile: (() => void) | null; targetWidth: number; targetHeight: number; className?: string;