feat(react): add user profile dialog to chat message
This commit is contained in:
parent
01c861565b
commit
ca36082f55
|
@ -87,7 +87,7 @@ export const ChatMenu = (props: Props) => {
|
||||||
<Menu>
|
<Menu>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
icon={<BellIcon />}
|
icon={<BellIcon />}
|
||||||
onSelect={() => userProfileDialog.open({ contact: 'Satoshi' })}
|
onSelect={() => userProfileDialog.open({ name: 'Satoshi' })}
|
||||||
>
|
>
|
||||||
View Profile
|
View Profile
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
|
|
@ -3,18 +3,18 @@ import React from 'react'
|
||||||
import { Avatar, Dialog, EmojiHash, Heading, Text } from '~/src/system'
|
import { Avatar, Dialog, EmojiHash, Heading, Text } from '~/src/system'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
contact: string
|
name: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add all states of contact, wait for desktop release
|
// TODO: Add all states of contact, wait for desktop release
|
||||||
export const UserProfileDialog = (props: Props) => {
|
export const UserProfileDialog = (props: Props) => {
|
||||||
const { contact, ...dialogProps } = props
|
const { name, ...dialogProps } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog title={`${contact}'s Profile`} size="640" {...dialogProps}>
|
<Dialog title={`${name}'s Profile`} size="640" {...dialogProps}>
|
||||||
<Dialog.Body align="center">
|
<Dialog.Body align="center">
|
||||||
<Avatar size="80" />
|
<Avatar size="80" />
|
||||||
<Heading size="22">{contact}</Heading>
|
<Heading size="22">{name}</Heading>
|
||||||
<Text>Chatkey:0x63FaC9201494f0bd17B9892B9fae4d52fe3BD377</Text>
|
<Text>Chatkey:0x63FaC9201494f0bd17B9892B9fae4d52fe3BD377</Text>
|
||||||
<EmojiHash />
|
<EmojiHash />
|
||||||
</Dialog.Body>
|
</Dialog.Body>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
|
||||||
|
import { UserProfileDialog } from '~/src/components/user-profile-dialog'
|
||||||
import { useChatContext } from '~/src/contexts/chat-context'
|
import { useChatContext } from '~/src/contexts/chat-context'
|
||||||
import { BellIcon } from '~/src/icons/bell-icon'
|
import { BellIcon } from '~/src/icons/bell-icon'
|
||||||
import { PinIcon } from '~/src/icons/pin-icon'
|
import { PinIcon } from '~/src/icons/pin-icon'
|
||||||
|
@ -16,6 +17,7 @@ import {
|
||||||
Flex,
|
Flex,
|
||||||
Image,
|
Image,
|
||||||
Text,
|
Text,
|
||||||
|
useDialog,
|
||||||
} from '~/src/system'
|
} from '~/src/system'
|
||||||
|
|
||||||
import { ChatInput } from '../chat-input'
|
import { ChatInput } from '../chat-input'
|
||||||
|
@ -60,6 +62,8 @@ export const ChatMessage = (props: Props) => {
|
||||||
|
|
||||||
const { dispatch } = useChatContext()
|
const { dispatch } = useChatContext()
|
||||||
|
|
||||||
|
const userProfileDialog = useDialog(UserProfileDialog)
|
||||||
|
|
||||||
const handleReplyClick = () => {
|
const handleReplyClick = () => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'SET_REPLY',
|
type: 'SET_REPLY',
|
||||||
|
@ -160,7 +164,12 @@ export const ChatMessage = (props: Props) => {
|
||||||
<EmojiHash />
|
<EmojiHash />
|
||||||
</Flex>
|
</Flex>
|
||||||
<DropdownMenu.Separator />
|
<DropdownMenu.Separator />
|
||||||
<DropdownMenu.Item icon={<BellIcon />}>
|
<DropdownMenu.Item
|
||||||
|
icon={<BellIcon />}
|
||||||
|
onSelect={() =>
|
||||||
|
userProfileDialog.open({ name: contact.name })
|
||||||
|
}
|
||||||
|
>
|
||||||
View Profile
|
View Profile
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
<DropdownMenu.Item icon={<BellIcon />}>
|
<DropdownMenu.Item icon={<BellIcon />}>
|
||||||
|
|
Loading…
Reference in New Issue