Spaces:
Running

axeronis commited on
Commit
315a354
·
1 Parent(s): ef12a34

fix: Fluid swipe-to-close and background scroll lock stability in ChatWindow

Browse files
Files changed (1) hide show
  1. frontend/components/ChatWindow.tsx +8 -6
frontend/components/ChatWindow.tsx CHANGED
@@ -436,19 +436,21 @@ export function ChatWindow({
436
  {/* Floating Sheet */}
437
  <motion.div
438
  drag="x"
439
- dragConstraints={{ left: 0, right: 300 }}
440
- dragElastic={0.05}
441
  onDragEnd={(_, info) => {
442
- if (info.offset.x > 80 || info.velocity.x > 300) {
443
  setIsMobileDrawerOpen(false)
444
  }
445
  }}
446
  initial={{ x: '100%' }}
447
  animate={{ x: 0 }}
448
  exit={{ x: '100%' }}
449
- transition={{ type: 'spring', damping: 25, stiffness: 200 }}
450
- className="md:hidden fixed right-0 top-16 bottom-14 w-[92%] sm:w-80 bg-[#0D0E18] border-l border-white/10 z-[101] flex flex-col shadow-[0_0_50px_rgba(0,0,0,0.5)] rounded-l-[32px] overflow-hidden"
451
  >
 
 
452
  {/* Floating Close Button */}
453
  <button
454
  onClick={() => setIsMobileDrawerOpen(false)}
@@ -457,7 +459,7 @@ export function ChatWindow({
457
  <X className="w-5 h-5" />
458
  </button>
459
 
460
- <div className="flex-1 min-h-0">
461
  <ClientCard
462
  lead={lead}
463
  onTakeover={onTakeover || (() => { })}
 
436
  {/* Floating Sheet */}
437
  <motion.div
438
  drag="x"
439
+ dragConstraints={{ left: 0, right: 0 }}
440
+ dragElastic={{ left: 0, right: 0.5 }}
441
  onDragEnd={(_, info) => {
442
+ if (info.offset.x > 50 || info.velocity.x > 200) {
443
  setIsMobileDrawerOpen(false)
444
  }
445
  }}
446
  initial={{ x: '100%' }}
447
  animate={{ x: 0 }}
448
  exit={{ x: '100%' }}
449
+ transition={{ type: 'spring', damping: 28, stiffness: 220, mass: 0.8 }}
450
+ className="md:hidden fixed right-0 top-16 bottom-14 w-[92%] sm:w-80 bg-[#0D0E18] border-l border-white/10 z-[101] flex flex-col shadow-[0_0_50px_rgba(0,0,0,0.5)] rounded-l-[32px] overflow-hidden touch-none"
451
  >
452
+ <div className="absolute top-2 left-1/2 -translate-x-1/2 w-8 h-1 bg-white/10 rounded-full z-50" />
453
+
454
  {/* Floating Close Button */}
455
  <button
456
  onClick={() => setIsMobileDrawerOpen(false)}
 
459
  <X className="w-5 h-5" />
460
  </button>
461
 
462
+ <div className="flex-1 min-h-0 pt-4">
463
  <ClientCard
464
  lead={lead}
465
  onTakeover={onTakeover || (() => { })}