diff --git a/packages/react-chat/src/components/Channels/Channels.tsx b/packages/react-chat/src/components/Channels/Channels.tsx index 7f782e54..3b4f6c12 100644 --- a/packages/react-chat/src/components/Channels/Channels.tsx +++ b/packages/react-chat/src/components/Channels/Channels.tsx @@ -2,8 +2,10 @@ import React, { useEffect } from "react"; import styled from "styled-components"; import { ChatState, useChatState } from "../../contexts/chatStateProvider"; +import { useIdentity } from "../../contexts/identityProvider"; import { useMessengerContext } from "../../contexts/messengerProvider"; import { CreateIcon } from "../Icons/CreateIcon"; +import { UserCreation } from "../UserCreation/UserCreation"; import { Channel } from "./Channel"; @@ -55,24 +57,34 @@ export function Channels({ onCommunityClick }: ChannelsProps) { } }, [notifications, activeChannel]); const setChatState = useChatState()[1]; + const identity = useIdentity(); + return ( - - - Chat - setChatState(ChatState.ChatCreation)}> - - - - - - - + {identity ? ( + <> + + Chat + setChatState(ChatState.ChatCreation)}> + + + + + + + + + ) : ( + + )} ); diff --git a/packages/react-chat/src/components/Chat.tsx b/packages/react-chat/src/components/Chat.tsx index 83707e35..e6ec4c97 100644 --- a/packages/react-chat/src/components/Chat.tsx +++ b/packages/react-chat/src/components/Chat.tsx @@ -2,7 +2,6 @@ import React, { useState } from "react"; import styled from "styled-components"; import { ChatState, useChatState } from "../contexts/chatStateProvider"; -import { useIdentity } from "../contexts/identityProvider"; import { useNarrow } from "../contexts/narrowProvider"; import { Channels } from "./Channels/Channels"; @@ -20,7 +19,6 @@ import { UserCreationModal } from "./Modals/UserCreationModal"; import { WalletConnectModal } from "./Modals/WalletConnectModal"; import { WalletModal } from "./Modals/WalletModal"; import { ToastMessageList } from "./ToastMessages/ToastMessageList"; -import { UserCreation } from "./UserCreation/UserCreation"; function Modals() { return ( @@ -42,13 +40,12 @@ export function Chat() { const [state] = useChatState(); const [showMembers, setShowMembers] = useState(false); const narrow = useNarrow(); - const identity = useIdentity(); return ( {!narrow && ( - {identity ? : } + )} {state === ChatState.ChatBody && ( diff --git a/packages/react-chat/src/components/Modals/LogoutModal.tsx b/packages/react-chat/src/components/Modals/LogoutModal.tsx index a720367b..c838dce4 100644 --- a/packages/react-chat/src/components/Modals/LogoutModal.tsx +++ b/packages/react-chat/src/components/Modals/LogoutModal.tsx @@ -6,6 +6,7 @@ import { useIdentity, useNickname, useSetIdentity, + useSetNikcname, } from "../../contexts/identityProvider"; import { useModal } from "../../contexts/modalProvider"; import { ButtonNo, ButtonYes } from "../Buttons/buttonStyle"; @@ -26,6 +27,7 @@ export const LogoutModalName = "LogoutModal"; export const LogoutModal = () => { const { setModal } = useModal(LogoutModalName); const logout = useSetIdentity(); + const setNickname = useSetNikcname(); const identity = useIdentity(); const nickname = useNickname(); @@ -71,6 +73,7 @@ export const LogoutModal = () => { onClick={() => { setModal(false); logout(undefined); + setNickname(undefined); }} > Disconnect diff --git a/packages/react-chat/src/components/Modals/UserCreationModal.tsx b/packages/react-chat/src/components/Modals/UserCreationModal.tsx index 6a6c6e6d..15b6b29a 100644 --- a/packages/react-chat/src/components/Modals/UserCreationModal.tsx +++ b/packages/react-chat/src/components/Modals/UserCreationModal.tsx @@ -6,6 +6,7 @@ import { useIdentity, useSetIdentity, useSetNikcname, + useWalletIdentity, } from "../../contexts/identityProvider"; import { useModal } from "../../contexts/modalProvider"; import { Contact } from "../../models/Contact"; @@ -36,6 +37,7 @@ import { EmojiKey, UserAddress } from "./ProfileModal"; export const UserCreationModalName = "UserCreationModal"; export function UserCreationModal() { + const walletIdentity = useWalletIdentity(); const identity = useIdentity(); const setIdentity = useSetIdentity(); const setNickname = useSetNikcname(); @@ -93,7 +95,7 @@ export function UserCreationModal() { onChange={(e) => setCustomNameInput(e.currentTarget.value)} /> )} - {!nextStep && encryptedIdentity && ( + {!nextStep && encryptedIdentity && !walletIdentity && (