Fix profile panel z-index overlap by rendering via portal
UserProfilePanel was rendered inside the header's stacking context (z-index: 50), which capped its effective z-index and allowed dashboard content to paint on top of it. Wrap the overlay in createPortal to document.body so its z-index: 100 resolves at the root level.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
||||||
|
import { createPortal } from 'react-dom';
|
||||||
import { X, User, Mail, Shield, Calendar, Clock, Loader, AlertCircle, RefreshCw, Lock, Eye, EyeOff, CheckCircle } from 'lucide-react';
|
import { X, User, Mail, Shield, Calendar, Clock, Loader, AlertCircle, RefreshCw, Lock, Eye, EyeOff, CheckCircle } from 'lucide-react';
|
||||||
|
|
||||||
const API_BASE = process.env.REACT_APP_API_BASE || 'http://localhost:3001/api';
|
const API_BASE = process.env.REACT_APP_API_BASE || 'http://localhost:3001/api';
|
||||||
@@ -10,19 +11,19 @@ const STYLES = {
|
|||||||
overlay: {
|
overlay: {
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
inset: 0,
|
inset: 0,
|
||||||
background: 'rgba(10, 14, 39, 0.97)',
|
background: 'var(--bg-overlay)',
|
||||||
backdropFilter: 'blur(12px)',
|
backdropFilter: 'blur(12px)',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
zIndex: 50,
|
zIndex: 100,
|
||||||
padding: '1rem',
|
padding: '1rem',
|
||||||
},
|
},
|
||||||
panel: {
|
panel: {
|
||||||
background: 'linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(51, 65, 85, 0.9) 50%, rgba(30, 41, 59, 0.95) 100%)',
|
background: 'linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(51, 65, 85, 0.9) 50%, rgba(30, 41, 59, 0.95) 100%)',
|
||||||
border: '1.5px solid rgba(14, 165, 233, 0.3)',
|
border: '1.5px solid rgba(14, 165, 233, 0.3)',
|
||||||
borderRadius: '0.5rem',
|
borderRadius: 12,
|
||||||
boxShadow: '0 20px 60px rgba(0, 0, 0, 0.6), 0 10px 30px rgba(14, 165, 233, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1)',
|
boxShadow: 'var(--shadow-modal)',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
maxWidth: '480px',
|
maxWidth: '480px',
|
||||||
maxHeight: '90vh',
|
maxHeight: '90vh',
|
||||||
@@ -482,7 +483,7 @@ export default function UserProfilePanel({ isOpen, onClose }) {
|
|||||||
|
|
||||||
if (!isOpen) return null;
|
if (!isOpen) return null;
|
||||||
|
|
||||||
return (
|
return createPortal(
|
||||||
<div style={STYLES.overlay}>
|
<div style={STYLES.overlay}>
|
||||||
<div ref={panelRef} style={STYLES.panel}>
|
<div ref={panelRef} style={STYLES.panel}>
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
@@ -749,6 +750,7 @@ export default function UserProfilePanel({ isOpen, onClose }) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>,
|
||||||
|
document.body
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user