From ca36082f55fed8e6f2c20c16ea3771e7933f32fa Mon Sep 17 00:00:00 2001 From: Pavel Prichodko <14926950+prichodko@users.noreply.github.com> Date: Mon, 23 May 2022 14:42:28 +0200 Subject: [PATCH] feat(react): add user profile dialog to chat message --- .../status-react/src/components/chat-menu/index.tsx | 2 +- .../src/components/user-profile-dialog/index.tsx | 8 ++++---- .../src/routes/chat/components/chat-message/index.tsx | 11 ++++++++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/status-react/src/components/chat-menu/index.tsx b/packages/status-react/src/components/chat-menu/index.tsx index ee9fad3..b591592 100644 --- a/packages/status-react/src/components/chat-menu/index.tsx +++ b/packages/status-react/src/components/chat-menu/index.tsx @@ -87,7 +87,7 @@ export const ChatMenu = (props: Props) => { } - onSelect={() => userProfileDialog.open({ contact: 'Satoshi' })} + onSelect={() => userProfileDialog.open({ name: 'Satoshi' })} > View Profile diff --git a/packages/status-react/src/components/user-profile-dialog/index.tsx b/packages/status-react/src/components/user-profile-dialog/index.tsx index 4e8b99e..f6630b8 100644 --- a/packages/status-react/src/components/user-profile-dialog/index.tsx +++ b/packages/status-react/src/components/user-profile-dialog/index.tsx @@ -3,18 +3,18 @@ import React from 'react' import { Avatar, Dialog, EmojiHash, Heading, Text } from '~/src/system' interface Props { - contact: string + name: string } // TODO: Add all states of contact, wait for desktop release export const UserProfileDialog = (props: Props) => { - const { contact, ...dialogProps } = props + const { name, ...dialogProps } = props return ( - + - {contact} + {name} Chatkey:0x63FaC9201494f0bd17B9892B9fae4d52fe3BD377 diff --git a/packages/status-react/src/routes/chat/components/chat-message/index.tsx b/packages/status-react/src/routes/chat/components/chat-message/index.tsx index f88ae41..b3b94b0 100644 --- a/packages/status-react/src/routes/chat/components/chat-message/index.tsx +++ b/packages/status-react/src/routes/chat/components/chat-message/index.tsx @@ -1,5 +1,6 @@ import React, { useState } from 'react' +import { UserProfileDialog } from '~/src/components/user-profile-dialog' import { useChatContext } from '~/src/contexts/chat-context' import { BellIcon } from '~/src/icons/bell-icon' import { PinIcon } from '~/src/icons/pin-icon' @@ -16,6 +17,7 @@ import { Flex, Image, Text, + useDialog, } from '~/src/system' import { ChatInput } from '../chat-input' @@ -60,6 +62,8 @@ export const ChatMessage = (props: Props) => { const { dispatch } = useChatContext() + const userProfileDialog = useDialog(UserProfileDialog) + const handleReplyClick = () => { dispatch({ type: 'SET_REPLY', @@ -160,7 +164,12 @@ export const ChatMessage = (props: Props) => { - }> + } + onSelect={() => + userProfileDialog.open({ name: contact.name }) + } + > View Profile }>