diff --git a/components/embed.js b/components/embed.js index 9446f234a..3677955f2 100644 --- a/components/embed.js +++ b/components/embed.js @@ -21,59 +21,6 @@ function TweetSkeleton ({ className }) { ) } -export const NostrEmbed = memo(function NostrEmbed ({ className, darkMode, id }) { - const [show, setShow] = useState(false) - const iframeRef = useRef(null) - - useEffect(() => { - if (!iframeRef.current) return - - const setHeightFromIframe = (e) => { - if (e.origin !== 'https://njump.me' || !e?.data?.height || e.source !== iframeRef.current.contentWindow) return - iframeRef.current.height = `${e.data.height}px` - } - - window?.addEventListener('message', setHeightFromIframe) - - const handleIframeLoad = () => { - iframeRef.current.contentWindow.postMessage({ setDarkMode: darkMode }, '*') - } - - if (iframeRef.current.complete) { - handleIframeLoad() - } else { - iframeRef.current.addEventListener('load', handleIframeLoad) - } - - // https://github.com/vercel/next.js/issues/39451 - iframeRef.current.src = `https://njump.me/${id}?embed=yes` - - return () => { - window?.removeEventListener('message', setHeightFromIframe) - iframeRef.current?.removeEventListener('load', handleIframeLoad) - } - }, [iframeRef.current, darkMode]) - - return ( -