commit 946eecdea068fab31a05fa79560f05f1b136fc85
parent c564a90f8a85355f7a2d7e9a41dd8c568fe6c73a
Author: Sebastian <sebasjm@taler-systems.com>
Date: Wed, 4 Feb 2026 15:39:04 -0300
fix #10993: show a banner on stage and version should be shown in all pages
Diffstat:
4 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/packages/merchant-backoffice-ui/src/components/menu/SideBar.tsx b/packages/merchant-backoffice-ui/src/components/menu/SideBar.tsx
@@ -31,6 +31,7 @@ import { useSessionContext } from "../../context/session.js";
import { useInstanceKYCDetailsLongPolling } from "../../hooks/instance.js";
import { UIElement, usePreference } from "../../hooks/preference.js";
import { LangSelector } from "./LangSelector.js";
+import { useSettingsContext } from "../../context/settings.js";
const TALER_SCREEN_ID = 17;
// const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined;
@@ -67,6 +68,8 @@ export function Sidebar({ mobile }: Props): VNode {
const isLoggedIn = state.status === "loggedIn";
const hasToken = isLoggedIn && state.token !== undefined;
+ const { isTestingEnvironment } = useSettingsContext();
+
return (
<aside
class="aside is-placed-left is-expanded"
@@ -96,6 +99,9 @@ export function Sidebar({ mobile }: Props): VNode {
</div>
</div>
<div class="menu is-menu-main">
+ {!isTestingEnvironment ? undefined : (
+ <div style="color:orangered">TESTING ENVIRONMENT</div>
+ )}
{isLoggedIn ? (
<Fragment>
<ul class="menu-list">
@@ -164,10 +170,7 @@ export function Sidebar({ mobile }: Props): VNode {
</span>
</a>
</HtmlPersonaFlag>
- <HtmlPersonaFlag
- htmlElement="li"
- point={UIElement.sidebar_group}
- >
+ <HtmlPersonaFlag htmlElement="li" point={UIElement.sidebar_group}>
<a href={"#/groups"} class="has-icon">
<span class="icon">
<i class="mdi mdi-group" />
@@ -177,10 +180,7 @@ export function Sidebar({ mobile }: Props): VNode {
</span>
</a>
</HtmlPersonaFlag>
- <HtmlPersonaFlag
- htmlElement="li"
- point={UIElement.sidebar_pots}
- >
+ <HtmlPersonaFlag htmlElement="li" point={UIElement.sidebar_pots}>
<a href={"#/pots"} class="has-icon">
<span class="icon">
<i class="mdi mdi-pot" />
diff --git a/packages/merchant-backoffice-ui/src/components/menu/index.tsx b/packages/merchant-backoffice-ui/src/components/menu/index.tsx
@@ -28,6 +28,7 @@ import {
} from "@gnu-taler/web-util/browser";
import { LangSelector } from "./LangSelector.js";
import { InternationalizationAPI } from "@gnu-taler/taler-util";
+import { useSettingsContext } from "../../context/settings.js";
function getInstanceTitle(
path: string,
@@ -238,6 +239,7 @@ export function NotificationCard({
</div>
);
}
+const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : undefined;
interface NotConnectedAppMenuProps {
title: string;
@@ -246,10 +248,11 @@ export function NotConnectedAppMenu({
title,
}: NotConnectedAppMenuProps): VNode {
const [mobileOpen, setMobileOpen] = useState(false);
-
+ const { i18n } = useTranslationContext();
useEffect(() => {
document.title = `Taler Backoffice: ${title}`;
}, [title]);
+ const { isTestingEnvironment } = useSettingsContext();
return (
<div
@@ -269,7 +272,16 @@ export function NotConnectedAppMenu({
paddingRight: 8,
}}
>
- <div />
+ <div>Version {VERSION}</div>
+ {!isTestingEnvironment ? undefined : (
+ <NotificationCard
+ notification={{
+ message: i18n.str`Testing environment`,
+ description: i18n.str`This server is meant for testing features and configurations. Don't use your personal information here.`,
+ type: "INFO",
+ }}
+ />
+ )}
<LangSelector />
</div>
</div>
diff --git a/packages/merchant-backoffice-ui/src/paths/login/index.tsx b/packages/merchant-backoffice-ui/src/paths/login/index.tsx
@@ -62,7 +62,6 @@ export const FOREVER_REFRESHABLE_TOKEN = (description: TranslatedString) =>
description,
}) as LoginTokenRequest;
-const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : undefined;
export function LoginPage({ showCreateAccount, focus }: Props): VNode {
const [password, setPassword] = useState("");
@@ -261,15 +260,6 @@ export function LoginPage({ showCreateAccount, focus }: Props): VNode {
)}
</div>
</div>
- <div
- style={{
- position: "absolute",
- bottom: 0,
- height: "2rem",
- }}
- >
- Version {VERSION}
- </div>
</Fragment>
);
}
diff --git a/packages/merchant-backoffice-ui/src/settings.ts b/packages/merchant-backoffice-ui/src/settings.ts
@@ -18,6 +18,7 @@ import {
Codec,
buildCodecForObject,
canonicalizeBaseUrl,
+ codecForBoolean,
codecForList,
codecForString,
codecOptional
@@ -28,6 +29,7 @@ export interface MerchantUiSettings {
// default: window.origin without "webui/"
backendBaseURL?: string;
+ isTestingEnvironment?: boolean;
}
/**
@@ -35,11 +37,13 @@ export interface MerchantUiSettings {
*/
const defaultSettings: MerchantUiSettings = {
backendBaseURL: buildDefaultBackendBaseURL(),
+ isTestingEnvironment: false,
};
const codecForBankUISettings = (): Codec<MerchantUiSettings> =>
buildCodecForObject<MerchantUiSettings>()
.property("backendBaseURL", codecOptional(codecForString()))
+ .property("isTestingEnvironment", codecOptional(codecForBoolean()))
.build("MerchantUiSettings");
function removeUndefineField<T extends object>(obj: T): T {