diff --git a/frontend/src/pages/Contribute.tsx b/frontend/src/pages/Contribute.tsx index 9e2ecefe9..23cd7ec33 100644 --- a/frontend/src/pages/Contribute.tsx +++ b/frontend/src/pages/Contribute.tsx @@ -1,4 +1,4 @@ -import { useContext, useEffect, useState } from "react"; +import { useContext, useEffect, useRef, useState } from "react"; import { Helmet } from "react-helmet"; import { Trans, useTranslation } from "react-i18next"; @@ -15,7 +15,6 @@ const translationFlags = getLanguageFlags(false); // Media const CirclesFrame = "https://images.clothingloop.org/0x0/circles.png"; -const map = "https://images.clothingloop.org/640x0/map_image_4.png"; const ClothesImage = "https://images.clothingloop.org/768x/nichon_zelfportret.jpg"; @@ -24,6 +23,7 @@ export default function Contribute() { const { addToastError } = useContext(ToastContext); const [event, setEvent] = useState(null); const [isHoveringDonate, setIsHoveringDonate] = useState(false); + const githubVideo = useRef(null); useEffect(() => { window.goatcounter?.count({ @@ -113,7 +113,8 @@ export default function Contribute() { } async function videoHandler(play: boolean) { - let video = document.getElementById("github-video") as HTMLVideoElement; + let video = githubVideo.current; + if (!video) return; try { if (play) { await video.play(); @@ -192,7 +193,7 @@ export default function Contribute() { target="_blank" > map of the clothing loop in Amsterdam area @@ -400,11 +401,12 @@ export default function Contribute() {
videoHandler(true)} onMouseLeave={() => videoHandler(false)} - className="w-full md:w-1/2 aspect-video md:pl-4 max-xs:-mx-8 max-xs:w-auto self-center mb-8 md:mb-0" + className="relative w-full md:w-1/2 aspect-video md:pl-4 max-xs:-mx-8 max-xs:w-auto self-center mb-8 md:mb-0 group" > +