diff --git a/packages/chat/src/chat-bubble/chat-bubble.tsx b/packages/chat/src/chat-bubble/chat-bubble.tsx index 2f680c5887..7f9e5cc14d 100644 --- a/packages/chat/src/chat-bubble/chat-bubble.tsx +++ b/packages/chat/src/chat-bubble/chat-bubble.tsx @@ -7,7 +7,6 @@ import { OtherUnreadInterface, PostMessageActionType, TextPayload, - UserInfoInterface, UserType, } from '../types' import { getProfileImageUrl } from '../utils' @@ -16,7 +15,7 @@ import { ChatBubbleStyle } from '../types/ui' import { ChatBubbleUI } from './chat-bubble-ui' interface ChatBubbleProps { - userInfo: UserInfoInterface + my: boolean message: MessageInterface otherReadInfo?: OtherUnreadInterface[] displayTarget: UserType @@ -29,9 +28,9 @@ interface ChatBubbleProps { } const ChatBubble = ({ + my, message, - message: { senderId, createdAt }, - userInfo: { me, others }, + message: { sender, createdAt }, otherReadInfo, displayTarget: componentDisplayTarget, postMessageAction, @@ -41,11 +40,6 @@ const ChatBubble = ({ blindedText, bubbleStyle, }: ChatBubbleProps) => { - const otherUserInfo = useMemo( - () => others.find((other) => other.id === senderId), - [senderId, others], - ) - const unreadCount = !disableUnreadCount && otherReadInfo ? otherReadInfo.reduce( @@ -92,11 +86,9 @@ const ChatBubble = ({ return ( - {userInfo ? ( - <> - - - - ) : null} + + diff --git a/packages/chat/src/types/index.ts b/packages/chat/src/types/index.ts index 0b52cc7998..6e5dab6327 100644 --- a/packages/chat/src/types/index.ts +++ b/packages/chat/src/types/index.ts @@ -71,6 +71,7 @@ export interface MessageInterface { displayTarget?: UserType[] | DisplayTargetAll alternative?: TextPayload | ImagePayload | RichPayload blindedAt?: string + sender: UserInterface } export interface UserInterface { diff --git a/packages/chat/src/utils/constants.ts b/packages/chat/src/utils/constants.ts index bb64d516da..0cc0878bc2 100644 --- a/packages/chat/src/utils/constants.ts +++ b/packages/chat/src/utils/constants.ts @@ -37,33 +37,17 @@ export const MEDIA_ARGS: ChatContextValue = { export const CHAT_ARGS: ChatProps = { displayTarget: UserType.TNA_PARTNER, - userInfo: { - me: { - id: '61ea67f0de3e37001997a80f', - type: UserType.TNA_PARTNER, - identifier: '130', - code: 'TNA_BPM', - profile: { - name: 'TNA_BPM', - thumbnail: - 'https://s3.ap-northeast-2.amazonaws.com/triple-tna-dev/partner/logo/1e2496ab-8725-4df4-84c7-db9804d3c71d.jpeg', - message: '', - }, + me: { + id: '61ea67f0de3e37001997a80f', + type: UserType.TNA_PARTNER, + identifier: '130', + code: 'TNA_BPM', + profile: { + name: 'TNA_BPM', + thumbnail: + 'https://s3.ap-northeast-2.amazonaws.com/triple-tna-dev/partner/logo/1e2496ab-8725-4df4-84c7-db9804d3c71d.jpeg', + message: '', }, - others: [ - { - id: '6344be9953749900140bca42', - type: UserType.TRIPLE_USER, - identifier: '4043', - code: '_KA2408084137-1661761357899', - profile: { - name: '후라이', - thumbnail: - 'https://media.triple.guide/triple-dev/c_limit,f_auto,h_2048,w_2048/52557846-363d-430a-9afd-1cd7fd4fe0b4.jpeg', - message: '', - }, - }, - ], }, getMessages: async () => { return [ @@ -96,6 +80,18 @@ export const CHAT_ARGS: ChatProps = { message: '안녕하세요.\nTNA_BPM입니다. 예약해주셔서 감사합니다!\n\n궁금한 점이 있으시면 TNA_BPM 문의를 편하게 이용해주세요.', }, + sender: { + id: '61ea67f0de3e37001997a80f', + type: UserType.TNA_PARTNER, + identifier: '130', + code: 'TNA_BPM', + profile: { + name: 'TNA_BPM', + thumbnail: + 'https://s3.ap-northeast-2.amazonaws.com/triple-tna-dev/partner/logo/1e2496ab-8725-4df4-84c7-db9804d3c71d.jpeg', + message: '', + }, + }, }, { id: 5749, @@ -107,6 +103,18 @@ export const CHAT_ARGS: ChatProps = { type: MessageType.TEXT, message: '테스트 메시지', }, + sender: { + id: '6344be9953749900140bca42', + type: UserType.TRIPLE_USER, + identifier: '4043', + code: '1', + profile: { + name: '후라이', + thumbnail: + 'https://media.triple.guide/triple-dev/c_limit,f_auto,h_2048,w_2048/52557846-363d-430a-9afd-1cd7fd4fe0b4.jpeg', + message: '', + }, + }, }, ] }, @@ -153,6 +161,18 @@ export const CHAT_ARGS: ChatProps = { type: MessageType.TEXT, message: '테스트 메시지', }, + sender: { + id: '6344be9953749900140bca42', + type: UserType.TRIPLE_USER, + identifier: '4043', + code: '1', + profile: { + name: '후라이', + thumbnail: + 'https://media.triple.guide/triple-dev/c_limit,f_auto,h_2048,w_2048/52557846-363d-430a-9afd-1cd7fd4fe0b4.jpeg', + message: '', + }, + }, }, unreadCount: 0, metadata: { @@ -171,6 +191,18 @@ export const CHAT_ARGS: ChatProps = { createdAt: '2022-11-04T06:44:57.017Z', displayTarget: 'all', payload, + sender: { + id: '61ea67f0de3e37001997a80f', + type: UserType.TNA_PARTNER, + identifier: '130', + code: 'TNA_BPM', + profile: { + name: 'TNA_BPM', + thumbnail: + 'https://s3.ap-northeast-2.amazonaws.com/triple-tna-dev/partner/logo/1e2496ab-8725-4df4-84c7-db9804d3c71d.jpeg', + message: '', + }, + }, }, ], }