Prevent navigation from login / logout links in user menu in room

This commit is contained in:
Robert Long 2022-02-02 15:09:16 -08:00
parent 35c11660a3
commit c4f335ebb6
4 changed files with 8 additions and 8 deletions

View file

@ -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 (

View file

@ -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 (
<>
<UserMenu
disableLogout={disableLogout}
preventNavigation={preventNavigation}
isAuthenticated={isAuthenticated}
isPasswordlessUser={isPasswordlessUser}
avatarUrl={avatarUrl}

View file

@ -121,7 +121,7 @@ export function InCallView({
</LeftNav>
<RightNav>
<GridLayoutMenu layout={layout} setLayout={setLayout} />
<UserMenuContainer disableLogout />
<UserMenuContainer preventNavigation />
</RightNav>
</Header>
{items.length === 0 ? (

View file

@ -49,7 +49,7 @@ export function RoomAuthView() {
<HeaderLogo />
</LeftNav>
<RightNav>
<UserMenuContainer disableLogout />
<UserMenuContainer preventNavigation />
</RightNav>
</Header>
<div className={styles.container}>