Spaces:
Running
Running
axeronis commited on
Commit ·
c5525ab
1
Parent(s): 5f8e071
fix: Consistent premium summary drawer UI across all mobile views
Browse files
frontend/components/ChatWindow.tsx
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
|
| 3 |
import { useState, useRef, useEffect } from 'react'
|
| 4 |
import { Message, Lead, leadsApi } from '@/lib/api'
|
| 5 |
-
import { Bot, Loader2, X
|
| 6 |
-
import { AnimatePresence } from 'framer-motion'
|
| 7 |
import { useToast } from '@/contexts/ToastContext'
|
| 8 |
|
| 9 |
import { ClientCard } from './ClientCard'
|
|
@@ -160,6 +160,16 @@ export function ChatWindow({
|
|
| 160 |
}
|
| 161 |
})
|
| 162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
// ============================================================================
|
| 164 |
// Handlers
|
| 165 |
// ============================================================================
|
|
@@ -385,19 +395,36 @@ export function ChatWindow({
|
|
| 385 |
isSending={isSending}
|
| 386 |
/>
|
| 387 |
|
| 388 |
-
{/* Mobile Drawer */}
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
<
|
| 392 |
-
|
| 393 |
-
<div
|
| 394 |
-
|
| 395 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 396 |
</button>
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
<div className="h-full overflow-y-auto pb-20">
|
| 400 |
-
{lead && (
|
| 401 |
<ClientCard
|
| 402 |
lead={lead}
|
| 403 |
onTakeover={onTakeover || (() => { })}
|
|
@@ -406,11 +433,11 @@ export function ChatWindow({
|
|
| 406 |
conversationId={conversationId}
|
| 407 |
tenantId={tenantId}
|
| 408 |
/>
|
| 409 |
-
|
| 410 |
-
</div>
|
| 411 |
-
</
|
| 412 |
-
|
| 413 |
-
|
| 414 |
|
| 415 |
{/* Booking Modal */}
|
| 416 |
<AnimatePresence>
|
|
|
|
| 2 |
|
| 3 |
import { useState, useRef, useEffect } from 'react'
|
| 4 |
import { Message, Lead, leadsApi } from '@/lib/api'
|
| 5 |
+
import { Bot, Loader2, X } from 'lucide-react'
|
| 6 |
+
import { AnimatePresence, motion } from 'framer-motion'
|
| 7 |
import { useToast } from '@/contexts/ToastContext'
|
| 8 |
|
| 9 |
import { ClientCard } from './ClientCard'
|
|
|
|
| 160 |
}
|
| 161 |
})
|
| 162 |
|
| 163 |
+
// Lock scroll when mobile drawer is open
|
| 164 |
+
useEffect(() => {
|
| 165 |
+
if (isMobileDrawerOpen) {
|
| 166 |
+
document.body.style.overflow = 'hidden'
|
| 167 |
+
} else {
|
| 168 |
+
document.body.style.overflow = ''
|
| 169 |
+
}
|
| 170 |
+
return () => { document.body.style.overflow = '' }
|
| 171 |
+
}, [isMobileDrawerOpen])
|
| 172 |
+
|
| 173 |
// ============================================================================
|
| 174 |
// Handlers
|
| 175 |
// ============================================================================
|
|
|
|
| 395 |
isSending={isSending}
|
| 396 |
/>
|
| 397 |
|
| 398 |
+
{/* Mobile Drawer (AI Summary Intelligence) */}
|
| 399 |
+
<AnimatePresence>
|
| 400 |
+
{isMobileDrawerOpen && lead && (
|
| 401 |
+
<>
|
| 402 |
+
{/* Backdrop */}
|
| 403 |
+
<motion.div
|
| 404 |
+
initial={{ opacity: 0 }}
|
| 405 |
+
animate={{ opacity: 1 }}
|
| 406 |
+
exit={{ opacity: 0 }}
|
| 407 |
+
onClick={() => setIsMobileDrawerOpen(false)}
|
| 408 |
+
className="md:hidden fixed inset-0 top-16 bottom-[72px] bg-black/50 z-[100]"
|
| 409 |
+
/>
|
| 410 |
+
|
| 411 |
+
{/* Floating Sheet */}
|
| 412 |
+
<motion.div
|
| 413 |
+
initial={{ x: '100%', opacity: 0 }}
|
| 414 |
+
animate={{ x: 0, opacity: 1 }}
|
| 415 |
+
exit={{ x: '100%', opacity: 0 }}
|
| 416 |
+
transition={{ type: 'spring', damping: 25, stiffness: 200 }}
|
| 417 |
+
className="md:hidden fixed left-3 right-3 top-[72px] bottom-[80px] bg-[#0D0E18] border border-white/10 z-[101] flex flex-col shadow-[0_0_50px_rgba(0,0,0,0.5)] rounded-[32px] overflow-hidden"
|
| 418 |
+
>
|
| 419 |
+
{/* Floating Close Button */}
|
| 420 |
+
<button
|
| 421 |
+
onClick={() => setIsMobileDrawerOpen(false)}
|
| 422 |
+
className="absolute top-4 right-4 z-[110] p-2 bg-white/5 hover:bg-white/10 rounded-full text-slate-400 hover:text-white transition-all backdrop-blur-md border border-white/5 shadow-xl"
|
| 423 |
+
>
|
| 424 |
+
<X className="w-5 h-5" />
|
| 425 |
</button>
|
| 426 |
+
|
| 427 |
+
<div className="flex-1 min-h-0">
|
|
|
|
|
|
|
| 428 |
<ClientCard
|
| 429 |
lead={lead}
|
| 430 |
onTakeover={onTakeover || (() => { })}
|
|
|
|
| 433 |
conversationId={conversationId}
|
| 434 |
tenantId={tenantId}
|
| 435 |
/>
|
| 436 |
+
</div>
|
| 437 |
+
</motion.div>
|
| 438 |
+
</>
|
| 439 |
+
)}
|
| 440 |
+
</AnimatePresence>
|
| 441 |
|
| 442 |
{/* Booking Modal */}
|
| 443 |
<AnimatePresence>
|