Integrated the demo mode badge into the HeaderComponent.jsx

This commit is contained in:
Mathias Wagner
2024-03-10 01:28:23 +01:00
parent 64fb533faa
commit 5f4ae34606

View File

@@ -18,6 +18,8 @@ import {t} from "i18next";
import {ConfigContext} from "@/common/contexts/Config";
import {LoadingDialog} from "@/common/components/LoadingDialog";
import {NodeContext} from "@/common/contexts/Node";
import {WEB_URL} from "@/index";
import {Trans} from "react-i18next";
function HeaderComponent(props) {
const findNode = useContext(NodeContext)[4];
@@ -35,6 +37,12 @@ function HeaderComponent(props) {
toggleDropdown(setIcon);
}
const showDemoDialog = () => setDialog({
title: t("preview.title"),
description: <Trans components={{Link: <a href={WEB_URL + "/install"} target="_blank" />}}>preview.description</Trans>,
buttonText: t("dialog.okay")
});
const showPasswordDialog = () => setDialog({
title: t("header.admin_login"),
placeholder: t("dialog.password.placeholder"),
@@ -90,7 +98,13 @@ function HeaderComponent(props) {
<header>
<LoadingDialog isOpen={startedManually}/>
<div className="header-main">
{config.viewMode ? <h2>{t("header.title")}</h2> : <h2 onClick={() => props.showNodePage(true)} className="h2-click"><FontAwesomeIcon icon={faServer} /> {getNodeName()}</h2>}
<div className="header-left">
{config.viewMode && <h2>{t("header.title")}</h2>}
{!config.viewMode && <h2 onClick={() => props.showNodePage(true)} className="h2-click"><FontAwesomeIcon icon={faServer} /> {getNodeName()}</h2>}
{config.previewMode && <h2 className="demo-info" onClick={showDemoDialog}>{t("preview.info")}</h2>}
</div>
<div className="header-right">
{updateAvailable ?