fix: disable body scroll on popup open #88

Merged
enes merged 5 commits from 61-popup-scroll into staging 2024-10-21 09:49:13 +00:00
Showing only changes of commit e3b6aecfe8 - Show all commits

View File

@ -28,6 +28,18 @@ export const Header = () => {
const { findMetadata } = useNDKContext()
const userState = useAppSelector((state) => state.user)
// Track nostr-login extension modal open state
const [isOpen, setIsOpen] = useState(false)
const handleOpen = () => setIsOpen(true)
const handleClose = () => setIsOpen(false)
useEffect(() => {
window.addEventListener('nlCloseModal', handleClose)
return () => {
window.removeEventListener('nlCloseModal', handleClose)
}
}, [])
useBodyScrollDisable(isOpen)
useEffect(() => {
initNostrLogin({
darkMode: true,
@ -67,6 +79,7 @@ export const Header = () => {
}, [dispatch, findMetadata])
const handleLogin = () => {
handleOpen()
launchNostrLoginDialog()
}