gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant-backoffice] branch master updated: make demo-content opt


From: gnunet
Subject: [taler-merchant-backoffice] branch master updated: make demo-content optional
Date: Thu, 26 May 2022 15:09:04 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository merchant-backoffice.

The following commit(s) were added to refs/heads/master by this push:
     new d64e853  make demo-content optional
d64e853 is described below

commit d64e853cf9f3a2181587f2265e1ae037069ba8e9
Author: ms <ms@taler.net>
AuthorDate: Thu May 26 15:07:57 2022 +0200

    make demo-content optional
---
 packages/bank/src/pages/home/index.tsx | 56 +++++++++++++++++++++-------------
 1 file changed, 35 insertions(+), 21 deletions(-)

diff --git a/packages/bank/src/pages/home/index.tsx 
b/packages/bank/src/pages/home/index.tsx
index b701844..734916d 100644
--- a/packages/bank/src/pages/home/index.tsx
+++ b/packages/bank/src/pages/home/index.tsx
@@ -110,6 +110,11 @@ interface AccountStateType {
  * Helpers. *
  ***********/
 
+function maybeDemoContent(content: VNode) {
+    // @ts-ignore
+    if (__LIBEUFIN_UI_IS_DEMO__) return content;
+}
+
 async function fetcher(url: string) {
   return fetch(url).then((r) => (r.json()));
 }
@@ -772,22 +777,23 @@ function BankFrame(Props: any): VNode {
   for (const i in DEMO_SITES) {
     demo_sites.push(<a href={DEMO_SITES[i][1]}>{DEMO_SITES[i][0]}</a>) 
   }
-
   return (
     <Fragment>
       <header class="demobar" style="display: flex; flex-direction: row; 
justify-content: space-between;">
         <div style="max-width: 50em; margin-left: 2em;">
           <h1>
             <span class="it">
-              <a href="/">{i18n`Demo Bank`}</a>
+              <a href="/">__LIBEUFIN_UI_BANK_NAME__</a>
             </span>
-          </h1>
-          <p><Translate>
-         This part of the demo shows how a bank that supports
-         Taler directly would work. In addition to using your own
-         bank account, you can also see the transaction history of
-         some <a href="#" onClick={goPublicAccounts(pageStateSetter)}>Public 
Accounts</a>.
-       </Translate></p>
+          </h1>{
+            maybeDemoContent(<p><Translate>
+              This part of the demo shows how a bank that supports
+             Taler directly would work. In addition to using your own
+             bank account, you can also see the transaction history of
+             some <a href="#" 
onClick={goPublicAccounts(pageStateSetter)}>Public Accounts</a>.
+             </Translate></p>
+           )
+         }
         </div>
         <a href="https://taler.net/";>
         <img
@@ -800,7 +806,7 @@ function BankFrame(Props: any): VNode {
       </header>
       <div style="display:flex; flex-direction: column;" class="navcontainer">
         <nav class="demolist">
-          {demo_sites}
+          {maybeDemoContent(<Fragment>{demo_sites}</Fragment>)}
           <div class="right">
             <LangSelector />
          </div>
@@ -1650,7 +1656,6 @@ export function BankHome(): VNode {
       </PageContext.Provider>
     );
   }
-
   /**
    * Credentials were correct, now render the bank account page,
    * with balance, transactions history, and a Taler withdrawal
@@ -1681,8 +1686,20 @@ export function BankHome(): VNode {
   /**
    * 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.
-   */
+   * bank did.)  FIXME: currency needed at startup too.  */
+  var regMsg = function () {
+    // @ts-ignore
+    if (__LIBEUFIN_UI_ALLOW_REGISTRATIONS__) {
+      return (
+        <p><Translate>If you are a new customer please &nbsp;
+        <a href="#" onClick={() =>
+         {pageStateSetter((prevState) =>
+            ({...prevState, tryRegister: true}))}}>register!</a>
+        &nbsp;&nbsp; Registration is fast and free, and it gives
+        you a registration bonus of 100 <Currency /></Translate></p>);
+    }
+  }
+
   return (
     <PageContext.Provider value={[pageState, pageStateSetter]}>
       <BankFrame>
@@ -1690,15 +1707,12 @@ export function BankHome(): VNode {
         <LoginForm
             pageStateSetter={pageStateSetter}
             backendStateSetter={backendStateSetter} />
-        <p><Translate>
-          If you are a new customer please <a href="#" onClick={() => {
-            pageStateSetter((prevState) => ({...prevState, tryRegister: 
true}))}}>register!</a>
-       &nbsp;&nbsp; Registration is fast and free, and it gives you a 
registration bonus
-       of 100 <Currency />
-        </Translate></p>
-        <p><Translate>To view transactions of public accounts, please <a 
href="#"
+       {regMsg()} 
+       {maybeDemoContent(<p><Translate>
+         To view transactions of public accounts, please <a href="#"
           onClick={goPublicAccounts(pageStateSetter)}>click here</a>.
-        </Translate></p>
+          </Translate></p>
+       )}
       </BankFrame>
     </PageContext.Provider>
   );

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]