@messenger-box/tailwind-ui-inbox 10.0.3-alpha.70 → 10.0.3-alpha.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.
@@ -8,6 +8,8 @@ interface SlackLikeMessageGroupProps {
8
8
  currentUser: IAuthUser;
9
9
  onOpen: (element?: any) => void;
10
10
  onMessageClick: (msg: IPost) => void;
11
+ isDesktopView?: boolean;
12
+ isSmallScreen?: boolean;
11
13
  }
12
14
 
13
15
  interface MessageGroupProps {
@@ -16,6 +18,8 @@ interface MessageGroupProps {
16
18
  currentUser: IAuthUser;
17
19
  onOpen: (element?: any) => void;
18
20
  onMessageClick: (msg: IPost) => void;
21
+ isDesktopView?: boolean;
22
+ isSmallScreen?: boolean;
19
23
  }
20
24
 
21
25
  // Utility function to group messages by user and time
@@ -53,7 +57,15 @@ export const groupMessagesByUserAndTime = (messages: IPost[], timeThresholdMinut
53
57
  return groups;
54
58
  };
55
59
 
56
- const MessageGroup: React.FC<MessageGroupProps> = ({ author, messages, currentUser, onOpen, onMessageClick }) => {
60
+ const MessageGroup: React.FC<MessageGroupProps> = ({
61
+ author,
62
+ messages,
63
+ currentUser,
64
+ onOpen,
65
+ onMessageClick,
66
+ isDesktopView = false,
67
+ isSmallScreen = false,
68
+ }) => {
57
69
  const isOwnMessage = author?.id === currentUser?.id;
58
70
  const authorName =
59
71
  author?.givenName && author?.familyName
@@ -67,12 +79,22 @@ const MessageGroup: React.FC<MessageGroupProps> = ({ author, messages, currentUs
67
79
  };
68
80
 
69
81
  return (
70
- <div className="mb-1 group hover:bg-white hover:bg-opacity-60 -mx-4 px-4 py-1 rounded transition-colors">
71
- <div className="flex items-start space-x-2">
82
+ <div
83
+ className={`group hover:bg-white hover:bg-opacity-60 rounded transition-colors ${
84
+ isDesktopView ? 'mb-8 -mx-6 px-6 py-4' : isSmallScreen ? 'mb-4 -mx-2 px-2 py-2' : 'mb-6 -mx-4 px-4 py-3'
85
+ }`}
86
+ >
87
+ <div
88
+ className={`flex items-start ${
89
+ isDesktopView ? 'space-x-4' : isSmallScreen ? 'space-x-2' : 'space-x-3'
90
+ }`}
91
+ >
72
92
  {/* Avatar - show for all messages */}
73
93
  <div className="flex-shrink-0 mt-0.5">
74
94
  <img
75
- className="w-9 h-9 rounded-lg cursor-pointer hover:opacity-80 transition-opacity"
95
+ className={`rounded-lg cursor-pointer hover:opacity-80 transition-opacity ${
96
+ isDesktopView ? 'w-12 h-12' : isSmallScreen ? 'w-8 h-8' : 'w-10 h-10'
97
+ }`}
76
98
  src={author?.picture || '/default-avatar.svg'}
77
99
  alt={authorName}
78
100
  onClick={() => onOpen(firstMessage)}
@@ -82,16 +104,18 @@ const MessageGroup: React.FC<MessageGroupProps> = ({ author, messages, currentUs
82
104
  />
83
105
  </div>
84
106
 
85
- <div className="flex-1 min-w-0">
107
+ <div className="flex-1 min-w-0 overflow-hidden">
86
108
  {/* Author name and timestamp - show for all messages */}
87
109
  <div className="flex items-center space-x-2 mb-1">
88
- <span className="text-sm font-bold text-gray-900">{authorName}</span>
89
- <span className="text-xs text-gray-500">{formatTime(firstMessage.createdAt)}</span>
90
- {isOwnMessage && <span className="text-xs text-gray-400 italic">(you)</span>}
110
+ <span className="text-sm font-semibold text-gray-900 truncate">{authorName}</span>
111
+ <span className="text-xs text-gray-500 flex-shrink-0">
112
+ {formatTime(firstMessage.createdAt)}
113
+ </span>
114
+ {isOwnMessage && <span className="text-xs text-gray-400 italic flex-shrink-0">(you)</span>}
91
115
  </div>
92
116
 
93
117
  {/* Messages in the group - single line for each message */}
94
- <div className="space-y-1">
118
+ <div className="space-y-0.5">
95
119
  {messages.map((message, index) => (
96
120
  <MessageBubble
97
121
  key={message.id}
@@ -142,23 +166,27 @@ const MessageBubble: React.FC<MessageBubbleProps> = ({
142
166
 
143
167
  // All messages use the same format (Slack style - left aligned)
144
168
  return (
145
- <div className="py-0.5 hover:bg-gray-50 hover:bg-opacity-50 rounded px-1 -mx-1 group">
146
- <div className="text-sm text-gray-900 cursor-pointer hover:bg-gray-100 px-1 rounded" onClick={handleClick}>
169
+ <div className="py-1 hover:bg-gray-50 hover:bg-opacity-50 rounded px-1 sm:px-2 -mx-1 sm:-mx-2 group relative">
170
+ <div
171
+ className="text-sm text-gray-900 cursor-pointer hover:bg-gray-100 px-1 sm:px-2 py-1 rounded"
172
+ onClick={handleClick}
173
+ >
147
174
  {/* Show timestamp on hover */}
148
- <span className="text-xs text-gray-500 opacity-0 group-hover:opacity-100 transition-opacity float-right ml-2">
175
+ <span className="text-xs text-gray-500 opacity-0 group-hover:opacity-100 transition-opacity absolute right-1 sm:right-2 top-1">
149
176
  {formatTime(message.createdAt)}
150
177
  </span>
151
178
 
152
179
  {message.message && (
153
- <span className="whitespace-pre-wrap break-words leading-relaxed">{message.message}</span>
180
+ <div className="whitespace-pre-wrap break-words leading-relaxed pr-12 sm:pr-16">
181
+ {message.message}
182
+ </div>
154
183
  )}
155
184
 
156
185
  {message.files?.totalCount > 0 && (
157
- <div className="mt-1 clear-both">
186
+ <div className="mt-2 pr-12 sm:pr-16">
158
187
  <FilesList uploaded files={message.files.data} />
159
188
  </div>
160
189
  )}
161
- <div className={`${navigator.userAgent.includes('Firefox') ? 'mt-1' : ''} clear-both`}></div>
162
190
 
163
191
  {/* Show delivery status for own messages */}
164
192
  {/* {isOwnMessage && message.isDelivered !== undefined && (
@@ -181,6 +209,8 @@ export const SlackLikeMessageGroup: React.FC<SlackLikeMessageGroupProps> = ({
181
209
  currentUser,
182
210
  onOpen,
183
211
  onMessageClick,
212
+ isDesktopView = false,
213
+ isSmallScreen = false,
184
214
  }) => {
185
215
  // Filter out non-message items (like date strings)
186
216
  const actualMessages = messages.filter((msg) => typeof msg !== 'string') as IPost[];
@@ -189,7 +219,7 @@ export const SlackLikeMessageGroup: React.FC<SlackLikeMessageGroupProps> = ({
189
219
  const messageGroups = groupMessagesByUserAndTime(actualMessages);
190
220
 
191
221
  return (
192
- <div className="space-y-2">
222
+ <div className={`min-h-fit ${isDesktopView ? 'space-y-8' : isSmallScreen ? 'space-y-4' : 'space-y-6'}`}>
193
223
  {messageGroups.map((group, groupIndex) => {
194
224
  const author = group[0]?.author;
195
225
  return (
@@ -200,6 +230,8 @@ export const SlackLikeMessageGroup: React.FC<SlackLikeMessageGroupProps> = ({
200
230
  currentUser={currentUser}
201
231
  onOpen={onOpen}
202
232
  onMessageClick={onMessageClick}
233
+ isDesktopView={isDesktopView}
234
+ isSmallScreen={isSmallScreen}
203
235
  />
204
236
  );
205
237
  })}