From c4f335ebb6fc45174bf9ad9d04d842840f024584 Mon Sep 17 00:00:00 2001 From: Robert Long Date: Wed, 2 Feb 2022 15:09:16 -0800 Subject: [PATCH] Prevent navigation from login / logout links in user menu in room --- src/UserMenu.jsx | 8 ++++---- src/UserMenuContainer.jsx | 4 ++-- src/room/InCallView.jsx | 2 +- src/room/RoomAuthView.jsx | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/UserMenu.jsx b/src/UserMenu.jsx index 3e9f7354..6363948c 100644 --- a/src/UserMenu.jsx +++ b/src/UserMenu.jsx @@ -13,7 +13,7 @@ import { useLocation } from "react-router-dom"; import { Body } from "./typography/Typography"; export function UserMenu({ - disableLogout, + preventNavigation, isAuthenticated, isPasswordlessUser, displayName, @@ -32,7 +32,7 @@ export function UserMenu({ label: displayName, }); - if (isPasswordlessUser) { + if (isPasswordlessUser && !preventNavigation) { arr.push({ key: "login", label: "Sign In", @@ -40,7 +40,7 @@ export function UserMenu({ }); } - if (!isPasswordlessUser && !disableLogout) { + if (!isPasswordlessUser && !preventNavigation) { arr.push({ key: "logout", label: "Sign Out", @@ -50,7 +50,7 @@ export function UserMenu({ } return arr; - }, [isAuthenticated, isPasswordlessUser, displayName, disableLogout]); + }, [isAuthenticated, isPasswordlessUser, displayName, preventNavigation]); if (!isAuthenticated) { return ( diff --git a/src/UserMenuContainer.jsx b/src/UserMenuContainer.jsx index b4af921f..eecb657e 100644 --- a/src/UserMenuContainer.jsx +++ b/src/UserMenuContainer.jsx @@ -6,7 +6,7 @@ import { useModalTriggerState } from "./Modal"; import { ProfileModal } from "./profile/ProfileModal"; import { UserMenu } from "./UserMenu"; -export function UserMenuContainer({ disableLogout }) { +export function UserMenuContainer({ preventNavigation }) { const location = useLocation(); const history = useHistory(); const { isAuthenticated, isPasswordlessUser, logout, userName, client } = @@ -34,7 +34,7 @@ export function UserMenuContainer({ disableLogout }) { return ( <> - + {items.length === 0 ? ( diff --git a/src/room/RoomAuthView.jsx b/src/room/RoomAuthView.jsx index 7728639c..4cb43796 100644 --- a/src/room/RoomAuthView.jsx +++ b/src/room/RoomAuthView.jsx @@ -49,7 +49,7 @@ export function RoomAuthView() { - +