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
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"; import { Body } from "./typography/Typography";
export function UserMenu({ export function UserMenu({
disableLogout, preventNavigation,
isAuthenticated, isAuthenticated,
isPasswordlessUser, isPasswordlessUser,
displayName, displayName,
@ -32,7 +32,7 @@ export function UserMenu({
label: displayName, label: displayName,
}); });
if (isPasswordlessUser) { if (isPasswordlessUser && !preventNavigation) {
arr.push({ arr.push({
key: "login", key: "login",
label: "Sign In", label: "Sign In",
@ -40,7 +40,7 @@ export function UserMenu({
}); });
} }
if (!isPasswordlessUser && !disableLogout) { if (!isPasswordlessUser && !preventNavigation) {
arr.push({ arr.push({
key: "logout", key: "logout",
label: "Sign Out", label: "Sign Out",
@ -50,7 +50,7 @@ export function UserMenu({
} }
return arr; return arr;
}, [isAuthenticated, isPasswordlessUser, displayName, disableLogout]); }, [isAuthenticated, isPasswordlessUser, displayName, preventNavigation]);
if (!isAuthenticated) { if (!isAuthenticated) {
return ( return (

View file

@ -6,7 +6,7 @@ import { useModalTriggerState } from "./Modal";
import { ProfileModal } from "./profile/ProfileModal"; import { ProfileModal } from "./profile/ProfileModal";
import { UserMenu } from "./UserMenu"; import { UserMenu } from "./UserMenu";
export function UserMenuContainer({ disableLogout }) { export function UserMenuContainer({ preventNavigation }) {
const location = useLocation(); const location = useLocation();
const history = useHistory(); const history = useHistory();
const { isAuthenticated, isPasswordlessUser, logout, userName, client } = const { isAuthenticated, isPasswordlessUser, logout, userName, client } =
@ -34,7 +34,7 @@ export function UserMenuContainer({ disableLogout }) {
return ( return (
<> <>
<UserMenu <UserMenu
disableLogout={disableLogout} preventNavigation={preventNavigation}
isAuthenticated={isAuthenticated} isAuthenticated={isAuthenticated}
isPasswordlessUser={isPasswordlessUser} isPasswordlessUser={isPasswordlessUser}
avatarUrl={avatarUrl} avatarUrl={avatarUrl}

View file

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

View file

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