From a89790d0b813ae04d9a1aba96ad6453110c21eac Mon Sep 17 00:00:00 2001 From: Martin Man Date: Tue, 10 Sep 2024 17:54:23 +0200 Subject: [PATCH] display qr code + description when not running GUI v1 --- .../ui/RemoteConsole/RemoteConsole.tsx | 61 +++++++++++++++++-- .../ui/SettingsMenu/SettingsMenu.tsx | 6 -- src/app/locales/languages/en.json | 5 +- 3 files changed, 60 insertions(+), 12 deletions(-) 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 ( <> -
- + { +