From 237fd44d6c70c9c2ce1ae4c5941c2bca4f8d3201 Mon Sep 17 00:00:00 2001 From: marcoelissa Date: Thu, 10 Nov 2022 14:43:39 +0700 Subject: [PATCH] Hide send message button on ownAccount profile --- src/components/Profile/Header/index.tsx | 54 ++++++++++++------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/components/Profile/Header/index.tsx b/src/components/Profile/Header/index.tsx index 64c085a50..273d87cd2 100644 --- a/src/components/Profile/Header/index.tsx +++ b/src/components/Profile/Header/index.tsx @@ -27,7 +27,7 @@ export default function AccountHeader({ }: { accountId: string }): ReactElement { - const { profile } = useProfile() + const { profile, ownAccount } = useProfile() const { orbis, setConvOpen, setConversationId, conversations } = useOrbis() const [isShowMore, setIsShowMore] = useState(false) const [userDid, setUserDid] = useState() @@ -51,6 +51,19 @@ export default function AccountHeader({ console.log('clicked') } + const checkConversation = () => { + const filtered = conversations.filter( + (conversation: OrbisConversationInterface) => { + // console.log(conversation) + console.log(userDid) + return conversation.recipients.includes(userDid) + } + ) + if (!filtered.length && userDid) { + createConversation() + } + } + useEffect(() => { const getDid = async () => { const { data, error } = await orbis.getDids(accountId) @@ -79,21 +92,6 @@ export default function AccountHeader({ } }, [orbis, accountId]) - const checkConversation = () => { - const filtered = conversations.filter( - (conversation: OrbisConversationInterface) => { - // console.log(conversation) - console.log(userDid) - return conversation.recipients.includes(userDid) - } - ) - if (!filtered.length) { - if (userDid) { - createConversation() - } - } - } - return (
@@ -102,17 +100,19 @@ export default function AccountHeader({
-
- -
+ {!ownAccount && ( +
+ +
+ )} {isDescriptionTextClamped() ? (