@daeryun/dr_components 0.8.78 → 0.8.79

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.
Files changed (38) hide show
  1. package/dist/asset/images/daeryuntalk/firstGo.svg +1 -1
  2. package/dist/asset/images/daeryuntalk/re_send.svg +11 -0
  3. package/dist/asset/images/daeryuntalk/viewer/gray-download.svg +1 -1
  4. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  5. package/dist/components/Daeryuntalk/ChatButton.jsx +1 -1
  6. package/dist/components/Daeryuntalk/ChatButton.tsx +1 -1
  7. package/dist/components/Daeryuntalk/ChatConversation.jsx +59 -94
  8. package/dist/components/Daeryuntalk/ChatConversation.tsx +58 -112
  9. package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.jsx +2 -2
  10. package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.tsx +2 -2
  11. package/dist/components/Daeryuntalk/ChatHomeView.jsx +11 -7
  12. package/dist/components/Daeryuntalk/ChatHomeView.tsx +13 -9
  13. package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +8 -8
  14. package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +8 -8
  15. package/dist/components/Daeryuntalk/ChatMessage.jsx +1 -1
  16. package/dist/components/Daeryuntalk/ChatMessage.tsx +3 -10
  17. package/dist/components/Daeryuntalk/ChatWidget.jsx +13 -12
  18. package/dist/components/Daeryuntalk/ChatWidget.tsx +15 -12
  19. package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +2 -1
  20. package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +2 -1
  21. package/dist/components/Daeryuntalk/HistoryView.jsx +4 -3
  22. package/dist/components/Daeryuntalk/HistoryView.tsx +3 -3
  23. package/dist/components/Daeryuntalk/HomeView.jsx +36 -21
  24. package/dist/components/Daeryuntalk/HomeView.tsx +37 -21
  25. package/dist/components/Daeryuntalk/NoticeMessage.jsx +5 -5
  26. package/dist/components/Daeryuntalk/NoticeMessage.tsx +10 -9
  27. package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +4 -4
  28. package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +6 -4
  29. package/dist/components/Daeryuntalk/Viewer/TbPcViewer.jsx +9 -6
  30. package/dist/components/Daeryuntalk/Viewer/TbPcViewer.tsx +17 -16
  31. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +2 -1
  32. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +10 -5
  33. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +9 -1
  34. package/dist/components/Daeryuntalk/index.jsx +12 -0
  35. package/dist/components/Daeryuntalk/index.tsx +13 -0
  36. package/dist/styles/globals.css +81 -27
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +1 -1
@@ -92,9 +92,9 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
92
92
  e.stopPropagation();
93
93
  await handleDownload(file);
94
94
  }}
95
- className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100"
95
+ 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"
96
96
  >
97
- <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-drTalkWhite" />
97
+ <FileDownLoadIcon className="h-[25px] w-[24px]" />
98
98
  </button>
99
99
  </div>
100
100
  );
@@ -127,9 +127,9 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
127
127
  await handleDownload(media.images[media.images.length - 1]);
128
128
  }
129
129
  }}
130
- className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100"
130
+ 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"
131
131
  >
132
- <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full text-drTalkGrayscale2 " />
132
+ <FileDownLoadIcon className="h-[25px] w-[24px]" />
133
133
  </button>
134
134
  </div>
135
135
  </div>
@@ -161,9 +161,9 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
161
161
  await handleDownload(media.images[0]);
162
162
  }
163
163
  }}
164
- className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100"
164
+ 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"
165
165
  >
166
- <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />
166
+ <FileDownLoadIcon className="h-[25px] w-[24px]" />
167
167
  </button>
168
168
  </div>
169
169
  </div>
@@ -204,9 +204,9 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
204
204
  e.stopPropagation();
205
205
  await handleDownload(file);
206
206
  }}
207
- className="flex h-[24px] w-[24px] items-center justify-center rounded-full"
207
+ className="flex h-[24px] w-[24px] items-center justify-center "
208
208
  >
209
- <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />
209
+ <FileDownLoadIcon className="h-[25px] w-[24px] bg-white" />
210
210
  </button>
211
211
  </div>
212
212
  </div>
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import React from 'react';
11
- import { hasBlocks, hasWorkFlowImg, hasCustomerWorkFlowClickData, hasForm, hasRichForm, hasFileArray } from './_types/message';
11
+ import { hasBlocks, hasCustomerWorkFlowClickData, hasFileArray, hasForm, hasRichForm, hasWorkFlowImg } from './_types/message';
12
12
  import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
13
13
  import { ObjectNumber, WorkFlowBackOrInit, WorkFlowButtonUiCode } from './_enums/work_flow_object_expose';
14
14
  import { MessageSenderType } from './_enums/sender_type';
@@ -1,22 +1,17 @@
1
1
  import React from 'react';
2
2
  import {
3
- Message,
4
- TextBlock,
5
3
  hasBlocks,
6
- hasWorkFlowImg,
7
4
  hasCustomerWorkFlowClickData,
5
+ hasFileArray,
8
6
  hasForm,
9
7
  hasRichForm,
10
- hasFiles,
11
- hasImages,
12
- hasFileArray
8
+ hasWorkFlowImg,
9
+ Message
13
10
  } from './_types/message';
14
11
  import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
15
12
  import { MessageObject } from './_types/message_object';
16
- import Image from 'next/image';
17
13
  import { ObjectNumber, WorkFlowBackOrInit, WorkFlowButtonUiCode } from './_enums/work_flow_object_expose';
18
14
  import { MessageSenderType } from './_enums/sender_type';
19
- import { useDaeryuntalk } from './DaeryuntalkContext';
20
15
  import ObjectButton from './ChatObject/ObjectButton';
21
16
  import ObjectBack from './ChatObject/ObjectBack';
22
17
  import WorkFlowClickData from './ChatItem/WorkFlowClickData';
@@ -25,9 +20,7 @@ import WorkFlowAuthForm from './ChatItem/WorkFlowAuthForm';
25
20
  import ChatWrapper from './ChatItem/ChatWrapper';
26
21
  import RichText from './ChatItem/RichText';
27
22
  import ChatFile from './ChatItem/ChatFile';
28
- import { getMessageFileDownloadUrl } from './_api';
29
23
  import FieldWorkObject from './ChatObject/FieldWorkObject';
30
- import { InquiryMessageTemplateType } from './_enums/template';
31
24
  import TimeWrapper from './ChatItem/TimeWrapper';
32
25
  import { InquiryStatus } from './_enums/ask-status';
33
26
 
@@ -19,24 +19,26 @@ const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
19
19
  bottom-0 right-0 h-[100dvh]
20
20
  `;
21
21
  // 해쉬 있을 경우는 여기서 중앙배치 css로
22
- const webTbPCWrapperCss = `
23
- ${isHash ? '' : 'duration-300 ease-in-out'}
24
- ${isHash ? '' : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
22
+ const webTbPCWrapperCss = `
23
+ ${isHash ? '' : 'xs:duration-300 ease-in-out'}
24
+ ${isHash
25
+ ? ''
26
+ : isOpen
27
+ ? 'opacity-100 pointer-events-auto xs:translate-y-0 xs:duration-500'
28
+ : 'opacity-0 pointer-events-none xs:translate-y-4 xs:duration-500 '}
25
29
  ${isHash
26
30
  ? `
27
31
  xs:fixed xs:flex xs:justify-center xs:items-center xs:inset-0 xs:bg-white
28
32
  xs:w-screen xs:h-[100dvh] xs:inset-0 xs:pt-[70px]
29
33
  `
30
- : `
31
- h-[100dvh]
32
- xs:bottom-[165px] xs:right-[30px] xs:max-w-[400px]
34
+ : `
35
+ h-[100dvh] ease-in-out
36
+ xs:bottom-[165px] xs:right-[25px] xs:max-w-[390px]
33
37
  xs:max-h-[690px] xs:rounded-[30px]
34
- lg:bottom-[110px]
35
- `}
36
-
37
-
38
+ lg:bottom-[100px]
39
+ `}
38
40
  `;
39
- // // // // //
41
+ //
40
42
  const innerMobileWrapperCss = `
41
43
  rounded-none sm:max-w-[640px] sm:m-auto
42
44
  `;
@@ -56,7 +58,6 @@ const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
56
58
  <div className="relative ">
57
59
  <div className={`
58
60
  ${isMobile ? `${mobileWrapperCss}` : `${webSmallWrapperCss} ${webTbPCWrapperCss} `}
59
-
60
61
  `}>
61
62
  {/* 여기서 외각 스크롤 생김 */}
62
63
  <div ref={containerRef} className={`
@@ -32,27 +32,31 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
32
32
  `;
33
33
 
34
34
  // 해쉬 있을 경우는 여기서 중앙배치 css로
35
- const webTbPCWrapperCss = `
36
- ${isHash ? '' : 'duration-300 ease-in-out'}
37
- ${isHash ? '' : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
35
+ const webTbPCWrapperCss = `
36
+ ${isHash ? '' : 'xs:duration-300 ease-in-out'}
37
+ ${
38
+ isHash
39
+ ? ''
40
+ : isOpen
41
+ ? 'opacity-100 pointer-events-auto xs:translate-y-0 xs:duration-500'
42
+ : 'opacity-0 pointer-events-none xs:translate-y-4 xs:duration-500 '
43
+ }
38
44
  ${
39
45
  isHash
40
46
  ? `
41
47
  xs:fixed xs:flex xs:justify-center xs:items-center xs:inset-0 xs:bg-white
42
48
  xs:w-screen xs:h-[100dvh] xs:inset-0 xs:pt-[70px]
43
49
  `
44
- : `
45
- h-[100dvh]
46
- xs:bottom-[165px] xs:right-[30px] xs:max-w-[400px]
50
+ : `
51
+ h-[100dvh] ease-in-out
52
+ xs:bottom-[165px] xs:right-[25px] xs:max-w-[390px]
47
53
  xs:max-h-[690px] xs:rounded-[30px]
48
- lg:bottom-[110px]
49
- `
54
+ lg:bottom-[100px]
55
+ `
50
56
  }
51
-
52
-
53
57
  `;
54
58
 
55
- // // // // //
59
+ //
56
60
  const innerMobileWrapperCss = `
57
61
  rounded-none sm:max-w-[640px] sm:m-auto
58
62
  `;
@@ -79,7 +83,6 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
79
83
  <div
80
84
  className={`
81
85
  ${isMobile ? `${mobileWrapperCss}` : `${webSmallWrapperCss} ${webTbPCWrapperCss} `}
82
-
83
86
  `}
84
87
  >
85
88
  {/* 여기서 외각 스크롤 생김 */}
@@ -88,7 +88,8 @@ export const DaeryuntalkProvider = ({ children, propsTel, isMobile }) => {
88
88
  setHistoryList,
89
89
  historyList,
90
90
  inquiryMainData,
91
- isMobile
91
+ isMobile,
92
+ setIsAuthenticated
92
93
  });
93
94
  // MSG15591497825895676
94
95
  // 채팅 관련
@@ -178,7 +178,8 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
178
178
  setHistoryList,
179
179
  historyList,
180
180
  inquiryMainData,
181
- isMobile
181
+ isMobile,
182
+ setIsAuthenticated
182
183
  });
183
184
 
184
185
  // MSG15591497825895676
@@ -9,6 +9,7 @@ import ShadowBox from './_ui/ShadowBox';
9
9
  import CloseSvgIcon from '../../asset/images/daeryuntalk/close.svg';
10
10
  import { formatTimestamp } from './_lib/utils';
11
11
  const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthenticated, historyLit, goGetHistoryList, isMobile, onClose, isHash, handleGoRequestPhone, handleGoHistoryPhoneAuth }) => {
12
+ var _a;
12
13
  const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
13
14
  useEffect(() => {
14
15
  checkScroll();
@@ -18,7 +19,7 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
18
19
  no-scrollbar relative w-full rounded-t-[30px]
19
20
  ${isMobile
20
21
  ? ` 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
+ : ' flex h-[calc(100dvh-64px)] flex-col items-center xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ' +
22
23
  ' xs:max-h-[626px] xs:min-h-[320px] '}
23
24
  `}>
24
25
  {/* 헤더 */}
@@ -36,9 +37,9 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
36
37
 
37
38
  {!isAuthenticated ? (<AuthForm goGetHistoryList={goGetHistoryList} handleGoRequestPhone={handleGoRequestPhone} handleGoHistoryPhoneAuth={handleGoHistoryPhoneAuth}/>) : (<>
38
39
  {/* 스크롤 가능한 컨텐츠 영역 */}
39
- <div className="relative flex-1 overflow-hidden">
40
+ <div className="relative w-full flex-1 overflow-hidden">
40
41
  <div ref={containerRef} className="no-scrollbar h-full overflow-y-auto px-[20px] pb-[20px] pt-[24px]">
41
- {hasHistories ? (historyLit === null || historyLit === void 0 ? void 0 : historyLit.map((history, index) => (<div key={`${history.chat_inquiry_number}-${index}`} className="cursor-pointer border-b border-drTalkGrayscale4 px-[12px] py-[18px] hover:bg-gray-50" onClick={() => onChatHistoryClick(history.chat_inquiry_number)}>
42
+ {hasHistories ? ((_a = historyLit.slice(0, 1)) === null || _a === void 0 ? void 0 : _a.map((history, index) => (<div key={`${history.chat_inquiry_number}-${index}`} className="cursor-pointer border-b border-drTalkGrayscale4 px-[12px] py-[18px] hover:bg-gray-50" onClick={() => onChatHistoryClick(history.chat_inquiry_number)}>
42
43
  <div className="flex items-center justify-between">
43
44
  <div className={`flex flex-row items-center gap-[10px]`}>
44
45
  <span className="dr_talk_subtitle_medium">{history.customer_name}</span>
@@ -52,7 +52,7 @@ const HistoryView: React.FC<HistoryViewProps> = ({
52
52
  ${
53
53
  isMobile
54
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)] ' +
55
+ : ' flex h-[calc(100dvh-64px)] flex-col items-center xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ' +
56
56
  ' xs:max-h-[626px] xs:min-h-[320px] '
57
57
  }
58
58
  `}
@@ -84,13 +84,13 @@ const HistoryView: React.FC<HistoryViewProps> = ({
84
84
  ) : (
85
85
  <>
86
86
  {/* 스크롤 가능한 컨텐츠 영역 */}
87
- <div className="relative flex-1 overflow-hidden">
87
+ <div className="relative w-full flex-1 overflow-hidden">
88
88
  <div
89
89
  ref={containerRef}
90
90
  className="no-scrollbar h-full overflow-y-auto px-[20px] pb-[20px] pt-[24px]"
91
91
  >
92
92
  {hasHistories ? (
93
- historyLit?.map((history, index) => (
93
+ historyLit.slice(0, 1)?.map((history, index) => (
94
94
  <div
95
95
  key={`${history.chat_inquiry_number}-${index}`}
96
96
  className="cursor-pointer border-b border-drTalkGrayscale4 px-[12px] py-[18px] hover:bg-gray-50"
@@ -15,8 +15,10 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
15
15
  const wrapperRef = useRef(null);
16
16
  const [contentHeight, setContentHeight] = useState(210);
17
17
  const currentHeightRef = useRef(210);
18
+ const prevWrapperHeightRef = useRef(null);
18
19
  useEffect(() => {
19
20
  const updateContentHeight = () => {
21
+ var _a;
20
22
  if (!wrapperRef.current)
21
23
  return;
22
24
  // 모바일이거나 width가 480px 미만이면 contentHeight를 210으로 되돌림
@@ -25,26 +27,37 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
25
27
  setContentHeight(210);
26
28
  return;
27
29
  }
28
- const rect = wrapperRef.current.getBoundingClientRect();
30
+ const rect = (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
29
31
  const gap = rect.top;
32
+ const wrapperHeight = wrapperRef.current.offsetHeight;
30
33
  const currentHeight = currentHeightRef.current;
34
+ // 이전 높이와 비교하여 줄어드는 중인지 판단
35
+ const prevHeight = prevWrapperHeightRef.current;
36
+ const isShrinking = prevHeight !== null && wrapperHeight < prevHeight;
37
+ const isExpanding = prevHeight !== null && wrapperHeight > prevHeight;
38
+ prevWrapperHeightRef.current = wrapperHeight; // 현재 높이를 저장
31
39
  // 줄어드는 애니메이션 (2단계)
32
- if (gap <= 1) {
40
+ if (isShrinking) {
33
41
  if (currentHeight > 140) {
34
- // 1단계: 210 → 140
35
- const next = Math.max(140, currentHeight - 6);
36
- currentHeightRef.current = next;
37
- setContentHeight(next);
42
+ if (wrapperHeight <= 625) {
43
+ // 1단계: 210 → 140
44
+ const next = Math.max(140, currentHeight - 6);
45
+ currentHeightRef.current = next;
46
+ setContentHeight(next);
47
+ }
38
48
  }
39
49
  else if (currentHeight > 80) {
50
+ // 여기에 height가 526 경우에만 가능
40
51
  // 2단계: 140 → 80
41
- const next = Math.max(80, currentHeight - 4);
42
- currentHeightRef.current = next;
43
- setContentHeight(next);
52
+ if (wrapperHeight <= 526) {
53
+ const next = Math.max(80, currentHeight - 4);
54
+ currentHeightRef.current = next;
55
+ setContentHeight(next);
56
+ }
44
57
  }
45
58
  }
46
59
  // 다시 늘어나는 애니메이션 (2단계)
47
- else if (gap > 1) {
60
+ else if (isExpanding) {
48
61
  if (currentHeight < 140) {
49
62
  // 1단계: 80 → 140
50
63
  const next = Math.min(140, currentHeight + 4);
@@ -52,10 +65,12 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
52
65
  setContentHeight(next);
53
66
  }
54
67
  else if (currentHeight < 210) {
55
- // 2단계: 140 → 210
56
- const next = Math.min(210, currentHeight + 6);
57
- currentHeightRef.current = next;
58
- setContentHeight(next);
68
+ if (wrapperHeight >= 526) {
69
+ // 2단계: 140 → 210
70
+ const next = Math.min(210, currentHeight + 6);
71
+ currentHeightRef.current = next;
72
+ setContentHeight(next);
73
+ }
59
74
  }
60
75
  }
61
76
  };
@@ -74,9 +89,9 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
74
89
  return (<div ref={wrapperRef} className={`
75
90
  no-scrollbar relative w-full rounded-t-[30px]
76
91
  ${isMobile
77
- ? 'flex h-[calc(100dvh-64px)] flex-col items-center justify-between '
78
- : 'flex h-[100vh] flex-col items-center justify-between xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ' +
79
- ' xs:max-h-[626px] xs:min-h-[320px] '}
92
+ ? ` flex h-[calc(100dvh-64px)] flex-col items-center justify-between `
93
+ : ` flex h-[100vh] flex-col items-center justify-between xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ` +
94
+ ` xs:max-h-[626px] xs:min-h-[320px] `}
80
95
  `}>
81
96
  <header className="z-10 flex h-[56px] w-full justify-between rounded-t-[30px] px-[20px]">
82
97
  <div className="dr_talk_subtitle_small flex items-center gap-[2px] pt-[31.5px] text-drTalkGrayscale1">
@@ -90,12 +105,12 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
90
105
 
91
106
  <div className="absolute left-0 top-0 z-0 h-full w-full overflow-hidden">
92
107
  <Image src={backgroundImage} alt="대화 배경" fill className={`${isMobile
93
- ? 'h-full max-h-[360px] w-full object-center will-change-transform'
94
- : 'w-full object-contain object-top will-change-transform'}`}/>
108
+ ? ' h-full max-h-[360px] w-full object-center will-change-transform '
109
+ : ` w-full object-contain object-top will-change-transform `}`}/>
95
110
  </div>
96
111
 
97
- <div className={`relative z-10 px-[20px] ${isMobile ? 'flex w-full justify-center' : 'flex h-full w-full flex-col justify-center'}`}>
98
- <section className={`flex flex-col rounded-[12px] bg-white px-[16px] py-[24px] ${isMobile ? 'w-full' : ''}`} style={{ boxShadow: '0px 4px 10px 0px #00000026' }}>
112
+ <div className={`relative z-10 px-[20px] ${isMobile ? 'flex w-full justify-center' : 'flex h-full w-full flex-col justify-center pb-[34px] xs:h-fit'}`}>
113
+ <section className={` flex flex-col rounded-[12px] bg-white px-[16px] py-[24px] ${isMobile ? 'w-full' : ''}`} style={{ boxShadow: '0px 4px 10px 0px #00000026' }}>
99
114
  {/* 해당 컴포넌트의 최상위 부모와 브라우저 상단과 닿았을 때 우선적으로 해당 부분의 높이가 먼저 줄어들게 하고 싶다*/}
100
115
  <div className="relative">
101
116
  <div ref={containerRef} className="no-scrollbar flex max-h-[210px] min-h-[80px] flex-col overflow-auto" style={{ maxHeight: `${contentHeight}px` }}>
@@ -29,6 +29,7 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
29
29
  const wrapperRef = useRef<HTMLDivElement | null>(null);
30
30
  const [contentHeight, setContentHeight] = useState(210);
31
31
  const currentHeightRef = useRef(210);
32
+ const prevWrapperHeightRef = useRef<number | null>(null);
32
33
 
33
34
  useEffect(() => {
34
35
  const updateContentHeight = () => {
@@ -41,37 +42,52 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
41
42
  return;
42
43
  }
43
44
 
44
- const rect = wrapperRef.current.getBoundingClientRect();
45
+ const rect = wrapperRef.current?.getBoundingClientRect();
45
46
  const gap = rect.top;
47
+ const wrapperHeight = wrapperRef.current.offsetHeight;
46
48
 
47
49
  const currentHeight = currentHeightRef.current;
48
50
 
51
+ // 이전 높이와 비교하여 줄어드는 중인지 판단
52
+ const prevHeight = prevWrapperHeightRef.current;
53
+ const isShrinking = prevHeight !== null && wrapperHeight < prevHeight;
54
+ const isExpanding = prevHeight !== null && wrapperHeight > prevHeight;
55
+
56
+ prevWrapperHeightRef.current = wrapperHeight; // 현재 높이를 저장
57
+
49
58
  // 줄어드는 애니메이션 (2단계)
50
- if (gap <= 1) {
59
+ if (isShrinking) {
51
60
  if (currentHeight > 140) {
52
- // 1단계: 210 → 140
53
- const next = Math.max(140, currentHeight - 6);
54
- currentHeightRef.current = next;
55
- setContentHeight(next);
61
+ if (wrapperHeight <= 625) {
62
+ // 1단계: 210 → 140
63
+ const next = Math.max(140, currentHeight - 6);
64
+ currentHeightRef.current = next;
65
+ setContentHeight(next);
66
+ }
56
67
  } else if (currentHeight > 80) {
68
+ // 여기에 height가 526 경우에만 가능
57
69
  // 2단계: 140 → 80
58
- const next = Math.max(80, currentHeight - 4);
59
- currentHeightRef.current = next;
60
- setContentHeight(next);
70
+ if (wrapperHeight <= 526) {
71
+ const next = Math.max(80, currentHeight - 4);
72
+ currentHeightRef.current = next;
73
+ setContentHeight(next);
74
+ }
61
75
  }
62
76
  }
63
77
  // 다시 늘어나는 애니메이션 (2단계)
64
- else if (gap > 1) {
78
+ else if (isExpanding) {
65
79
  if (currentHeight < 140) {
66
80
  // 1단계: 80 → 140
67
81
  const next = Math.min(140, currentHeight + 4);
68
82
  currentHeightRef.current = next;
69
83
  setContentHeight(next);
70
84
  } else if (currentHeight < 210) {
71
- // 2단계: 140 → 210
72
- const next = Math.min(210, currentHeight + 6);
73
- currentHeightRef.current = next;
74
- setContentHeight(next);
85
+ if (wrapperHeight >= 526) {
86
+ // 2단계: 140 → 210
87
+ const next = Math.min(210, currentHeight + 6);
88
+ currentHeightRef.current = next;
89
+ setContentHeight(next);
90
+ }
75
91
  }
76
92
  }
77
93
  };
@@ -98,9 +114,9 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
98
114
  no-scrollbar relative w-full rounded-t-[30px]
99
115
  ${
100
116
  isMobile
101
- ? 'flex h-[calc(100dvh-64px)] flex-col items-center justify-between '
102
- : 'flex h-[100vh] flex-col items-center justify-between xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ' +
103
- ' xs:max-h-[626px] xs:min-h-[320px] '
117
+ ? ` flex h-[calc(100dvh-64px)] flex-col items-center justify-between `
118
+ : ` flex h-[100vh] flex-col items-center justify-between xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ` +
119
+ ` xs:max-h-[626px] xs:min-h-[320px] `
104
120
  }
105
121
  `}
106
122
  >
@@ -124,17 +140,17 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
124
140
  fill
125
141
  className={`${
126
142
  isMobile
127
- ? 'h-full max-h-[360px] w-full object-center will-change-transform'
128
- : 'w-full object-contain object-top will-change-transform'
143
+ ? ' h-full max-h-[360px] w-full object-center will-change-transform '
144
+ : ` w-full object-contain object-top will-change-transform `
129
145
  }`}
130
146
  />
131
147
  </div>
132
148
 
133
149
  <div
134
- className={`relative z-10 px-[20px] ${isMobile ? 'flex w-full justify-center' : 'flex h-full w-full flex-col justify-center'}`}
150
+ className={`relative z-10 px-[20px] ${isMobile ? 'flex w-full justify-center' : 'flex h-full w-full flex-col justify-center pb-[34px] xs:h-fit'}`}
135
151
  >
136
152
  <section
137
- className={`flex flex-col rounded-[12px] bg-white px-[16px] py-[24px] ${isMobile ? 'w-full' : ''}`}
153
+ className={` flex flex-col rounded-[12px] bg-white px-[16px] py-[24px] ${isMobile ? 'w-full' : ''}`}
138
154
  style={{ boxShadow: '0px 4px 10px 0px #00000026' }}
139
155
  >
140
156
  {/* 해당 컴포넌트의 최상위 부모와 브라우저 상단과 닿았을 때 우선적으로 해당 부분의 높이가 먼저 줄어들게 하고 싶다*/}
@@ -3,22 +3,22 @@ import NoticeIcon from '../../asset/images/daeryuntalk/notice.svg';
3
3
  import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
4
4
  const NoticeMessage = ({ content, isMobile }) => {
5
5
  const [isExpanded, setIsExpanded] = useState(false);
6
- return (<div className={`bg-[#F7F7F7]/90 px-[20px] pb-[12px] pt-[8px] backdrop-blur-[4px]`}>
6
+ return (<button type={'button'} onClick={() => setIsExpanded(!isExpanded)} className={`bg-[#F7F7F7]/90 px-[20px] pb-[12px] pt-[8px] backdrop-blur-[4px]`} aria-label={isExpanded ? '접기' : '펼치기'}>
7
7
  <div className="flex items-start gap-[8px]">
8
8
  <div className="flex-shrink-0">
9
9
  <NoticeIcon width={24} height={24}/>
10
10
  </div>
11
11
  <div className="">
12
- <div className={`dr_talk_body_medium2 overflow-hidden pt-[0.5px] ${isExpanded ? '' : 'line-clamp-2'}`}>
12
+ <div className={`dr_talk_body_medium2 overflow-hidden whitespace-pre-line break-words pt-[0.5px] text-left ${isExpanded ? '' : 'line-clamp-2'}`}>
13
13
  {content}
14
14
  </div>
15
15
  </div>
16
- <button onClick={() => setIsExpanded(!isExpanded)} className="ml-1 flex-shrink-0 transform transition-transform duration-200" aria-label={isExpanded ? '접기' : '펼치기'}>
16
+ <div className="ml-1 flex-shrink-0 transform transition-transform duration-200">
17
17
  <div className={`transform transition-transform duration-200 ${isExpanded ? 'rotate-90' : '-rotate-90'}`}>
18
18
  <PrevIcon width={24} height={24}/>
19
19
  </div>
20
- </button>
20
+ </div>
21
21
  </div>
22
- </div>);
22
+ </button>);
23
23
  };
24
24
  export default NoticeMessage;
@@ -12,31 +12,32 @@ const NoticeMessage: React.FC<NoticeMessageProps> = ({ content, isMobile }) => {
12
12
  const [isExpanded, setIsExpanded] = useState(false);
13
13
 
14
14
  return (
15
- <div className={`bg-[#F7F7F7]/90 px-[20px] pb-[12px] pt-[8px] backdrop-blur-[4px]`}>
15
+ <button
16
+ type={'button'}
17
+ onClick={() => setIsExpanded(!isExpanded)}
18
+ className={`bg-[#F7F7F7]/90 px-[20px] pb-[12px] pt-[8px] backdrop-blur-[4px]`}
19
+ aria-label={isExpanded ? '접기' : '펼치기'}
20
+ >
16
21
  <div className="flex items-start gap-[8px]">
17
22
  <div className="flex-shrink-0">
18
23
  <NoticeIcon width={24} height={24} />
19
24
  </div>
20
25
  <div className="">
21
26
  <div
22
- className={`dr_talk_body_medium2 overflow-hidden pt-[0.5px] ${isExpanded ? '' : 'line-clamp-2'}`}
27
+ className={`dr_talk_body_medium2 overflow-hidden whitespace-pre-line break-words pt-[0.5px] text-left ${isExpanded ? '' : 'line-clamp-2'}`}
23
28
  >
24
29
  {content}
25
30
  </div>
26
31
  </div>
27
- <button
28
- onClick={() => setIsExpanded(!isExpanded)}
29
- className="ml-1 flex-shrink-0 transform transition-transform duration-200"
30
- aria-label={isExpanded ? '접기' : '펼치기'}
31
- >
32
+ <div className="ml-1 flex-shrink-0 transform transition-transform duration-200">
32
33
  <div
33
34
  className={`transform transition-transform duration-200 ${isExpanded ? 'rotate-90' : '-rotate-90'}`}
34
35
  >
35
36
  <PrevIcon width={24} height={24} />
36
37
  </div>
37
- </button>
38
+ </div>
38
39
  </div>
39
- </div>
40
+ </button>
40
41
  );
41
42
  };
42
43
 
@@ -39,12 +39,12 @@ const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력하세
39
39
  class: `dr_talk_body_medium2 focus:outline-none min-h-[36px] max-h-[72px] overflow-y-auto resize-none pt-[6px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere no-scrollbar `
40
40
  },
41
41
  handleKeyDown: (view, event) => {
42
+ const isMobile = /Mobi|Android/i.test(navigator.userAgent); // 모바일 여부 판별
42
43
  if (event.key === 'Enter') {
43
- if (event.shiftKey) {
44
- // Shift+Enter: 줄바꿈 (hard break) 삽입
44
+ if (event.shiftKey || isMobile) {
45
+ // Shift+Enter 또는 모바일 Enter는 줄바꿈
45
46
  if (editor) {
46
47
  editor.commands.setHardBreak();
47
- // 줄바꿈 이후 스크롤 이동 보장
48
48
  requestAnimationFrame(() => {
49
49
  if (view && view.dom) {
50
50
  view.dom.scrollTop = view.dom.scrollHeight;
@@ -54,7 +54,7 @@ const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력하세
54
54
  return true; // 기본 동작 방지
55
55
  }
56
56
  else {
57
- // Enter: 메시지 전송
57
+ // 데스크탑에서의 일반 Enter는 메시지 전송
58
58
  event.preventDefault();
59
59
  const content = editor === null || editor === void 0 ? void 0 : editor.getText();
60
60
  if (content && content.trim() && onEnterKeyPress) {
@@ -60,12 +60,14 @@ const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
60
60
  class: `dr_talk_body_medium2 focus:outline-none min-h-[36px] max-h-[72px] overflow-y-auto resize-none pt-[6px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere no-scrollbar `
61
61
  },
62
62
  handleKeyDown: (view, event) => {
63
+ const isMobile = /Mobi|Android/i.test(navigator.userAgent); // 모바일 여부 판별
64
+
63
65
  if (event.key === 'Enter') {
64
- if (event.shiftKey) {
65
- // Shift+Enter: 줄바꿈 (hard break) 삽입
66
+ if (event.shiftKey || isMobile) {
67
+ // Shift+Enter 또는 모바일 Enter는 줄바꿈
66
68
  if (editor) {
67
69
  editor.commands.setHardBreak();
68
- // 줄바꿈 이후 스크롤 이동 보장
70
+
69
71
  requestAnimationFrame(() => {
70
72
  if (view && view.dom) {
71
73
  view.dom.scrollTop = view.dom.scrollHeight;
@@ -74,7 +76,7 @@ const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
74
76
  }
75
77
  return true; // 기본 동작 방지
76
78
  } else {
77
- // Enter: 메시지 전송
79
+ // 데스크탑에서의 일반 Enter는 메시지 전송
78
80
  event.preventDefault();
79
81
  const content = editor?.getText();
80
82
  if (content && content.trim() && onEnterKeyPress) {