@daeryun/dr_components 0.8.78 → 0.8.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asset/images/daeryuntalk/firstGo.svg +1 -1
- package/dist/asset/images/daeryuntalk/re_send.svg +11 -0
- package/dist/asset/images/daeryuntalk/viewer/gray-download.svg +1 -1
- 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/ChatConversation.jsx +59 -94
- package/dist/components/Daeryuntalk/ChatConversation.tsx +58 -112
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.jsx +2 -2
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.tsx +2 -2
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +11 -7
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +13 -9
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +8 -8
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +8 -8
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +10 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +15 -0
- package/dist/components/Daeryuntalk/ChatMessage.jsx +8 -3
- package/dist/components/Daeryuntalk/ChatMessage.tsx +11 -12
- package/dist/components/Daeryuntalk/ChatWidget.jsx +13 -12
- package/dist/components/Daeryuntalk/ChatWidget.tsx +15 -12
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +2 -1
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +2 -1
- package/dist/components/Daeryuntalk/HistoryView.jsx +3 -3
- package/dist/components/Daeryuntalk/HistoryView.tsx +3 -3
- package/dist/components/Daeryuntalk/HomeView.jsx +36 -21
- package/dist/components/Daeryuntalk/HomeView.tsx +37 -21
- package/dist/components/Daeryuntalk/NoticeMessage.jsx +5 -5
- package/dist/components/Daeryuntalk/NoticeMessage.tsx +10 -9
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +4 -4
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +6 -4
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.jsx +9 -6
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.tsx +17 -16
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +2 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +10 -5
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +9 -1
- package/dist/components/Daeryuntalk/_types/message.d.ts +1 -1
- package/dist/components/Daeryuntalk/_types/message.js +6 -1
- package/dist/components/Daeryuntalk/_types/message.ts +7 -1
- package/dist/components/Daeryuntalk/index.jsx +12 -0
- package/dist/components/Daeryuntalk/index.tsx +13 -0
- package/dist/styles/globals.css +81 -27
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -10,85 +10,46 @@ import ChatConversationHeader from './ChatConversationItem/ChatConversationHeade
|
|
|
10
10
|
import ChatLoading from './ChatItem/ChatLoading';
|
|
11
11
|
import { useWindowSize } from './_hooks/useWindowSize';
|
|
12
12
|
const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose, isHash }) => {
|
|
13
|
+
var _a, _b;
|
|
13
14
|
const { inquiryStatus, messages, isLoading, inquiryMainData, messageObject, workFlowBack, workFlowStack, chatInquiryNumber } = useDaeryuntalk();
|
|
14
15
|
const [isHovered, setIsHovered] = useState(false);
|
|
15
16
|
const messagesEndRef = useRef(null);
|
|
16
17
|
const headerRef = useRef(null);
|
|
17
|
-
const
|
|
18
|
-
const
|
|
18
|
+
const pcBottomRef = useRef(null);
|
|
19
|
+
const mobileBottomRef = useRef(null);
|
|
19
20
|
const [bottomHeight, setBottomHeight] = useState(0);
|
|
20
|
-
const [availableHeight, setAvailableHeight] = useState(null);
|
|
21
|
-
const wrapperRef = useRef(null);
|
|
22
|
-
const messageAreaRef = useRef(null);
|
|
23
21
|
const windowSize = useWindowSize();
|
|
24
22
|
useEffect(() => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const calcMessageAreaHeight = () => {
|
|
28
|
-
var _a, _b, _c, _d;
|
|
29
|
-
const headerHeight = (_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height) !== null && _b !== void 0 ? _b : 0;
|
|
30
|
-
const noticeHeight = (_d = (_c = noticeRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().height) !== null && _d !== void 0 ? _d : 0;
|
|
31
|
-
const total = headerHeight + noticeHeight + bottomHeight;
|
|
32
|
-
const available = window.innerHeight - total;
|
|
33
|
-
setAvailableHeight(available);
|
|
34
|
-
};
|
|
35
|
-
calcMessageAreaHeight();
|
|
36
|
-
const resizeObserver = new ResizeObserver(calcMessageAreaHeight);
|
|
37
|
-
if (headerRef.current)
|
|
38
|
-
resizeObserver.observe(headerRef.current);
|
|
39
|
-
if (noticeRef.current)
|
|
40
|
-
resizeObserver.observe(noticeRef.current);
|
|
41
|
-
window.addEventListener('resize', calcMessageAreaHeight);
|
|
42
|
-
return () => {
|
|
43
|
-
resizeObserver.disconnect();
|
|
44
|
-
window.removeEventListener('resize', calcMessageAreaHeight);
|
|
45
|
-
};
|
|
46
|
-
}, [isMobile]);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (!bottomRef.current)
|
|
23
|
+
var _a;
|
|
24
|
+
if (!mobileBottomRef.current || !pcBottomRef.current)
|
|
49
25
|
return;
|
|
26
|
+
// 현재 브라우저 크기에 따라 참조할 요소 결정
|
|
27
|
+
// - 모바일이거나 화면 너비가 480px 이하인 경우: mobileBottomRef 추적
|
|
28
|
+
// - 그 외에는 pcBottomRef 추적
|
|
29
|
+
const bottomRef = windowSize.width <= 480 ? pcBottomRef : pcBottomRef;
|
|
50
30
|
const updateHeight = () => {
|
|
51
31
|
var _a, _b;
|
|
52
32
|
const height = (_b = (_a = bottomRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height) !== null && _b !== void 0 ? _b : 0;
|
|
53
33
|
setBottomHeight(height);
|
|
54
34
|
};
|
|
55
|
-
updateHeight(); // 초기 측정
|
|
35
|
+
updateHeight(); // 초기 높이 측정
|
|
56
36
|
const resizeObserver = new ResizeObserver(updateHeight);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
37
|
+
if (bottomRef.current) {
|
|
38
|
+
// bottomRef 요소의 크기 변화를 감지
|
|
39
|
+
resizeObserver.observe(bottomRef === null || bottomRef === void 0 ? void 0 : bottomRef.current);
|
|
40
|
+
// TipTap 에디터 내부 `.tiptap-editor-wrapper` 요소도 함께 감지
|
|
41
|
+
const tiptapWrapper = (_a = bottomRef === null || bottomRef === void 0 ? void 0 : bottomRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.tiptap-editor-wrapper');
|
|
42
|
+
if (tiptapWrapper) {
|
|
43
|
+
resizeObserver.observe(tiptapWrapper);
|
|
44
|
+
}
|
|
63
45
|
}
|
|
64
|
-
// 윈도우 리사이즈
|
|
46
|
+
// 윈도우 리사이즈 시 높이 재측정
|
|
65
47
|
window.addEventListener('resize', updateHeight);
|
|
66
48
|
return () => {
|
|
67
49
|
resizeObserver.disconnect();
|
|
68
50
|
window.removeEventListener('resize', updateHeight);
|
|
69
51
|
};
|
|
70
52
|
}, []);
|
|
71
|
-
useEffect(() => {
|
|
72
|
-
if (!bottomRef.current || !wrapperRef.current || !messageAreaRef.current)
|
|
73
|
-
return;
|
|
74
|
-
const updateAvailableHeight = () => {
|
|
75
|
-
const wrapperRect = wrapperRef.current.getBoundingClientRect();
|
|
76
|
-
const bottomHeight = bottomRef.current.getBoundingClientRect().height;
|
|
77
|
-
const topOfMessage = messageAreaRef.current.getBoundingClientRect().top;
|
|
78
|
-
const visibleHeight = window.innerHeight - bottomHeight;
|
|
79
|
-
const contentHeight = visibleHeight - (topOfMessage - wrapperRect.top); // header + notice 높이 제거
|
|
80
|
-
setAvailableHeight(contentHeight);
|
|
81
|
-
};
|
|
82
|
-
updateAvailableHeight();
|
|
83
|
-
const resizeObserver = new ResizeObserver(updateAvailableHeight);
|
|
84
|
-
resizeObserver.observe(bottomRef.current);
|
|
85
|
-
resizeObserver.observe(wrapperRef.current);
|
|
86
|
-
window.addEventListener('resize', updateAvailableHeight);
|
|
87
|
-
return () => {
|
|
88
|
-
resizeObserver.disconnect();
|
|
89
|
-
window.removeEventListener('resize', updateAvailableHeight);
|
|
90
|
-
};
|
|
91
|
-
}, [isMobile]);
|
|
92
53
|
const defaultNoticeContent = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_explanation) ||
|
|
93
54
|
'본 채팅을 통해 제공되는 서비스는 일반적인 법률정보 제공 및 고객 편의 도모를 위한 것 입니다. 본 채팅을 통해 제공된 정보를 이용한 행위에 대해서는 당사는 어떠한 법적 책임을 지지 않으며 구체적인 사안에 대한 적용은 변호사와의 추가 상담을 통해 자문을 받으시기를 권해드립니다.';
|
|
94
55
|
const noticeContent = defaultNoticeContent;
|
|
@@ -100,7 +61,7 @@ const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose,
|
|
|
100
61
|
useEffect(() => {
|
|
101
62
|
const timeout = setTimeout(() => {
|
|
102
63
|
scrollEnd();
|
|
103
|
-
},
|
|
64
|
+
}, 200);
|
|
104
65
|
return () => clearTimeout(timeout); // cleanup
|
|
105
66
|
}, [messages, messageObject]);
|
|
106
67
|
const isNewDay = (date1, date2) => {
|
|
@@ -128,32 +89,28 @@ const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose,
|
|
|
128
89
|
};
|
|
129
90
|
return (<>
|
|
130
91
|
{/*isMoblie true일때 헤더 주의 내용이 상단에 있고 ,나머지 높이영역은 메시지 리스트로 붙게*/}
|
|
131
|
-
<div className={`flex
|
|
132
|
-
height: isMobile
|
|
133
|
-
? undefined
|
|
134
|
-
: windowSize.width < 480
|
|
135
|
-
? `calc(100dvh - ${bottomHeight}px)`
|
|
136
|
-
: undefined
|
|
137
|
-
}}>
|
|
92
|
+
<div className={` no-scrollbar flex h-[100dvh] flex-col items-center justify-between xs:h-[calc(100vh-165px)] xs:max-h-[690px] lg:h-[calc(100vh-110px)] `}>
|
|
138
93
|
<div className={`
|
|
139
|
-
no-scrollbar relative w-full
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
`}>
|
|
94
|
+
no-scrollbar relative h-[100%] w-full
|
|
95
|
+
rounded-t-[30px]
|
|
96
|
+
xs:max-h-[690px] xs:min-h-[320px] xs:justify-start
|
|
97
|
+
${isMobile ? 'flex flex-col items-center justify-between' : 'flex flex-col'}
|
|
98
|
+
`}>
|
|
145
99
|
{/* 헤더 부분 */}
|
|
146
|
-
<div ref={headerRef} className={`w-full`}>
|
|
100
|
+
<div ref={headerRef} className={`flex w-full flex-col`}>
|
|
147
101
|
<ChatConversationHeader inquiryMainData={inquiryMainData !== null && inquiryMainData !== void 0 ? inquiryMainData : null} isMobile={isMobile} onClose={onClose} isHash={isHash} onBackClick={onBackClick}/>
|
|
148
|
-
</div>
|
|
149
|
-
{/* 주의내용 */}
|
|
150
|
-
<div ref={noticeRef}>
|
|
151
102
|
<NoticeMessage content={noticeContent} isMobile={isMobile}/>
|
|
152
103
|
</div>
|
|
153
104
|
{/* 메시지 노출 부분 -> 무한스크롤 변환 필요 */}
|
|
154
105
|
{/* 여기서 isMpblie일때 위에 2개 헤더부분이랑 아래 메시지 입력이랑 높이를 빼서 넣어야한ㄷ */}
|
|
155
|
-
<div className={
|
|
156
|
-
|
|
106
|
+
<div className={`
|
|
107
|
+
${isMobile ? ' ' : 'flex- xs:pb-[100px]'} no-scrollbar mx-[20px] overflow-auto pt-[20px]
|
|
108
|
+
`} style={{
|
|
109
|
+
height: isMobile
|
|
110
|
+
? `calc(100vh - ${bottomHeight}px - ${((_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0}px)`
|
|
111
|
+
: bottomHeight && headerRef.current
|
|
112
|
+
? `calc(100% - ${bottomHeight}px - ${(_b = headerRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight}px)`
|
|
113
|
+
: '100%' // fallback
|
|
157
114
|
}}>
|
|
158
115
|
{messages.length === 0 ? (<div className="dr_talk_body_medium2 flex h-full flex-col items-center justify-center text-center text-drTalkGrayscale1">
|
|
159
116
|
<p>문의하실 내용을 입력해 주세요.</p>
|
|
@@ -168,7 +125,7 @@ const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose,
|
|
|
168
125
|
</div>)}
|
|
169
126
|
</div>
|
|
170
127
|
|
|
171
|
-
<div className={`
|
|
128
|
+
<div ref={pcBottomRef} className={`w-full`}>
|
|
172
129
|
{/* 높이가 부모에 스크롤이 줄어도 해당 부분은 바텀에 고정 필요 */}
|
|
173
130
|
{inquiryStatus === InquiryStatus.CLOSED ? (<div className="w-full border-t border-drTalkGrayscale4 px-[20px] py-[16px]">
|
|
174
131
|
<div className="">
|
|
@@ -184,21 +141,29 @@ const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose,
|
|
|
184
141
|
</div>
|
|
185
142
|
</div>
|
|
186
143
|
</div>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
</
|
|
144
|
+
|
|
145
|
+
{/*/!* 모바일 *!/*/}
|
|
146
|
+
{/*<div ref={mobileBottomRef} className={`block w-full xs:hidden`}>*/}
|
|
147
|
+
{/* /!* 높이가 부모에 스크롤이 줄어도 해당 부분은 바텀에 고정 필요 *!/*/}
|
|
148
|
+
{/* {inquiryStatus === InquiryStatus.CLOSED ? (*/}
|
|
149
|
+
{/* <div className="w-full border-t border-drTalkGrayscale4 px-[20px] py-[16px]">*/}
|
|
150
|
+
{/* <div className="">*/}
|
|
151
|
+
{/* <Button3*/}
|
|
152
|
+
{/* onClick={() => {*/}
|
|
153
|
+
{/* onChatNew && onChatNew();*/}
|
|
154
|
+
{/* }}*/}
|
|
155
|
+
{/* className={`w-full`}*/}
|
|
156
|
+
{/* >*/}
|
|
157
|
+
{/* 새 문의하기*/}
|
|
158
|
+
{/* </Button3>*/}
|
|
159
|
+
{/* </div>*/}
|
|
160
|
+
{/* </div>*/}
|
|
161
|
+
{/* ) : (*/}
|
|
162
|
+
{/* <div className=" w-full border-t border-drTalkGrayscale4 px-[20px] py-[8px]">*/}
|
|
163
|
+
{/* <ChatInput />*/}
|
|
164
|
+
{/* </div>*/}
|
|
165
|
+
{/* )}*/}
|
|
166
|
+
{/*</div>*/}
|
|
202
167
|
</>);
|
|
203
168
|
};
|
|
204
169
|
export default ChatConversation;
|
|
@@ -40,61 +40,41 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
40
40
|
const [isHovered, setIsHovered] = useState<boolean>(false);
|
|
41
41
|
const messagesEndRef = useRef<HTMLDivElement>(null);
|
|
42
42
|
const headerRef = useRef<HTMLDivElement | null>(null);
|
|
43
|
-
const
|
|
44
|
-
const
|
|
43
|
+
const pcBottomRef = useRef<HTMLDivElement | null>(null);
|
|
44
|
+
const mobileBottomRef = useRef<HTMLDivElement | null>(null);
|
|
45
45
|
const [bottomHeight, setBottomHeight] = useState(0);
|
|
46
46
|
|
|
47
|
-
const [availableHeight, setAvailableHeight] = useState<number | null>(null);
|
|
48
|
-
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
|
49
|
-
const messageAreaRef = useRef<HTMLDivElement | null>(null);
|
|
50
47
|
const windowSize = useWindowSize();
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (!isMobile) return;
|
|
53
|
-
|
|
54
|
-
const calcMessageAreaHeight = () => {
|
|
55
|
-
const headerHeight = headerRef.current?.getBoundingClientRect().height ?? 0;
|
|
56
|
-
const noticeHeight = noticeRef.current?.getBoundingClientRect().height ?? 0;
|
|
57
|
-
const total = headerHeight + noticeHeight + bottomHeight;
|
|
58
|
-
const available = window.innerHeight - total;
|
|
59
|
-
setAvailableHeight(available);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
calcMessageAreaHeight();
|
|
63
|
-
|
|
64
|
-
const resizeObserver = new ResizeObserver(calcMessageAreaHeight);
|
|
65
|
-
if (headerRef.current) resizeObserver.observe(headerRef.current);
|
|
66
|
-
if (noticeRef.current) resizeObserver.observe(noticeRef.current);
|
|
67
|
-
|
|
68
|
-
window.addEventListener('resize', calcMessageAreaHeight);
|
|
69
|
-
|
|
70
|
-
return () => {
|
|
71
|
-
resizeObserver.disconnect();
|
|
72
|
-
window.removeEventListener('resize', calcMessageAreaHeight);
|
|
73
|
-
};
|
|
74
|
-
}, [isMobile]);
|
|
75
48
|
|
|
76
49
|
useEffect(() => {
|
|
77
|
-
if (!
|
|
50
|
+
if (!mobileBottomRef.current || !pcBottomRef.current) return;
|
|
51
|
+
|
|
52
|
+
// 현재 브라우저 크기에 따라 참조할 요소 결정
|
|
53
|
+
// - 모바일이거나 화면 너비가 480px 이하인 경우: mobileBottomRef 추적
|
|
54
|
+
// - 그 외에는 pcBottomRef 추적
|
|
55
|
+
const bottomRef = windowSize.width <= 480 ? pcBottomRef : pcBottomRef;
|
|
78
56
|
|
|
79
57
|
const updateHeight = () => {
|
|
80
58
|
const height = bottomRef.current?.getBoundingClientRect().height ?? 0;
|
|
81
59
|
setBottomHeight(height);
|
|
82
60
|
};
|
|
83
61
|
|
|
84
|
-
updateHeight(); // 초기 측정
|
|
62
|
+
updateHeight(); // 초기 높이 측정
|
|
85
63
|
|
|
86
64
|
const resizeObserver = new ResizeObserver(updateHeight);
|
|
87
65
|
|
|
88
|
-
|
|
89
|
-
|
|
66
|
+
if (bottomRef.current) {
|
|
67
|
+
// bottomRef 요소의 크기 변화를 감지
|
|
68
|
+
resizeObserver.observe(bottomRef?.current);
|
|
90
69
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
70
|
+
// TipTap 에디터 내부 `.tiptap-editor-wrapper` 요소도 함께 감지
|
|
71
|
+
const tiptapWrapper = bottomRef?.current?.querySelector('.tiptap-editor-wrapper');
|
|
72
|
+
if (tiptapWrapper) {
|
|
73
|
+
resizeObserver.observe(tiptapWrapper);
|
|
74
|
+
}
|
|
95
75
|
}
|
|
96
76
|
|
|
97
|
-
// 윈도우 리사이즈
|
|
77
|
+
// 윈도우 리사이즈 시 높이 재측정
|
|
98
78
|
window.addEventListener('resize', updateHeight);
|
|
99
79
|
|
|
100
80
|
return () => {
|
|
@@ -103,34 +83,6 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
103
83
|
};
|
|
104
84
|
}, []);
|
|
105
85
|
|
|
106
|
-
useEffect(() => {
|
|
107
|
-
if (!bottomRef.current || !wrapperRef.current || !messageAreaRef.current) return;
|
|
108
|
-
|
|
109
|
-
const updateAvailableHeight = () => {
|
|
110
|
-
const wrapperRect = wrapperRef.current!.getBoundingClientRect();
|
|
111
|
-
const bottomHeight = bottomRef.current!.getBoundingClientRect().height;
|
|
112
|
-
const topOfMessage = messageAreaRef.current!.getBoundingClientRect().top;
|
|
113
|
-
|
|
114
|
-
const visibleHeight = window.innerHeight - bottomHeight;
|
|
115
|
-
const contentHeight = visibleHeight - (topOfMessage - wrapperRect.top); // header + notice 높이 제거
|
|
116
|
-
|
|
117
|
-
setAvailableHeight(contentHeight);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
updateAvailableHeight();
|
|
121
|
-
|
|
122
|
-
const resizeObserver = new ResizeObserver(updateAvailableHeight);
|
|
123
|
-
resizeObserver.observe(bottomRef.current);
|
|
124
|
-
resizeObserver.observe(wrapperRef.current);
|
|
125
|
-
|
|
126
|
-
window.addEventListener('resize', updateAvailableHeight);
|
|
127
|
-
|
|
128
|
-
return () => {
|
|
129
|
-
resizeObserver.disconnect();
|
|
130
|
-
window.removeEventListener('resize', updateAvailableHeight);
|
|
131
|
-
};
|
|
132
|
-
}, [isMobile]);
|
|
133
|
-
|
|
134
86
|
const defaultNoticeContent =
|
|
135
87
|
inquiryMainData?.channel_explanation ||
|
|
136
88
|
'본 채팅을 통해 제공되는 서비스는 일반적인 법률정보 제공 및 고객 편의 도모를 위한 것 입니다. 본 채팅을 통해 제공된 정보를 이용한 행위에 대해서는 당사는 어떠한 법적 책임을 지지 않으며 구체적인 사안에 대한 적용은 변호사와의 추가 상담을 통해 자문을 받으시기를 권해드립니다.';
|
|
@@ -144,7 +96,7 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
144
96
|
useEffect(() => {
|
|
145
97
|
const timeout = setTimeout(() => {
|
|
146
98
|
scrollEnd();
|
|
147
|
-
},
|
|
99
|
+
}, 200);
|
|
148
100
|
return () => clearTimeout(timeout); // cleanup
|
|
149
101
|
}, [messages, messageObject]);
|
|
150
102
|
|
|
@@ -195,28 +147,18 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
195
147
|
<>
|
|
196
148
|
{/*isMoblie true일때 헤더 주의 내용이 상단에 있고 ,나머지 높이영역은 메시지 리스트로 붙게*/}
|
|
197
149
|
<div
|
|
198
|
-
className={`flex
|
|
199
|
-
style={{
|
|
200
|
-
height: isMobile
|
|
201
|
-
? undefined
|
|
202
|
-
: windowSize.width < 480
|
|
203
|
-
? `calc(100dvh - ${bottomHeight}px)`
|
|
204
|
-
: undefined
|
|
205
|
-
}}
|
|
150
|
+
className={` no-scrollbar flex h-[100dvh] flex-col items-center justify-between xs:h-[calc(100vh-165px)] xs:max-h-[690px] lg:h-[calc(100vh-110px)] `}
|
|
206
151
|
>
|
|
207
152
|
<div
|
|
208
153
|
className={`
|
|
209
|
-
no-scrollbar relative w-full
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
' xs:max-h-[626px] xs:min-h-[320px] '
|
|
215
|
-
}
|
|
216
|
-
`}
|
|
154
|
+
no-scrollbar relative h-[100%] w-full
|
|
155
|
+
rounded-t-[30px]
|
|
156
|
+
xs:max-h-[690px] xs:min-h-[320px] xs:justify-start
|
|
157
|
+
${isMobile ? 'flex flex-col items-center justify-between' : 'flex flex-col'}
|
|
158
|
+
`}
|
|
217
159
|
>
|
|
218
160
|
{/* 헤더 부분 */}
|
|
219
|
-
<div ref={headerRef} className={`w-full`}>
|
|
161
|
+
<div ref={headerRef} className={`flex w-full flex-col`}>
|
|
220
162
|
<ChatConversationHeader
|
|
221
163
|
inquiryMainData={inquiryMainData ?? null}
|
|
222
164
|
isMobile={isMobile}
|
|
@@ -224,17 +166,20 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
224
166
|
isHash={isHash}
|
|
225
167
|
onBackClick={onBackClick}
|
|
226
168
|
/>
|
|
227
|
-
</div>
|
|
228
|
-
{/* 주의내용 */}
|
|
229
|
-
<div ref={noticeRef}>
|
|
230
169
|
<NoticeMessage content={noticeContent} isMobile={isMobile} />
|
|
231
170
|
</div>
|
|
232
171
|
{/* 메시지 노출 부분 -> 무한스크롤 변환 필요 */}
|
|
233
172
|
{/* 여기서 isMpblie일때 위에 2개 헤더부분이랑 아래 메시지 입력이랑 높이를 빼서 넣어야한ㄷ */}
|
|
234
173
|
<div
|
|
235
|
-
className={
|
|
174
|
+
className={`
|
|
175
|
+
${isMobile ? ' ' : 'flex- xs:pb-[100px]'} no-scrollbar mx-[20px] overflow-auto pt-[20px]
|
|
176
|
+
`}
|
|
236
177
|
style={{
|
|
237
|
-
height: isMobile
|
|
178
|
+
height: isMobile
|
|
179
|
+
? `calc(100vh - ${bottomHeight}px - ${headerRef.current?.offsetHeight || 0}px)`
|
|
180
|
+
: bottomHeight && headerRef.current
|
|
181
|
+
? `calc(100% - ${bottomHeight}px - ${headerRef.current?.offsetHeight}px)`
|
|
182
|
+
: '100%' // fallback
|
|
238
183
|
}}
|
|
239
184
|
>
|
|
240
185
|
{messages.length === 0 ? (
|
|
@@ -260,7 +205,7 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
260
205
|
)}
|
|
261
206
|
</div>
|
|
262
207
|
|
|
263
|
-
<div className={`
|
|
208
|
+
<div ref={pcBottomRef} className={`w-full`}>
|
|
264
209
|
{/* 높이가 부모에 스크롤이 줄어도 해당 부분은 바텀에 고정 필요 */}
|
|
265
210
|
{inquiryStatus === InquiryStatus.CLOSED ? (
|
|
266
211
|
<div className="w-full border-t border-drTalkGrayscale4 px-[20px] py-[16px]">
|
|
@@ -283,28 +228,29 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
283
228
|
</div>
|
|
284
229
|
</div>
|
|
285
230
|
</div>
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
231
|
+
|
|
232
|
+
{/*/!* 모바일 *!/*/}
|
|
233
|
+
{/*<div ref={mobileBottomRef} className={`block w-full xs:hidden`}>*/}
|
|
234
|
+
{/* /!* 높이가 부모에 스크롤이 줄어도 해당 부분은 바텀에 고정 필요 *!/*/}
|
|
235
|
+
{/* {inquiryStatus === InquiryStatus.CLOSED ? (*/}
|
|
236
|
+
{/* <div className="w-full border-t border-drTalkGrayscale4 px-[20px] py-[16px]">*/}
|
|
237
|
+
{/* <div className="">*/}
|
|
238
|
+
{/* <Button3*/}
|
|
239
|
+
{/* onClick={() => {*/}
|
|
240
|
+
{/* onChatNew && onChatNew();*/}
|
|
241
|
+
{/* }}*/}
|
|
242
|
+
{/* className={`w-full`}*/}
|
|
243
|
+
{/* >*/}
|
|
244
|
+
{/* 새 문의하기*/}
|
|
245
|
+
{/* </Button3>*/}
|
|
246
|
+
{/* </div>*/}
|
|
247
|
+
{/* </div>*/}
|
|
248
|
+
{/* ) : (*/}
|
|
249
|
+
{/* <div className=" w-full border-t border-drTalkGrayscale4 px-[20px] py-[8px]">*/}
|
|
250
|
+
{/* <ChatInput />*/}
|
|
251
|
+
{/* </div>*/}
|
|
252
|
+
{/* )}*/}
|
|
253
|
+
{/*</div>*/}
|
|
308
254
|
</>
|
|
309
255
|
);
|
|
310
256
|
};
|
|
@@ -11,12 +11,12 @@ const ChatConversationHeader = ({ inquiryMainData, isMobile, onClose, isHash, on
|
|
|
11
11
|
onBackClick();
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
return (<div className={`${isMobile ? '
|
|
14
|
+
return (<div className={`${isMobile ? '' : ''} flex h-[56px] w-full items-center justify-between border-b border-gray-200 px-[16px] `}>
|
|
15
15
|
<button className="flex h-[28px] w-[28px] items-center justify-center" aria-label="이전" onClick={handleBackClick}>
|
|
16
16
|
<PrevIcon width={28} height={28}/>
|
|
17
17
|
</button>
|
|
18
18
|
<div className="flex items-center gap-[10px] ">
|
|
19
|
-
{logoImageUrl ? (<Image src={logoImageUrl} alt="로고" width={28} height={28} className="
|
|
19
|
+
{logoImageUrl ? (<Image src={logoImageUrl} alt="로고" width={28} height={28} className=""/>) : (<DaeryunLogoIcon width={28} height={28}/>)}
|
|
20
20
|
<h2 className={`dr_talk_title_small text-drTalkBlack`}>{channelName}</h2>
|
|
21
21
|
</div>
|
|
22
22
|
<div className={`${isHash ? 'pointer-events-none !opacity-0' : ''} ${isMobile ? 'block' : ' xs:pointer-events-none xs:!opacity-0 '} py-[14px] text-drTalkGrayscale2 hover:cursor-pointer`} onClick={onClose}>
|
|
@@ -29,7 +29,7 @@ const ChatConversationHeader = ({
|
|
|
29
29
|
};
|
|
30
30
|
return (
|
|
31
31
|
<div
|
|
32
|
-
className={`${isMobile ? '
|
|
32
|
+
className={`${isMobile ? '' : ''} flex h-[56px] w-full items-center justify-between border-b border-gray-200 px-[16px] `}
|
|
33
33
|
>
|
|
34
34
|
<button
|
|
35
35
|
className="flex h-[28px] w-[28px] items-center justify-center"
|
|
@@ -40,7 +40,7 @@ const ChatConversationHeader = ({
|
|
|
40
40
|
</button>
|
|
41
41
|
<div className="flex items-center gap-[10px] ">
|
|
42
42
|
{logoImageUrl ? (
|
|
43
|
-
<Image src={logoImageUrl} alt="로고" width={28} height={28} className="
|
|
43
|
+
<Image src={logoImageUrl} alt="로고" width={28} height={28} className="" />
|
|
44
44
|
) : (
|
|
45
45
|
<DaeryunLogoIcon width={28} height={28} />
|
|
46
46
|
)}
|
|
@@ -58,11 +58,13 @@ const ChatHomeView = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
|
58
58
|
<main className={`
|
|
59
59
|
relative flex justify-end border-[1px]
|
|
60
60
|
${isMobile ? 'h-[100dvh]' : 'h-[100dvh] xs:h-auto xs:rounded-[30px] '}
|
|
61
|
-
`}
|
|
61
|
+
`} style={{
|
|
62
|
+
boxShadow: '0px 0px 20px 0px #00000040'
|
|
63
|
+
}}>
|
|
62
64
|
<div className={`
|
|
63
65
|
relative overflow-hidden bg-white
|
|
64
66
|
${isMobile
|
|
65
|
-
? `h-[100dvh]
|
|
67
|
+
? `h-[100dvh] w-screen rounded-[0px]`
|
|
66
68
|
: `
|
|
67
69
|
${isHash
|
|
68
70
|
? `
|
|
@@ -71,17 +73,19 @@ const ChatHomeView = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
|
71
73
|
xs:shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]
|
|
72
74
|
`
|
|
73
75
|
: `
|
|
74
|
-
w-
|
|
76
|
+
w-screen rounded-[0px]
|
|
75
77
|
xs:w-[390px] xs:rounded-[30px]
|
|
76
78
|
`}
|
|
77
79
|
|
|
78
80
|
`}
|
|
79
81
|
|
|
80
82
|
`}>
|
|
81
|
-
<div className="flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
<div className="flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]">
|
|
84
|
+
<div className={`
|
|
85
|
+
no-scrollbar ${isMobile ? '' : ` overflow-hidden xs:overflow-auto ${viewState === 'conversation' ? ' ' : ' '} `}
|
|
86
|
+
`}>
|
|
87
|
+
{content}
|
|
88
|
+
</div>
|
|
85
89
|
{/* 얘는 아래 64px로 고정 */}
|
|
86
90
|
<NavigationFooter activeView={activeView} onHomeClick={handleBackToHome} onHistoryClick={handleHistoryClick} historyList={historyList} isAuthenticated={isAuthenticated}/>
|
|
87
91
|
</div>
|
|
@@ -111,13 +111,16 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
111
111
|
relative flex justify-end border-[1px]
|
|
112
112
|
${isMobile ? 'h-[100dvh]' : 'h-[100dvh] xs:h-auto xs:rounded-[30px] '}
|
|
113
113
|
`}
|
|
114
|
+
style={{
|
|
115
|
+
boxShadow: '0px 0px 20px 0px #00000040'
|
|
116
|
+
}}
|
|
114
117
|
>
|
|
115
118
|
<div
|
|
116
119
|
className={`
|
|
117
120
|
relative overflow-hidden bg-white
|
|
118
121
|
${
|
|
119
122
|
isMobile
|
|
120
|
-
? `h-[100dvh]
|
|
123
|
+
? `h-[100dvh] w-screen rounded-[0px]`
|
|
121
124
|
: `
|
|
122
125
|
${
|
|
123
126
|
isHash
|
|
@@ -127,7 +130,7 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
127
130
|
xs:shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]
|
|
128
131
|
`
|
|
129
132
|
: `
|
|
130
|
-
w-
|
|
133
|
+
w-screen rounded-[0px]
|
|
131
134
|
xs:w-[390px] xs:rounded-[30px]
|
|
132
135
|
`
|
|
133
136
|
}
|
|
@@ -137,13 +140,14 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
137
140
|
|
|
138
141
|
`}
|
|
139
142
|
>
|
|
140
|
-
<div
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
<div className="flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]">
|
|
144
|
+
<div
|
|
145
|
+
className={`
|
|
146
|
+
no-scrollbar ${isMobile ? '' : ` overflow-hidden xs:overflow-auto ${viewState === 'conversation' ? ' ' : ' '} `}
|
|
147
|
+
`}
|
|
148
|
+
>
|
|
149
|
+
{content}
|
|
150
|
+
</div>
|
|
147
151
|
{/* 얘는 아래 64px로 고정 */}
|
|
148
152
|
<NavigationFooter
|
|
149
153
|
activeView={activeView}
|
|
@@ -70,8 +70,8 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
|
70
70
|
<button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
71
|
e.stopPropagation();
|
|
72
72
|
yield handleDownload(file);
|
|
73
|
-
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center
|
|
74
|
-
<FileDownLoadIcon className="h-[
|
|
73
|
+
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center bg-transparent opacity-0 transition-opacity group-hover/image:opacity-100">
|
|
74
|
+
<FileDownLoadIcon className="h-[25px] w-[24px]"/>
|
|
75
75
|
</button>
|
|
76
76
|
</div>);
|
|
77
77
|
})}
|
|
@@ -90,8 +90,8 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
|
90
90
|
if (media.type === 'image') {
|
|
91
91
|
yield handleDownload(media.images[media.images.length - 1]);
|
|
92
92
|
}
|
|
93
|
-
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center
|
|
94
|
-
<FileDownLoadIcon className="h-[
|
|
93
|
+
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center opacity-0 transition-opacity group-hover/image:opacity-100">
|
|
94
|
+
<FileDownLoadIcon className="h-[25px] w-[24px]"/>
|
|
95
95
|
</button>
|
|
96
96
|
</div>
|
|
97
97
|
</div>)}
|
|
@@ -109,8 +109,8 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
|
109
109
|
if (media.type === 'image') {
|
|
110
110
|
yield handleDownload(media.images[0]);
|
|
111
111
|
}
|
|
112
|
-
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center
|
|
113
|
-
<FileDownLoadIcon className="h-[
|
|
112
|
+
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center opacity-0 transition-opacity group-hover/image:opacity-100">
|
|
113
|
+
<FileDownLoadIcon className="h-[25px] w-[24px]"/>
|
|
114
114
|
</button>
|
|
115
115
|
</div>
|
|
116
116
|
</div>)}
|
|
@@ -140,8 +140,8 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
|
140
140
|
<button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
141
141
|
e.stopPropagation();
|
|
142
142
|
yield handleDownload(file);
|
|
143
|
-
})} className="flex h-[24px] w-[24px] items-center justify-center
|
|
144
|
-
<FileDownLoadIcon className="h-[
|
|
143
|
+
})} className="flex h-[24px] w-[24px] items-center justify-center ">
|
|
144
|
+
<FileDownLoadIcon className="h-[25px] w-[24px] bg-white"/>
|
|
145
145
|
</button>
|
|
146
146
|
</div>
|
|
147
147
|
</div>);
|