"use client" import { useSyncExternalStore } from "react" import { useTranslations } from "next-intl" import Image from "next/image" import { ReactPhotoSphereViewer } from "react-photo-sphere-viewer" import * as styles from "./office.module.css" let webGL2Support: boolean | undefined // Checked once, since creating a WebGL context is not free const getWebGL2Support = () => { webGL2Support ??= Boolean( document.createElement("canvas").getContext("webgl2") ) return webGL2Support } // WebGL support never changes, so there is nothing to subscribe to const subscribe = () => () => {} const Office = () => { const t = useTranslations("office") // null on the server, which renders the fallback image const supportsWebGL2 = useSyncExternalStore( subscribe, getWebGL2Support, () => null ) return (

{t("title")}

{t("text")}

{t("tip")}

{supportsWebGL2 === true ? ( ) : ( {t("title")} )}
{t("pcRoomImageAlt")}
) } export default Office