[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant-backoffice] branch master updated: -hide registration bu
From: |
gnunet |
Subject: |
[taler-merchant-backoffice] branch master updated: -hide registration button if registrations are disabled |
Date: |
Sun, 25 Sep 2022 19:22:18 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant-backoffice.
The following commit(s) were added to refs/heads/master by this push:
new 482e00d -hide registration button if registrations are disabled
482e00d is described below
commit 482e00d055f70a178449603c6604f747779d0d5d
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Sep 25 19:22:15 2022 +0200
-hide registration button if registrations are disabled
---
packages/bank/src/pages/home/index.tsx | 68 +++++++++++++++++++++-------------
1 file changed, 43 insertions(+), 25 deletions(-)
diff --git a/packages/bank/src/pages/home/index.tsx
b/packages/bank/src/pages/home/index.tsx
index 3c4f349..90e044f 100644
--- a/packages/bank/src/pages/home/index.tsx
+++ b/packages/bank/src/pages/home/index.tsx
@@ -133,7 +133,6 @@ interface AccountStateType {
***********/
function maybeDemoContent(content: VNode) {
- // @ts-ignore
if (__LIBEUFIN_UI_IS_DEMO__) return content;
}
@@ -865,7 +864,10 @@ function BankFrame(Props: any): VNode {
<div style="max-width: 50em; margin-left: 2em;">
<h1>
<span class="it">
- <a href="/">__LIBEUFIN_UI_BANK_NAME__</a>
+ <a href="/">{
+ __LIBEUFIN_UI_BANK_NAME__
+ }
+ </a>
</span>
</h1>{
maybeDemoContent(<p><Translate>
@@ -1279,6 +1281,26 @@ function TalerWithdrawal(Props: any): VNode {
</article>);
}
+function RegistrationButton(Props: any): VNode {
+ const { backendStateSetter, pageStateSetter } = Props;
+ const i18n = useTranslator();
+ if (__LIBEUFIN_UI_ALLOW_REGISTRATIONS__)
+ {
+ return (<button
+ autofocus
+ class="pure-button pure-button-secondary btn-cancel"
+ onClick={() => {
+ pageStateSetter((prevState: PageStateType) => ({ ...prevState,
tryRegister: true }))
+ }}>
+ {i18n`Register`}
+ </button>);
+ }
+ else
+ {
+ return (<span></span>);
+ }
+}
+
/**
* Collect and submit login data.
*/
@@ -1337,15 +1359,10 @@ function LoginForm(Props: any): VNode {
pageStateSetter
);
submitDataSetter(undefined);
- }}>{i18n`Login`}</button>
- <button
- autofocus
- class="pure-button pure-button-secondary btn-cancel"
- onClick={() => {
- pageStateSetter((prevState: PageStateType) => ({ ...prevState,
tryRegister: true }))
- }}>
- {i18n`Register`}
- </button>
+ }}>{i18n`Login`}
+ </button>)
+ + RegistrationButton(props) +
+ (
</div>
</form>);
}
@@ -1361,7 +1378,11 @@ function RegistrationForm(Props: any): VNode {
//
https://stackoverflow.com/questions/36683770/how-to-get-the-value-of-an-input-field-using-reactjs
return (
<Fragment>
- <h1 class="nav">{i18n`Welcome to ${__LIBEUFIN_UI_BANK_NAME__}!`}</h1>
+ <h1 class="nav">
+ {
+ i18n`Welcome to ${__LIBEUFIN_UI_BANK_NAME__}!`
+ }
+ </h1>
<aside class="sidebar" id="left" />
<article>
<div class="register-form">
@@ -1801,7 +1822,8 @@ function PublicHistories(Props: any): VNode {
break;
}
}
- if (!data) return <p>Waiting public accounts list...</p>
+ if (!data)
+ return (<p>Waiting public accounts list...</p>)
const txs: any = {};
const accountsBar = [];
@@ -1868,7 +1890,7 @@ export function BankHome(): VNode {
</SWRWithoutCredentials>);
if (pageState.tryRegister) {
- console.log('allow registrations?', __LIBEUFIN_UI_ALLOW_REGISTRATIONS__)
+ console.log('allow registrations?', __LIBEUFIN_UI_ALLOW_REGISTRATIONS__);
if (__LIBEUFIN_UI_ALLOW_REGISTRATIONS__)
return (
<PageContext.Provider value={[pageState, pageStateSetter]}>
@@ -1894,7 +1916,7 @@ export function BankHome(): VNode {
isLoggedIn: false,
error: i18n`Page has a problem: logged in but backend state is lost.`
}));
- return <p>Error: waiting for details...</p>;
+ return (<p>Error: waiting for details...</p>);
}
console.log('Showing the profile page..');
return (
@@ -1908,22 +1930,18 @@ export function BankHome(): VNode {
</SWRWithCredentials>
);
} // end of logged-in state.
- /**
- * Currency only known _after_ a user logs in / registers. Thus not
- * mentioning the currency right at the home page (as instead the Python
- * bank did.) FIXME: currency needed at startup too. */
- const regMsg = function () {
- if (__LIBEUFIN_UI_ALLOW_REGISTRATIONS__)
- return <span></span>
- } // close helper function.
+
return (
<PageContext.Provider value={[pageState, pageStateSetter]}>
<BankFrame>
- <h1 class="nav">{i18n`Welcome to ${__LIBEUFIN_UI_BANK_NAME__}!`}</h1>
+ <h1 class="nav">
+ {
+ i18n`Welcome to ${__LIBEUFIN_UI_BANK_NAME__}!`
+ }
+ </h1>
<LoginForm
pageStateSetter={pageStateSetter}
backendStateSetter={backendStateSetter} />
- {regMsg()}
{maybeDemoContent(<p><Translate>
To view transactions of public accounts, please <a href="#"
onClick={goPublicAccounts(pageStateSetter)}>click here</a>.
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant-backoffice] branch master updated: -hide registration button if registrations are disabled,
gnunet <=