Spaces:
Sleeping

axeronis commited on
Commit
33757b5
·
1 Parent(s): 66a0f3d

fix: resolve z-index collisions and optimize AI summary scroll performance via Portals and hardware acceleration

Browse files
frontend/app/chats/page.tsx CHANGED
@@ -326,7 +326,7 @@ function ChatsContent() {
326
  animate={{ opacity: 1 }}
327
  exit={{ opacity: 0 }}
328
  onClick={() => setIsSummaryOpen(false)}
329
- className="fixed inset-0 top-[128px] bottom-14 bg-black/50 backdrop-blur-sm z-40"
330
  />
331
 
332
  <motion.div
@@ -341,8 +341,9 @@ function ChatsContent() {
341
  initial={{ x: '100%', opacity: 0 }}
342
  animate={{ x: 0, opacity: 1 }}
343
  exit={{ x: '100%', opacity: 0 }}
344
- transition={{ type: 'spring', damping: 25, stiffness: 200 }}
345
- className="fixed right-0 top-[128px] bottom-14 w-[92%] sm:w-[380px] bg-[#0D0E18]/95 backdrop-blur-3xl border-l border-white/10 z-50 flex flex-col shadow-[0_0_50px_rgba(0,0,0,0.5)] rounded-l-[32px] overflow-hidden"
 
346
  >
347
  {/* Drag handle indicator */}
348
  <div className="absolute top-2 left-1/2 -translate-x-1/2 w-8 h-1 bg-white/10 rounded-full z-50" />
 
326
  animate={{ opacity: 1 }}
327
  exit={{ opacity: 0 }}
328
  onClick={() => setIsSummaryOpen(false)}
329
+ className="fixed inset-0 top-[128px] bottom-14 bg-black/40 backdrop-blur-md z-[60]"
330
  />
331
 
332
  <motion.div
 
341
  initial={{ x: '100%', opacity: 0 }}
342
  animate={{ x: 0, opacity: 1 }}
343
  exit={{ x: '100%', opacity: 0 }}
344
+ transition={{ type: 'spring', damping: 28, stiffness: 220, mass: 0.8 }}
345
+ className="fixed right-0 top-[128px] bottom-14 w-[92%] sm:w-[380px] bg-[#0D0E18]/95 backdrop-blur-xl border-l border-white/10 z-[70] flex flex-col shadow-[0_0_50px_rgba(0,0,0,0.5)] rounded-l-[32px] overflow-hidden"
346
+ style={{ willChange: 'transform', transform: 'translateZ(0)' }}
347
  >
348
  {/* Drag handle indicator */}
349
  <div className="absolute top-2 left-1/2 -translate-x-1/2 w-8 h-1 bg-white/10 rounded-full z-50" />
frontend/components/ClientCard.tsx CHANGED
@@ -184,7 +184,10 @@ export function ClientCard({ lead, onTakeover, isAnalyzing, onRefresh, conversat
184
  <div className="h-full flex flex-col bg-[#0D0E18] font-['Inter'] relative">
185
 
186
  {/* Content */}
187
- <div className="flex-1 overflow-y-auto p-5 space-y-5 scrollbar-thin scrollbar-thumb-white/10">
 
 
 
188
 
189
  {/* Header Title with Icon */}
190
  <div className="flex items-center gap-3 mb-2 p-1">
 
184
  <div className="h-full flex flex-col bg-[#0D0E18] font-['Inter'] relative">
185
 
186
  {/* Content */}
187
+ <div
188
+ className="flex-1 overflow-y-auto p-5 space-y-5 scrollbar-thin scrollbar-thumb-white/10"
189
+ style={{ willChange: 'transform, scroll-position', transform: 'translateZ(0)' }}
190
+ >
191
 
192
  {/* Header Title with Icon */}
193
  <div className="flex items-center gap-3 mb-2 p-1">
frontend/components/Header.tsx CHANGED
@@ -1,6 +1,7 @@
1
  'use client'
2
 
3
  import { useState, useEffect } from 'react'
 
4
  import { useAuth } from '@/contexts/AuthContext'
5
  import { LogOut, ChevronDown, Building2, Settings, User } from 'lucide-react'
6
  import { cn } from '@/lib/utils'
@@ -16,6 +17,11 @@ export function Header() {
16
  const { t } = useTranslation()
17
  const [companyName, setCompanyName] = useState<string | null>(null)
18
  const [showDropdown, setShowDropdown] = useState(false)
 
 
 
 
 
19
 
20
  useEffect(() => {
21
  const loadTenant = async () => {
@@ -111,14 +117,14 @@ export function Header() {
111
  <ChevronDown className="w-4 h-4 text-slate-400" />
112
  </button>
113
 
114
- {/* Dropdown Menu */}
115
- {showDropdown && (
116
  <>
117
  <div
118
- className="fixed inset-0 z-40"
119
  onClick={() => setShowDropdown(false)}
120
  />
121
- <div className="absolute right-0 top-full mt-2 w-56 bg-[#1E1F2E] border border-white/10 rounded-xl shadow-2xl z-50 overflow-hidden">
122
  <div className="p-3 border-b border-white/10">
123
  <p className="text-sm font-semibold text-white">{user?.full_name}</p>
124
  <p className="text-xs text-slate-500 mt-0.5">{user?.email}</p>
@@ -151,7 +157,8 @@ export function Header() {
151
  </button>
152
  </div>
153
  </div>
154
- </>
 
155
  )}
156
  </div>
157
  </div>
 
1
  'use client'
2
 
3
  import { useState, useEffect } from 'react'
4
+ import { createPortal } from 'react-dom'
5
  import { useAuth } from '@/contexts/AuthContext'
6
  import { LogOut, ChevronDown, Building2, Settings, User } from 'lucide-react'
7
  import { cn } from '@/lib/utils'
 
17
  const { t } = useTranslation()
18
  const [companyName, setCompanyName] = useState<string | null>(null)
19
  const [showDropdown, setShowDropdown] = useState(false)
20
+ const [mounted, setMounted] = useState(false)
21
+
22
+ useEffect(() => {
23
+ setMounted(true)
24
+ }, [])
25
 
26
  useEffect(() => {
27
  const loadTenant = async () => {
 
117
  <ChevronDown className="w-4 h-4 text-slate-400" />
118
  </button>
119
 
120
+ {/* Dropdown Menu - Portalled for perfect layering */}
121
+ {mounted && showDropdown && createPortal(
122
  <>
123
  <div
124
+ className="fixed inset-0 z-[900]"
125
  onClick={() => setShowDropdown(false)}
126
  />
127
+ <div className="fixed right-6 top-16 w-56 bg-[#1E1F2E]/95 backdrop-blur-3xl border border-white/10 rounded-xl shadow-2xl z-[901] overflow-hidden">
128
  <div className="p-3 border-b border-white/10">
129
  <p className="text-sm font-semibold text-white">{user?.full_name}</p>
130
  <p className="text-xs text-slate-500 mt-0.5">{user?.email}</p>
 
157
  </button>
158
  </div>
159
  </div>
160
+ </>,
161
+ document.body
162
  )}
163
  </div>
164
  </div>
frontend/components/LeadsList.tsx CHANGED
@@ -108,8 +108,8 @@ export function LeadsList({
108
  <>
109
  {/* Delete/Reset Confirmation Modal */}
110
  <AnimatePresence>
111
- {mounted && deleteModal && (
112
- <div className="fixed inset-0 z-[100] flex items-center justify-center p-4">
113
  {/* Backdrop */}
114
  <motion.div
115
  initial={{ opacity: 0 }}
@@ -194,7 +194,8 @@ export function LeadsList({
194
  {t('common.cancel')}
195
  </button>
196
  </motion.div>
197
- </div>
 
198
  )}
199
  </AnimatePresence>
200
 
 
108
  <>
109
  {/* Delete/Reset Confirmation Modal */}
110
  <AnimatePresence>
111
+ {mounted && deleteModal && createPortal(
112
+ <div className="fixed inset-0 z-[1000] flex items-center justify-center p-4">
113
  {/* Backdrop */}
114
  <motion.div
115
  initial={{ opacity: 0 }}
 
194
  {t('common.cancel')}
195
  </button>
196
  </motion.div>
197
+ </div>,
198
+ document.body
199
  )}
200
  </AnimatePresence>
201
 
frontend/components/ui/ConfirmModal.tsx CHANGED
@@ -1,6 +1,7 @@
1
  'use client'
2
 
3
  import { motion, AnimatePresence } from 'framer-motion'
 
4
  import { AlertCircle, X, Check, Loader2 } from 'lucide-react'
5
  import { cn } from '@/lib/utils'
6
 
@@ -27,10 +28,12 @@ export function ConfirmModal({
27
  isLoading = false,
28
  variant = 'primary'
29
  }: ConfirmModalProps) {
30
- return (
 
 
31
  <AnimatePresence>
32
  {isOpen && (
33
- <div className="fixed inset-0 z-[999] flex items-center justify-center p-4">
34
  {/* Backdrop */}
35
  <motion.div
36
  initial={{ opacity: 0 }}
@@ -105,6 +108,7 @@ export function ConfirmModal({
105
  </motion.div>
106
  </div>
107
  )}
108
- </AnimatePresence>
 
109
  )
110
  }
 
1
  'use client'
2
 
3
  import { motion, AnimatePresence } from 'framer-motion'
4
+ import { createPortal } from 'react-dom'
5
  import { AlertCircle, X, Check, Loader2 } from 'lucide-react'
6
  import { cn } from '@/lib/utils'
7
 
 
28
  isLoading = false,
29
  variant = 'primary'
30
  }: ConfirmModalProps) {
31
+ if (typeof document === 'undefined') return null
32
+
33
+ return createPortal(
34
  <AnimatePresence>
35
  {isOpen && (
36
+ <div className="fixed inset-0 z-[1000] flex items-center justify-center p-4">
37
  {/* Backdrop */}
38
  <motion.div
39
  initial={{ opacity: 0 }}
 
108
  </motion.div>
109
  </div>
110
  )}
111
+ </AnimatePresence>,
112
+ document.body
113
  )
114
  }