Spaces:
Sleeping

axeronis commited on
Commit
65ad247
·
1 Parent(s): a2b2ffe

fix(ux): optimize mobile performance and fix image viewer touch

Browse files
frontend/components/ChatWindow.tsx CHANGED
@@ -414,7 +414,7 @@ export function ChatWindow({
414
 
415
  {/* Messages Area */}
416
  <div
417
- className="flex-1 overflow-y-auto px-4 md:px-6 space-y-6 scrollbar-thin scrollbar-thumb-white/10 overscroll-contain isolation-auto"
418
  style={{
419
  WebkitOverflowScrolling: 'touch',
420
  }}
 
414
 
415
  {/* Messages Area */}
416
  <div
417
+ className="flex-1 overflow-y-auto px-4 md:px-6 space-y-6 scrollbar-thin scrollbar-thumb-white/10"
418
  style={{
419
  WebkitOverflowScrolling: 'touch',
420
  }}
frontend/components/ChatWindow/MessageBubble.tsx CHANGED
@@ -100,12 +100,25 @@ function MediaContent({ message, isMe, onImageClick }: { message: Message; isMe:
100
  if (mediaType.includes('image')) {
101
  return (
102
  <div className="mt-2">
103
- <img
104
- src={message.media_url}
105
- alt={message.media_name || 'Image'}
106
- className="rounded-xl max-w-full max-h-64 object-cover cursor-pointer hover:opacity-90 transition-opacity"
107
- onClick={() => onImageClick?.(message.media_url!, message.media_name || 'Image')}
108
- />
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  </div>
110
  )
111
  }
@@ -226,10 +239,7 @@ export function MessageBubble({
226
  </div>
227
  )}
228
 
229
- <motion.div
230
- initial={{ opacity: 0, y: 10 }}
231
- animate={{ opacity: 1, y: 0 }}
232
- transition={{ duration: 0.3 }}
233
  className={cn(
234
  "flex w-full max-w-3xl mx-auto group relative",
235
  isMe ? "justify-end" : "justify-start",
@@ -318,7 +328,7 @@ export function MessageBubble({
318
  </div>
319
  </>
320
  )}
321
- </motion.div>
322
  </div>
323
  )
324
  }
 
100
  if (mediaType.includes('image')) {
101
  return (
102
  <div className="mt-2">
103
+ <button
104
+ type="button"
105
+ className="block w-full text-left rounded-xl overflow-hidden cursor-pointer hover:opacity-90 transition-opacity"
106
+ onPointerDown={(e) => {
107
+ // PointerDown catches earlier on mobile
108
+ e.stopPropagation();
109
+ onImageClick?.(message.media_url!, message.media_name || 'Image');
110
+ }}
111
+ onClick={(e) => {
112
+ e.stopPropagation();
113
+ e.preventDefault();
114
+ }}
115
+ >
116
+ <img
117
+ src={message.media_url}
118
+ alt={message.media_name || 'Image'}
119
+ className="w-full max-h-64 object-cover"
120
+ />
121
+ </button>
122
  </div>
123
  )
124
  }
 
239
  </div>
240
  )}
241
 
242
+ <div
 
 
 
243
  className={cn(
244
  "flex w-full max-w-3xl mx-auto group relative",
245
  isMe ? "justify-end" : "justify-start",
 
328
  </div>
329
  </>
330
  )}
331
+ </div>
332
  </div>
333
  )
334
  }