@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,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
const NavigationFooter = ({ activeView, onHomeClick, onHistoryClick, historyList, isAuthenticated }) => {
|
|
4
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
5
|
+
const Home = `${s3Url}/daeryuntalk/home.svg`;
|
|
6
|
+
const History = `${s3Url}/daeryuntalk/history.svg`;
|
|
7
|
+
if (activeView === 'conversation') {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return (<footer className={`z-10 bg-white`}>
|
|
11
|
+
<div className="h-px w-full bg-drTalkGrayscale4" role="separator"></div>
|
|
12
|
+
<nav className={' flex h-[64px] justify-around px-8 pb-[12px] pt-[8px]'}>
|
|
13
|
+
<div className={`group flex cursor-pointer flex-col items-center ${activeView === 'home' ? 'text-drTalkCrimson' : 'text-gray-400 hover:text-drTalkCrimson'}`} role="button" tabIndex={0} onClick={onHomeClick}>
|
|
14
|
+
<Image src={Home} alt="홈" width={32} height={32} className=""/>
|
|
15
|
+
{/* <Home width={32} height={32} className="" /> */}
|
|
16
|
+
<span className={`dr_talk_subtitle_small2 ${activeView === 'home'
|
|
17
|
+
? 'text-drTalkCrimson'
|
|
18
|
+
: 'text-drTalkGrayscale3 group-hover:text-drTalkCrimson'}`}>
|
|
19
|
+
홈
|
|
20
|
+
</span>
|
|
21
|
+
</div>
|
|
22
|
+
<div className={`group relative flex cursor-pointer flex-col items-center ${activeView === 'history'
|
|
23
|
+
? 'text-drTalkCrimson'
|
|
24
|
+
: 'text-drTalkGrayscale3 hover:text-drTalkCrimson'}`} role="button" tabIndex={0} onClick={onHistoryClick}>
|
|
25
|
+
{isAuthenticated &&
|
|
26
|
+
(() => {
|
|
27
|
+
const unreadCount = historyList.reduce((sum, item) => sum + (item.unread_message_count || 0), 0);
|
|
28
|
+
const isHundredOver = unreadCount > 99;
|
|
29
|
+
return unreadCount > 0 ? (<span className={`${isHundredOver ? ' -right-[20px] -top-[5px] h-[18px] w-[31px] rounded-[15.5px] ' : '-right-[8px] -top-[5px] h-[18px] w-[18px] rounded-full pr-[1px]'} dr_talk_subtitle_small2 absolute flex items-center justify-center bg-drTalkCrimson text-drTalkWhite`}>
|
|
30
|
+
{isHundredOver ? '99+' : unreadCount}
|
|
31
|
+
</span>) : null;
|
|
32
|
+
})()}
|
|
33
|
+
<Image src={History} alt="히스토리" width={32} height={32}/>
|
|
34
|
+
{/* <History width={32} height={32} /> */}
|
|
35
|
+
<span className={`dr_talk_subtitle_small2 ${activeView === 'history'
|
|
36
|
+
? 'text-drTalkCrimson'
|
|
37
|
+
: 'text-drTalkGrayscale3 group-hover:text-drTalkCrimson'}`}>
|
|
38
|
+
히스토리
|
|
39
|
+
</span>
|
|
40
|
+
</div>
|
|
41
|
+
</nav>
|
|
42
|
+
</footer>);
|
|
43
|
+
};
|
|
44
|
+
export default NavigationFooter;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { History as HisResType } from './_api/daeryuntalk/type/response';
|
|
3
|
+
import Image from 'next/image';
|
|
4
|
+
|
|
5
|
+
// 이미지
|
|
6
|
+
// import Home from '../../asset/images/daeryuntalk/home.svg';
|
|
7
|
+
// import History from '../../asset/images/daeryuntalk/history.svg';
|
|
8
|
+
|
|
9
|
+
type NavigationFooterProps = {
|
|
10
|
+
activeView: 'home' | 'history' | 'conversation';
|
|
11
|
+
onHomeClick: () => void;
|
|
12
|
+
onHistoryClick: () => void;
|
|
13
|
+
historyList: HisResType[];
|
|
14
|
+
isAuthenticated: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const NavigationFooter: React.FC<NavigationFooterProps> = ({
|
|
18
|
+
activeView,
|
|
19
|
+
onHomeClick,
|
|
20
|
+
onHistoryClick,
|
|
21
|
+
historyList,
|
|
22
|
+
isAuthenticated
|
|
23
|
+
}) => {
|
|
24
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
25
|
+
const Home = `${s3Url}/daeryuntalk/home.svg`;
|
|
26
|
+
const History = `${s3Url}/daeryuntalk/history.svg`;
|
|
27
|
+
if (activeView === 'conversation') {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return (
|
|
31
|
+
<footer className={`z-10 bg-white`}>
|
|
32
|
+
<div className="h-px w-full bg-drTalkGrayscale4" role="separator"></div>
|
|
33
|
+
<nav className={' flex h-[64px] justify-around px-8 pb-[12px] pt-[8px]'}>
|
|
34
|
+
<div
|
|
35
|
+
className={`group flex cursor-pointer flex-col items-center ${
|
|
36
|
+
activeView === 'home' ? 'text-drTalkCrimson' : 'text-gray-400 hover:text-drTalkCrimson'
|
|
37
|
+
}`}
|
|
38
|
+
role="button"
|
|
39
|
+
tabIndex={0}
|
|
40
|
+
onClick={onHomeClick}
|
|
41
|
+
>
|
|
42
|
+
<Image src={Home} alt="홈" width={32} height={32} className="" />
|
|
43
|
+
{/* <Home width={32} height={32} className="" /> */}
|
|
44
|
+
<span
|
|
45
|
+
className={`dr_talk_subtitle_small2 ${
|
|
46
|
+
activeView === 'home'
|
|
47
|
+
? 'text-drTalkCrimson'
|
|
48
|
+
: 'text-drTalkGrayscale3 group-hover:text-drTalkCrimson'
|
|
49
|
+
}`}
|
|
50
|
+
>
|
|
51
|
+
홈
|
|
52
|
+
</span>
|
|
53
|
+
</div>
|
|
54
|
+
<div
|
|
55
|
+
className={`group relative flex cursor-pointer flex-col items-center ${
|
|
56
|
+
activeView === 'history'
|
|
57
|
+
? 'text-drTalkCrimson'
|
|
58
|
+
: 'text-drTalkGrayscale3 hover:text-drTalkCrimson'
|
|
59
|
+
}`}
|
|
60
|
+
role="button"
|
|
61
|
+
tabIndex={0}
|
|
62
|
+
onClick={onHistoryClick}
|
|
63
|
+
>
|
|
64
|
+
{isAuthenticated &&
|
|
65
|
+
(() => {
|
|
66
|
+
const unreadCount = historyList.reduce(
|
|
67
|
+
(sum, item) => sum + (item.unread_message_count || 0),
|
|
68
|
+
0
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const isHundredOver = unreadCount > 99;
|
|
72
|
+
|
|
73
|
+
return unreadCount > 0 ? (
|
|
74
|
+
<span
|
|
75
|
+
className={`${isHundredOver ? ' -right-[20px] -top-[5px] h-[18px] w-[31px] rounded-[15.5px] ' : '-right-[8px] -top-[5px] h-[18px] w-[18px] rounded-full pr-[1px]'} dr_talk_subtitle_small2 absolute flex items-center justify-center bg-drTalkCrimson text-drTalkWhite`}
|
|
76
|
+
>
|
|
77
|
+
{isHundredOver ? '99+' : unreadCount}
|
|
78
|
+
</span>
|
|
79
|
+
) : null;
|
|
80
|
+
})()}
|
|
81
|
+
<Image src={History} alt="히스토리" width={32} height={32} />
|
|
82
|
+
{/* <History width={32} height={32} /> */}
|
|
83
|
+
<span
|
|
84
|
+
className={`dr_talk_subtitle_small2 ${
|
|
85
|
+
activeView === 'history'
|
|
86
|
+
? 'text-drTalkCrimson'
|
|
87
|
+
: 'text-drTalkGrayscale3 group-hover:text-drTalkCrimson'
|
|
88
|
+
}`}
|
|
89
|
+
>
|
|
90
|
+
히스토리
|
|
91
|
+
</span>
|
|
92
|
+
</div>
|
|
93
|
+
</nav>
|
|
94
|
+
</footer>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default NavigationFooter;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
// 이미지
|
|
4
|
+
// import NoticeIcon from '../../asset/images/daeryuntalk/notice.svg';
|
|
5
|
+
// import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
|
|
6
|
+
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
7
|
+
const NoticeMessage = ({ content, isMobile }) => {
|
|
8
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
9
|
+
const NoticeIcon = `${s3Url}/daeryuntalk/notice.svg`;
|
|
10
|
+
const PrevIcon = `${s3Url}/daeryuntalk/prev.svg`;
|
|
11
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
12
|
+
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
|
|
13
|
+
// const { style: hoverStyle } = useHoverScrollbar(containerRef);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
checkScroll();
|
|
16
|
+
}, [isExpanded]);
|
|
17
|
+
return (<button type={'button'} onClick={() => setIsExpanded(!isExpanded)} className={`w-full bg-[#F7F7F7]/90 px-[20px] pb-[12px] pt-[8px] backdrop-blur-[4px]`} aria-label={isExpanded ? '접기' : '펼치기'}>
|
|
18
|
+
<div className="flex items-start justify-between gap-[8px]">
|
|
19
|
+
<div className="flex-shrink-0">
|
|
20
|
+
<Image src={NoticeIcon} alt="공지" width={24} height={24}/>
|
|
21
|
+
{/* <NoticeIcon width={24} height={24} /> */}
|
|
22
|
+
</div>
|
|
23
|
+
<div className="relative">
|
|
24
|
+
<div ref={containerRef} className={`dr_talk_body_medium2 max-h-[108px] pt-[0.5px] text-left ${isExpanded ? 'overflow-y-auto whitespace-pre-line break-words' : 'line-clamp-2 overflow-hidden break-all'}`}>
|
|
25
|
+
{content}
|
|
26
|
+
</div>
|
|
27
|
+
{/* {isExpanded && isScroll && !isBottom && (
|
|
28
|
+
<ShadowBox className={`!h-[50px] !bg-gradient-to-t from-[#F7F7F7]/90 !to-[#F7F7F7]/0 `} />
|
|
29
|
+
)} */}
|
|
30
|
+
</div>
|
|
31
|
+
<div className="ml-1 flex-shrink-0 transform transition-transform duration-200">
|
|
32
|
+
<div className={`transform transition-transform duration-200 ${isExpanded ? 'rotate-90' : '-rotate-90'}`}>
|
|
33
|
+
<Image src={PrevIcon} alt="이전" width={24} height={24}/>
|
|
34
|
+
{/* <PrevIcon width={24} height={24} /> */}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</button>);
|
|
39
|
+
};
|
|
40
|
+
export default NoticeMessage;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
// 이미지
|
|
4
|
+
// import NoticeIcon from '../../asset/images/daeryuntalk/notice.svg';
|
|
5
|
+
// import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
|
|
6
|
+
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
7
|
+
|
|
8
|
+
type NoticeMessageProps = {
|
|
9
|
+
content: string;
|
|
10
|
+
isMobile: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const NoticeMessage: React.FC<NoticeMessageProps> = ({ content, isMobile }) => {
|
|
14
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
15
|
+
const NoticeIcon = `${s3Url}/daeryuntalk/notice.svg`;
|
|
16
|
+
const PrevIcon = `${s3Url}/daeryuntalk/prev.svg`;
|
|
17
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
18
|
+
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow<HTMLDivElement>();
|
|
19
|
+
// const { style: hoverStyle } = useHoverScrollbar(containerRef);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
checkScroll();
|
|
22
|
+
}, [isExpanded]);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<button
|
|
26
|
+
type={'button'}
|
|
27
|
+
onClick={() => setIsExpanded(!isExpanded)}
|
|
28
|
+
className={`w-full bg-[#F7F7F7]/90 px-[20px] pb-[12px] pt-[8px] backdrop-blur-[4px]`}
|
|
29
|
+
aria-label={isExpanded ? '접기' : '펼치기'}
|
|
30
|
+
>
|
|
31
|
+
<div className="flex items-start justify-between gap-[8px]">
|
|
32
|
+
<div className="flex-shrink-0">
|
|
33
|
+
<Image src={NoticeIcon} alt="공지" width={24} height={24} />
|
|
34
|
+
{/* <NoticeIcon width={24} height={24} /> */}
|
|
35
|
+
</div>
|
|
36
|
+
<div className="relative">
|
|
37
|
+
<div
|
|
38
|
+
ref={containerRef}
|
|
39
|
+
className={`dr_talk_body_medium2 max-h-[108px] pt-[0.5px] text-left ${isExpanded ? 'overflow-y-auto whitespace-pre-line break-words' : 'line-clamp-2 overflow-hidden break-all'}`}
|
|
40
|
+
>
|
|
41
|
+
{content}
|
|
42
|
+
</div>
|
|
43
|
+
{/* {isExpanded && isScroll && !isBottom && (
|
|
44
|
+
<ShadowBox className={`!h-[50px] !bg-gradient-to-t from-[#F7F7F7]/90 !to-[#F7F7F7]/0 `} />
|
|
45
|
+
)} */}
|
|
46
|
+
</div>
|
|
47
|
+
<div className="ml-1 flex-shrink-0 transform transition-transform duration-200">
|
|
48
|
+
<div
|
|
49
|
+
className={`transform transition-transform duration-200 ${isExpanded ? 'rotate-90' : '-rotate-90'}`}
|
|
50
|
+
>
|
|
51
|
+
<Image src={PrevIcon} alt="이전" width={24} height={24} />
|
|
52
|
+
{/* <PrevIcon width={24} height={24} /> */}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</button>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default NoticeMessage;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const DisabledInput = ({ placeholder = '만 14세 이상 확인 후 이용 가능합니다.' }) => {
|
|
4
|
+
return (<div className={`
|
|
5
|
+
dr_talk_body_medium2
|
|
6
|
+
|
|
7
|
+
mt-[1px]
|
|
8
|
+
h-[36px]
|
|
9
|
+
|
|
10
|
+
w-full
|
|
11
|
+
cursor-not-allowed rounded-[10px]
|
|
12
|
+
bg-drTalkGrayscale4 px-[6px] pb-[8px] pt-[10px] text-drTalkGrayscale2
|
|
13
|
+
`}>
|
|
14
|
+
{placeholder}
|
|
15
|
+
</div>);
|
|
16
|
+
};
|
|
17
|
+
export default DisabledInput;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
interface DisabledInputProps {
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const DisabledInput: React.FC<DisabledInputProps> = ({ placeholder = '만 14세 이상 확인 후 이용 가능합니다.' }) => {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
className={`
|
|
13
|
+
dr_talk_body_medium2
|
|
14
|
+
|
|
15
|
+
mt-[1px]
|
|
16
|
+
h-[36px]
|
|
17
|
+
|
|
18
|
+
w-full
|
|
19
|
+
cursor-not-allowed rounded-[10px]
|
|
20
|
+
bg-drTalkGrayscale4 px-[6px] pb-[8px] pt-[10px] text-drTalkGrayscale2
|
|
21
|
+
`}
|
|
22
|
+
>
|
|
23
|
+
{placeholder}
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default DisabledInput;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { JSONContent } from '@tiptap/core';
|
|
3
|
+
export interface TiptapEditorRef {
|
|
4
|
+
clearContent: () => void;
|
|
5
|
+
getHTML: () => string;
|
|
6
|
+
getJSON: () => JSONContent;
|
|
7
|
+
isEmpty: () => boolean;
|
|
8
|
+
focus: () => void;
|
|
9
|
+
insertContent: (content: string) => void;
|
|
10
|
+
}
|
|
11
|
+
interface TiptapProps {
|
|
12
|
+
onChange?: (html: string, json: JSONContent) => void;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
onEnterKeyPress?: () => void;
|
|
15
|
+
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
16
|
+
contentClassName?: string;
|
|
17
|
+
isMobile?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const Tiptap: React.ForwardRefExoticComponent<TiptapProps & React.RefAttributes<TiptapEditorRef>>;
|
|
20
|
+
export default Tiptap;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { EditorContent, useEditor } from '@tiptap/react';
|
|
3
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
4
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
5
|
+
import HardBreak from '@tiptap/extension-hard-break'; // 추가
|
|
6
|
+
import Document from '@tiptap/extension-document';
|
|
7
|
+
import Paragraph from '@tiptap/extension-paragraph';
|
|
8
|
+
import Text from '@tiptap/extension-text';
|
|
9
|
+
const Tiptap = forwardRef(({ onChange, placeholder = '상담내용을 입력해 주세요.', onEnterKeyPress, onKeyDown, contentClassName = '', isMobile = false }, ref) => {
|
|
10
|
+
const containerRef = useRef(null);
|
|
11
|
+
const [isScroll, setIsScroll] = useState(false);
|
|
12
|
+
const [isBottom, setIsBottom] = useState(false);
|
|
13
|
+
const editor = useEditor({
|
|
14
|
+
extensions: [
|
|
15
|
+
Document,
|
|
16
|
+
Paragraph,
|
|
17
|
+
Text,
|
|
18
|
+
Placeholder.configure({ placeholder }),
|
|
19
|
+
HardBreak.configure({
|
|
20
|
+
keepMarks: false,
|
|
21
|
+
HTMLAttributes: {
|
|
22
|
+
class: 'my-custom-hard-break'
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
],
|
|
26
|
+
content: '',
|
|
27
|
+
enableInputRules: false,
|
|
28
|
+
enablePasteRules: false,
|
|
29
|
+
onUpdate: ({ editor }) => {
|
|
30
|
+
const text = editor.getText().trim();
|
|
31
|
+
const html = editor.getHTML();
|
|
32
|
+
const json = editor.getJSON();
|
|
33
|
+
if (!text) {
|
|
34
|
+
// 비어있는 경우엔 빈 문자열 반환
|
|
35
|
+
onChange === null || onChange === void 0 ? void 0 : onChange('', json);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(html, json);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
editorProps: {
|
|
42
|
+
attributes: {
|
|
43
|
+
class: `max-h-[72px] min-h-[36px] overflow-auto dr_talk_body_medium2 focus:outline-none overflow-y-auto resize-none pt-[6px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere no-scrollbar `
|
|
44
|
+
},
|
|
45
|
+
handleKeyDown: (view, event) => {
|
|
46
|
+
const isMobile = /Mobi|Android/i.test(navigator.userAgent); // 모바일 여부 판별
|
|
47
|
+
if (event.key === 'Enter') {
|
|
48
|
+
if (event.shiftKey || isMobile) {
|
|
49
|
+
// Shift+Enter 또는 모바일 Enter는 줄바꿈
|
|
50
|
+
if (editor) {
|
|
51
|
+
editor.commands.setHardBreak();
|
|
52
|
+
requestAnimationFrame(() => {
|
|
53
|
+
if (view && view.dom) {
|
|
54
|
+
view.dom.scrollTop = view.dom.scrollHeight;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return true; // 기본 동작 방지
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// 데스크탑에서의 일반 Enter는 메시지 전송
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
const content = editor === null || editor === void 0 ? void 0 : editor.getText();
|
|
64
|
+
if (content && content.trim() && onEnterKeyPress) {
|
|
65
|
+
onEnterKeyPress();
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
// 최초 렌더시 포커스 설정
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (editor) {
|
|
78
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.clearContent(true);
|
|
79
|
+
// 내용을 지운 후 포커스 유지
|
|
80
|
+
!isMobile && (editor === null || editor === void 0 ? void 0 : editor.commands.focus());
|
|
81
|
+
}
|
|
82
|
+
}, [editor]);
|
|
83
|
+
useImperativeHandle(ref, () => ({
|
|
84
|
+
clearContent: () => {
|
|
85
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.clearContent(true);
|
|
86
|
+
},
|
|
87
|
+
getHTML: () => (editor === null || editor === void 0 ? void 0 : editor.getHTML()) || '',
|
|
88
|
+
getJSON: () => (editor === null || editor === void 0 ? void 0 : editor.getJSON()) || { type: 'doc', content: [] },
|
|
89
|
+
isEmpty: () => (editor === null || editor === void 0 ? void 0 : editor.isEmpty) || true,
|
|
90
|
+
focus: () => editor === null || editor === void 0 ? void 0 : editor.commands.focus(),
|
|
91
|
+
insertContent: (content) => {
|
|
92
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.insertContent(content);
|
|
93
|
+
}
|
|
94
|
+
}));
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
var _a;
|
|
97
|
+
const checkScroll = () => {
|
|
98
|
+
var _a;
|
|
99
|
+
const proseEl = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.ProseMirror');
|
|
100
|
+
if (!proseEl)
|
|
101
|
+
return;
|
|
102
|
+
const hasScroll = proseEl.scrollHeight > proseEl.clientHeight;
|
|
103
|
+
const atBottom = proseEl.scrollTop + proseEl.clientHeight >= proseEl.scrollHeight - 1;
|
|
104
|
+
setIsScroll(hasScroll);
|
|
105
|
+
setIsBottom(atBottom);
|
|
106
|
+
};
|
|
107
|
+
const proseEl = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.ProseMirror');
|
|
108
|
+
if (proseEl) {
|
|
109
|
+
proseEl.addEventListener('scroll', checkScroll);
|
|
110
|
+
const observer = new ResizeObserver(checkScroll);
|
|
111
|
+
observer.observe(proseEl);
|
|
112
|
+
// 초기 체크
|
|
113
|
+
checkScroll();
|
|
114
|
+
return () => {
|
|
115
|
+
proseEl.removeEventListener('scroll', checkScroll);
|
|
116
|
+
observer.disconnect();
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}, [editor]);
|
|
120
|
+
if (!editor)
|
|
121
|
+
return null;
|
|
122
|
+
return (<div className={`relative w-full `}>
|
|
123
|
+
<div ref={containerRef} className={`w-full`}>
|
|
124
|
+
<EditorContent editor={editor} tabIndex={0} className={`${contentClassName} w-full rounded-md border !text-black dark:text-white `}/>
|
|
125
|
+
</div>
|
|
126
|
+
{/*{isScroll && !isBottom && <ShadowBox className={`!h-[5px]`} />}*/}
|
|
127
|
+
</div>);
|
|
128
|
+
});
|
|
129
|
+
Tiptap.displayName = 'Tiptap';
|
|
130
|
+
export default Tiptap;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { EditorContent, useEditor } from '@tiptap/react';
|
|
3
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
4
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
5
|
+
import HardBreak from '@tiptap/extension-hard-break'; // 추가
|
|
6
|
+
|
|
7
|
+
import { JSONContent } from '@tiptap/core'; // 추가 필요
|
|
8
|
+
import Document from '@tiptap/extension-document';
|
|
9
|
+
import Paragraph from '@tiptap/extension-paragraph';
|
|
10
|
+
import Text from '@tiptap/extension-text';
|
|
11
|
+
|
|
12
|
+
export interface TiptapEditorRef {
|
|
13
|
+
clearContent: () => void;
|
|
14
|
+
getHTML: () => string;
|
|
15
|
+
getJSON: () => JSONContent;
|
|
16
|
+
isEmpty: () => boolean;
|
|
17
|
+
focus: () => void;
|
|
18
|
+
insertContent: (content: string) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface TiptapProps {
|
|
22
|
+
onChange?: (html: string, json: JSONContent) => void;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
onEnterKeyPress?: () => void;
|
|
25
|
+
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
26
|
+
contentClassName?: string;
|
|
27
|
+
isMobile?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
|
|
31
|
+
(
|
|
32
|
+
{
|
|
33
|
+
onChange,
|
|
34
|
+
placeholder = '상담내용을 입력해 주세요.',
|
|
35
|
+
onEnterKeyPress,
|
|
36
|
+
onKeyDown,
|
|
37
|
+
contentClassName = '',
|
|
38
|
+
isMobile = false
|
|
39
|
+
},
|
|
40
|
+
ref
|
|
41
|
+
) => {
|
|
42
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
43
|
+
|
|
44
|
+
const [isScroll, setIsScroll] = useState(false);
|
|
45
|
+
const [isBottom, setIsBottom] = useState(false);
|
|
46
|
+
|
|
47
|
+
const editor = useEditor({
|
|
48
|
+
extensions: [
|
|
49
|
+
Document,
|
|
50
|
+
Paragraph,
|
|
51
|
+
Text,
|
|
52
|
+
Placeholder.configure({ placeholder }),
|
|
53
|
+
HardBreak.configure({
|
|
54
|
+
keepMarks: false,
|
|
55
|
+
HTMLAttributes: {
|
|
56
|
+
class: 'my-custom-hard-break'
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
],
|
|
60
|
+
content: '',
|
|
61
|
+
enableInputRules: false,
|
|
62
|
+
enablePasteRules: false,
|
|
63
|
+
onUpdate: ({ editor }) => {
|
|
64
|
+
const text = editor.getText().trim();
|
|
65
|
+
const html = editor.getHTML();
|
|
66
|
+
const json = editor.getJSON();
|
|
67
|
+
|
|
68
|
+
if (!text) {
|
|
69
|
+
// 비어있는 경우엔 빈 문자열 반환
|
|
70
|
+
onChange?.('', json);
|
|
71
|
+
} else {
|
|
72
|
+
onChange?.(html, json);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
editorProps: {
|
|
76
|
+
attributes: {
|
|
77
|
+
class: `max-h-[72px] min-h-[36px] overflow-auto dr_talk_body_medium2 focus:outline-none overflow-y-auto resize-none pt-[6px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere no-scrollbar `
|
|
78
|
+
},
|
|
79
|
+
handleKeyDown: (view, event) => {
|
|
80
|
+
const isMobile = /Mobi|Android/i.test(navigator.userAgent); // 모바일 여부 판별
|
|
81
|
+
|
|
82
|
+
if (event.key === 'Enter') {
|
|
83
|
+
if (event.shiftKey || isMobile) {
|
|
84
|
+
// Shift+Enter 또는 모바일 Enter는 줄바꿈
|
|
85
|
+
if (editor) {
|
|
86
|
+
editor.commands.setHardBreak();
|
|
87
|
+
|
|
88
|
+
requestAnimationFrame(() => {
|
|
89
|
+
if (view && view.dom) {
|
|
90
|
+
view.dom.scrollTop = view.dom.scrollHeight;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return true; // 기본 동작 방지
|
|
95
|
+
} else {
|
|
96
|
+
// 데스크탑에서의 일반 Enter는 메시지 전송
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
const content = editor?.getText();
|
|
99
|
+
if (content && content.trim() && onEnterKeyPress) {
|
|
100
|
+
onEnterKeyPress();
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
onKeyDown?.(event as unknown as React.KeyboardEvent);
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// 최초 렌더시 포커스 설정
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (editor) {
|
|
115
|
+
editor?.commands.clearContent(true);
|
|
116
|
+
// 내용을 지운 후 포커스 유지
|
|
117
|
+
!isMobile && editor?.commands.focus();
|
|
118
|
+
}
|
|
119
|
+
}, [editor]);
|
|
120
|
+
|
|
121
|
+
useImperativeHandle(ref, () => ({
|
|
122
|
+
clearContent: () => {
|
|
123
|
+
editor?.commands.clearContent(true);
|
|
124
|
+
},
|
|
125
|
+
getHTML: () => editor?.getHTML() || '',
|
|
126
|
+
getJSON: () => editor?.getJSON() || { type: 'doc', content: [] },
|
|
127
|
+
isEmpty: () => editor?.isEmpty || true,
|
|
128
|
+
focus: () => editor?.commands.focus(),
|
|
129
|
+
insertContent: (content: string) => {
|
|
130
|
+
editor?.commands.insertContent(content);
|
|
131
|
+
}
|
|
132
|
+
}));
|
|
133
|
+
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
const checkScroll = () => {
|
|
136
|
+
const proseEl = containerRef.current?.querySelector('.ProseMirror');
|
|
137
|
+
if (!proseEl) return;
|
|
138
|
+
|
|
139
|
+
const hasScroll = proseEl.scrollHeight > proseEl.clientHeight;
|
|
140
|
+
const atBottom = proseEl.scrollTop + proseEl.clientHeight >= proseEl.scrollHeight - 1;
|
|
141
|
+
|
|
142
|
+
setIsScroll(hasScroll);
|
|
143
|
+
setIsBottom(atBottom);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const proseEl = containerRef.current?.querySelector('.ProseMirror');
|
|
147
|
+
if (proseEl) {
|
|
148
|
+
proseEl.addEventListener('scroll', checkScroll);
|
|
149
|
+
const observer = new ResizeObserver(checkScroll);
|
|
150
|
+
observer.observe(proseEl);
|
|
151
|
+
|
|
152
|
+
// 초기 체크
|
|
153
|
+
checkScroll();
|
|
154
|
+
|
|
155
|
+
return () => {
|
|
156
|
+
proseEl.removeEventListener('scroll', checkScroll);
|
|
157
|
+
observer.disconnect();
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}, [editor]);
|
|
161
|
+
|
|
162
|
+
if (!editor) return null;
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<div className={`relative w-full `}>
|
|
166
|
+
<div ref={containerRef} className={`w-full`}>
|
|
167
|
+
<EditorContent
|
|
168
|
+
editor={editor}
|
|
169
|
+
tabIndex={0}
|
|
170
|
+
className={`${contentClassName} w-full rounded-md border !text-black dark:text-white `}
|
|
171
|
+
/>
|
|
172
|
+
</div>
|
|
173
|
+
{/*{isScroll && !isBottom && <ShadowBox className={`!h-[5px]`} />}*/}
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
Tiptap.displayName = 'Tiptap';
|
|
180
|
+
|
|
181
|
+
export default Tiptap;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ToastType = 'success' | 'warning' | 'error';
|
|
3
|
+
export type AnimationState = 'hidden' | 'entering' | 'visible' | 'exiting';
|
|
4
|
+
interface ToastItem {
|
|
5
|
+
type: ToastType;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
duration?: number;
|
|
9
|
+
}
|
|
10
|
+
interface ToastContextProps {
|
|
11
|
+
toast: ToastItem | null;
|
|
12
|
+
animationState: AnimationState;
|
|
13
|
+
hideToast: () => void;
|
|
14
|
+
success: (title: string, desc?: string, duration?: number) => void;
|
|
15
|
+
warning: (title: string, desc?: string, duration?: number) => void;
|
|
16
|
+
error: (title: string, desc?: string, duration?: number) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const ToastContext: import("react").Context<ToastContextProps | undefined>;
|
|
19
|
+
export declare const useDaeryunTalkToast: () => ToastContextProps;
|
|
20
|
+
export declare const DaeryuntalkToastProvider: ({ children }: {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}) => import("react").JSX.Element;
|
|
23
|
+
export {};
|