@daeryun/dr_components 1.2.17 → 1.2.19
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/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/banner/TopBanner.jsx +2 -2
- package/dist/components/banner/TopBanner.tsx +4 -2
- package/dist/styles/globals.css +5 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
4
|
+
import ChatMessage from './ChatMessage';
|
|
5
|
+
import ChatInput from './ChatInput';
|
|
6
|
+
import NoticeMessage from './NoticeMessage';
|
|
7
|
+
import DateSeparator from './DateSeparator';
|
|
8
|
+
import { InquiryStatusEnum } from './_enums/ask-status';
|
|
9
|
+
import Button3 from './_ui/buttons/Button3';
|
|
10
|
+
import ChatConversationHeader from './ChatConversationItem/ChatConversationHeader';
|
|
11
|
+
import ChatLoading from './ChatItem/ChatLoading';
|
|
12
|
+
import { useWindowSize } from './_hooks/useWindowSize';
|
|
13
|
+
import TypingComp from './ChatItem/TypingComp';
|
|
14
|
+
import { useHoverScrollbar } from './_hooks/useHoverScrollbar';
|
|
15
|
+
import { ViewState } from './ChatHomeView';
|
|
16
|
+
import { History } from './_api/daeryuntalk/type/response';
|
|
17
|
+
import AgeCheckBox from './ChatItem/AgeCheckBox';
|
|
18
|
+
import { AgeCheckStatusEnums } from './_enums/ags_check_status';
|
|
19
|
+
|
|
20
|
+
type ChatConversationProps = {
|
|
21
|
+
// onBackClick?: () => void;
|
|
22
|
+
onChatNew?: () => void;
|
|
23
|
+
isActive: boolean;
|
|
24
|
+
isMobile: boolean;
|
|
25
|
+
onClose: () => void;
|
|
26
|
+
isHash: boolean;
|
|
27
|
+
initialLoading: boolean | null;
|
|
28
|
+
viewState: ViewState;
|
|
29
|
+
handleHistoryClick?: () => void;
|
|
30
|
+
isAuthenticated: boolean;
|
|
31
|
+
historyList: History[];
|
|
32
|
+
ageCheckStatus: AgeCheckStatusEnums | null;
|
|
33
|
+
isMobileSafari?: boolean;
|
|
34
|
+
androidViewportHeight?: number;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
38
|
+
// onBackClick,
|
|
39
|
+
onChatNew,
|
|
40
|
+
isActive,
|
|
41
|
+
isMobile,
|
|
42
|
+
onClose,
|
|
43
|
+
isHash,
|
|
44
|
+
initialLoading,
|
|
45
|
+
viewState,
|
|
46
|
+
handleHistoryClick,
|
|
47
|
+
isAuthenticated,
|
|
48
|
+
historyList,
|
|
49
|
+
ageCheckStatus,
|
|
50
|
+
isMobileSafari = false,
|
|
51
|
+
androidViewportHeight = 0
|
|
52
|
+
}) => {
|
|
53
|
+
const {
|
|
54
|
+
getNextMessageList,
|
|
55
|
+
isNextPage,
|
|
56
|
+
inquiryStatus,
|
|
57
|
+
messages,
|
|
58
|
+
isLoading,
|
|
59
|
+
inquiryMainData,
|
|
60
|
+
messageObject,
|
|
61
|
+
workFlowBack,
|
|
62
|
+
workFlowStack,
|
|
63
|
+
chatInquiryNumber,
|
|
64
|
+
isTyping,
|
|
65
|
+
ageConfirm
|
|
66
|
+
} = useDaeryuntalk();
|
|
67
|
+
|
|
68
|
+
const isNotAgeCheck = ageCheckStatus === AgeCheckStatusEnums.DISAGREED;
|
|
69
|
+
|
|
70
|
+
const [isFetchingPrev, setIsFetchingPrev] = useState(false);
|
|
71
|
+
|
|
72
|
+
const sortedMessages = useMemo(() => {
|
|
73
|
+
return messages?.length ? messages.slice().sort((a, b) => a.timestamp - b.timestamp) : [];
|
|
74
|
+
}, [messages]);
|
|
75
|
+
|
|
76
|
+
const [isHovered, setIsHovered] = useState<boolean>(false);
|
|
77
|
+
|
|
78
|
+
const headerRef = useRef<HTMLDivElement | null>(null);
|
|
79
|
+
const pcBottomRef = useRef<HTMLDivElement | null>(null);
|
|
80
|
+
const [bottomHeight, setBottomHeight] = useState(0);
|
|
81
|
+
|
|
82
|
+
const isClosed = inquiryStatus === InquiryStatusEnum.CLOSED;
|
|
83
|
+
|
|
84
|
+
const windowSize = useWindowSize();
|
|
85
|
+
|
|
86
|
+
// 최초 렌더 여부 플래그
|
|
87
|
+
const isInitialMount = useRef(true);
|
|
88
|
+
// 이후
|
|
89
|
+
const messagesContainerRef = useRef<HTMLDivElement>(null);
|
|
90
|
+
const messagesEndRef = useRef<HTMLDivElement>(null);
|
|
91
|
+
|
|
92
|
+
const { style: hoverStyle } = useHoverScrollbar(messagesContainerRef, [messages.length]);
|
|
93
|
+
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
const bottomRef = pcBottomRef;
|
|
96
|
+
|
|
97
|
+
let retries = 10;
|
|
98
|
+
|
|
99
|
+
const tryMeasure = () => {
|
|
100
|
+
const height = bottomRef.current?.getBoundingClientRect().height ?? 0;
|
|
101
|
+
console.log('measure:', height);
|
|
102
|
+
|
|
103
|
+
if (height > 0 || retries-- <= 0) {
|
|
104
|
+
setBottomHeight(height);
|
|
105
|
+
} else {
|
|
106
|
+
requestAnimationFrame(tryMeasure);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
tryMeasure();
|
|
111
|
+
}, [windowSize.width]);
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
const defaultNoticeContent = inquiryMainData?.channel_explanation || '';
|
|
115
|
+
|
|
116
|
+
const noticeContent = defaultNoticeContent;
|
|
117
|
+
const scrollEnd = () => {
|
|
118
|
+
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// 새 메시지가 도착할 때 자동으로 스크롤 최하단으로 이동 sortedMessages의 마지막 행에 type이 live일 경우만 scrollEnd 실행
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
const lastMessage = sortedMessages && sortedMessages.length > 0 && sortedMessages[sortedMessages.length - 1];
|
|
124
|
+
if (!lastMessage || lastMessage?.type !== 'live') return;
|
|
125
|
+
|
|
126
|
+
const timeout = setTimeout(() => {
|
|
127
|
+
scrollEnd();
|
|
128
|
+
}, 200);
|
|
129
|
+
return () => clearTimeout(timeout); // cleanup
|
|
130
|
+
}, [sortedMessages, messageObject]);
|
|
131
|
+
|
|
132
|
+
// 최초 진입 시 스크롤 최하단으로 이동
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if (!isInitialMount.current) return;
|
|
135
|
+
if (sortedMessages.length === 0) return;
|
|
136
|
+
|
|
137
|
+
const container = messagesContainerRef.current;
|
|
138
|
+
if (!container) return;
|
|
139
|
+
|
|
140
|
+
const images = container.querySelectorAll('img');
|
|
141
|
+
let hasScrolled = false;
|
|
142
|
+
|
|
143
|
+
const scrollToBottom = () => {
|
|
144
|
+
if (hasScrolled) return;
|
|
145
|
+
hasScrolled = true;
|
|
146
|
+
|
|
147
|
+
requestAnimationFrame(() => {
|
|
148
|
+
scrollEnd(); // 무조건 실행
|
|
149
|
+
isInitialMount.current = false;
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
if (images.length === 0) {
|
|
154
|
+
scrollToBottom();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
let loaded = 0;
|
|
159
|
+
const total = images.length;
|
|
160
|
+
|
|
161
|
+
images.forEach(img => {
|
|
162
|
+
const done = () => {
|
|
163
|
+
loaded++;
|
|
164
|
+
if (loaded === total) {
|
|
165
|
+
setTimeout(scrollToBottom, 50);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
if (img.complete) {
|
|
170
|
+
// 강제 로드 보장
|
|
171
|
+
const newImg = new Image();
|
|
172
|
+
newImg.src = img.src;
|
|
173
|
+
newImg.onload = done;
|
|
174
|
+
newImg.onerror = done;
|
|
175
|
+
} else {
|
|
176
|
+
img.addEventListener('load', done, { once: true });
|
|
177
|
+
img.addEventListener('error', done, { once: true });
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// fallback 타이머로 scrollToBottom 보장 (예: 이미지 로딩 실패 시)
|
|
182
|
+
const fallback = setTimeout(() => {
|
|
183
|
+
scrollToBottom();
|
|
184
|
+
}, 500); // 1초 후 강제 실행
|
|
185
|
+
|
|
186
|
+
return () => clearTimeout(fallback);
|
|
187
|
+
}, [sortedMessages, messageObject]);
|
|
188
|
+
|
|
189
|
+
// 무한 스크롤
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
const container = messagesContainerRef.current;
|
|
192
|
+
if (!container || !isNextPage || !chatInquiryNumber || sortedMessages.length === 0) return;
|
|
193
|
+
|
|
194
|
+
const handleScroll = async () => {
|
|
195
|
+
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
196
|
+
|
|
197
|
+
// 스크롤이 없더라도 무시하지 않음! → handleScroll은 무한스크롤 용도에만 사용
|
|
198
|
+
const scrolledPercent = (scrollTop / scrollHeight) * 100;
|
|
199
|
+
|
|
200
|
+
if (scrolledPercent < 5 && !isFetchingPrev) {
|
|
201
|
+
setIsFetchingPrev(true);
|
|
202
|
+
const prevScrollHeight = container.scrollHeight;
|
|
203
|
+
const oldestMessage = sortedMessages[0];
|
|
204
|
+
if (!oldestMessage?.createdAt) return;
|
|
205
|
+
|
|
206
|
+
try {
|
|
207
|
+
await getNextMessageList(chatInquiryNumber, oldestMessage.timestamp);
|
|
208
|
+
requestAnimationFrame(() => {
|
|
209
|
+
const newScrollHeight = container.scrollHeight;
|
|
210
|
+
container.scrollTop = newScrollHeight - prevScrollHeight;
|
|
211
|
+
});
|
|
212
|
+
} finally {
|
|
213
|
+
setIsFetchingPrev(false);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
handleScroll();
|
|
218
|
+
|
|
219
|
+
container.addEventListener('scroll', handleScroll);
|
|
220
|
+
return () => container.removeEventListener('scroll', handleScroll);
|
|
221
|
+
}, [sortedMessages, chatInquiryNumber, isNextPage, isFetchingPrev, getNextMessageList]);
|
|
222
|
+
|
|
223
|
+
const isNewDay = (date1: Date, date2: Date): boolean => {
|
|
224
|
+
return (
|
|
225
|
+
date1.getFullYear() !== date2.getFullYear() ||
|
|
226
|
+
date1.getMonth() !== date2.getMonth() ||
|
|
227
|
+
date1.getDate() !== date2.getDate()
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const renderedMessages = useMemo(() => {
|
|
232
|
+
const elements: React.ReactNode[] = [];
|
|
233
|
+
if (sortedMessages.length < 1) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
sortedMessages.forEach((message, index) => {
|
|
238
|
+
const findObject =
|
|
239
|
+
message.workFlow &&
|
|
240
|
+
messageObject?.exposeObjectListYn &&
|
|
241
|
+
messageObject?.messageNumber === message.messageNumber
|
|
242
|
+
? messageObject
|
|
243
|
+
: null;
|
|
244
|
+
|
|
245
|
+
if (index === 0 || isNewDay(message.createdAt, sortedMessages[index - 1].createdAt)) {
|
|
246
|
+
elements.push(<DateSeparator key={`date-${message.messageNumber}`} date={message.createdAt} />);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
elements.push(
|
|
250
|
+
<ChatMessage
|
|
251
|
+
isMobile={isMobile}
|
|
252
|
+
inquiryStatus={inquiryStatus}
|
|
253
|
+
key={message.messageNumber}
|
|
254
|
+
message={message}
|
|
255
|
+
object={findObject}
|
|
256
|
+
handelObjectBack={workFlowBack}
|
|
257
|
+
chatInquiryNumber={chatInquiryNumber || ''}
|
|
258
|
+
workFlowStack={workFlowStack}
|
|
259
|
+
isHovered={isHovered}
|
|
260
|
+
scrollEnd={scrollEnd}
|
|
261
|
+
/>
|
|
262
|
+
);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
return elements;
|
|
266
|
+
}, [
|
|
267
|
+
sortedMessages,
|
|
268
|
+
messageObject, // 둘 다 바뀌면 리렌더됨
|
|
269
|
+
isMobile,
|
|
270
|
+
inquiryStatus,
|
|
271
|
+
workFlowBack,
|
|
272
|
+
chatInquiryNumber,
|
|
273
|
+
workFlowStack,
|
|
274
|
+
isHovered,
|
|
275
|
+
scrollEnd
|
|
276
|
+
]);
|
|
277
|
+
|
|
278
|
+
const onAgree = () => {
|
|
279
|
+
ageConfirm(chatInquiryNumber || '', AgeCheckStatusEnums.AGREED);
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
return (
|
|
284
|
+
<>
|
|
285
|
+
{/*isMoblie true일때 헤더 주의 내용이 상단에 있고 ,나머지 높이영역은 메시지 리스트로 붙게*/}
|
|
286
|
+
<div
|
|
287
|
+
className={` flex ${isMobile ? ' h-full' : 'h-[100vh]'} flex-col items-center justify-between xs:h-[calc(100vh-165px)] xs:max-h-[690px] lg:h-[calc(100vh-110px)] `
|
|
288
|
+
}
|
|
289
|
+
>
|
|
290
|
+
<div
|
|
291
|
+
className={`
|
|
292
|
+
relative h-full w-full
|
|
293
|
+
rounded-t-[30px]
|
|
294
|
+
xs:max-h-[690px] xs:min-h-[320px] xs:justify-start
|
|
295
|
+
${isMobile ? 'flex flex-col items-center justify-between' : 'flex flex-col'}
|
|
296
|
+
`}
|
|
297
|
+
>
|
|
298
|
+
{/* 헤더 부분 */}
|
|
299
|
+
<div ref={headerRef} className={`flex w-full flex-col`}>
|
|
300
|
+
<ChatConversationHeader
|
|
301
|
+
inquiryMainData={inquiryMainData ?? null}
|
|
302
|
+
isMobile={isMobile}
|
|
303
|
+
viewState={viewState}
|
|
304
|
+
onClose={onClose}
|
|
305
|
+
isHash={isHash}
|
|
306
|
+
// onBackClick={onBackClick}
|
|
307
|
+
onHistoryClick={handleHistoryClick}
|
|
308
|
+
isAuthenticated={isAuthenticated}
|
|
309
|
+
historyList={historyList}
|
|
310
|
+
/>
|
|
311
|
+
|
|
312
|
+
<NoticeMessage content={noticeContent} isMobile={isMobile} />
|
|
313
|
+
</div>
|
|
314
|
+
{/* 메시지 노출 부분 -> 무한스크롤 변환 필요 */}
|
|
315
|
+
{/* 여기서 isMpblie일때 위에 2개 헤더부분이랑 아래 메시지 입력이랑 높이를 빼서 넣어야한ㄷ */}
|
|
316
|
+
<div
|
|
317
|
+
ref={messagesContainerRef}
|
|
318
|
+
className={`
|
|
319
|
+
${isMobile ? ` ${isLoading ? ' pb-[50px]' : ''} mx-[20px] overflow-y-auto ` : 'flex- ml-[20px] mr-[5px] xs:pb-[100px] '} overlay-scrollbar overflow-auto pt-[20px]
|
|
320
|
+
`}
|
|
321
|
+
style={{
|
|
322
|
+
height: isMobile ?
|
|
323
|
+
isMobileSafari ?
|
|
324
|
+
`calc(100vh - ${bottomHeight}px - ${headerRef.current?.offsetHeight || 0}px)`
|
|
325
|
+
: `100%`
|
|
326
|
+
: bottomHeight && headerRef.current
|
|
327
|
+
? `calc(100% - ${bottomHeight}px - ${headerRef.current?.offsetHeight}px)`
|
|
328
|
+
: '100%', // fallback
|
|
329
|
+
...(!isMobile ? hoverStyle : {})
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
{initialLoading === null ? (
|
|
333
|
+
<div className={`flex h-full w-full items-center justify-center `}>
|
|
334
|
+
<ChatLoading outerClass={`!pl-0`} />
|
|
335
|
+
</div>
|
|
336
|
+
) : (
|
|
337
|
+
<div
|
|
338
|
+
className={` w-full`}
|
|
339
|
+
onMouseEnter={() => setIsHovered(true)}
|
|
340
|
+
onMouseLeave={() => setIsHovered(false)}
|
|
341
|
+
>
|
|
342
|
+
{renderedMessages}
|
|
343
|
+
{/* 타이핑 UI */}
|
|
344
|
+
{isTyping && <TypingComp />}
|
|
345
|
+
{isClosed && (
|
|
346
|
+
<div
|
|
347
|
+
className={` dr_talk_body_medium2 pb-[16px] text-center text-drTalkGrayscale1`}
|
|
348
|
+
>
|
|
349
|
+
문의가 종료되었습니다.
|
|
350
|
+
</div>
|
|
351
|
+
)}
|
|
352
|
+
{isLoading && <ChatLoading />}
|
|
353
|
+
<div ref={messagesEndRef} />
|
|
354
|
+
</div>
|
|
355
|
+
)}
|
|
356
|
+
</div>
|
|
357
|
+
{!isClosed && isNotAgeCheck && <AgeCheckBox onAgree={onAgree} />}
|
|
358
|
+
|
|
359
|
+
<div ref={pcBottomRef} className={`!z-[50] w-full`}>
|
|
360
|
+
{/* 높이가 부모에 스크롤이 줄어도 해당 부분은 바텀에 고정 필요 */}
|
|
361
|
+
{isClosed ? (
|
|
362
|
+
<div className='w-full border-t border-drTalkGrayscale4 px-[20px] py-[16px]'>
|
|
363
|
+
<div className=''>
|
|
364
|
+
<Button3
|
|
365
|
+
onClick={() => {
|
|
366
|
+
onChatNew && onChatNew();
|
|
367
|
+
}}
|
|
368
|
+
className={`w-full`}
|
|
369
|
+
>
|
|
370
|
+
새 문의하기
|
|
371
|
+
</Button3>
|
|
372
|
+
</div>
|
|
373
|
+
</div>
|
|
374
|
+
) : (
|
|
375
|
+
<div className=' w-full border-t border-drTalkGrayscale4 px-[20px] py-[8px]'>
|
|
376
|
+
<ChatInput
|
|
377
|
+
isMobile={isMobile}
|
|
378
|
+
isNotAgeCheck={isNotAgeCheck}
|
|
379
|
+
chatInquiryNumber={chatInquiryNumber || ''}
|
|
380
|
+
/>
|
|
381
|
+
</div>
|
|
382
|
+
)}
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
</div>
|
|
386
|
+
</>
|
|
387
|
+
);
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
export default ChatConversation;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IChatInquiryMainDataResponse } from '../_api/daeryuntalk/type/response';
|
|
3
|
+
import { ViewState } from '../ChatHomeView';
|
|
4
|
+
import { History } from '../_api/daeryuntalk/type/response';
|
|
5
|
+
interface IChatConversationHeaderProps {
|
|
6
|
+
inquiryMainData: IChatInquiryMainDataResponse | null;
|
|
7
|
+
isMobile: boolean;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
isHash: boolean;
|
|
10
|
+
onHistoryClick?: () => void;
|
|
11
|
+
viewState: ViewState;
|
|
12
|
+
isAuthenticated: boolean;
|
|
13
|
+
historyList: History[];
|
|
14
|
+
}
|
|
15
|
+
declare const ChatConversationHeader: ({ inquiryMainData, isMobile, onClose, isHash, viewState, onHistoryClick, isAuthenticated, historyList }: IChatConversationHeaderProps) => React.JSX.Element;
|
|
16
|
+
export default ChatConversationHeader;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
const ChatConversationHeader = ({ inquiryMainData, isMobile, onClose, isHash,
|
|
4
|
+
// onBackClick,
|
|
5
|
+
viewState, onHistoryClick, isAuthenticated, historyList }) => {
|
|
6
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
7
|
+
const HistoryNewbadge = `${s3Url}/daeryuntalk/history-new-badge.png`;
|
|
8
|
+
const DaeryunLogoIcon = `${s3Url}/daeryuntalk/daeryun-logo.svg`;
|
|
9
|
+
const PrevIcon = `${s3Url}/daeryuntalk/prev.svg`;
|
|
10
|
+
const CloseSvgIcon = `${s3Url}/daeryuntalk/close.svg`;
|
|
11
|
+
const HistoryIcon = `${s3Url}/daeryuntalk/history-icon.png`;
|
|
12
|
+
const channelName = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_name) || '';
|
|
13
|
+
const logoImageUrl = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_logo_image_url) || '';
|
|
14
|
+
const unreadCount = historyList.length > 0 ? historyList.reduce((sum, item) => sum + (item.unread_message_count || 0), 0) : 0;
|
|
15
|
+
const isNewBadge = isAuthenticated && unreadCount > 0;
|
|
16
|
+
const handleBackClick = () => {
|
|
17
|
+
// if (onBackClick) {
|
|
18
|
+
// onBackClick();
|
|
19
|
+
// }
|
|
20
|
+
};
|
|
21
|
+
const handleHistoryClick = () => {
|
|
22
|
+
if (onHistoryClick) {
|
|
23
|
+
onHistoryClick();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (<div className={`${isMobile ? '' : ''} flex h-[56px] w-full items-center justify-between border-b border-gray-200 px-[16px] `}>
|
|
27
|
+
{viewState === 'conversation' ? (<button type="button" className={`relative flex flex-col items-center justify-center`} onClick={handleHistoryClick}>
|
|
28
|
+
<Image src={HistoryIcon} alt="히스토리" width={20} height={20}/>
|
|
29
|
+
<span className="h-[10px] text-[10px] font-[700] leading-[100%] tracking-[-0.04%]">히스토리</span>
|
|
30
|
+
<div className={`${isNewBadge ? 'opacity-100' : 'opacity-0'} absolute -right-[4px] -top-[1px]`}>
|
|
31
|
+
<Image src={HistoryNewbadge} alt="뉴 히스토리 뱃지" width={12} height={12}/>
|
|
32
|
+
</div>
|
|
33
|
+
</button>) : (<button className={`flex h-[28px] w-[28px] items-center justify-center `} aria-label="이전" onClick={handleBackClick}>
|
|
34
|
+
<Image src={PrevIcon} alt="이전" width={28} height={28}/>
|
|
35
|
+
{/* <PrevIcon width={28} height={28} /> */}
|
|
36
|
+
</button>)}
|
|
37
|
+
<div className="flex items-center gap-[10px] ">
|
|
38
|
+
{logoImageUrl ? (<Image src={logoImageUrl} alt="로고" width={28} height={28} className=""/>) : (<Image src={DaeryunLogoIcon} alt="대륜 로고" width={28} height={28}/>)}
|
|
39
|
+
{/* <DaeryunLogoIcon width={28} height={28} /> */}
|
|
40
|
+
<p className={`dr_talk_title_small text-drTalkBlack`}>{channelName}</p>
|
|
41
|
+
</div>
|
|
42
|
+
<div
|
|
43
|
+
// className={`${isHash ? 'pointer-events-none !opacity-0' : ''} ${isMobile ? 'block' : ' xs:pointer-events-none xs:!opacity-0 '} py-[14px] text-drTalkGrayscale2 hover:cursor-pointer`}
|
|
44
|
+
className={`py-[14px] text-black hover:cursor-pointer`} onClick={onClose}>
|
|
45
|
+
<Image src={CloseSvgIcon} alt="닫기" width={28} height={28}/>
|
|
46
|
+
{/* <CloseSvgIcon width={28} height={28} /> */}
|
|
47
|
+
</div>
|
|
48
|
+
</div>);
|
|
49
|
+
};
|
|
50
|
+
export default ChatConversationHeader;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import { IChatInquiryMainDataResponse } from '../_api/daeryuntalk/type/response';
|
|
4
|
+
import { ViewState } from '../ChatHomeView';
|
|
5
|
+
import { History } from '../_api/daeryuntalk/type/response';
|
|
6
|
+
|
|
7
|
+
// 이미지
|
|
8
|
+
// import HistoryNewbadge from '../../../asset/images/daeryuntalk/history-new-badge.png';
|
|
9
|
+
// import DaeryunLogoIcon from '../../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
10
|
+
// import PrevIcon from '../../../asset/images/daeryuntalk/prev.svg';
|
|
11
|
+
// import CloseSvgIcon from '../../../asset/images/daeryuntalk/close.svg';
|
|
12
|
+
// import HistoryIcon from '../../../asset/images/daeryuntalk/history-icon.png';
|
|
13
|
+
|
|
14
|
+
interface IChatConversationHeaderProps {
|
|
15
|
+
inquiryMainData: IChatInquiryMainDataResponse | null;
|
|
16
|
+
isMobile: boolean;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
isHash: boolean;
|
|
19
|
+
// onBackClick?: () => void;
|
|
20
|
+
onHistoryClick?: () => void;
|
|
21
|
+
viewState: ViewState;
|
|
22
|
+
isAuthenticated: boolean;
|
|
23
|
+
historyList: History[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const ChatConversationHeader = ({
|
|
27
|
+
inquiryMainData,
|
|
28
|
+
isMobile,
|
|
29
|
+
onClose,
|
|
30
|
+
isHash,
|
|
31
|
+
// onBackClick,
|
|
32
|
+
viewState,
|
|
33
|
+
onHistoryClick,
|
|
34
|
+
isAuthenticated,
|
|
35
|
+
historyList
|
|
36
|
+
}: IChatConversationHeaderProps) => {
|
|
37
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
38
|
+
const HistoryNewbadge = `${s3Url}/daeryuntalk/history-new-badge.png`;
|
|
39
|
+
const DaeryunLogoIcon = `${s3Url}/daeryuntalk/daeryun-logo.svg`;
|
|
40
|
+
const PrevIcon = `${s3Url}/daeryuntalk/prev.svg`;
|
|
41
|
+
const CloseSvgIcon = `${s3Url}/daeryuntalk/close.svg`;
|
|
42
|
+
const HistoryIcon = `${s3Url}/daeryuntalk/history-icon.png`;
|
|
43
|
+
|
|
44
|
+
const channelName = inquiryMainData?.channel_name || '';
|
|
45
|
+
const logoImageUrl = inquiryMainData?.channel_logo_image_url || '';
|
|
46
|
+
const unreadCount =
|
|
47
|
+
historyList.length > 0 ? historyList.reduce((sum, item) => sum + (item.unread_message_count || 0), 0) : 0;
|
|
48
|
+
const isNewBadge = isAuthenticated && unreadCount > 0;
|
|
49
|
+
|
|
50
|
+
const handleBackClick = () => {
|
|
51
|
+
// if (onBackClick) {
|
|
52
|
+
// onBackClick();
|
|
53
|
+
// }
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleHistoryClick = () => {
|
|
57
|
+
if (onHistoryClick) {
|
|
58
|
+
onHistoryClick();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
className={`${isMobile ? '' : ''} flex h-[56px] w-full items-center justify-between border-b border-gray-200 px-[16px] `}
|
|
64
|
+
>
|
|
65
|
+
{viewState === 'conversation' ? (
|
|
66
|
+
<button
|
|
67
|
+
type="button"
|
|
68
|
+
className={`relative flex flex-col items-center justify-center`}
|
|
69
|
+
onClick={handleHistoryClick}
|
|
70
|
+
>
|
|
71
|
+
<Image src={HistoryIcon} alt="히스토리" width={20} height={20} />
|
|
72
|
+
<span className="h-[10px] text-[10px] font-[700] leading-[100%] tracking-[-0.04%]">히스토리</span>
|
|
73
|
+
<div className={`${isNewBadge ? 'opacity-100' : 'opacity-0'} absolute -right-[4px] -top-[1px]`}>
|
|
74
|
+
<Image src={HistoryNewbadge} alt="뉴 히스토리 뱃지" width={12} height={12} />
|
|
75
|
+
</div>
|
|
76
|
+
</button>
|
|
77
|
+
) : (
|
|
78
|
+
<button
|
|
79
|
+
className={`flex h-[28px] w-[28px] items-center justify-center `}
|
|
80
|
+
aria-label="이전"
|
|
81
|
+
onClick={handleBackClick}
|
|
82
|
+
>
|
|
83
|
+
<Image src={PrevIcon} alt="이전" width={28} height={28} />
|
|
84
|
+
{/* <PrevIcon width={28} height={28} /> */}
|
|
85
|
+
</button>
|
|
86
|
+
)}
|
|
87
|
+
<div className="flex items-center gap-[10px] ">
|
|
88
|
+
{logoImageUrl ? (
|
|
89
|
+
<Image src={logoImageUrl} alt="로고" width={28} height={28} className="" />
|
|
90
|
+
) : (
|
|
91
|
+
<Image src={DaeryunLogoIcon} alt="대륜 로고" width={28} height={28} />
|
|
92
|
+
)}
|
|
93
|
+
{/* <DaeryunLogoIcon width={28} height={28} /> */}
|
|
94
|
+
<p className={`dr_talk_title_small text-drTalkBlack`}>{channelName}</p>
|
|
95
|
+
</div>
|
|
96
|
+
<div
|
|
97
|
+
// className={`${isHash ? 'pointer-events-none !opacity-0' : ''} ${isMobile ? 'block' : ' xs:pointer-events-none xs:!opacity-0 '} py-[14px] text-drTalkGrayscale2 hover:cursor-pointer`}
|
|
98
|
+
className={`py-[14px] text-black hover:cursor-pointer`}
|
|
99
|
+
onClick={onClose}
|
|
100
|
+
>
|
|
101
|
+
<Image src={CloseSvgIcon} alt="닫기" width={28} height={28} />
|
|
102
|
+
{/* <CloseSvgIcon width={28} height={28} /> */}
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export default ChatConversationHeader;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export type ViewState = 'conversation' | 'history';
|
|
3
|
+
type ChatHomeViewProps = {
|
|
4
|
+
hashValue: string | null;
|
|
5
|
+
isMobile: boolean;
|
|
6
|
+
isHash: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
androidViewportHeight?: number;
|
|
9
|
+
isMobileSafari?: boolean;
|
|
10
|
+
viewState: ViewState;
|
|
11
|
+
setViewState: Dispatch<SetStateAction<ViewState>>;
|
|
12
|
+
};
|
|
13
|
+
declare const ChatHomeView: React.FC<ChatHomeViewProps>;
|
|
14
|
+
export default ChatHomeView;
|