From e3b6aecfe840152d7a31fd0246eade6524d25896 Mon Sep 17 00:00:00 2001 From: enes Date: Mon, 21 Oct 2024 11:44:26 +0200 Subject: [PATCH] fix: disable scroll on nostr-login popup open --- src/layout/header.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/layout/header.tsx b/src/layout/header.tsx index 5f5fc10..faae13e 100644 --- a/src/layout/header.tsx +++ b/src/layout/header.tsx @@ -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() }