@daeryun/dr_components 0.7.78 → 0.7.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asset/images/daeryuntalk/download.svg +5 -0
- package/dist/asset/images/daeryuntalk/firstGo.svg +5 -0
- package/dist/asset/images/daeryuntalk/objectBack.svg +4 -0
- package/dist/asset/images/daeryuntalk/viewer/close.svg +4 -0
- package/dist/asset/images/daeryuntalk/viewer/gray-download.svg +7 -0
- package/dist/asset/images/daeryuntalk/viewer/move-button.svg +4 -0
- package/dist/asset/images/daeryuntalk/viewer/rotate.svg +17 -0
- package/dist/asset/images/daeryuntalk/viewer/zoom-in.svg +5 -0
- package/dist/asset/images/daeryuntalk/viewer/zoom-out.svg +6 -0
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatButton.jsx +1 -0
- package/dist/components/Daeryuntalk/ChatButton.tsx +1 -0
- package/dist/components/Daeryuntalk/ChatConversation.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatConversation.jsx +19 -12
- package/dist/components/Daeryuntalk/ChatConversation.tsx +48 -11
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +27 -6
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +39 -8
- package/dist/components/Daeryuntalk/ChatInput.jsx +23 -3
- package/dist/components/Daeryuntalk/ChatInput.tsx +26 -10
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.d.ts +10 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +186 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +252 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.d.ts +8 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.jsx +87 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.tsx +115 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.d.ts +8 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.jsx +13 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.tsx +25 -0
- package/dist/components/Daeryuntalk/ChatItem/RichText.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatItem/RichText.jsx +25 -0
- package/dist/components/Daeryuntalk/ChatItem/RichText.tsx +32 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowAuthForm.d.ts +8 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowAuthForm.jsx +19 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowAuthForm.tsx +31 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.jsx +20 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.tsx +36 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +9 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +16 -0
- package/dist/components/Daeryuntalk/ChatMessage.d.ts +11 -1
- package/dist/components/Daeryuntalk/ChatMessage.jsx +116 -14
- package/dist/components/Daeryuntalk/ChatMessage.tsx +175 -20
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.jsx +16 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.tsx +28 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.d.ts +10 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.jsx +118 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.tsx +162 -0
- package/dist/components/Daeryuntalk/ChatWidget.jsx +7 -3
- package/dist/components/Daeryuntalk/ChatWidget.tsx +9 -5
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +37 -5
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +71 -157
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +128 -189
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.d.ts +17 -0
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +57 -0
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +82 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.d.ts +3 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.jsx +172 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.tsx +236 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +133 -0
- package/dist/{lib/api → components/Daeryuntalk/_api}/daeryuntalk/index.js +251 -46
- package/dist/{lib/api → components/Daeryuntalk/_api}/daeryuntalk/index.ts +353 -129
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.d.ts +115 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.js +1 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.ts +135 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.d.ts +6 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.js +11 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.ts +11 -0
- package/dist/components/Daeryuntalk/_enums/message_type.d.ts +6 -0
- package/dist/components/Daeryuntalk/_enums/message_type.js +13 -0
- package/dist/components/Daeryuntalk/_enums/message_type.ts +13 -0
- package/dist/components/Daeryuntalk/_enums/sender_type.d.ts +8 -0
- package/dist/components/Daeryuntalk/_enums/sender_type.js +16 -0
- package/dist/components/Daeryuntalk/_enums/sender_type.ts +16 -0
- package/dist/components/Daeryuntalk/_enums/socket_type.d.ts +22 -0
- package/dist/components/Daeryuntalk/_enums/socket_type.js +23 -0
- package/dist/components/Daeryuntalk/_enums/socket_type.ts +31 -0
- package/dist/components/Daeryuntalk/_enums/template.d.ts +32 -0
- package/dist/components/Daeryuntalk/_enums/template.js +49 -0
- package/dist/components/Daeryuntalk/_enums/template.ts +53 -0
- package/dist/components/Daeryuntalk/_enums/work_flow_object_expose.d.ts +34 -0
- package/dist/components/Daeryuntalk/_enums/work_flow_object_expose.js +66 -0
- package/dist/components/Daeryuntalk/_enums/work_flow_object_expose.ts +69 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.d.ts +46 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +296 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +364 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHistory.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHistory.js +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHistory.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.js +22 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.ts +30 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +21 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +205 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +240 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useViewerHook.d.ts +8 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useViewerHook.js +18 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useViewerHook.ts +23 -0
- package/dist/components/Daeryuntalk/_lib/index.d.ts +7 -0
- package/dist/components/Daeryuntalk/_lib/index.js +101 -0
- package/dist/components/Daeryuntalk/_lib/index.ts +137 -0
- package/dist/components/Daeryuntalk/_lib/utils.d.ts +2 -0
- package/dist/components/Daeryuntalk/_lib/utils.js +16 -0
- package/dist/components/Daeryuntalk/_lib/utils.ts +17 -0
- package/dist/components/Daeryuntalk/{types.d.ts → _types/message.d.ts} +33 -17
- package/dist/components/Daeryuntalk/_types/message.js +19 -0
- package/dist/components/Daeryuntalk/{types.ts → _types/message.ts} +64 -19
- package/dist/components/Daeryuntalk/_types/message_object.d.ts +16 -0
- package/dist/components/Daeryuntalk/_types/message_object.js +1 -0
- package/dist/components/Daeryuntalk/_types/message_object.ts +20 -0
- package/dist/components/Daeryuntalk/_types/socket/message.d.ts +0 -0
- package/dist/components/Daeryuntalk/_types/socket/message.js +1 -0
- package/dist/components/Daeryuntalk/_types/socket/message.ts +0 -0
- package/dist/components/Daeryuntalk/_types/socket/workflow.d.ts +15 -0
- package/dist/components/Daeryuntalk/_types/socket/workflow.js +1 -0
- package/dist/components/Daeryuntalk/_types/socket/workflow.ts +15 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button1.d.ts +10 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button1.jsx +11 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button1.tsx +28 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input1.d.ts +12 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input1.jsx +9 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input1.tsx +39 -0
- package/dist/components/Daeryuntalk/index.tsx +1 -0
- package/dist/components/common/data/index.js +2 -2
- package/dist/components/common/data/index.ts +2 -2
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.ts +1 -1
- package/dist/styles/globals.css +161 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -2
- package/dist/components/Daeryuntalk/types.js +0 -8
- package/dist/lib/api/daeryuntalk/index.d.ts +0 -143
- /package/dist/{lib/api → components/Daeryuntalk/_api}/index.d.ts +0 -0
- /package/dist/{lib/api → components/Daeryuntalk/_api}/index.js +0 -0
- /package/dist/{lib/api → components/Daeryuntalk/_api}/index.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import ChatMessage from './ChatMessage';
|
|
4
4
|
import ChatInput from './ChatInput';
|
|
@@ -7,24 +7,39 @@ import DateSeparator from './DateSeparator';
|
|
|
7
7
|
import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
|
|
8
8
|
import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
9
9
|
import Image from 'next/image';
|
|
10
|
+
import { useChatSocketState } from './_hooks/talkprovider/useChatSocketState';
|
|
11
|
+
import { getMessageFileDownloadUrl } from './_api';
|
|
10
12
|
|
|
11
13
|
type ChatConversationProps = {
|
|
12
14
|
onBackClick?: () => void;
|
|
15
|
+
isActive: boolean;
|
|
13
16
|
};
|
|
14
17
|
|
|
15
|
-
const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick }) => {
|
|
16
|
-
const {
|
|
18
|
+
const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick, isActive }) => {
|
|
19
|
+
const {
|
|
20
|
+
messages,
|
|
21
|
+
isLoading,
|
|
22
|
+
inquiryMainData,
|
|
23
|
+
messageObject,
|
|
24
|
+
workFlowBack,
|
|
25
|
+
workFlowStack,
|
|
26
|
+
chatInquiryNumber,
|
|
27
|
+
sendHeartbeat
|
|
28
|
+
} = useDaeryuntalk();
|
|
29
|
+
const [isHovered, setIsHovered] = useState<boolean>(false);
|
|
17
30
|
const messagesEndRef = useRef<HTMLDivElement>(null);
|
|
18
31
|
|
|
19
32
|
const defaultNoticeContent =
|
|
20
33
|
'본 채팅을 통해 제공되는 서비스는 일반적인 법률정보 제공 및 고객 편의 도모를 위한 것 입니다. 본 채팅을 통해 제공된 정보를 이용한 행위에 대해서는 당사는 어떠한 법적 책임을 지지 않으며 구체적인 사안에 대한 적용은 변호사와의 추가 상담을 통해 자문을 받으시기를 권해드립니다.';
|
|
21
34
|
|
|
22
|
-
const noticeContent =
|
|
35
|
+
const noticeContent = defaultNoticeContent;
|
|
23
36
|
|
|
24
37
|
// 새 메시지가 도착할 때 자동으로 스크롤 최하단으로 이동
|
|
25
38
|
useEffect(() => {
|
|
26
39
|
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
|
27
|
-
}, [messages]);
|
|
40
|
+
}, [messages, messageObject]);
|
|
41
|
+
|
|
42
|
+
console.log('messages', messages);
|
|
28
43
|
|
|
29
44
|
const isNewDay = (date1: Date, date2: Date): boolean => {
|
|
30
45
|
return (
|
|
@@ -38,10 +53,28 @@ const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick }) => {
|
|
|
38
53
|
const elements: React.ReactNode[] = [];
|
|
39
54
|
|
|
40
55
|
messages.forEach((message, index) => {
|
|
56
|
+
// 오브젝트 워크플로우 있는경우는 넣어주기
|
|
57
|
+
const findObject =
|
|
58
|
+
message.workFlow &&
|
|
59
|
+
messageObject?.exposeObjectListYn &&
|
|
60
|
+
messageObject?.messageNumber === message.messageNumber
|
|
61
|
+
? messageObject
|
|
62
|
+
: null;
|
|
63
|
+
|
|
41
64
|
if (index === 0 || isNewDay(message.createdAt, messages[index - 1].createdAt)) {
|
|
42
|
-
elements.push(<DateSeparator key={`date-${message.
|
|
65
|
+
elements.push(<DateSeparator key={`date-${message.messageNumber}`} date={message.createdAt} />);
|
|
43
66
|
}
|
|
44
|
-
elements.push(
|
|
67
|
+
elements.push(
|
|
68
|
+
<ChatMessage
|
|
69
|
+
key={message.messageNumber}
|
|
70
|
+
message={message}
|
|
71
|
+
object={findObject}
|
|
72
|
+
handelObjectBack={workFlowBack}
|
|
73
|
+
chatInquiryNumber={chatInquiryNumber || ''}
|
|
74
|
+
workFlowStack={workFlowStack}
|
|
75
|
+
isHovered={isHovered}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
45
78
|
});
|
|
46
79
|
|
|
47
80
|
return elements;
|
|
@@ -53,8 +86,8 @@ const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick }) => {
|
|
|
53
86
|
}
|
|
54
87
|
};
|
|
55
88
|
|
|
56
|
-
const channelName = inquiryMainData?.
|
|
57
|
-
const logoImageUrl = inquiryMainData?.
|
|
89
|
+
const channelName = inquiryMainData?.channel_name || '법무법인(유한)대륜';
|
|
90
|
+
const logoImageUrl = inquiryMainData?.channel_logo_image_url || '';
|
|
58
91
|
|
|
59
92
|
return (
|
|
60
93
|
<div className="flex h-full flex-col">
|
|
@@ -84,7 +117,11 @@ const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick }) => {
|
|
|
84
117
|
<p className="mt-2 text-sm">24시간 운영하고 있습니다.</p>
|
|
85
118
|
</div>
|
|
86
119
|
) : (
|
|
87
|
-
|
|
120
|
+
<div
|
|
121
|
+
className={``}
|
|
122
|
+
onMouseEnter={() => setIsHovered(true)}
|
|
123
|
+
onMouseLeave={() => setIsHovered(false)}
|
|
124
|
+
>
|
|
88
125
|
{renderMessagesWithDateSeparators()}
|
|
89
126
|
{isLoading && (
|
|
90
127
|
<div className="flex justify-start">
|
|
@@ -102,7 +139,7 @@ const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick }) => {
|
|
|
102
139
|
</div>
|
|
103
140
|
)}
|
|
104
141
|
<div ref={messagesEndRef} />
|
|
105
|
-
|
|
142
|
+
</div>
|
|
106
143
|
)}
|
|
107
144
|
</div>
|
|
108
145
|
|
|
@@ -18,17 +18,21 @@ import TimeIcon from '../../asset/images/daeryuntalk/time.svg';
|
|
|
18
18
|
import InfoIcon from '../../asset/images/daeryuntalk/info.svg';
|
|
19
19
|
import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
20
20
|
import DaeryuntalkIntro from '../../asset/images/daeryuntalk/daeryuntalk-intro.png';
|
|
21
|
+
import { useChatSocketState } from './_hooks/talkprovider/useChatSocketState';
|
|
21
22
|
const ChatHomeView = () => {
|
|
22
|
-
const { viewHistory, inquiryMainData, startChat } = useDaeryuntalk();
|
|
23
|
+
const { viewHistory, inquiryMainData, startChat, createNewChat, chatInquiryNumber, sendHeartbeat, sendInquiryLeft } = useDaeryuntalk();
|
|
23
24
|
const [viewState, setViewState] = useState('home');
|
|
24
25
|
const [selectedHistoryId, setSelectedHistoryId] = useState(null);
|
|
25
26
|
const [mainData, setMainData] = useState(null);
|
|
26
27
|
const [isLoading, setIsLoading] = useState(false);
|
|
27
28
|
useEffect(() => {
|
|
28
|
-
if (inquiryMainData
|
|
29
|
-
setMainData(inquiryMainData
|
|
29
|
+
if (inquiryMainData) {
|
|
30
|
+
setMainData(inquiryMainData);
|
|
30
31
|
}
|
|
31
32
|
}, [inquiryMainData]);
|
|
33
|
+
// 채팅창관리
|
|
34
|
+
useChatSocketState(chatInquiryNumber, viewState, sendHeartbeat, sendInquiryLeft);
|
|
35
|
+
// 홈에서 사용
|
|
32
36
|
const handleStartChat = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
37
|
try {
|
|
34
38
|
setIsLoading(true);
|
|
@@ -44,6 +48,22 @@ const ChatHomeView = () => {
|
|
|
44
48
|
setIsLoading(false);
|
|
45
49
|
}
|
|
46
50
|
});
|
|
51
|
+
// 히스토리에서 사용
|
|
52
|
+
const handleNewStartChat = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
try {
|
|
54
|
+
setIsLoading(true);
|
|
55
|
+
// 채팅 시작 - 새 문의 생성 또는 기존 문의 조회 처리
|
|
56
|
+
yield createNewChat();
|
|
57
|
+
// 대화 화면으로 전환
|
|
58
|
+
setViewState('conversation');
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error('신규 채팅 실패:', error);
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
setIsLoading(false);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
47
67
|
const handleHistoryClick = () => {
|
|
48
68
|
viewHistory();
|
|
49
69
|
setViewState('history');
|
|
@@ -56,10 +76,11 @@ const ChatHomeView = () => {
|
|
|
56
76
|
viewHistory();
|
|
57
77
|
setViewState('conversation');
|
|
58
78
|
};
|
|
79
|
+
// 채팅 문의 창
|
|
59
80
|
if (viewState === 'conversation') {
|
|
60
81
|
return (<main className="flex h-[690px] w-[390px] items-center justify-center rounded-[30px]">
|
|
61
82
|
<div className="relative h-[690px] w-[390px] overflow-hidden rounded-[30px] bg-white shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]">
|
|
62
|
-
<ChatConversation onBackClick={handleBackToHome}/>
|
|
83
|
+
<ChatConversation onBackClick={handleBackToHome} isActive={viewState === 'conversation'}/>
|
|
63
84
|
</div>
|
|
64
85
|
</main>);
|
|
65
86
|
}
|
|
@@ -75,7 +96,7 @@ const ChatHomeView = () => {
|
|
|
75
96
|
</main>);
|
|
76
97
|
};
|
|
77
98
|
if (viewState === 'history') {
|
|
78
|
-
return renderWithNavigation(<HistoryView onBackClick={handleBackToHome} onChatHistoryClick={handleChatHistoryClick} onNewChatClick={
|
|
99
|
+
return renderWithNavigation(<HistoryView onBackClick={handleBackToHome} onChatHistoryClick={handleChatHistoryClick} onNewChatClick={handleNewStartChat}/>, 'history');
|
|
79
100
|
}
|
|
80
101
|
// 아직 커버이미지 url이 안나옴
|
|
81
102
|
// const backgroundImage = mainData?.sleeve_image_url ? mainData.sleeve_image_url : DaeryuntalkIntro;
|
|
@@ -108,7 +129,7 @@ const ChatHomeView = () => {
|
|
|
108
129
|
6:00~24:00 외 시간에는 상담인력의 편성에 따라 순차적으로 응대를 도와드리고 있습니다.`}
|
|
109
130
|
</div>
|
|
110
131
|
|
|
111
|
-
<button className="mt-4 flex h-[48px] w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white" aria-label=
|
|
132
|
+
<button className="mt-4 flex h-[48px] w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white" aria-label={`문의하기`} onClick={handleStartChat} disabled={isLoading}>
|
|
112
133
|
{isLoading ? '로딩 중...' : '문의하기'}
|
|
113
134
|
{!isLoading && <SendIcon width={24} height={24}/>}
|
|
114
135
|
</button>
|
|
@@ -9,26 +9,40 @@ import TimeIcon from '../../asset/images/daeryuntalk/time.svg';
|
|
|
9
9
|
import InfoIcon from '../../asset/images/daeryuntalk/info.svg';
|
|
10
10
|
import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
11
11
|
import DaeryuntalkIntro from '../../asset/images/daeryuntalk/daeryuntalk-intro.png';
|
|
12
|
-
import {
|
|
12
|
+
import { IChatInquiryMainDataResponse } from './_api/daeryuntalk/type/response';
|
|
13
|
+
import { useChatSocketState } from './_hooks/talkprovider/useChatSocketState';
|
|
13
14
|
|
|
14
15
|
type ViewState = 'home' | 'conversation' | 'history';
|
|
15
16
|
|
|
16
17
|
const ChatHomeView: React.FC = () => {
|
|
17
|
-
const {
|
|
18
|
+
const {
|
|
19
|
+
viewHistory,
|
|
20
|
+
inquiryMainData,
|
|
21
|
+
startChat,
|
|
22
|
+
createNewChat,
|
|
23
|
+
chatInquiryNumber,
|
|
24
|
+
sendHeartbeat,
|
|
25
|
+
sendInquiryLeft
|
|
26
|
+
} = useDaeryuntalk();
|
|
18
27
|
const [viewState, setViewState] = useState<ViewState>('home');
|
|
19
28
|
const [selectedHistoryId, setSelectedHistoryId] = useState<string | null>(null);
|
|
20
|
-
const [mainData, setMainData] = useState<
|
|
29
|
+
const [mainData, setMainData] = useState<IChatInquiryMainDataResponse | null>(null);
|
|
21
30
|
const [isLoading, setIsLoading] = useState(false);
|
|
22
31
|
|
|
23
32
|
useEffect(() => {
|
|
24
|
-
if (inquiryMainData
|
|
25
|
-
setMainData(inquiryMainData
|
|
33
|
+
if (inquiryMainData) {
|
|
34
|
+
setMainData(inquiryMainData);
|
|
26
35
|
}
|
|
27
36
|
}, [inquiryMainData]);
|
|
28
37
|
|
|
38
|
+
// 채팅창관리
|
|
39
|
+
useChatSocketState(chatInquiryNumber, viewState, sendHeartbeat, sendInquiryLeft);
|
|
40
|
+
|
|
41
|
+
// 홈에서 사용
|
|
29
42
|
const handleStartChat = async () => {
|
|
30
43
|
try {
|
|
31
44
|
setIsLoading(true);
|
|
45
|
+
|
|
32
46
|
// 채팅 시작 - 새 문의 생성 또는 기존 문의 조회 처리
|
|
33
47
|
await startChat();
|
|
34
48
|
// 대화 화면으로 전환
|
|
@@ -40,6 +54,22 @@ const ChatHomeView: React.FC = () => {
|
|
|
40
54
|
}
|
|
41
55
|
};
|
|
42
56
|
|
|
57
|
+
// 히스토리에서 사용
|
|
58
|
+
const handleNewStartChat = async () => {
|
|
59
|
+
try {
|
|
60
|
+
setIsLoading(true);
|
|
61
|
+
|
|
62
|
+
// 채팅 시작 - 새 문의 생성 또는 기존 문의 조회 처리
|
|
63
|
+
await createNewChat();
|
|
64
|
+
// 대화 화면으로 전환
|
|
65
|
+
setViewState('conversation');
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.error('신규 채팅 실패:', error);
|
|
68
|
+
} finally {
|
|
69
|
+
setIsLoading(false);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
43
73
|
const handleHistoryClick = () => {
|
|
44
74
|
viewHistory();
|
|
45
75
|
setViewState('history');
|
|
@@ -55,11 +85,12 @@ const ChatHomeView: React.FC = () => {
|
|
|
55
85
|
setViewState('conversation');
|
|
56
86
|
};
|
|
57
87
|
|
|
88
|
+
// 채팅 문의 창
|
|
58
89
|
if (viewState === 'conversation') {
|
|
59
90
|
return (
|
|
60
91
|
<main className="flex h-[690px] w-[390px] items-center justify-center rounded-[30px]">
|
|
61
92
|
<div className="relative h-[690px] w-[390px] overflow-hidden rounded-[30px] bg-white shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]">
|
|
62
|
-
<ChatConversation onBackClick={handleBackToHome} />
|
|
93
|
+
<ChatConversation onBackClick={handleBackToHome} isActive={viewState === 'conversation'} />
|
|
63
94
|
</div>
|
|
64
95
|
</main>
|
|
65
96
|
);
|
|
@@ -88,7 +119,7 @@ const ChatHomeView: React.FC = () => {
|
|
|
88
119
|
<HistoryView
|
|
89
120
|
onBackClick={handleBackToHome}
|
|
90
121
|
onChatHistoryClick={handleChatHistoryClick}
|
|
91
|
-
onNewChatClick={
|
|
122
|
+
onNewChatClick={handleNewStartChat}
|
|
92
123
|
/>,
|
|
93
124
|
'history'
|
|
94
125
|
);
|
|
@@ -144,7 +175,7 @@ const ChatHomeView: React.FC = () => {
|
|
|
144
175
|
|
|
145
176
|
<button
|
|
146
177
|
className="mt-4 flex h-[48px] w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white"
|
|
147
|
-
aria-label=
|
|
178
|
+
aria-label={`문의하기`}
|
|
148
179
|
onClick={handleStartChat}
|
|
149
180
|
disabled={isLoading}
|
|
150
181
|
>
|
|
@@ -1,18 +1,38 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
4
|
+
import Tiptap from './Tiptap/Tiptap';
|
|
4
5
|
const ChatInput = () => {
|
|
5
6
|
const [message, setMessage] = useState('');
|
|
6
7
|
const { sendMessage, isLoading } = useDaeryuntalk();
|
|
8
|
+
const tiptapRef = useRef(null);
|
|
7
9
|
const handleSubmit = (e) => {
|
|
10
|
+
var _a, _b, _c;
|
|
8
11
|
e.preventDefault();
|
|
9
12
|
if (message.trim() && !isLoading) {
|
|
10
|
-
|
|
13
|
+
const html = ((_a = tiptapRef.current) === null || _a === void 0 ? void 0 : _a.getHTML()) || ''; // HTML 형태
|
|
14
|
+
const json = ((_b = tiptapRef.current) === null || _b === void 0 ? void 0 : _b.getJSON()) || {}; // JSON 형태
|
|
11
15
|
setMessage('');
|
|
16
|
+
sendMessage(html, json);
|
|
17
|
+
(_c = tiptapRef.current) === null || _c === void 0 ? void 0 : _c.clearContent(); // 입력창 초기화
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const handleEnter = () => {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
if (message.trim() && !isLoading) {
|
|
23
|
+
const html = ((_a = tiptapRef.current) === null || _a === void 0 ? void 0 : _a.getHTML()) || ''; // HTML 형태
|
|
24
|
+
const json = ((_b = tiptapRef.current) === null || _b === void 0 ? void 0 : _b.getJSON()) || {}; // JSON 형태
|
|
25
|
+
sendMessage(html, json);
|
|
26
|
+
setMessage('');
|
|
27
|
+
(_c = tiptapRef.current) === null || _c === void 0 ? void 0 : _c.clearContent(); // 입력창 초기화
|
|
12
28
|
}
|
|
13
29
|
};
|
|
14
30
|
return (<form onSubmit={handleSubmit} className="flex w-full items-center gap-2">
|
|
15
|
-
<
|
|
31
|
+
<div className="flex-1">
|
|
32
|
+
<Tiptap ref={tiptapRef}
|
|
33
|
+
// value={message}
|
|
34
|
+
onChange={setMessage} onEnterKeyPress={handleEnter} placeholder="메시지를 입력하세요..."/>
|
|
35
|
+
</div>
|
|
16
36
|
<button type="submit" className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-[#2E385B] text-white ${isLoading || !message.trim() ? 'cursor-not-allowed opacity-50' : 'bg-[#AA1D36]'}`} disabled={isLoading || !message.trim()}>
|
|
17
37
|
<div className="flex h-9 w-9 items-center justify-center">
|
|
18
38
|
<SendIcon width={24} height={24}/>
|
|
@@ -1,29 +1,45 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
4
|
+
import Tiptap, { TiptapEditorRef } from './Tiptap/Tiptap';
|
|
4
5
|
|
|
5
6
|
const ChatInput: React.FC = () => {
|
|
6
7
|
const [message, setMessage] = useState('');
|
|
7
8
|
const { sendMessage, isLoading } = useDaeryuntalk();
|
|
9
|
+
const tiptapRef = useRef<TiptapEditorRef | null>(null);
|
|
8
10
|
|
|
9
11
|
const handleSubmit = (e: React.FormEvent) => {
|
|
10
12
|
e.preventDefault();
|
|
11
13
|
if (message.trim() && !isLoading) {
|
|
12
|
-
|
|
14
|
+
const html = tiptapRef.current?.getHTML() || ''; // HTML 형태
|
|
15
|
+
const json = tiptapRef.current?.getJSON() || {}; // JSON 형태
|
|
13
16
|
setMessage('');
|
|
17
|
+
sendMessage(html, json);
|
|
18
|
+
tiptapRef.current?.clearContent(); // 입력창 초기화
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const handleEnter = () => {
|
|
23
|
+
if (message.trim() && !isLoading) {
|
|
24
|
+
const html = tiptapRef.current?.getHTML() || ''; // HTML 형태
|
|
25
|
+
const json = tiptapRef.current?.getJSON() || {}; // JSON 형태
|
|
26
|
+
sendMessage(html, json);
|
|
27
|
+
setMessage('');
|
|
28
|
+
tiptapRef.current?.clearContent(); // 입력창 초기화
|
|
14
29
|
}
|
|
15
30
|
};
|
|
16
31
|
|
|
17
32
|
return (
|
|
18
33
|
<form onSubmit={handleSubmit} className="flex w-full items-center gap-2">
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
<div className="flex-1">
|
|
35
|
+
<Tiptap
|
|
36
|
+
ref={tiptapRef}
|
|
37
|
+
// value={message}
|
|
38
|
+
onChange={setMessage}
|
|
39
|
+
onEnterKeyPress={handleEnter}
|
|
40
|
+
placeholder="메시지를 입력하세요..."
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
27
43
|
<button
|
|
28
44
|
type="submit"
|
|
29
45
|
className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-[#2E385B] text-white ${
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Message } from '../_types/message';
|
|
3
|
+
interface props {
|
|
4
|
+
message: Message;
|
|
5
|
+
isOperator: boolean;
|
|
6
|
+
isHovered: boolean;
|
|
7
|
+
time: string;
|
|
8
|
+
}
|
|
9
|
+
declare const ChatFile: ({ message, isOperator, isHovered, time }: props) => React.JSX.Element | undefined;
|
|
10
|
+
export default ChatFile;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import Image from 'next/image';
|
|
12
|
+
import { formatFileSize } from '../_lib/utils';
|
|
13
|
+
import FileDownLoadIcon from '../../../asset/images/daeryuntalk/viewer/gray-download.svg';
|
|
14
|
+
import { useDaeryuntalk } from '../DaeryuntalkContext';
|
|
15
|
+
import { getMessageFileDownloadUrl } from '../_api';
|
|
16
|
+
const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
17
|
+
const { openImageViewer } = useDaeryuntalk();
|
|
18
|
+
const handleDownload = (file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
try {
|
|
20
|
+
const res = yield getMessageFileDownloadUrl({
|
|
21
|
+
chatInquiryNumber: message.inquiryNumber || '',
|
|
22
|
+
fileNumber: file.fileNumber
|
|
23
|
+
});
|
|
24
|
+
const filePath = res.data.url;
|
|
25
|
+
const response = yield fetch(filePath);
|
|
26
|
+
const blob = yield response.blob();
|
|
27
|
+
const url = window.URL.createObjectURL(blob);
|
|
28
|
+
const link = document.createElement('a');
|
|
29
|
+
link.href = url;
|
|
30
|
+
link.download = file.name;
|
|
31
|
+
document.body.appendChild(link);
|
|
32
|
+
link.click();
|
|
33
|
+
window.URL.revokeObjectURL(url);
|
|
34
|
+
document.body.removeChild(link);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
console.error('다운로드 URL 요청 실패:', err);
|
|
38
|
+
// 사용자에게 알림 또는 토스트 표시 등을 추가할 수 있습니다.
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const renderMediaContent = () => {
|
|
42
|
+
const images = message.files
|
|
43
|
+
? message.files.filter(file => file.type === 'image').sort((a, b) => a.sequence - b.sequence)
|
|
44
|
+
: [];
|
|
45
|
+
const files = message.files
|
|
46
|
+
? message.files.filter(file => file.type !== 'image').sort((a, b) => a.sequence - b.sequence)
|
|
47
|
+
: [];
|
|
48
|
+
return (<div className={`flex flex-col gap-3`}>
|
|
49
|
+
{images.length > 0 && renderMedia({ type: 'image', images })}
|
|
50
|
+
{files.length > 0 && renderMedia({ type: 'file', files })}
|
|
51
|
+
</div>);
|
|
52
|
+
};
|
|
53
|
+
const renderMedia = (media) => {
|
|
54
|
+
if (media.type === 'image') {
|
|
55
|
+
return (<div className={`flex w-full items-end justify-start gap-[4px]`}>
|
|
56
|
+
{media.images.length > 1 ? (<div className={`flex flex-col`}>
|
|
57
|
+
{/* grid로 감싸진 짝수 개수 또는 홀수에서 마지막 전까지 */}
|
|
58
|
+
<div className="grid grid-cols-2 gap-2 rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]">
|
|
59
|
+
{media.images.map((file, index) => {
|
|
60
|
+
const isLastOdd = media.images.length % 2 === 1 && index === media.images.length - 1;
|
|
61
|
+
if (isLastOdd)
|
|
62
|
+
return null;
|
|
63
|
+
return (<div key={index} className="group/image relative aspect-square h-[100px] w-[113px] overflow-hidden rounded-[5px]" onClick={() => {
|
|
64
|
+
if (media.type === 'image') {
|
|
65
|
+
openImageViewer === null || openImageViewer === void 0 ? void 0 : openImageViewer(media.images[media.images.length - 1], message);
|
|
66
|
+
}
|
|
67
|
+
}}>
|
|
68
|
+
<Image src={file.thumbnailUrl} alt={file.name} width={113} height={100} className="h-full w-full cursor-pointer rounded-md object-cover" onClick={() => { }}/>
|
|
69
|
+
<button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
e.stopPropagation();
|
|
71
|
+
yield handleDownload(file);
|
|
72
|
+
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full">
|
|
73
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white"/>
|
|
74
|
+
</button>
|
|
75
|
+
</div>);
|
|
76
|
+
})}
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
{/* 홀수 개수일 때 마지막 하나는 별도로 */}
|
|
80
|
+
{media.images.length % 2 === 1 && (<div className="mt-2 rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]" onClick={() => {
|
|
81
|
+
if (media.type === 'image') {
|
|
82
|
+
openImageViewer === null || openImageViewer === void 0 ? void 0 : openImageViewer(media.images[media.images.length - 1], message);
|
|
83
|
+
}
|
|
84
|
+
}}>
|
|
85
|
+
<div className="group/image relative h-[100px] w-[100%] overflow-hidden rounded-[5px]">
|
|
86
|
+
<Image src={media.images[media.images.length - 1].thumbnailUrl} alt={media.images[media.images.length - 1].name} width={160} height={100} className="h-full w-full cursor-pointer rounded-md object-cover" onClick={() => { }}/>
|
|
87
|
+
<button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
if (media.type === 'image') {
|
|
90
|
+
yield handleDownload(media.images[media.images.length - 1]);
|
|
91
|
+
}
|
|
92
|
+
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full">
|
|
93
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full text-[#777777] "/>
|
|
94
|
+
</button>
|
|
95
|
+
</div>
|
|
96
|
+
</div>)}
|
|
97
|
+
</div>) : (
|
|
98
|
+
// 이미지 1장일 경우 (grid 없이 단독)
|
|
99
|
+
<div className="rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]" onClick={() => {
|
|
100
|
+
if (media.type === 'image') {
|
|
101
|
+
openImageViewer && openImageViewer(media.images[0], message);
|
|
102
|
+
}
|
|
103
|
+
}}>
|
|
104
|
+
<div className="group/image relative h-[100px] w-[160px] overflow-hidden rounded-[5px]">
|
|
105
|
+
<Image src={media.images[0].thumbnailUrl} alt={media.images[0].name} width={160} height={100} className="h-full w-full cursor-pointer rounded-md object-cover" onClick={() => { }}/>
|
|
106
|
+
<button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
+
e.stopPropagation();
|
|
108
|
+
if (media.type === 'image') {
|
|
109
|
+
yield handleDownload(media.images[0]);
|
|
110
|
+
}
|
|
111
|
+
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full">
|
|
112
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white"/>
|
|
113
|
+
</button>
|
|
114
|
+
</div>
|
|
115
|
+
</div>)}
|
|
116
|
+
{/*<div*/}
|
|
117
|
+
{/* className={`*/}
|
|
118
|
+
{/* grid rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]*/}
|
|
119
|
+
{/* ${media.images.length > 1 ? 'grid-cols-2 gap-2' : ''}*/}
|
|
120
|
+
{/*`}*/}
|
|
121
|
+
{/*>*/}
|
|
122
|
+
{/* {media.images.map((file, index) => (*/}
|
|
123
|
+
{/* <div*/}
|
|
124
|
+
{/* key={index}*/}
|
|
125
|
+
{/* className={`group/image relative overflow-hidden rounded-[5px] */}
|
|
126
|
+
{/* ${media.images.length > 1 ? 'aspect-square w-[120px]' : 'aspect-auto h-[100px] w-[160px]'} `}*/}
|
|
127
|
+
{/* >*/}
|
|
128
|
+
{/* <Image*/}
|
|
129
|
+
{/* src={file.thumbnailUrl}*/}
|
|
130
|
+
{/* alt={file.name}*/}
|
|
131
|
+
{/* width={media.images.length > 1 ? 113 : 160}*/}
|
|
132
|
+
{/* height={media.images.length > 1 ? 100 : 100}*/}
|
|
133
|
+
{/* className={`h-full w-full cursor-pointer rounded-md object-cover `}*/}
|
|
134
|
+
{/* onClick={() => {}}*/}
|
|
135
|
+
{/* />*/}
|
|
136
|
+
{/* <button*/}
|
|
137
|
+
{/* onClick={e => {*/}
|
|
138
|
+
{/* e.stopPropagation();*/}
|
|
139
|
+
{/* }}*/}
|
|
140
|
+
{/* className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full"*/}
|
|
141
|
+
{/* >*/}
|
|
142
|
+
{/* <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />*/}
|
|
143
|
+
{/* </button>*/}
|
|
144
|
+
{/* </div>*/}
|
|
145
|
+
{/* ))}*/}
|
|
146
|
+
{/*</div>*/}
|
|
147
|
+
<div className={`text-[12px] font-[400] text-[#C2C2C2]`}>{time}</div>
|
|
148
|
+
</div>);
|
|
149
|
+
}
|
|
150
|
+
else if (media.type === 'file') {
|
|
151
|
+
return (<div className={`flex w-fit items-end gap-[4px]`}>
|
|
152
|
+
<div className="flex w-full flex-col gap-[10px] ">
|
|
153
|
+
{media.files.map((file, index) => {
|
|
154
|
+
const fileExtension = file.name.split('.').pop() || '';
|
|
155
|
+
const baseName = file.name.replace(`.${fileExtension}`, '');
|
|
156
|
+
const truncatedName = baseName.length > 12 ? `${baseName.slice(0, 12)}…` : baseName;
|
|
157
|
+
const fileName = `${truncatedName}.${fileExtension}`;
|
|
158
|
+
return (<div key={index} className={`flex w-full items-end justify-start gap-[4px]`}>
|
|
159
|
+
<div key={index} className={`
|
|
160
|
+
flex items-center justify-between gap-[16px]
|
|
161
|
+
rounded-[10px] border-[1px] border-[#EDEDED] p-[12px]
|
|
162
|
+
`}>
|
|
163
|
+
<div className="flex flex-col gap-[4px] ">
|
|
164
|
+
<span className={`text-[14px] font-[400] `}>{fileName}</span>
|
|
165
|
+
<span className="flex items-center gap-[10px] text-[12px] text-[#777777]">
|
|
166
|
+
{formatFileSize(file.size)} | {file.name.split('.').pop()}
|
|
167
|
+
</span>
|
|
168
|
+
</div>
|
|
169
|
+
<button onClick={() => { }} className="">
|
|
170
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white"/>
|
|
171
|
+
</button>
|
|
172
|
+
</div>
|
|
173
|
+
</div>);
|
|
174
|
+
})}
|
|
175
|
+
</div>
|
|
176
|
+
<div className={`text-[12px] font-[400] text-[#C2C2C2]`}>{time}</div>
|
|
177
|
+
</div>);
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
};
|
|
181
|
+
if (!message.files) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
return <>{renderMediaContent()}</>;
|
|
185
|
+
};
|
|
186
|
+
export default ChatFile;
|