@daeryun/dr_components 0.8.69 → 0.8.71
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/ChatConversation.jsx +146 -25
- package/dist/components/Daeryuntalk/ChatConversation.tsx +193 -50
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.tsx +3 -1
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +7 -5
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +11 -6
- package/dist/components/Daeryuntalk/ChatInput.jsx +9 -7
- package/dist/components/Daeryuntalk/ChatInput.tsx +15 -12
- package/dist/components/Daeryuntalk/ChatWidget.jsx +15 -16
- package/dist/components/Daeryuntalk/ChatWidget.tsx +19 -20
- package/dist/components/Daeryuntalk/HistoryView.jsx +9 -3
- package/dist/components/Daeryuntalk/HistoryView.tsx +15 -3
- package/dist/components/Daeryuntalk/HomeView.jsx +84 -92
- package/dist/components/Daeryuntalk/HomeView.tsx +95 -104
- package/dist/components/Daeryuntalk/NavigationFooter.jsx +1 -1
- package/dist/components/Daeryuntalk/NavigationFooter.tsx +1 -1
- package/dist/components/Daeryuntalk/NoticeMessage.d.ts +1 -0
- package/dist/components/Daeryuntalk/NoticeMessage.jsx +2 -2
- package/dist/components/Daeryuntalk/NoticeMessage.tsx +3 -2
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.d.ts +1 -0
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +3 -3
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +4 -3
- package/dist/components/Daeryuntalk/ViewportHandler.d.ts +1 -1
- package/dist/components/Daeryuntalk/ViewportHandler.jsx +5 -23
- package/dist/components/Daeryuntalk/ViewportHandler.tsx +44 -30
- package/dist/components/Daeryuntalk/_hooks/useWindowSize.d.ts +6 -0
- package/dist/components/Daeryuntalk/_hooks/useWindowSize.js +20 -0
- package/dist/components/Daeryuntalk/_hooks/useWindowSize.ts +30 -0
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/styles/globals.css +385 -331
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import React, { useEffect,
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import ChatMessage from './ChatMessage';
|
|
4
4
|
import ChatInput from './ChatInput';
|
|
5
5
|
import NoticeMessage from './NoticeMessage';
|
|
6
6
|
import DateSeparator from './DateSeparator';
|
|
7
|
-
import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
|
|
8
|
-
import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
9
|
-
import Image from 'next/image';
|
|
10
|
-
import { useChatSocketState } from './_hooks/view/useChatSocketState';
|
|
11
|
-
import { getMessageFileDownloadUrl } from './_api';
|
|
12
7
|
import { InquiryStatus } from './_enums/ask-status';
|
|
13
|
-
import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
14
|
-
import CloseSvgIcon from '../../asset/images/daeryuntalk/close.svg';
|
|
15
8
|
import Button3 from './_ui/buttons/Button3';
|
|
16
9
|
import ChatConversationHeader from './ChatConversationItem/ChatConversationHeader';
|
|
17
|
-
import { IChatInquiryMainDataResponse } from './_api/daeryuntalk/type/response';
|
|
18
10
|
import ChatLoading from './ChatItem/ChatLoading';
|
|
11
|
+
import { useWindowSize } from './_hooks/useWindowSize';
|
|
19
12
|
|
|
20
13
|
type ChatConversationProps = {
|
|
21
14
|
onBackClick?: () => void;
|
|
@@ -46,6 +39,97 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
46
39
|
} = useDaeryuntalk();
|
|
47
40
|
const [isHovered, setIsHovered] = useState<boolean>(false);
|
|
48
41
|
const messagesEndRef = useRef<HTMLDivElement>(null);
|
|
42
|
+
const headerRef = useRef<HTMLDivElement | null>(null);
|
|
43
|
+
const noticeRef = useRef<HTMLDivElement | null>(null);
|
|
44
|
+
const bottomRef = useRef<HTMLDivElement | null>(null);
|
|
45
|
+
const [bottomHeight, setBottomHeight] = useState(0);
|
|
46
|
+
|
|
47
|
+
const [availableHeight, setAvailableHeight] = useState<number | null>(null);
|
|
48
|
+
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
|
49
|
+
const messageAreaRef = useRef<HTMLDivElement | null>(null);
|
|
50
|
+
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
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!bottomRef.current) return;
|
|
78
|
+
|
|
79
|
+
const updateHeight = () => {
|
|
80
|
+
const height = bottomRef.current?.getBoundingClientRect().height ?? 0;
|
|
81
|
+
setBottomHeight(height);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
updateHeight(); // 초기 측정
|
|
85
|
+
|
|
86
|
+
const resizeObserver = new ResizeObserver(updateHeight);
|
|
87
|
+
|
|
88
|
+
// bottomRef 자체 감지
|
|
89
|
+
resizeObserver.observe(bottomRef.current);
|
|
90
|
+
|
|
91
|
+
// TipTap 내부 wrapper도 별도로 감지
|
|
92
|
+
const tiptapWrapper = bottomRef.current.querySelector('.tiptap-editor-wrapper');
|
|
93
|
+
if (tiptapWrapper) {
|
|
94
|
+
resizeObserver.observe(tiptapWrapper);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 윈도우 리사이즈 대응
|
|
98
|
+
window.addEventListener('resize', updateHeight);
|
|
99
|
+
|
|
100
|
+
return () => {
|
|
101
|
+
resizeObserver.disconnect();
|
|
102
|
+
window.removeEventListener('resize', updateHeight);
|
|
103
|
+
};
|
|
104
|
+
}, []);
|
|
105
|
+
|
|
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]);
|
|
49
133
|
|
|
50
134
|
const defaultNoticeContent =
|
|
51
135
|
inquiryMainData?.channel_explanation ||
|
|
@@ -108,61 +192,120 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
108
192
|
};
|
|
109
193
|
|
|
110
194
|
return (
|
|
111
|
-
|
|
112
|
-
{/* 헤더
|
|
113
|
-
<ChatConversationHeader
|
|
114
|
-
inquiryMainData={inquiryMainData ?? null}
|
|
115
|
-
isMobile={isMobile}
|
|
116
|
-
onClose={onClose}
|
|
117
|
-
isHash={isHash}
|
|
118
|
-
onBackClick={onBackClick}
|
|
119
|
-
/>
|
|
120
|
-
{/* 주의내용 */}
|
|
121
|
-
<NoticeMessage content={noticeContent} />
|
|
122
|
-
{/* 메시지 노출 부분 -> 무한스크롤 변환 필요 */}
|
|
195
|
+
<>
|
|
196
|
+
{/*isMoblie true일때 헤더 주의 내용이 상단에 있고 ,나머지 높이영역은 메시지 리스트로 붙게*/}
|
|
123
197
|
<div
|
|
124
|
-
className={
|
|
198
|
+
className={`flex flex-col justify-between xs:h-auto xs:justify-start`}
|
|
199
|
+
style={{
|
|
200
|
+
height: isMobile
|
|
201
|
+
? undefined
|
|
202
|
+
: windowSize.width < 480
|
|
203
|
+
? `calc(100dvh - ${bottomHeight}px)`
|
|
204
|
+
: undefined
|
|
205
|
+
}}
|
|
125
206
|
>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
207
|
+
<div
|
|
208
|
+
className={`
|
|
209
|
+
no-scrollbar relative w-full rounded-t-[30px]
|
|
210
|
+
${
|
|
211
|
+
isMobile
|
|
212
|
+
? 'flex flex-col items-center justify-between'
|
|
213
|
+
: 'flex h-[100dvh] flex-col items-center xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ' +
|
|
214
|
+
' xs:max-h-[626px] xs:min-h-[320px] '
|
|
215
|
+
}
|
|
216
|
+
`}
|
|
217
|
+
>
|
|
218
|
+
{/* 헤더 부분 */}
|
|
219
|
+
<div ref={headerRef} className={`w-full`}>
|
|
220
|
+
<ChatConversationHeader
|
|
221
|
+
inquiryMainData={inquiryMainData ?? null}
|
|
222
|
+
isMobile={isMobile}
|
|
223
|
+
onClose={onClose}
|
|
224
|
+
isHash={isHash}
|
|
225
|
+
onBackClick={onBackClick}
|
|
226
|
+
/>
|
|
130
227
|
</div>
|
|
131
|
-
|
|
228
|
+
{/* 주의내용 */}
|
|
229
|
+
<div ref={noticeRef}>
|
|
230
|
+
<NoticeMessage content={noticeContent} isMobile={isMobile} />
|
|
231
|
+
</div>
|
|
232
|
+
{/* 메시지 노출 부분 -> 무한스크롤 변환 필요 */}
|
|
233
|
+
{/* 여기서 isMpblie일때 위에 2개 헤더부분이랑 아래 메시지 입력이랑 높이를 빼서 넣어야한ㄷ */}
|
|
132
234
|
<div
|
|
133
|
-
className={
|
|
134
|
-
|
|
135
|
-
|
|
235
|
+
className={`${isMobile ? ' ' : 'flex-1 xs:pb-[100px]'} no-scrollbar mx-[20px] overflow-auto pt-[20px]`}
|
|
236
|
+
style={{
|
|
237
|
+
height: isMobile ? (availableHeight ?? undefined) : undefined
|
|
238
|
+
}}
|
|
136
239
|
>
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
240
|
+
{messages.length === 0 ? (
|
|
241
|
+
<div className="dr_talk_body_medium2 flex h-full flex-col items-center justify-center text-center text-drTalkGrayscale1">
|
|
242
|
+
<p>문의하실 내용을 입력해 주세요.</p>
|
|
243
|
+
<p className="mt-2 text-sm">24시간 운영하고 있습니다.</p>
|
|
244
|
+
</div>
|
|
245
|
+
) : (
|
|
246
|
+
<div
|
|
247
|
+
className={``}
|
|
248
|
+
onMouseEnter={() => setIsHovered(true)}
|
|
249
|
+
onMouseLeave={() => setIsHovered(false)}
|
|
250
|
+
>
|
|
251
|
+
{renderMessagesWithDateSeparators()}
|
|
252
|
+
{inquiryStatus === InquiryStatus.CLOSED && (
|
|
253
|
+
<div className={` dr_talk_body_medium2 text-center text-drTalkGrayscale1 `}>
|
|
254
|
+
문의가 종료되었습니다.
|
|
255
|
+
</div>
|
|
256
|
+
)}
|
|
257
|
+
{isLoading && <ChatLoading />}
|
|
258
|
+
<div ref={messagesEndRef} />
|
|
141
259
|
</div>
|
|
142
260
|
)}
|
|
143
|
-
{isLoading && <ChatLoading />}
|
|
144
|
-
<div ref={messagesEndRef} />
|
|
145
261
|
</div>
|
|
146
|
-
)}
|
|
147
|
-
</div>
|
|
148
262
|
|
|
149
|
-
|
|
263
|
+
<div className={`hidden w-full xs:block`}>
|
|
264
|
+
{/* 높이가 부모에 스크롤이 줄어도 해당 부분은 바텀에 고정 필요 */}
|
|
265
|
+
{inquiryStatus === InquiryStatus.CLOSED ? (
|
|
266
|
+
<div className="w-full border-t border-drTalkGrayscale4 px-[20px] py-[16px]">
|
|
267
|
+
<div className="">
|
|
268
|
+
<Button3
|
|
269
|
+
onClick={() => {
|
|
270
|
+
onChatNew && onChatNew();
|
|
271
|
+
}}
|
|
272
|
+
className={`w-full`}
|
|
273
|
+
>
|
|
274
|
+
새 문의하기
|
|
275
|
+
</Button3>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
) : (
|
|
279
|
+
<div className=" w-full border-t border-drTalkGrayscale4 px-[20px] py-[8px]">
|
|
280
|
+
<ChatInput />
|
|
281
|
+
</div>
|
|
282
|
+
)}
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
{/* isMoblie true일때 한 화면에 하단에 붙게 */}
|
|
287
|
+
<div ref={bottomRef} className={`block w-full xs:hidden`}>
|
|
288
|
+
{/* 높이가 부모에 스크롤이 줄어도 해당 부분은 바텀에 고정 필요 */}
|
|
150
289
|
{inquiryStatus === InquiryStatus.CLOSED ? (
|
|
151
|
-
<div className="">
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
290
|
+
<div className="w-full border-t border-drTalkGrayscale4 px-[20px] py-[16px]">
|
|
291
|
+
<div className="">
|
|
292
|
+
<Button3
|
|
293
|
+
onClick={() => {
|
|
294
|
+
onChatNew && onChatNew();
|
|
295
|
+
}}
|
|
296
|
+
className={`w-full`}
|
|
297
|
+
>
|
|
298
|
+
새 문의하기
|
|
299
|
+
</Button3>
|
|
300
|
+
</div>
|
|
160
301
|
</div>
|
|
161
302
|
) : (
|
|
162
|
-
<
|
|
303
|
+
<div className=" w-full border-t border-drTalkGrayscale4 px-[20px] py-[8px]">
|
|
304
|
+
<ChatInput />
|
|
305
|
+
</div>
|
|
163
306
|
)}
|
|
164
307
|
</div>
|
|
165
|
-
|
|
308
|
+
</>
|
|
166
309
|
);
|
|
167
310
|
};
|
|
168
311
|
|
|
@@ -11,7 +11,7 @@ const ChatConversationHeader = ({ inquiryMainData, isMobile, onClose, isHash, on
|
|
|
11
11
|
onBackClick();
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
return (<div className=
|
|
14
|
+
return (<div className={`${isMobile ? 'sticky top-0 z-10 ' : ''} 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>
|
|
@@ -28,7 +28,9 @@ const ChatConversationHeader = ({
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
return (
|
|
31
|
-
<div
|
|
31
|
+
<div
|
|
32
|
+
className={`${isMobile ? 'sticky top-0 z-10 ' : ''} flex h-[56px] w-full items-center justify-between border-b border-gray-200 px-[16px]`}
|
|
33
|
+
>
|
|
32
34
|
<button
|
|
33
35
|
className="flex h-[28px] w-[28px] items-center justify-center"
|
|
34
36
|
aria-label="이전"
|
|
@@ -56,7 +56,7 @@ const ChatHomeView = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
|
56
56
|
return (
|
|
57
57
|
//
|
|
58
58
|
<main className={`
|
|
59
|
-
relative flex justify-end
|
|
59
|
+
relative flex justify-end border-[1px]
|
|
60
60
|
${isMobile ? 'h-[100dvh]' : 'h-[100dvh] xs:h-auto xs:rounded-[30px] '}
|
|
61
61
|
`}>
|
|
62
62
|
<div className={`
|
|
@@ -71,15 +71,17 @@ const ChatHomeView = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
|
71
71
|
xs:shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]
|
|
72
72
|
`
|
|
73
73
|
: `
|
|
74
|
-
|
|
75
|
-
xs:
|
|
74
|
+
w-full rounded-[0px]
|
|
75
|
+
xs:w-[390px] xs:rounded-[30px]
|
|
76
76
|
`}
|
|
77
77
|
|
|
78
78
|
`}
|
|
79
79
|
|
|
80
80
|
`}>
|
|
81
|
-
<div className="flex h-full flex-col
|
|
82
|
-
|
|
81
|
+
<div className="flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]" style={{
|
|
82
|
+
boxShadow: 'box-shadow: 0px 0px 20px 0px #00000040'
|
|
83
|
+
}}>
|
|
84
|
+
<div className={`no-scrollbar ${isMobile ? '' : 'overflow-auto'} `}>{content}</div>
|
|
83
85
|
{/* 얘는 아래 64px로 고정 */}
|
|
84
86
|
<NavigationFooter activeView={activeView} onHomeClick={handleBackToHome} onHistoryClick={handleHistoryClick} historyList={historyList} isAuthenticated={isAuthenticated}/>
|
|
85
87
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
|
1
|
+
import React, { Dispatch, SetStateAction, useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import ChatConversation from './ChatConversation';
|
|
4
4
|
import HistoryView from './HistoryView';
|
|
@@ -108,7 +108,7 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
108
108
|
//
|
|
109
109
|
<main
|
|
110
110
|
className={`
|
|
111
|
-
relative flex justify-end
|
|
111
|
+
relative flex justify-end border-[1px]
|
|
112
112
|
${isMobile ? 'h-[100dvh]' : 'h-[100dvh] xs:h-auto xs:rounded-[30px] '}
|
|
113
113
|
`}
|
|
114
114
|
>
|
|
@@ -127,8 +127,8 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
127
127
|
xs:shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]
|
|
128
128
|
`
|
|
129
129
|
: `
|
|
130
|
-
|
|
131
|
-
xs:
|
|
130
|
+
w-full rounded-[0px]
|
|
131
|
+
xs:w-[390px] xs:rounded-[30px]
|
|
132
132
|
`
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -137,8 +137,13 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
137
137
|
|
|
138
138
|
`}
|
|
139
139
|
>
|
|
140
|
-
<div
|
|
141
|
-
|
|
140
|
+
<div
|
|
141
|
+
className="flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]"
|
|
142
|
+
style={{
|
|
143
|
+
boxShadow: 'box-shadow: 0px 0px 20px 0px #00000040'
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
<div className={`no-scrollbar ${isMobile ? '' : 'overflow-auto'} `}>{content}</div>
|
|
142
147
|
{/* 얘는 아래 64px로 고정 */}
|
|
143
148
|
<NavigationFooter
|
|
144
149
|
activeView={activeView}
|
|
@@ -28,18 +28,20 @@ const ChatInput = () => {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
return (<form onSubmit={handleSubmit} className="flex w-full items-center gap-2">
|
|
31
|
-
<div className="flex-1">
|
|
31
|
+
<div className="flex flex-1 justify-center gap-[10px] rounded-[10px] border-[1px] border-solid border-grayScale6 p-[4px]">
|
|
32
32
|
{/* 최초 높이 44 */}
|
|
33
33
|
{/*내용이 2줄 이상되면 입력창 높이도 키워져야합니다. 최대한 4줄까지만 보이도록 해주시고, 그 이상은 스크롤 될 수 있도록 해주시는 게 좋을 것 같습니다. max height 값을 72로 지정 부탁드립니다*/}
|
|
34
34
|
<Tiptap ref={tiptapRef}
|
|
35
35
|
// value={message}
|
|
36
|
-
onChange={setMessage} onEnterKeyPress={handleEnter} placeholder="메시지를 입력하세요..."/>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
onChange={setMessage} onEnterKeyPress={handleEnter} placeholder="메시지를 입력하세요..." contentClassName={`!outline-none !border-[0px] !pt-[4px] !pl-[4px]`}/>
|
|
37
|
+
<div className={`flex flex-col justify-end`}>
|
|
38
|
+
<button type="submit" className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-drTalkBtnActive2 text-white ${isLoading || !message.trim() ? 'cursor-not-allowed opacity-50' : ' bg-drTalkCrimson '}`} disabled={isLoading || !message.trim()}>
|
|
39
|
+
<div className="flex h-9 w-9 items-center justify-center">
|
|
40
|
+
<SendIcon width={24} height={24}/>
|
|
41
|
+
</div>
|
|
42
|
+
</button>
|
|
41
43
|
</div>
|
|
42
|
-
</
|
|
44
|
+
</div>
|
|
43
45
|
</form>);
|
|
44
46
|
};
|
|
45
47
|
export default ChatInput;
|
|
@@ -31,7 +31,7 @@ const ChatInput: React.FC = () => {
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<form onSubmit={handleSubmit} className="flex w-full items-center gap-2">
|
|
34
|
-
<div className="flex-1">
|
|
34
|
+
<div className="flex flex-1 justify-center gap-[10px] rounded-[10px] border-[1px] border-solid border-grayScale6 p-[4px]">
|
|
35
35
|
{/* 최초 높이 44 */}
|
|
36
36
|
{/*내용이 2줄 이상되면 입력창 높이도 키워져야합니다. 최대한 4줄까지만 보이도록 해주시고, 그 이상은 스크롤 될 수 있도록 해주시는 게 좋을 것 같습니다. max height 값을 72로 지정 부탁드립니다*/}
|
|
37
37
|
<Tiptap
|
|
@@ -40,19 +40,22 @@ const ChatInput: React.FC = () => {
|
|
|
40
40
|
onChange={setMessage}
|
|
41
41
|
onEnterKeyPress={handleEnter}
|
|
42
42
|
placeholder="메시지를 입력하세요..."
|
|
43
|
+
contentClassName={`!outline-none !border-[0px] !pt-[4px] !pl-[4px]`}
|
|
43
44
|
/>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
<div className={`flex flex-col justify-end`}>
|
|
46
|
+
<button
|
|
47
|
+
type="submit"
|
|
48
|
+
className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-drTalkBtnActive2 text-white ${
|
|
49
|
+
isLoading || !message.trim() ? 'cursor-not-allowed opacity-50' : ' bg-drTalkCrimson '
|
|
50
|
+
}`}
|
|
51
|
+
disabled={isLoading || !message.trim()}
|
|
52
|
+
>
|
|
53
|
+
<div className="flex h-9 w-9 items-center justify-center">
|
|
54
|
+
<SendIcon width={24} height={24} />
|
|
55
|
+
</div>
|
|
56
|
+
</button>
|
|
54
57
|
</div>
|
|
55
|
-
</
|
|
58
|
+
</div>
|
|
56
59
|
</form>
|
|
57
60
|
);
|
|
58
61
|
};
|
|
@@ -14,26 +14,25 @@ const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
|
|
|
14
14
|
// 웹 모바일 ~480px
|
|
15
15
|
const webSmallWrapperCss = `
|
|
16
16
|
${isHash ? `` : `duration-300 ease-in-out`}
|
|
17
|
-
|
|
18
17
|
${isHash ? '' : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
fixed w-screen max-w-[100vw] z-[999998] rounded-none flex flex-col
|
|
19
|
+
bottom-0 right-0 h-[100dvh]
|
|
21
20
|
`;
|
|
22
21
|
// 해쉬 있을 경우는 여기서 중앙배치 css로
|
|
23
22
|
const webTbPCWrapperCss = `
|
|
24
|
-
|
|
23
|
+
${isHash ? '' : 'duration-300 ease-in-out'}
|
|
25
24
|
${isHash ? '' : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
|
|
26
|
-
|
|
25
|
+
${isHash
|
|
27
26
|
? `
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
`
|
|
27
|
+
xs:fixed xs:flex xs:justify-center xs:items-center xs:inset-0 xs:bg-white
|
|
28
|
+
xs:w-screen xs:h-[100dvh] xs:inset-0 xs:pt-[70px]
|
|
29
|
+
`
|
|
32
30
|
: `
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
h-[100dvh]
|
|
32
|
+
xs:bottom-[165px] xs:right-[30px] xs:max-w-[400px]
|
|
33
|
+
xs:max-h-[690px] xs:rounded-[30px]
|
|
34
|
+
lg:bottom-[110px]
|
|
35
|
+
`}
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
`;
|
|
@@ -56,16 +55,16 @@ const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
|
|
|
56
55
|
|
|
57
56
|
<div className="relative ">
|
|
58
57
|
<div className={`
|
|
59
|
-
flex justify-end
|
|
60
58
|
${isMobile ? `${mobileWrapperCss}` : `${webSmallWrapperCss} ${webTbPCWrapperCss} `}
|
|
61
59
|
|
|
62
60
|
`}>
|
|
63
61
|
{/* 여기서 외각 스크롤 생김 */}
|
|
64
62
|
<div ref={containerRef} className={`
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
relative z-[999998]
|
|
64
|
+
flex h-full flex-col items-center justify-end
|
|
67
65
|
${isMobile ? `${innerMobileWrapperCss}` : `${innerWebSmallWrapperCss} ${innerWebTbPCWrapperCss}`}
|
|
68
66
|
`}>
|
|
67
|
+
{/* 여기서 보장해줘야하나? */}
|
|
69
68
|
<ChatHomeView hashValue={hashValue} isMobile={isMobile} isHash={isHash} onClose={onClose}/>
|
|
70
69
|
</div>
|
|
71
70
|
</div>
|
|
@@ -26,29 +26,28 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
|
|
|
26
26
|
// 웹 모바일 ~480px
|
|
27
27
|
const webSmallWrapperCss = `
|
|
28
28
|
${isHash ? `` : `duration-300 ease-in-out`}
|
|
29
|
-
|
|
30
29
|
${isHash ? '' : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
fixed w-screen max-w-[100vw] z-[999998] rounded-none flex flex-col
|
|
31
|
+
bottom-0 right-0 h-[100dvh]
|
|
33
32
|
`;
|
|
34
33
|
|
|
35
34
|
// 해쉬 있을 경우는 여기서 중앙배치 css로
|
|
36
35
|
const webTbPCWrapperCss = `
|
|
37
|
-
|
|
36
|
+
${isHash ? '' : 'duration-300 ease-in-out'}
|
|
38
37
|
${isHash ? '' : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
${
|
|
39
|
+
isHash
|
|
40
|
+
? `
|
|
41
|
+
xs:fixed xs:flex xs:justify-center xs:items-center xs:inset-0 xs:bg-white
|
|
42
|
+
xs:w-screen xs:h-[100dvh] xs:inset-0 xs:pt-[70px]
|
|
43
|
+
`
|
|
44
|
+
: `
|
|
45
|
+
h-[100dvh]
|
|
46
|
+
xs:bottom-[165px] xs:right-[30px] xs:max-w-[400px]
|
|
47
|
+
xs:max-h-[690px] xs:rounded-[30px]
|
|
48
|
+
lg:bottom-[110px]
|
|
49
|
+
`
|
|
50
|
+
}
|
|
52
51
|
|
|
53
52
|
|
|
54
53
|
`;
|
|
@@ -79,7 +78,6 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
|
|
|
79
78
|
<div className="relative ">
|
|
80
79
|
<div
|
|
81
80
|
className={`
|
|
82
|
-
flex justify-end
|
|
83
81
|
${isMobile ? `${mobileWrapperCss}` : `${webSmallWrapperCss} ${webTbPCWrapperCss} `}
|
|
84
82
|
|
|
85
83
|
`}
|
|
@@ -88,11 +86,12 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
|
|
|
88
86
|
<div
|
|
89
87
|
ref={containerRef}
|
|
90
88
|
className={`
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
relative z-[999998]
|
|
90
|
+
flex h-full flex-col items-center justify-end
|
|
93
91
|
${isMobile ? `${innerMobileWrapperCss}` : `${innerWebSmallWrapperCss} ${innerWebTbPCWrapperCss}`}
|
|
94
92
|
`}
|
|
95
93
|
>
|
|
94
|
+
{/* 여기서 보장해줘야하나? */}
|
|
96
95
|
<ChatHomeView hashValue={hashValue} isMobile={isMobile} isHash={isHash} onClose={onClose} />
|
|
97
96
|
</div>
|
|
98
97
|
</div>
|
|
@@ -14,9 +14,15 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
|
|
|
14
14
|
checkScroll();
|
|
15
15
|
}, [historyLit]);
|
|
16
16
|
const hasHistories = historyLit.length > 0;
|
|
17
|
-
return (<div className={`
|
|
17
|
+
return (<div className={`
|
|
18
|
+
no-scrollbar relative w-full rounded-t-[30px]
|
|
19
|
+
${isMobile
|
|
20
|
+
? ` flex h-[calc(100dvh-64px)] flex-col items-center justify-start `
|
|
21
|
+
: 'flex flex-col items-center xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ' +
|
|
22
|
+
' xs:max-h-[626px] xs:min-h-[320px] '}
|
|
23
|
+
`}>
|
|
18
24
|
{/* 헤더 */}
|
|
19
|
-
<div className={`flex h-[56px] items-center justify-between border-b border-gray-200 p-[16px]`}>
|
|
25
|
+
<div className={`sub_title top-0 z-10 flex h-[56px] w-full items-center justify-between border-b border-gray-200 p-[16px]`}>
|
|
20
26
|
<button className="flex h-7 w-7 items-center justify-center" aria-label="이전" onClick={onBackClick}>
|
|
21
27
|
<PrevIcon width={28} height={28}/>
|
|
22
28
|
</button>
|
|
@@ -66,7 +72,7 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
|
|
|
66
72
|
</>)}
|
|
67
73
|
|
|
68
74
|
{/* 새 문의하기 버튼 - 항상 하단에 고정 */}
|
|
69
|
-
{isAuthenticated && (<div className="flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
75
|
+
{isAuthenticated && (<div className="w-full flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
70
76
|
<button className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white" onClick={onNewChatClick}>
|
|
71
77
|
새 문의하기
|
|
72
78
|
<SendIcon width={24} height={24}/>
|
|
@@ -46,9 +46,21 @@ const HistoryView: React.FC<HistoryViewProps> = ({
|
|
|
46
46
|
const hasHistories = historyLit.length > 0;
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
|
-
<div
|
|
49
|
+
<div
|
|
50
|
+
className={`
|
|
51
|
+
no-scrollbar relative w-full rounded-t-[30px]
|
|
52
|
+
${
|
|
53
|
+
isMobile
|
|
54
|
+
? ` flex h-[calc(100dvh-64px)] flex-col items-center justify-start `
|
|
55
|
+
: 'flex flex-col items-center xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ' +
|
|
56
|
+
' xs:max-h-[626px] xs:min-h-[320px] '
|
|
57
|
+
}
|
|
58
|
+
`}
|
|
59
|
+
>
|
|
50
60
|
{/* 헤더 */}
|
|
51
|
-
<div
|
|
61
|
+
<div
|
|
62
|
+
className={`sub_title top-0 z-10 flex h-[56px] w-full items-center justify-between border-b border-gray-200 p-[16px]`}
|
|
63
|
+
>
|
|
52
64
|
<button className="flex h-7 w-7 items-center justify-center" aria-label="이전" onClick={onBackClick}>
|
|
53
65
|
<PrevIcon width={28} height={28} />
|
|
54
66
|
</button>
|
|
@@ -127,7 +139,7 @@ const HistoryView: React.FC<HistoryViewProps> = ({
|
|
|
127
139
|
|
|
128
140
|
{/* 새 문의하기 버튼 - 항상 하단에 고정 */}
|
|
129
141
|
{isAuthenticated && (
|
|
130
|
-
<div className="flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
142
|
+
<div className="w-full flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
131
143
|
<button
|
|
132
144
|
className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white"
|
|
133
145
|
onClick={onNewChatClick}
|