@daeryun/dr_components 1.2.18 → 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/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 -410
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FileInfo, Message } from '../../_types/message';
|
|
2
|
+
export declare const useViewerHook: () => {
|
|
3
|
+
isImageViewerOpen: boolean;
|
|
4
|
+
selectedImageFile: FileInfo | null;
|
|
5
|
+
imageViewerMessage: Message | null;
|
|
6
|
+
openImageViewer: (file: FileInfo, msg: Message) => void;
|
|
7
|
+
closeImageViewer: () => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
export const useViewerHook = () => {
|
|
3
|
+
// 이미지 뷰어용
|
|
4
|
+
const [isImageViewerOpen, setIsImageViewerOpen] = useState(false);
|
|
5
|
+
const [selectedImageFile, setSelectedImageFile] = useState(null);
|
|
6
|
+
const [imageViewerMessage, setImageViewerMessage] = useState(null);
|
|
7
|
+
const openImageViewer = (file, msg) => {
|
|
8
|
+
setSelectedImageFile(file);
|
|
9
|
+
setImageViewerMessage(msg);
|
|
10
|
+
setIsImageViewerOpen(true);
|
|
11
|
+
};
|
|
12
|
+
const closeImageViewer = () => {
|
|
13
|
+
setIsImageViewerOpen(false);
|
|
14
|
+
setSelectedImageFile(null);
|
|
15
|
+
setImageViewerMessage(null);
|
|
16
|
+
};
|
|
17
|
+
return { isImageViewerOpen, selectedImageFile, imageViewerMessage, openImageViewer, closeImageViewer };
|
|
18
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { FileInfo, Message } from '../../_types/message';
|
|
3
|
+
|
|
4
|
+
export const useViewerHook = () => {
|
|
5
|
+
// 이미지 뷰어용
|
|
6
|
+
const [isImageViewerOpen, setIsImageViewerOpen] = useState(false);
|
|
7
|
+
const [selectedImageFile, setSelectedImageFile] = useState<FileInfo | null>(null);
|
|
8
|
+
const [imageViewerMessage, setImageViewerMessage] = useState<Message | null>(null);
|
|
9
|
+
|
|
10
|
+
const openImageViewer = (file: FileInfo, msg: Message) => {
|
|
11
|
+
setSelectedImageFile(file);
|
|
12
|
+
setImageViewerMessage(msg);
|
|
13
|
+
setIsImageViewerOpen(true);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const closeImageViewer = () => {
|
|
17
|
+
setIsImageViewerOpen(false);
|
|
18
|
+
setSelectedImageFile(null);
|
|
19
|
+
setImageViewerMessage(null);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return { isImageViewerOpen, selectedImageFile, imageViewerMessage, openImageViewer, closeImageViewer };
|
|
23
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { insert, savePowerLinkConversion } from '../../../../lib';
|
|
2
|
+
import * as gtag from '../../../../lib/gtag';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
export const useWorkFlow = (props) => {
|
|
5
|
+
const mobile = require('is-mobile');
|
|
6
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
7
|
+
const onClickKakao = () => {
|
|
8
|
+
insert('kakao', isMobile);
|
|
9
|
+
savePowerLinkConversion('kakao', isMobile);
|
|
10
|
+
if (isMobile) {
|
|
11
|
+
mKakaoClick();
|
|
12
|
+
if (props.aceUrl) {
|
|
13
|
+
ace_mKakaoClick();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
pcKakaoClick();
|
|
18
|
+
if (props.aceUrl) {
|
|
19
|
+
ace_pcKakaoClick();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const onClickTel = () => {
|
|
24
|
+
insert('call', isMobile);
|
|
25
|
+
savePowerLinkConversion('call', isMobile);
|
|
26
|
+
if (isMobile) {
|
|
27
|
+
mTelClick();
|
|
28
|
+
if (props.aceUrl) {
|
|
29
|
+
ace_mTelClick();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
pcTelClick();
|
|
34
|
+
if (props.aceUrl) {
|
|
35
|
+
ace_pcTelClick();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// GA 클릭이벤트
|
|
40
|
+
const mTelClick = () => {
|
|
41
|
+
gtag.event({
|
|
42
|
+
action: 'mobile_tel',
|
|
43
|
+
category: 'tel',
|
|
44
|
+
label: '모바일전화버튼',
|
|
45
|
+
value: '1'
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const pcTelClick = () => {
|
|
49
|
+
gtag.event({
|
|
50
|
+
action: 'pc_tel',
|
|
51
|
+
category: 'tel',
|
|
52
|
+
label: '피씨전화버튼',
|
|
53
|
+
value: '1'
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const mKakaoClick = () => {
|
|
57
|
+
gtag.event({
|
|
58
|
+
action: 'mobile_kakao',
|
|
59
|
+
category: 'kakao',
|
|
60
|
+
label: '모바일카카오버튼',
|
|
61
|
+
value: '1'
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const pcKakaoClick = () => {
|
|
65
|
+
gtag.event({
|
|
66
|
+
action: 'pc_kakao',
|
|
67
|
+
category: 'kakao',
|
|
68
|
+
label: '피씨카카오버튼',
|
|
69
|
+
value: '1'
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
// 에이스카운터 전환태그
|
|
73
|
+
const ace_mTelClick = () => {
|
|
74
|
+
try {
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
AM_PL('/m_tel');
|
|
77
|
+
}
|
|
78
|
+
catch (e) { }
|
|
79
|
+
};
|
|
80
|
+
const ace_pcTelClick = () => {
|
|
81
|
+
try {
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
_PL(`${props.aceUrl}/tel`);
|
|
84
|
+
}
|
|
85
|
+
catch (e) { }
|
|
86
|
+
};
|
|
87
|
+
const ace_mKakaoClick = () => {
|
|
88
|
+
try {
|
|
89
|
+
// @ts-ignore
|
|
90
|
+
AM_PL('/m_kakao');
|
|
91
|
+
}
|
|
92
|
+
catch (e) { }
|
|
93
|
+
};
|
|
94
|
+
const ace_pcKakaoClick = () => {
|
|
95
|
+
try {
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
_PL(`${props.aceUrl}/kakao`);
|
|
98
|
+
}
|
|
99
|
+
catch (e) { }
|
|
100
|
+
};
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
const is_mobile = mobile();
|
|
103
|
+
setIsMobile(is_mobile);
|
|
104
|
+
}, []);
|
|
105
|
+
return {
|
|
106
|
+
onClickKakao: onClickKakao,
|
|
107
|
+
onClickTel: onClickTel
|
|
108
|
+
};
|
|
109
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { insert, savePowerLinkConversion } from '../../../../lib';
|
|
2
|
+
import * as gtag from '../../../../lib/gtag';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
export const useWorkFlow = (props: {
|
|
6
|
+
tel: string;
|
|
7
|
+
aceUrl?: string;
|
|
8
|
+
wideBottom?: boolean;
|
|
9
|
+
centerConsultUrl?: string;
|
|
10
|
+
}) => {
|
|
11
|
+
const mobile = require('is-mobile');
|
|
12
|
+
|
|
13
|
+
const [isMobile, setIsMobile] = useState<boolean>(false);
|
|
14
|
+
const onClickKakao = () => {
|
|
15
|
+
insert('kakao', isMobile);
|
|
16
|
+
savePowerLinkConversion('kakao', isMobile);
|
|
17
|
+
|
|
18
|
+
if (isMobile) {
|
|
19
|
+
mKakaoClick();
|
|
20
|
+
if (props.aceUrl) {
|
|
21
|
+
ace_mKakaoClick();
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
pcKakaoClick();
|
|
25
|
+
if (props.aceUrl) {
|
|
26
|
+
ace_pcKakaoClick();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const onClickTel = () => {
|
|
31
|
+
insert('call', isMobile);
|
|
32
|
+
savePowerLinkConversion('call', isMobile);
|
|
33
|
+
if (isMobile) {
|
|
34
|
+
mTelClick();
|
|
35
|
+
if (props.aceUrl) {
|
|
36
|
+
ace_mTelClick();
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
pcTelClick();
|
|
40
|
+
if (props.aceUrl) {
|
|
41
|
+
ace_pcTelClick();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// GA 클릭이벤트
|
|
47
|
+
const mTelClick = () => {
|
|
48
|
+
gtag.event({
|
|
49
|
+
action: 'mobile_tel',
|
|
50
|
+
category: 'tel',
|
|
51
|
+
label: '모바일전화버튼',
|
|
52
|
+
value: '1'
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const pcTelClick = () => {
|
|
57
|
+
gtag.event({
|
|
58
|
+
action: 'pc_tel',
|
|
59
|
+
category: 'tel',
|
|
60
|
+
label: '피씨전화버튼',
|
|
61
|
+
value: '1'
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const mKakaoClick = () => {
|
|
66
|
+
gtag.event({
|
|
67
|
+
action: 'mobile_kakao',
|
|
68
|
+
category: 'kakao',
|
|
69
|
+
label: '모바일카카오버튼',
|
|
70
|
+
value: '1'
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const pcKakaoClick = () => {
|
|
75
|
+
gtag.event({
|
|
76
|
+
action: 'pc_kakao',
|
|
77
|
+
category: 'kakao',
|
|
78
|
+
label: '피씨카카오버튼',
|
|
79
|
+
value: '1'
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// 에이스카운터 전환태그
|
|
84
|
+
const ace_mTelClick = () => {
|
|
85
|
+
try {
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
AM_PL('/m_tel');
|
|
88
|
+
} catch (e) {}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const ace_pcTelClick = () => {
|
|
92
|
+
try {
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
_PL(`${props.aceUrl}/tel`);
|
|
95
|
+
} catch (e) {}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const ace_mKakaoClick = () => {
|
|
99
|
+
try {
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
AM_PL('/m_kakao');
|
|
102
|
+
} catch (e) {}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const ace_pcKakaoClick = () => {
|
|
106
|
+
try {
|
|
107
|
+
// @ts-ignore
|
|
108
|
+
_PL(`${props.aceUrl}/kakao`);
|
|
109
|
+
} catch (e) {}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
const is_mobile = mobile();
|
|
114
|
+
setIsMobile(is_mobile);
|
|
115
|
+
}, []);
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
onClickKakao: onClickKakao,
|
|
119
|
+
onClickTel: onClickTel
|
|
120
|
+
};
|
|
121
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSProperties, RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* useHoverScrollbar (scrollbar-gutter 완전 해결)
|
|
4
|
+
* - scrollbar-gutter: stable로 항상 스크롤바 공간 확보
|
|
5
|
+
* - 가로 밀림 현상 완전 방지
|
|
6
|
+
*/
|
|
7
|
+
type MaybeDivRef = RefObject<HTMLDivElement | null> | undefined;
|
|
8
|
+
export declare function useHoverScrollbar(refParam?: MaybeDivRef, watchDeps?: any[]): {
|
|
9
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
10
|
+
style: CSSProperties;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
export function useHoverScrollbar(refParam, watchDeps = []) {
|
|
3
|
+
const localRef = useRef(null);
|
|
4
|
+
const ref = refParam || localRef;
|
|
5
|
+
const [hovered, setHovered] = useState(false);
|
|
6
|
+
const [hasScroll, setHasScroll] = useState(false);
|
|
7
|
+
// 스크롤 여부 체크
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const el = ref.current;
|
|
10
|
+
if (!el)
|
|
11
|
+
return;
|
|
12
|
+
const checkScroll = () => {
|
|
13
|
+
setHasScroll(el.scrollHeight > el.clientHeight);
|
|
14
|
+
};
|
|
15
|
+
checkScroll();
|
|
16
|
+
// ResizeObserver로 더 정확한 감지
|
|
17
|
+
const resizeObserver = new ResizeObserver(checkScroll);
|
|
18
|
+
resizeObserver.observe(el);
|
|
19
|
+
window.addEventListener('resize', checkScroll);
|
|
20
|
+
return () => {
|
|
21
|
+
resizeObserver.disconnect();
|
|
22
|
+
window.removeEventListener('resize', checkScroll);
|
|
23
|
+
};
|
|
24
|
+
}, [ref, ...watchDeps]);
|
|
25
|
+
// 호버 상태 관리
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const el = ref.current;
|
|
28
|
+
if (!el)
|
|
29
|
+
return;
|
|
30
|
+
const onEnter = () => setHovered(true);
|
|
31
|
+
const onLeave = () => setHovered(false);
|
|
32
|
+
const onMove = () => setHovered(true);
|
|
33
|
+
el.addEventListener('mouseenter', onEnter);
|
|
34
|
+
el.addEventListener('mouseleave', onLeave);
|
|
35
|
+
el.addEventListener('mousemove', onMove);
|
|
36
|
+
return () => {
|
|
37
|
+
el.removeEventListener('mouseenter', onEnter);
|
|
38
|
+
el.removeEventListener('mouseleave', onLeave);
|
|
39
|
+
el.removeEventListener('mousemove', onMove);
|
|
40
|
+
};
|
|
41
|
+
}, [ref]);
|
|
42
|
+
const style = {
|
|
43
|
+
overflowY: hovered && hasScroll ? 'auto' : 'hidden',
|
|
44
|
+
// 항상 스크롤바 공간을 확보 (최신 브라우저)
|
|
45
|
+
scrollbarGutter: 'stable' //15px
|
|
46
|
+
};
|
|
47
|
+
return { ref, style };
|
|
48
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CSSProperties, RefObject, useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* useHoverScrollbar (scrollbar-gutter 완전 해결)
|
|
5
|
+
* - scrollbar-gutter: stable로 항상 스크롤바 공간 확보
|
|
6
|
+
* - 가로 밀림 현상 완전 방지
|
|
7
|
+
*/
|
|
8
|
+
type MaybeDivRef = RefObject<HTMLDivElement | null> | undefined;
|
|
9
|
+
|
|
10
|
+
export function useHoverScrollbar(
|
|
11
|
+
refParam?: MaybeDivRef,
|
|
12
|
+
watchDeps: any[] = []
|
|
13
|
+
): {
|
|
14
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
15
|
+
style: CSSProperties;
|
|
16
|
+
} {
|
|
17
|
+
const localRef = useRef<HTMLDivElement | null>(null);
|
|
18
|
+
const ref = refParam || localRef;
|
|
19
|
+
|
|
20
|
+
const [hovered, setHovered] = useState(false);
|
|
21
|
+
const [hasScroll, setHasScroll] = useState(false);
|
|
22
|
+
|
|
23
|
+
// 스크롤 여부 체크
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const el = ref.current;
|
|
26
|
+
if (!el) return;
|
|
27
|
+
|
|
28
|
+
const checkScroll = () => {
|
|
29
|
+
setHasScroll(el.scrollHeight > el.clientHeight);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
checkScroll();
|
|
33
|
+
|
|
34
|
+
// ResizeObserver로 더 정확한 감지
|
|
35
|
+
const resizeObserver = new ResizeObserver(checkScroll);
|
|
36
|
+
resizeObserver.observe(el);
|
|
37
|
+
|
|
38
|
+
window.addEventListener('resize', checkScroll);
|
|
39
|
+
|
|
40
|
+
return () => {
|
|
41
|
+
resizeObserver.disconnect();
|
|
42
|
+
window.removeEventListener('resize', checkScroll);
|
|
43
|
+
};
|
|
44
|
+
}, [ref, ...watchDeps]);
|
|
45
|
+
|
|
46
|
+
// 호버 상태 관리
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const el = ref.current;
|
|
49
|
+
if (!el) return;
|
|
50
|
+
|
|
51
|
+
const onEnter = () => setHovered(true);
|
|
52
|
+
const onLeave = () => setHovered(false);
|
|
53
|
+
const onMove = () => setHovered(true);
|
|
54
|
+
|
|
55
|
+
el.addEventListener('mouseenter', onEnter);
|
|
56
|
+
el.addEventListener('mouseleave', onLeave);
|
|
57
|
+
el.addEventListener('mousemove', onMove);
|
|
58
|
+
|
|
59
|
+
return () => {
|
|
60
|
+
el.removeEventListener('mouseenter', onEnter);
|
|
61
|
+
el.removeEventListener('mouseleave', onLeave);
|
|
62
|
+
el.removeEventListener('mousemove', onMove);
|
|
63
|
+
};
|
|
64
|
+
}, [ref]);
|
|
65
|
+
|
|
66
|
+
const style: CSSProperties = {
|
|
67
|
+
overflowY: hovered && hasScroll ? 'auto' : 'hidden',
|
|
68
|
+
// 항상 스크롤바 공간을 확보 (최신 브라우저)
|
|
69
|
+
scrollbarGutter: 'stable' //15px
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return { ref, style };
|
|
73
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
export function useScrollShadow() {
|
|
3
|
+
const containerRef = useRef(null);
|
|
4
|
+
const [isScroll, setIsScroll] = useState(false);
|
|
5
|
+
const [isBottom, setIsBottom] = useState(false);
|
|
6
|
+
const [isScrolling, setIsScrolling] = useState(false);
|
|
7
|
+
const scrollTimeoutRef = useRef(null);
|
|
8
|
+
const checkScroll = useCallback(() => {
|
|
9
|
+
const container = containerRef.current;
|
|
10
|
+
if (!container)
|
|
11
|
+
return;
|
|
12
|
+
const { scrollHeight, scrollTop, clientHeight } = container;
|
|
13
|
+
const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
|
|
14
|
+
setIsScroll(scrollHeight > clientHeight);
|
|
15
|
+
setIsBottom(scrollPercentage >= 0.98);
|
|
16
|
+
}, []);
|
|
17
|
+
const handleScroll = useCallback(() => {
|
|
18
|
+
checkScroll();
|
|
19
|
+
setIsScrolling(true);
|
|
20
|
+
if (scrollTimeoutRef.current) {
|
|
21
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
22
|
+
}
|
|
23
|
+
scrollTimeoutRef.current = setTimeout(() => {
|
|
24
|
+
setIsScrolling(false);
|
|
25
|
+
}, 800); // 스크롤 멈춘 후 800ms 뒤 isScrolling false
|
|
26
|
+
}, [checkScroll]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const container = containerRef.current;
|
|
29
|
+
if (!container)
|
|
30
|
+
return;
|
|
31
|
+
container.addEventListener('scroll', handleScroll);
|
|
32
|
+
// mount 시 초기 상태 확인
|
|
33
|
+
checkScroll();
|
|
34
|
+
return () => {
|
|
35
|
+
container.removeEventListener('scroll', handleScroll);
|
|
36
|
+
if (scrollTimeoutRef.current) {
|
|
37
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}, [handleScroll, checkScroll]);
|
|
41
|
+
return { containerRef, isScroll, isBottom, isScrolling, checkScroll };
|
|
42
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export function useScrollShadow<T extends HTMLElement>() {
|
|
4
|
+
const containerRef = useRef<T>(null);
|
|
5
|
+
const [isScroll, setIsScroll] = useState(false);
|
|
6
|
+
const [isBottom, setIsBottom] = useState(false);
|
|
7
|
+
const [isScrolling, setIsScrolling] = useState(false);
|
|
8
|
+
const scrollTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
9
|
+
|
|
10
|
+
const checkScroll = useCallback(() => {
|
|
11
|
+
const container = containerRef.current;
|
|
12
|
+
if (!container) return;
|
|
13
|
+
|
|
14
|
+
const { scrollHeight, scrollTop, clientHeight } = container;
|
|
15
|
+
const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
|
|
16
|
+
|
|
17
|
+
setIsScroll(scrollHeight > clientHeight);
|
|
18
|
+
setIsBottom(scrollPercentage >= 0.98);
|
|
19
|
+
}, []);
|
|
20
|
+
|
|
21
|
+
const handleScroll = useCallback(() => {
|
|
22
|
+
checkScroll();
|
|
23
|
+
setIsScrolling(true);
|
|
24
|
+
|
|
25
|
+
if (scrollTimeoutRef.current) {
|
|
26
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
scrollTimeoutRef.current = setTimeout(() => {
|
|
30
|
+
setIsScrolling(false);
|
|
31
|
+
}, 800); // 스크롤 멈춘 후 800ms 뒤 isScrolling false
|
|
32
|
+
}, [checkScroll]);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const container = containerRef.current;
|
|
36
|
+
if (!container) return;
|
|
37
|
+
|
|
38
|
+
container.addEventListener('scroll', handleScroll);
|
|
39
|
+
|
|
40
|
+
// mount 시 초기 상태 확인
|
|
41
|
+
checkScroll();
|
|
42
|
+
|
|
43
|
+
return () => {
|
|
44
|
+
container.removeEventListener('scroll', handleScroll);
|
|
45
|
+
if (scrollTimeoutRef.current) {
|
|
46
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}, [handleScroll, checkScroll]);
|
|
50
|
+
|
|
51
|
+
return { containerRef, isScroll, isBottom, isScrolling, checkScroll };
|
|
52
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
export const useWindowSize = () => {
|
|
3
|
+
const [windowSize, setWindowSize] = useState({
|
|
4
|
+
width: typeof window !== 'undefined' ? window.innerWidth : 0,
|
|
5
|
+
height: typeof window !== 'undefined' ? window.innerHeight : 0
|
|
6
|
+
});
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const handleResize = () => {
|
|
9
|
+
setWindowSize({
|
|
10
|
+
width: window.innerWidth,
|
|
11
|
+
height: window.innerHeight
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
// 초기 실행
|
|
15
|
+
handleResize();
|
|
16
|
+
window.addEventListener('resize', handleResize);
|
|
17
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
18
|
+
}, []);
|
|
19
|
+
return windowSize;
|
|
20
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
type WindowSize = {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const useWindowSize = (): WindowSize => {
|
|
9
|
+
const [windowSize, setWindowSize] = useState<WindowSize>({
|
|
10
|
+
width: typeof window !== 'undefined' ? window.innerWidth : 0,
|
|
11
|
+
height: typeof window !== 'undefined' ? window.innerHeight : 0
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const handleResize = () => {
|
|
16
|
+
setWindowSize({
|
|
17
|
+
width: window.innerWidth,
|
|
18
|
+
height: window.innerHeight
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// 초기 실행
|
|
23
|
+
handleResize();
|
|
24
|
+
|
|
25
|
+
window.addEventListener('resize', handleResize);
|
|
26
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
27
|
+
}, []);
|
|
28
|
+
|
|
29
|
+
return windowSize;
|
|
30
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { History } from '../../_api/daeryuntalk/type/response';
|
|
2
|
+
export declare const useChatSocketState: (chatInquiryNumber: string | null, viewState: "home" | "conversation" | "history", sendInquiryWatching: (chatInquiryNumber: string) => void, sendInquiryJoined: (chatInquiryNumber: string) => void, sendHeartbeat: () => void, sendInquiryLeft: (chatInquiryNumber: string) => void, isConnected: boolean | null, isAuthenticated: boolean, sendHistoryEntered: (historyList: string[]) => void, historyList: History[]) => void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export const useChatSocketState = (chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryJoined, sendHeartbeat, sendInquiryLeft, isConnected, isAuthenticated, sendHistoryEntered, historyList) => {
|
|
3
|
+
// 1. 공통 하트비트 (항상 실행)
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
sendHeartbeat();
|
|
6
|
+
const heartbeatInterval = setInterval(() => {
|
|
7
|
+
sendHeartbeat();
|
|
8
|
+
}, 30000);
|
|
9
|
+
return () => clearInterval(heartbeatInterval);
|
|
10
|
+
}, [sendHeartbeat]);
|
|
11
|
+
// 2. 뷰 상태에 따른 watch / leave
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (viewState === 'conversation' && chatInquiryNumber) {
|
|
14
|
+
sendInquiryJoined(chatInquiryNumber);
|
|
15
|
+
return () => {
|
|
16
|
+
sendInquiryLeft(chatInquiryNumber);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}, [viewState, chatInquiryNumber]);
|
|
20
|
+
// 소켓
|
|
21
|
+
// useEffect(() => {
|
|
22
|
+
// if (isConnected && isAuthenticated && viewState === 'history') {
|
|
23
|
+
// sendHistoryEntered(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
|
|
24
|
+
// }
|
|
25
|
+
// }, [isConnected, isAuthenticated, historyList, viewState]);
|
|
26
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { History } from '../../_api/daeryuntalk/type/response';
|
|
3
|
+
|
|
4
|
+
export const useChatSocketState = (
|
|
5
|
+
chatInquiryNumber: string | null,
|
|
6
|
+
viewState: 'home' | 'conversation' | 'history',
|
|
7
|
+
sendInquiryWatching: (chatInquiryNumber: string) => void,
|
|
8
|
+
sendInquiryJoined: (chatInquiryNumber: string) => void,
|
|
9
|
+
sendHeartbeat: () => void,
|
|
10
|
+
sendInquiryLeft: (chatInquiryNumber: string) => void,
|
|
11
|
+
isConnected: boolean | null,
|
|
12
|
+
isAuthenticated: boolean,
|
|
13
|
+
sendHistoryEntered: (historyList: string[]) => void,
|
|
14
|
+
historyList: History[]
|
|
15
|
+
) => {
|
|
16
|
+
// 1. 공통 하트비트 (항상 실행)
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
sendHeartbeat();
|
|
19
|
+
const heartbeatInterval = setInterval(() => {
|
|
20
|
+
sendHeartbeat();
|
|
21
|
+
}, 30000);
|
|
22
|
+
|
|
23
|
+
return () => clearInterval(heartbeatInterval);
|
|
24
|
+
}, [sendHeartbeat]);
|
|
25
|
+
|
|
26
|
+
// 2. 뷰 상태에 따른 watch / leave
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (viewState === 'conversation' && chatInquiryNumber) {
|
|
29
|
+
sendInquiryJoined(chatInquiryNumber);
|
|
30
|
+
|
|
31
|
+
return () => {
|
|
32
|
+
sendInquiryLeft(chatInquiryNumber);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}, [viewState, chatInquiryNumber]);
|
|
36
|
+
|
|
37
|
+
// 소켓
|
|
38
|
+
// useEffect(() => {
|
|
39
|
+
// if (isConnected && isAuthenticated && viewState === 'history') {
|
|
40
|
+
// sendHistoryEntered(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
|
|
41
|
+
// }
|
|
42
|
+
// }, [isConnected, isAuthenticated, historyList, viewState]);
|
|
43
|
+
};
|