diff --git a/src/app/Marine2/components/ui/RemoteConsole/RemoteConsole.tsx b/src/app/Marine2/components/ui/RemoteConsole/RemoteConsole.tsx index d2b3b24c..f425f41a 100644 --- a/src/app/Marine2/components/ui/RemoteConsole/RemoteConsole.tsx +++ b/src/app/Marine2/components/ui/RemoteConsole/RemoteConsole.tsx @@ -1,13 +1,66 @@ +import { useEffect, useRef, useState } from "react" import { observer } from "mobx-react-lite" -import { translate } from "react-i18nify" +import classnames from "classnames" +import { translate, Translate } from "react-i18nify" +import useSize from "@react-hook/size" +import { useApp } from "@victronenergy/mfd-modules" import { QRCode } from "react-qrcode-logo" -import Paginator from "../Paginator" const RemoteConsole = ({ host, width, height }: Props) => { + const iframeRef = useRef(null) + const [iframeWidth, iframeHeight] = useSize(iframeRef) + + const [iframeLoaded, setIframeLoaded] = useState(false) + const loading = !iframeLoaded + const protocol = (typeof window !== "undefined" && window.location.protocol) || "http:" + const url = protocol + "//" + host + const app = useApp() + + useEffect(() => { + iframeRef.current?.focus() + }, [iframeLoaded]) + + console.log(`Venus Running GUI version: ${app.guiVersion}`) + + const consoleUrl = `${window.location.protocol}://venus.local/` + + if (app.guiVersion !== 1) { + return ( +
+ + + +
+ ) + } + return ( <> -
- + { +