@daeryun/dr_components 1.2.18 → 1.2.20
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/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatButton.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatButton.tsx +1 -1
- package/dist/components/Daeryuntalk/ChatWidget.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatWidget.jsx +114 -31
- package/dist/components/Daeryuntalk/ChatWidget.tsx +120 -37
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.tsx +0 -9
- package/dist/components/Daeryuntalk/index.jsx +17 -1
- package/dist/components/Daeryuntalk/index.tsx +26 -2
- package/dist/components/DaeryuntalkBackup/ChatButton.d.ts +11 -0
- package/dist/components/DaeryuntalkBackup/ChatButton.jsx +123 -0
- package/dist/components/DaeryuntalkBackup/ChatButton.tsx +157 -0
- package/dist/components/DaeryuntalkBackup/ChatConversation.d.ts +21 -0
- package/dist/components/DaeryuntalkBackup/ChatConversation.jsx +259 -0
- package/dist/components/DaeryuntalkBackup/ChatConversation.tsx +390 -0
- package/dist/components/DaeryuntalkBackup/ChatConversationItem/ChatConversationHeader.d.ts +16 -0
- package/dist/components/DaeryuntalkBackup/ChatConversationItem/ChatConversationHeader.jsx +50 -0
- package/dist/components/DaeryuntalkBackup/ChatConversationItem/ChatConversationHeader.tsx +108 -0
- package/dist/components/DaeryuntalkBackup/ChatHomeView.d.ts +14 -0
- package/dist/components/DaeryuntalkBackup/ChatHomeView.jsx +147 -0
- package/dist/components/DaeryuntalkBackup/ChatHomeView.tsx +262 -0
- package/dist/components/DaeryuntalkBackup/ChatInput.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/ChatInput.jsx +64 -0
- package/dist/components/DaeryuntalkBackup/ChatInput.tsx +98 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/AgeCheckBox.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/AgeCheckBox.jsx +19 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/AgeCheckBox.tsx +27 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatFile.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatFile.jsx +165 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatFile.tsx +244 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatLoading.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatLoading.jsx +12 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatLoading.tsx +25 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatPrivacyAuth.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatPrivacyAuth.jsx +100 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatPrivacyAuth.tsx +135 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatWrapper.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatWrapper.jsx +14 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatWrapper.tsx +26 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/RichText.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/RichText.jsx +37 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/RichText.tsx +45 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TimeWrapper.d.ts +9 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TimeWrapper.jsx +10 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TimeWrapper.tsx +21 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TypingComp.d.ts +3 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TypingComp.jsx +34 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TypingComp.tsx +43 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowAuthForm.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowAuthForm.jsx +20 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowAuthForm.tsx +32 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowClickData.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowClickData.jsx +21 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowClickData.tsx +37 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowImg.d.ts +9 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowImg.jsx +178 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowImg.tsx +233 -0
- package/dist/components/DaeryuntalkBackup/ChatMessage.d.ts +20 -0
- package/dist/components/DaeryuntalkBackup/ChatMessage.jsx +198 -0
- package/dist/components/DaeryuntalkBackup/ChatMessage.tsx +295 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/FieldWorkObject.d.ts +9 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/FieldWorkObject.jsx +39 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/FieldWorkObject.tsx +75 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectBack.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectBack.jsx +20 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectBack.tsx +39 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectButton.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectButton.jsx +138 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectButton.tsx +177 -0
- package/dist/components/DaeryuntalkBackup/ChatWidget.d.ts +13 -0
- package/dist/components/DaeryuntalkBackup/ChatWidget.jsx +154 -0
- package/dist/components/DaeryuntalkBackup/ChatWidget.tsx +221 -0
- package/dist/components/DaeryuntalkBackup/DaeryuntalkContext.d.ts +103 -0
- package/dist/components/DaeryuntalkBackup/DaeryuntalkContext.jsx +207 -0
- package/dist/components/DaeryuntalkBackup/DaeryuntalkContext.tsx +350 -0
- package/dist/components/DaeryuntalkBackup/DateSeparator.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/DateSeparator.jsx +14 -0
- package/dist/components/DaeryuntalkBackup/DateSeparator.tsx +24 -0
- package/dist/components/DaeryuntalkBackup/FixedErrorBox.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/FixedErrorBox.jsx +34 -0
- package/dist/components/DaeryuntalkBackup/FixedErrorBox.tsx +73 -0
- package/dist/components/DaeryuntalkBackup/History/AuthForm.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/History/AuthForm.jsx +157 -0
- package/dist/components/DaeryuntalkBackup/History/AuthForm.tsx +206 -0
- package/dist/components/DaeryuntalkBackup/HistoryView.d.ts +19 -0
- package/dist/components/DaeryuntalkBackup/HistoryView.jsx +94 -0
- package/dist/components/DaeryuntalkBackup/HistoryView.tsx +182 -0
- package/dist/components/DaeryuntalkBackup/HomeView.d.ts +12 -0
- package/dist/components/DaeryuntalkBackup/HomeView.jsx +178 -0
- package/dist/components/DaeryuntalkBackup/HomeView.tsx +261 -0
- package/dist/components/DaeryuntalkBackup/NavigationFooter.d.ts +11 -0
- package/dist/components/DaeryuntalkBackup/NavigationFooter.jsx +44 -0
- package/dist/components/DaeryuntalkBackup/NavigationFooter.tsx +98 -0
- package/dist/components/DaeryuntalkBackup/NoticeMessage.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/NoticeMessage.jsx +40 -0
- package/dist/components/DaeryuntalkBackup/NoticeMessage.tsx +60 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/DisabledInput.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/DisabledInput.jsx +17 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/DisabledInput.tsx +28 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/Tiptap.d.ts +20 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/Tiptap.jsx +130 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/Tiptap.tsx +181 -0
- package/dist/components/DaeryuntalkBackup/Toast/DaeryuntalkToastProvider.d.ts +23 -0
- package/dist/components/DaeryuntalkBackup/Toast/DaeryuntalkToastProvider.jsx +40 -0
- package/dist/components/DaeryuntalkBackup/Toast/DaeryuntalkToastProvider.tsx +70 -0
- package/dist/components/DaeryuntalkBackup/Toast/Toast.d.ts +11 -0
- package/dist/components/DaeryuntalkBackup/Toast/Toast.jsx +64 -0
- package/dist/components/DaeryuntalkBackup/Toast/Toast.tsx +98 -0
- package/dist/components/DaeryuntalkBackup/Toast/ToastRender.d.ts +1 -0
- package/dist/components/DaeryuntalkBackup/Toast/ToastRender.jsx +22 -0
- package/dist/components/DaeryuntalkBackup/Toast/ToastRender.tsx +30 -0
- package/dist/components/DaeryuntalkBackup/Viewer/ImageViewer.d.ts +9 -0
- package/dist/components/DaeryuntalkBackup/Viewer/ImageViewer.jsx +98 -0
- package/dist/components/DaeryuntalkBackup/Viewer/ImageViewer.tsx +138 -0
- package/dist/components/DaeryuntalkBackup/Viewer/MobileViewer.d.ts +18 -0
- package/dist/components/DaeryuntalkBackup/Viewer/MobileViewer.jsx +104 -0
- package/dist/components/DaeryuntalkBackup/Viewer/MobileViewer.tsx +182 -0
- package/dist/components/DaeryuntalkBackup/Viewer/TbPcViewer.d.ts +24 -0
- package/dist/components/DaeryuntalkBackup/Viewer/TbPcViewer.jsx +141 -0
- package/dist/components/DaeryuntalkBackup/Viewer/TbPcViewer.tsx +278 -0
- package/dist/components/DaeryuntalkBackup/ViewportHandler.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/ViewportHandler.jsx +25 -0
- package/dist/components/DaeryuntalkBackup/ViewportHandler.tsx +32 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/index.d.ts +177 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/index.js +801 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/index.ts +1097 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/type/response.d.ts +131 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/type/response.js +1 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/type/response.ts +159 -0
- package/dist/components/DaeryuntalkBackup/_api/index.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/_api/index.js +6 -0
- package/dist/components/DaeryuntalkBackup/_api/index.ts +7 -0
- package/dist/components/DaeryuntalkBackup/_enums/ags_check_status.d.ts +5 -0
- package/dist/components/DaeryuntalkBackup/_enums/ags_check_status.js +9 -0
- package/dist/components/DaeryuntalkBackup/_enums/ags_check_status.ts +9 -0
- package/dist/components/DaeryuntalkBackup/_enums/ask-status.d.ts +13 -0
- package/dist/components/DaeryuntalkBackup/_enums/ask-status.js +25 -0
- package/dist/components/DaeryuntalkBackup/_enums/ask-status.ts +26 -0
- package/dist/components/DaeryuntalkBackup/_enums/error.d.ts +109 -0
- package/dist/components/DaeryuntalkBackup/_enums/error.js +254 -0
- package/dist/components/DaeryuntalkBackup/_enums/error.ts +289 -0
- package/dist/components/DaeryuntalkBackup/_enums/message_type.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/_enums/message_type.js +13 -0
- package/dist/components/DaeryuntalkBackup/_enums/message_type.ts +13 -0
- package/dist/components/DaeryuntalkBackup/_enums/sender_type.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/_enums/sender_type.js +16 -0
- package/dist/components/DaeryuntalkBackup/_enums/sender_type.ts +16 -0
- package/dist/components/DaeryuntalkBackup/_enums/socket_type.d.ts +34 -0
- package/dist/components/DaeryuntalkBackup/_enums/socket_type.js +46 -0
- package/dist/components/DaeryuntalkBackup/_enums/socket_type.ts +56 -0
- package/dist/components/DaeryuntalkBackup/_enums/template.d.ts +32 -0
- package/dist/components/DaeryuntalkBackup/_enums/template.js +76 -0
- package/dist/components/DaeryuntalkBackup/_enums/template.ts +81 -0
- package/dist/components/DaeryuntalkBackup/_enums/work_flow_object_expose.d.ts +33 -0
- package/dist/components/DaeryuntalkBackup/_enums/work_flow_object_expose.js +66 -0
- package/dist/components/DaeryuntalkBackup/_enums/work_flow_object_expose.ts +71 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useChatHandler.d.ts +48 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useChatHandler.js +465 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useChatHandler.ts +595 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useFullURL.d.ts +1 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useFullURL.jsx +15 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useFullURL.tsx +17 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useHistoryHandler.d.ts +24 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useHistoryHandler.js +112 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useHistoryHandler.ts +144 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useSocketEventHandler.d.ts +44 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useSocketEventHandler.js +534 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useSocketEventHandler.ts +706 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useViewerHook.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useViewerHook.js +18 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useViewerHook.ts +23 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useWorkFlow.d.ts +9 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useWorkFlow.js +109 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useWorkFlow.ts +121 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useHoverScrollbar.d.ts +12 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useHoverScrollbar.js +48 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useHoverScrollbar.ts +73 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useScrollShadow.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useScrollShadow.js +42 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useScrollShadow.ts +52 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useWindowSize.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useWindowSize.js +20 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useWindowSize.ts +30 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useChatSocketState.d.ts +2 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useChatSocketState.js +26 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useChatSocketState.ts +43 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHistoryView.d.ts +27 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHistoryView.js +80 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHistoryView.ts +101 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHomeView.d.ts +18 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHomeView.js +66 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHomeView.ts +75 -0
- package/dist/components/DaeryuntalkBackup/_lib/index.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/_lib/index.js +103 -0
- package/dist/components/DaeryuntalkBackup/_lib/index.ts +136 -0
- package/dist/components/DaeryuntalkBackup/_lib/utils.d.ts +17 -0
- package/dist/components/DaeryuntalkBackup/_lib/utils.js +94 -0
- package/dist/components/DaeryuntalkBackup/_lib/utils.ts +119 -0
- package/dist/components/DaeryuntalkBackup/_types/message.d.ts +92 -0
- package/dist/components/DaeryuntalkBackup/_types/message.js +25 -0
- package/dist/components/DaeryuntalkBackup/_types/message.ts +156 -0
- package/dist/components/DaeryuntalkBackup/_types/message_object.d.ts +17 -0
- package/dist/components/DaeryuntalkBackup/_types/message_object.js +1 -0
- package/dist/components/DaeryuntalkBackup/_types/message_object.ts +18 -0
- package/dist/components/DaeryuntalkBackup/_types/socket/workflow.d.ts +15 -0
- package/dist/components/DaeryuntalkBackup/_types/socket/workflow.js +1 -0
- package/dist/components/DaeryuntalkBackup/_types/socket/workflow.ts +15 -0
- package/dist/components/DaeryuntalkBackup/_ui/ShadowBox.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/_ui/ShadowBox.jsx +5 -0
- package/dist/components/DaeryuntalkBackup/_ui/ShadowBox.tsx +15 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button1.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button1.jsx +12 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button1.tsx +29 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button2.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button2.jsx +12 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button2.tsx +29 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button3.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button3.jsx +12 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button3.tsx +29 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button4.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button4.jsx +12 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button4.tsx +29 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox1.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox1.jsx +15 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox1.tsx +38 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox2.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox2.jsx +21 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox2.tsx +50 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input1.d.ts +12 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input1.jsx +9 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input1.tsx +39 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input2.d.ts +13 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input2.jsx +10 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input2.tsx +43 -0
- package/dist/components/DaeryuntalkBackup/index.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/index.jsx +190 -0
- package/dist/components/DaeryuntalkBackup/index.tsx +261 -0
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/styles/globals.css +415 -414
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
4
|
+
import Tiptap, { TiptapEditorRef } from './Tiptap/Tiptap';
|
|
5
|
+
import { stripHtmlTags } from './_lib/utils';
|
|
6
|
+
import DisabledInput from './Tiptap/DisabledInput';
|
|
7
|
+
import Image from 'next/image';
|
|
8
|
+
|
|
9
|
+
// 이미지
|
|
10
|
+
// import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
11
|
+
|
|
12
|
+
interface props {
|
|
13
|
+
isMobile: boolean;
|
|
14
|
+
isNotAgeCheck: boolean;
|
|
15
|
+
chatInquiryNumber: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const ChatInput: React.FC<props> = ({ isMobile, isNotAgeCheck, chatInquiryNumber }) => {
|
|
19
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
20
|
+
const SendIcon = `${s3Url}/daeryuntalk/send.svg`;
|
|
21
|
+
const [message, setMessage] = useState('');
|
|
22
|
+
const { sendMessage, isLoading } = useDaeryuntalk();
|
|
23
|
+
const tiptapRef = useRef<TiptapEditorRef | null>(null);
|
|
24
|
+
const isEmpty = useMemo(() => {
|
|
25
|
+
return !stripHtmlTags(message);
|
|
26
|
+
}, [message]);
|
|
27
|
+
|
|
28
|
+
// useEffect(() => {
|
|
29
|
+
// setIsEmpty(!stripHtmlTags(message));
|
|
30
|
+
// }, [message]);
|
|
31
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
if (message.trim() && !isLoading) {
|
|
34
|
+
const html = tiptapRef.current?.getHTML() || ''; // HTML 형태
|
|
35
|
+
const json = tiptapRef.current?.getJSON() || {}; // JSON 형태
|
|
36
|
+
setMessage('');
|
|
37
|
+
sendMessage(html, json);
|
|
38
|
+
tiptapRef.current?.clearContent(); // 입력창 초기화
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const handleEnter = () => {
|
|
43
|
+
if (message.trim() && !isLoading) {
|
|
44
|
+
const html = tiptapRef.current?.getHTML() || ''; // HTML 형태
|
|
45
|
+
const json = tiptapRef.current?.getJSON() || {}; // JSON 형태
|
|
46
|
+
sendMessage(html, json);
|
|
47
|
+
setMessage('');
|
|
48
|
+
tiptapRef.current?.clearContent(); // 입력창 초기화
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<form onSubmit={handleSubmit} className="flex w-full items-center gap-2">
|
|
54
|
+
<div
|
|
55
|
+
className={`${isNotAgeCheck ? 'bg-drTalkGrayscale4' : 'bg-drTalkGrayscale5'} flex flex-1 justify-center gap-[10px] rounded-[10px] border-[1px] border-solid border-drTalkGrayscale5 p-[4px]`}
|
|
56
|
+
>
|
|
57
|
+
{/* 최초 높이 44 */}
|
|
58
|
+
{/*내용이 2줄 이상되면 입력창 높이도 키워져야합니다. 최대한 4줄까지만 보이도록 해주시고, 그 이상은 스크롤 될 수 있도록 해주시는 게 좋을 것 같습니다. max height 값을 72로 지정 부탁드립니다*/}
|
|
59
|
+
|
|
60
|
+
{isNotAgeCheck ? (
|
|
61
|
+
<DisabledInput placeholder="만 14세 이상 확인 후 이용 가능합니다." />
|
|
62
|
+
) : (
|
|
63
|
+
<Tiptap
|
|
64
|
+
key={`${chatInquiryNumber}-${isNotAgeCheck}`}
|
|
65
|
+
ref={tiptapRef}
|
|
66
|
+
onChange={setMessage}
|
|
67
|
+
onEnterKeyPress={handleEnter}
|
|
68
|
+
placeholder={'상담내용을 입력해 주세요.'}
|
|
69
|
+
contentClassName="!outline-none !border-[0px] !pt-[4px] !pl-[4px]"
|
|
70
|
+
isMobile={isMobile}
|
|
71
|
+
/>
|
|
72
|
+
)}
|
|
73
|
+
|
|
74
|
+
<div className={`flex flex-col justify-end`}>
|
|
75
|
+
<button
|
|
76
|
+
type="submit"
|
|
77
|
+
className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-drTalkBtnActive2 text-white
|
|
78
|
+
${
|
|
79
|
+
isLoading || isNotAgeCheck
|
|
80
|
+
? 'cursor-not-allowed opacity-50'
|
|
81
|
+
: isEmpty
|
|
82
|
+
? ' bg-drTalkBtnActive2 '
|
|
83
|
+
: ' bg-drTalkCrimson '
|
|
84
|
+
}`}
|
|
85
|
+
disabled={isLoading || isNotAgeCheck}
|
|
86
|
+
>
|
|
87
|
+
<div className="flex h-9 w-9 items-center justify-center">
|
|
88
|
+
<Image src={SendIcon} alt="전송" width={24} height={24} />
|
|
89
|
+
{/* <SendIcon width={24} height={24} /> */}
|
|
90
|
+
</div>
|
|
91
|
+
</button>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</form>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default ChatInput;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import CheckBox2 from '../_ui/checkboxs/CheckBox2';
|
|
4
|
+
import Button4 from '../_ui/buttons/Button4';
|
|
5
|
+
const AgeCheckBox = ({ onAgree }) => {
|
|
6
|
+
const [checked, setChecked] = useState(false);
|
|
7
|
+
const onChange = (e) => {
|
|
8
|
+
setChecked(e.target.checked);
|
|
9
|
+
};
|
|
10
|
+
return (<div className={`z-10 h-[42px] w-full px-[20px] py-[8px]`}>
|
|
11
|
+
<div className={`flex items-center justify-between`}>
|
|
12
|
+
<CheckBox2 title={'(필수)만 14세 이상입니다.'} checked={checked} onChange={onChange}/>
|
|
13
|
+
<Button4 onClick={onAgree} isDisabled={!checked} className={`min-w-[18px]`}>
|
|
14
|
+
동의
|
|
15
|
+
</Button4>
|
|
16
|
+
</div>
|
|
17
|
+
</div>);
|
|
18
|
+
};
|
|
19
|
+
export default AgeCheckBox;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import CheckBox2 from '../_ui/checkboxs/CheckBox2';
|
|
4
|
+
import Button4 from '../_ui/buttons/Button4';
|
|
5
|
+
|
|
6
|
+
interface AgeCheckBoxProps {
|
|
7
|
+
onAgree: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const AgeCheckBox = ({ onAgree }: AgeCheckBoxProps) => {
|
|
11
|
+
const [checked, setChecked] = useState(false);
|
|
12
|
+
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
13
|
+
setChecked(e.target.checked);
|
|
14
|
+
};
|
|
15
|
+
return (
|
|
16
|
+
<div className={`z-10 h-[42px] w-full px-[20px] py-[8px]`}>
|
|
17
|
+
<div className={`flex items-center justify-between`}>
|
|
18
|
+
<CheckBox2 title={'(필수)만 14세 이상입니다.'} checked={checked} onChange={onChange} />
|
|
19
|
+
<Button4 onClick={onAgree} isDisabled={!checked} className={`min-w-[18px]`}>
|
|
20
|
+
동의
|
|
21
|
+
</Button4>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default AgeCheckBox;
|
|
@@ -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,165 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import Image from 'next/image';
|
|
13
|
+
import { formatFileSize } from '../_lib/utils';
|
|
14
|
+
import { useDaeryuntalk } from '../DaeryuntalkContext';
|
|
15
|
+
import { getMessageFileDownloadUrl } from '../_api';
|
|
16
|
+
import TimeWrapper from './TimeWrapper';
|
|
17
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
18
|
+
const FileDownLoadIcon = `${s3Url}/daeryuntalk/viewer/gray-download.svg`;
|
|
19
|
+
const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
20
|
+
const { openImageViewer } = useDaeryuntalk();
|
|
21
|
+
const handleDownload = (file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
try {
|
|
23
|
+
const res = yield getMessageFileDownloadUrl({
|
|
24
|
+
chatInquiryNumber: message.inquiryNumber || '',
|
|
25
|
+
fileNumber: file.fileNumber
|
|
26
|
+
});
|
|
27
|
+
const filePath = res.data.url;
|
|
28
|
+
const response = yield fetch(filePath);
|
|
29
|
+
const blob = yield response.blob();
|
|
30
|
+
const url = window.URL.createObjectURL(blob);
|
|
31
|
+
const link = document.createElement('a');
|
|
32
|
+
link.href = url;
|
|
33
|
+
link.download = file.name;
|
|
34
|
+
document.body.appendChild(link);
|
|
35
|
+
link.click();
|
|
36
|
+
window.URL.revokeObjectURL(url);
|
|
37
|
+
document.body.removeChild(link);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
console.error('다운로드 URL 요청 실패:', err);
|
|
41
|
+
// 사용자에게 알림 또는 토스트 표시 등을 추가할 수 있습니다.
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const renderMediaContent = () => {
|
|
45
|
+
const images = message.files
|
|
46
|
+
? message.files.filter(file => file.type === 'image').sort((a, b) => a.sequence - b.sequence)
|
|
47
|
+
: [];
|
|
48
|
+
const files = message.files
|
|
49
|
+
? message.files.filter(file => file.type === 'file').sort((a, b) => a.sequence - b.sequence)
|
|
50
|
+
: [];
|
|
51
|
+
return (<div className={`flex flex-col gap-[10px]`}>
|
|
52
|
+
{images.length > 0 && renderMedia({ type: 'image', images })}
|
|
53
|
+
{files.length > 0 && renderMedia({ type: 'file', files })}
|
|
54
|
+
</div>);
|
|
55
|
+
};
|
|
56
|
+
const renderMedia = (media) => {
|
|
57
|
+
if (media.type === 'image') {
|
|
58
|
+
return (<TimeWrapper time={time}>
|
|
59
|
+
{media.images.length > 1 ? (<div className={`flex flex-col`}>
|
|
60
|
+
{/* grid로 감싸진 짝수 개수 또는 홀수에서 마지막 전까지 */}
|
|
61
|
+
<div className="group grid grid-cols-2 gap-[8px] rounded-[10px] border-[1px] border-drTalkGrayscale4 p-[8px]">
|
|
62
|
+
{media.images.map((file, index) => {
|
|
63
|
+
const isLastOdd = media.images.length % 2 === 1 && index === media.images.length - 1;
|
|
64
|
+
if (isLastOdd)
|
|
65
|
+
return null;
|
|
66
|
+
return (<div key={index} className="group/image relative aspect-square h-[100px] w-[113px] overflow-hidden rounded-[5px]" onClick={() => {
|
|
67
|
+
if (media.type === 'image') {
|
|
68
|
+
openImageViewer === null || openImageViewer === void 0 ? void 0 : openImageViewer(media.images[index], message);
|
|
69
|
+
}
|
|
70
|
+
}}>
|
|
71
|
+
<Image src={file.thumbnailUrl} alt={file.name} width={113} height={100} className="h-full w-full cursor-pointer rounded-md object-cover" onClick={() => { }}/>
|
|
72
|
+
<button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
yield handleDownload(file);
|
|
75
|
+
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center bg-transparent opacity-0 transition-opacity group-hover/image:opacity-100">
|
|
76
|
+
<Image src={FileDownLoadIcon} alt="다운로드" width={25} height={24}/>
|
|
77
|
+
{/* <FileDownLoadIcon className="h-[25px] w-[24px]" /> */}
|
|
78
|
+
</button>
|
|
79
|
+
</div>);
|
|
80
|
+
})}
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
{/* 홀수 개수일 때 마지막 하나는 별도로 */}
|
|
84
|
+
{media.images.length % 2 === 1 && (<div className="mt-2 rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]" onClick={() => {
|
|
85
|
+
if (media.type === 'image') {
|
|
86
|
+
openImageViewer === null || openImageViewer === void 0 ? void 0 : openImageViewer(media.images[media.images.length - 1], message);
|
|
87
|
+
}
|
|
88
|
+
}}>
|
|
89
|
+
<div className="group/image relative h-[100px] w-[100%] overflow-hidden rounded-[5px]">
|
|
90
|
+
<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={() => { }}/>
|
|
91
|
+
<button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
e.stopPropagation();
|
|
93
|
+
if (media.type === 'image') {
|
|
94
|
+
yield handleDownload(media.images[media.images.length - 1]);
|
|
95
|
+
}
|
|
96
|
+
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center opacity-0 transition-opacity group-hover/image:opacity-100">
|
|
97
|
+
<Image src={FileDownLoadIcon} alt="다운로드" width={25} height={24}/>
|
|
98
|
+
{/* <FileDownLoadIcon className="h-[25px] w-[24px]" /> */}
|
|
99
|
+
</button>
|
|
100
|
+
</div>
|
|
101
|
+
</div>)}
|
|
102
|
+
</div>) : (
|
|
103
|
+
// 이미지 1장일 경우 (grid 없이 단독)
|
|
104
|
+
<div className="rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]" onClick={() => {
|
|
105
|
+
if (media.type === 'image') {
|
|
106
|
+
openImageViewer && openImageViewer(media.images[0], message);
|
|
107
|
+
}
|
|
108
|
+
}}>
|
|
109
|
+
<div className=" group/image relative h-[100px] w-[160px] overflow-hidden rounded-[5px]">
|
|
110
|
+
<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={() => { }}/>
|
|
111
|
+
<button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
if (media.type === 'image') {
|
|
114
|
+
yield handleDownload(media.images[0]);
|
|
115
|
+
}
|
|
116
|
+
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center opacity-0 transition-opacity group-hover/image:opacity-100">
|
|
117
|
+
<Image src={FileDownLoadIcon} alt="다운로드" width={25} height={24}/>
|
|
118
|
+
{/* <FileDownLoadIcon className="h-[25px] w-[24px]" /> */}
|
|
119
|
+
</button>
|
|
120
|
+
</div>
|
|
121
|
+
</div>)}
|
|
122
|
+
</TimeWrapper>);
|
|
123
|
+
}
|
|
124
|
+
else if (media.type === 'file') {
|
|
125
|
+
return (<TimeWrapper time={time} className={`w-fit`}>
|
|
126
|
+
<div className="flex w-full flex-col gap-[10px] ">
|
|
127
|
+
{media.files.map((file, index) => {
|
|
128
|
+
const fileExtension = file.name.split('.').pop() || '';
|
|
129
|
+
const baseName = file.name.replace(`.${fileExtension}`, '');
|
|
130
|
+
const truncatedName = baseName.length > 12 ? `${baseName.slice(0, 12)}…` : baseName;
|
|
131
|
+
const fileName = `${truncatedName}.${fileExtension}`;
|
|
132
|
+
return (<div key={index} className={` group flex w-full items-end justify-start gap-[4px]`}>
|
|
133
|
+
<div key={index} className={`
|
|
134
|
+
relative flex items-center justify-between
|
|
135
|
+
gap-[16px] rounded-[10px] border-[1px] border-[#EDEDED] p-[12px]
|
|
136
|
+
`}>
|
|
137
|
+
<div className="flex flex-col gap-[4px] ">
|
|
138
|
+
<span className={`dr_talk_body_medium2 line-clamp-1 text-drTalkBlack`}>
|
|
139
|
+
{fileName}
|
|
140
|
+
</span>
|
|
141
|
+
<span className="flex items-center gap-[10px] text-[12px] text-[#777777]">
|
|
142
|
+
{formatFileSize(file.size)} | {file.name.split('.').pop()}
|
|
143
|
+
</span>
|
|
144
|
+
</div>
|
|
145
|
+
<button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
146
|
+
e.stopPropagation();
|
|
147
|
+
yield handleDownload(file);
|
|
148
|
+
})} className="flex h-[24px] w-[24px] items-center justify-center ">
|
|
149
|
+
<Image src={FileDownLoadIcon} alt="다운로드" width={25} height={24} className="bg-white"/>
|
|
150
|
+
{/* <FileDownLoadIcon className="h-[25px] w-[24px] bg-white" /> */}
|
|
151
|
+
</button>
|
|
152
|
+
</div>
|
|
153
|
+
</div>);
|
|
154
|
+
})}
|
|
155
|
+
</div>
|
|
156
|
+
</TimeWrapper>);
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
};
|
|
160
|
+
if (!message.files) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
return <>{renderMediaContent()}</>;
|
|
164
|
+
};
|
|
165
|
+
export default ChatFile;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FileInfo, Message } from '../_types/message';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import { formatFileSize } from '../_lib/utils';
|
|
6
|
+
import { useDaeryuntalk } from '../DaeryuntalkContext';
|
|
7
|
+
import { getMessageFileDownloadUrl } from '../_api';
|
|
8
|
+
import TimeWrapper from './TimeWrapper';
|
|
9
|
+
//이미지
|
|
10
|
+
// import FileDownLoadIcon from '../../../asset/images/daeryuntalk/viewer/gray-download.svg';
|
|
11
|
+
|
|
12
|
+
interface props {
|
|
13
|
+
message: Message;
|
|
14
|
+
isOperator: boolean;
|
|
15
|
+
isHovered: boolean;
|
|
16
|
+
time: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
20
|
+
const FileDownLoadIcon = `${s3Url}/daeryuntalk/viewer/gray-download.svg`;
|
|
21
|
+
|
|
22
|
+
const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
23
|
+
const { openImageViewer } = useDaeryuntalk();
|
|
24
|
+
|
|
25
|
+
const handleDownload = async (file: FileInfo) => {
|
|
26
|
+
try {
|
|
27
|
+
const res = await getMessageFileDownloadUrl({
|
|
28
|
+
chatInquiryNumber: message.inquiryNumber || '',
|
|
29
|
+
fileNumber: file.fileNumber
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const filePath = res.data.url;
|
|
33
|
+
const response = await fetch(filePath);
|
|
34
|
+
const blob = await response.blob();
|
|
35
|
+
|
|
36
|
+
const url = window.URL.createObjectURL(blob);
|
|
37
|
+
const link = document.createElement('a');
|
|
38
|
+
link.href = url;
|
|
39
|
+
link.download = file.name;
|
|
40
|
+
document.body.appendChild(link);
|
|
41
|
+
link.click();
|
|
42
|
+
window.URL.revokeObjectURL(url);
|
|
43
|
+
document.body.removeChild(link);
|
|
44
|
+
} catch (err) {
|
|
45
|
+
console.error('다운로드 URL 요청 실패:', err);
|
|
46
|
+
// 사용자에게 알림 또는 토스트 표시 등을 추가할 수 있습니다.
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const renderMediaContent = () => {
|
|
50
|
+
const images = message.files
|
|
51
|
+
? message.files.filter(file => file.type === 'image').sort((a, b) => a.sequence - b.sequence)
|
|
52
|
+
: [];
|
|
53
|
+
const files = message.files
|
|
54
|
+
? message.files.filter(file => file.type === 'file').sort((a, b) => a.sequence - b.sequence)
|
|
55
|
+
: [];
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div className={`flex flex-col gap-[10px]`}>
|
|
59
|
+
{images.length > 0 && renderMedia({ type: 'image', images })}
|
|
60
|
+
{files.length > 0 && renderMedia({ type: 'file', files })}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const renderMedia = (media: { type: 'image'; images: FileInfo[] } | { type: 'file'; files: FileInfo[] }) => {
|
|
66
|
+
if (media.type === 'image') {
|
|
67
|
+
return (
|
|
68
|
+
<TimeWrapper time={time}>
|
|
69
|
+
{media.images.length > 1 ? (
|
|
70
|
+
<div className={`flex flex-col`}>
|
|
71
|
+
{/* grid로 감싸진 짝수 개수 또는 홀수에서 마지막 전까지 */}
|
|
72
|
+
<div className="group grid grid-cols-2 gap-[8px] rounded-[10px] border-[1px] border-drTalkGrayscale4 p-[8px]">
|
|
73
|
+
{media.images.map((file, index) => {
|
|
74
|
+
const isLastOdd =
|
|
75
|
+
media.images.length % 2 === 1 && index === media.images.length - 1;
|
|
76
|
+
if (isLastOdd) return null;
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div
|
|
80
|
+
key={index}
|
|
81
|
+
className="group/image relative aspect-square h-[100px] w-[113px] overflow-hidden rounded-[5px]"
|
|
82
|
+
onClick={() => {
|
|
83
|
+
if (media.type === 'image') {
|
|
84
|
+
openImageViewer?.(media.images[index], message);
|
|
85
|
+
}
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<Image
|
|
89
|
+
src={file.thumbnailUrl}
|
|
90
|
+
alt={file.name}
|
|
91
|
+
width={113}
|
|
92
|
+
height={100}
|
|
93
|
+
className="h-full w-full cursor-pointer rounded-md object-cover"
|
|
94
|
+
onClick={() => {}}
|
|
95
|
+
/>
|
|
96
|
+
<button
|
|
97
|
+
onClick={async e => {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
await handleDownload(file);
|
|
100
|
+
}}
|
|
101
|
+
className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center bg-transparent opacity-0 transition-opacity group-hover/image:opacity-100"
|
|
102
|
+
>
|
|
103
|
+
<Image src={FileDownLoadIcon} alt="다운로드" width={25} height={24} />
|
|
104
|
+
{/* <FileDownLoadIcon className="h-[25px] w-[24px]" /> */}
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
})}
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
{/* 홀수 개수일 때 마지막 하나는 별도로 */}
|
|
112
|
+
{media.images.length % 2 === 1 && (
|
|
113
|
+
<div
|
|
114
|
+
className="mt-2 rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]"
|
|
115
|
+
onClick={() => {
|
|
116
|
+
if (media.type === 'image') {
|
|
117
|
+
openImageViewer?.(media.images[media.images.length - 1], message);
|
|
118
|
+
}
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
<div className="group/image relative h-[100px] w-[100%] overflow-hidden rounded-[5px]">
|
|
122
|
+
<Image
|
|
123
|
+
src={media.images[media.images.length - 1].thumbnailUrl}
|
|
124
|
+
alt={media.images[media.images.length - 1].name}
|
|
125
|
+
width={160}
|
|
126
|
+
height={100}
|
|
127
|
+
className="h-full w-full cursor-pointer rounded-md object-cover"
|
|
128
|
+
onClick={() => {}}
|
|
129
|
+
/>
|
|
130
|
+
<button
|
|
131
|
+
onClick={async e => {
|
|
132
|
+
e.stopPropagation();
|
|
133
|
+
if (media.type === 'image') {
|
|
134
|
+
await handleDownload(media.images[media.images.length - 1]);
|
|
135
|
+
}
|
|
136
|
+
}}
|
|
137
|
+
className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center opacity-0 transition-opacity group-hover/image:opacity-100"
|
|
138
|
+
>
|
|
139
|
+
<Image src={FileDownLoadIcon} alt="다운로드" width={25} height={24} />
|
|
140
|
+
{/* <FileDownLoadIcon className="h-[25px] w-[24px]" /> */}
|
|
141
|
+
</button>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
)}
|
|
145
|
+
</div>
|
|
146
|
+
) : (
|
|
147
|
+
// 이미지 1장일 경우 (grid 없이 단독)
|
|
148
|
+
<div
|
|
149
|
+
className="rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]"
|
|
150
|
+
onClick={() => {
|
|
151
|
+
if (media.type === 'image') {
|
|
152
|
+
openImageViewer && openImageViewer(media.images[0], message);
|
|
153
|
+
}
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
<div className=" group/image relative h-[100px] w-[160px] overflow-hidden rounded-[5px]">
|
|
157
|
+
<Image
|
|
158
|
+
src={media.images[0].thumbnailUrl}
|
|
159
|
+
alt={media.images[0].name}
|
|
160
|
+
width={160}
|
|
161
|
+
height={100}
|
|
162
|
+
className="h-full w-full cursor-pointer rounded-md object-cover"
|
|
163
|
+
onClick={() => {}}
|
|
164
|
+
/>
|
|
165
|
+
<button
|
|
166
|
+
onClick={async e => {
|
|
167
|
+
e.stopPropagation();
|
|
168
|
+
if (media.type === 'image') {
|
|
169
|
+
await handleDownload(media.images[0]);
|
|
170
|
+
}
|
|
171
|
+
}}
|
|
172
|
+
className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center opacity-0 transition-opacity group-hover/image:opacity-100"
|
|
173
|
+
>
|
|
174
|
+
<Image src={FileDownLoadIcon} alt="다운로드" width={25} height={24} />
|
|
175
|
+
{/* <FileDownLoadIcon className="h-[25px] w-[24px]" /> */}
|
|
176
|
+
</button>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
)}
|
|
180
|
+
</TimeWrapper>
|
|
181
|
+
);
|
|
182
|
+
} else if (media.type === 'file') {
|
|
183
|
+
return (
|
|
184
|
+
<TimeWrapper time={time} className={`w-fit`}>
|
|
185
|
+
<div className="flex w-full flex-col gap-[10px] ">
|
|
186
|
+
{media.files.map((file, index) => {
|
|
187
|
+
const fileExtension = file.name.split('.').pop() || '';
|
|
188
|
+
const baseName = file.name.replace(`.${fileExtension}`, '');
|
|
189
|
+
|
|
190
|
+
const truncatedName = baseName.length > 12 ? `${baseName.slice(0, 12)}…` : baseName;
|
|
191
|
+
|
|
192
|
+
const fileName = `${truncatedName}.${fileExtension}`;
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<div key={index} className={` group flex w-full items-end justify-start gap-[4px]`}>
|
|
196
|
+
<div
|
|
197
|
+
key={index}
|
|
198
|
+
className={`
|
|
199
|
+
relative flex items-center justify-between
|
|
200
|
+
gap-[16px] rounded-[10px] border-[1px] border-[#EDEDED] p-[12px]
|
|
201
|
+
`}
|
|
202
|
+
>
|
|
203
|
+
<div className="flex flex-col gap-[4px] ">
|
|
204
|
+
<span className={`dr_talk_body_medium2 line-clamp-1 text-drTalkBlack`}>
|
|
205
|
+
{fileName}
|
|
206
|
+
</span>
|
|
207
|
+
<span className="flex items-center gap-[10px] text-[12px] text-[#777777]">
|
|
208
|
+
{formatFileSize(file.size)} | {file.name.split('.').pop()}
|
|
209
|
+
</span>
|
|
210
|
+
</div>
|
|
211
|
+
<button
|
|
212
|
+
onClick={async e => {
|
|
213
|
+
e.stopPropagation();
|
|
214
|
+
await handleDownload(file);
|
|
215
|
+
}}
|
|
216
|
+
className="flex h-[24px] w-[24px] items-center justify-center "
|
|
217
|
+
>
|
|
218
|
+
<Image
|
|
219
|
+
src={FileDownLoadIcon}
|
|
220
|
+
alt="다운로드"
|
|
221
|
+
width={25}
|
|
222
|
+
height={24}
|
|
223
|
+
className="bg-white"
|
|
224
|
+
/>
|
|
225
|
+
{/* <FileDownLoadIcon className="h-[25px] w-[24px] bg-white" /> */}
|
|
226
|
+
</button>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
);
|
|
230
|
+
})}
|
|
231
|
+
</div>
|
|
232
|
+
</TimeWrapper>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
if (!message.files) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
return <>{renderMediaContent()}</>;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export default ChatFile;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const ChatLoading = ({ outerClass }) => {
|
|
4
|
+
return (<div className={`flex justify-start pl-8 ${outerClass}`}>
|
|
5
|
+
<div className="flex h-8 animate-pulse space-x-2 rounded-full ">
|
|
6
|
+
<div className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale2 "></div>
|
|
7
|
+
<div className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale3" style={{ animationDelay: '0.2s' }}></div>
|
|
8
|
+
<div className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale3" style={{ animationDelay: '0.4s' }}></div>
|
|
9
|
+
</div>
|
|
10
|
+
</div>);
|
|
11
|
+
};
|
|
12
|
+
export default ChatLoading;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
interface ChatLoadingProsp {
|
|
5
|
+
outerClass?: string;
|
|
6
|
+
}
|
|
7
|
+
const ChatLoading = ({ outerClass }: ChatLoadingProsp) => {
|
|
8
|
+
return (
|
|
9
|
+
<div className={`flex justify-start pl-8 ${outerClass}`}>
|
|
10
|
+
<div className="flex h-8 animate-pulse space-x-2 rounded-full ">
|
|
11
|
+
<div className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale2 "></div>
|
|
12
|
+
<div
|
|
13
|
+
className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale3"
|
|
14
|
+
style={{ animationDelay: '0.2s' }}
|
|
15
|
+
></div>
|
|
16
|
+
<div
|
|
17
|
+
className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale3"
|
|
18
|
+
style={{ animationDelay: '0.4s' }}
|
|
19
|
+
></div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default ChatLoading;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Message } from '../_types/message';
|
|
3
|
+
interface props {
|
|
4
|
+
message: Message;
|
|
5
|
+
isOperator: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const ChatPrivacyAuth: ({ message, isOperator }: props) => React.JSX.Element | undefined;
|
|
8
|
+
export default ChatPrivacyAuth;
|