gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant-backoffice] branch master updated (f4e5ed9 -> edf1742)


From: gnunet
Subject: [taler-merchant-backoffice] branch master updated (f4e5ed9 -> edf1742)
Date: Thu, 24 Jun 2021 18:59:47 +0200

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

sebasjm pushed a change to branch master
in repository merchant-backoffice.

    from f4e5ed9  refactor transfer list
     new 8a6e70e  h collide
     new 2ab391e  fix loop render
     new 17c5aed  missing shipping
     new accec6d  fix mixed up fields
     new c97e3ce  split QR and added into reserve details
     new edf1742  places holder for transaction

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../index.tsx => components/exception/QR.tsx}      | 26 ++++++++------
 .../src/components/picker/DurationPicker.tsx       | 40 +++++++++++-----------
 .../components/product/NonInventoryProductForm.tsx |  2 +-
 .../src/components/product/ProductForm.tsx         |  2 +-
 .../paths/instance/orders/create/CreatePage.tsx    |  4 +--
 .../src/paths/instance/orders/list/index.tsx       |  6 ++--
 .../reserves/create/CreatedSuccessfully.tsx        | 21 ++----------
 .../paths/instance/reserves/details/DetailPage.tsx | 14 ++++----
 .../paths/instance/transfers/create/CreatePage.tsx |  4 +--
 9 files changed, 53 insertions(+), 66 deletions(-)
 copy packages/frontend/src/{paths/login/index.tsx => 
components/exception/QR.tsx} (56%)

diff --git a/packages/frontend/src/paths/login/index.tsx 
b/packages/frontend/src/components/exception/QR.tsx
similarity index 56%
copy from packages/frontend/src/paths/login/index.tsx
copy to packages/frontend/src/components/exception/QR.tsx
index acad7fe..4295c63 100644
--- a/packages/frontend/src/paths/login/index.tsx
+++ b/packages/frontend/src/components/exception/QR.tsx
@@ -14,16 +14,22 @@
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
- /**
-*
-* @author Sebastian Javier Marchano (sebasjm)
-*/
 import { h, VNode } from "preact";
-import { LoginModal } from '../../components/exception/login';
+import { useEffect, useRef } from "preact/hooks";
+import qrcode from "qrcode-generator";
 
-interface Props {
-  onConfirm: (url: string, token?: string) => void;
+export function QR({ text }: { text: string; }):VNode {
+  const divRef = useRef<HTMLDivElement>(null);
+  useEffect(() => {
+    const qr = qrcode(0, 'L');
+    qr.addData(text);
+    qr.make();
+    divRef.current.innerHTML = qr.createSvgTag({
+      scalable: true,
+    });
+  });
+
+  return <div style={{ width: '100%', display: 'flex', flexDirection: 
'column', alignItems: 'center' }}>
+    <div style={{ width: '50%', minWidth: 200, maxWidth: 300 }} ref={divRef} />
+  </div>;
 }
-export default function LoginPage({ onConfirm }: Props): VNode {
-  return <LoginModal onConfirm={onConfirm} />
-} 
\ No newline at end of file
diff --git a/packages/frontend/src/components/picker/DurationPicker.tsx 
b/packages/frontend/src/components/picker/DurationPicker.tsx
index 2d51f2d..1c301c9 100644
--- a/packages/frontend/src/components/picker/DurationPicker.tsx
+++ b/packages/frontend/src/components/picker/DurationPicker.tsx
@@ -35,36 +35,36 @@ export interface Props {
 
 // inspiration taken from https://github.com/flurmbo/react-duration-picker
 export function DurationPicker({ days, hours, minutes, seconds, onChange, 
value }: Props): VNode {
-  const s = 1000
-  const m = s * 60
-  const h = m * 60
-  const d = h * 24
+  const ss = 1000
+  const ms = ss * 60
+  const hs = ms * 60
+  const ds = hs * 24
   const i18n = useTranslator()
   
   return <div class="rdp-picker">
     {days && <DurationColumn unit={i18n`days`} max={99}
-      value={Math.floor(value / d)}
-      onDecrease={value >= d ? () => onChange(value - d) : undefined}
-      onIncrease={value < 99 * d ? () => onChange(value + d) : undefined}
-      onChange={diff => onChange(value + diff * d)}
+      value={Math.floor(value / ds)}
+      onDecrease={value >= ds ? () => onChange(value - ds) : undefined}
+      onIncrease={value < 99 * ds ? () => onChange(value + ds) : undefined}
+      onChange={diff => onChange(value + diff * ds)}
     />}
     {hours && <DurationColumn unit={i18n`hours`} max={23} min={1}
-      value={Math.floor(value / h) % 24}
-      onDecrease={value >= h ? () => onChange(value - h) : undefined}
-      onIncrease={value < 99 * d ? () => onChange(value + h) : undefined}
-      onChange={diff => onChange(value + diff * h)}
+      value={Math.floor(value / hs) % 24}
+      onDecrease={value >= hs ? () => onChange(value - hs) : undefined}
+      onIncrease={value < 99 * ds ? () => onChange(value + hs) : undefined}
+      onChange={diff => onChange(value + diff * hs)}
     />}
     {minutes && <DurationColumn unit={i18n`minutes`} max={59} min={1}
-      value={Math.floor(value / m) % 60}
-      onDecrease={value >= m ? () => onChange(value - m) : undefined}
-      onIncrease={value < 99 * d ? () => onChange(value + m) : undefined}
-      onChange={diff => onChange(value + diff * m)}
+      value={Math.floor(value / ms) % 60}
+      onDecrease={value >= ms ? () => onChange(value - ms) : undefined}
+      onIncrease={value < 99 * ds ? () => onChange(value + ms) : undefined}
+      onChange={diff => onChange(value + diff * ms)}
     />}
     {seconds && <DurationColumn unit={i18n`seconds`} max={59}
-      value={Math.floor(value / s) % 60}
-      onDecrease={value >= s ? () => onChange(value - s) : undefined}
-      onIncrease={value < 99 * d ? () => onChange(value + s) : undefined}
-      onChange={diff => onChange(value + diff * s)}
+      value={Math.floor(value / ss) % 60}
+      onDecrease={value >= ss ? () => onChange(value - ss) : undefined}
+      onIncrease={value < 99 * ds ? () => onChange(value + ss) : undefined}
+      onChange={diff => onChange(value + diff * ss)}
     />}
   </div>
 }
diff --git 
a/packages/frontend/src/components/product/NonInventoryProductForm.tsx 
b/packages/frontend/src/components/product/NonInventoryProductForm.tsx
index d2f6503..8aff1cd 100644
--- a/packages/frontend/src/components/product/NonInventoryProductForm.tsx
+++ b/packages/frontend/src/components/product/NonInventoryProductForm.tsx
@@ -123,7 +123,7 @@ export function ProductForm({ onSubscribe, initial }: 
ProductProps): VNode {
 
   useEffect(() => {
     onSubscribe(hasErrors ? undefined : submit)
-  }, [submit, hasErrors, onSubscribe])
+  }, [submit, hasErrors])
 
   const i18n = useTranslator()
 
diff --git a/packages/frontend/src/components/product/ProductForm.tsx 
b/packages/frontend/src/components/product/ProductForm.tsx
index ba0a380..9e8ac97 100644
--- a/packages/frontend/src/components/product/ProductForm.tsx
+++ b/packages/frontend/src/components/product/ProductForm.tsx
@@ -88,7 +88,7 @@ export function ProductForm({ onSubscribe, initial, 
alreadyExist, }: Props) {
 
   useEffect(() => {
     onSubscribe(hasErrors ? undefined : submit)
-  }, [submit, hasErrors, onSubscribe])
+  }, [submit, hasErrors])
 
   const backend = useBackendContext();
   const i18n = useTranslator()
diff --git a/packages/frontend/src/paths/instance/orders/create/CreatePage.tsx 
b/packages/frontend/src/paths/instance/orders/create/CreatePage.tsx
index 22fa2f3..c57c50d 100644
--- a/packages/frontend/src/paths/instance/orders/create/CreatePage.tsx
+++ b/packages/frontend/src/paths/instance/orders/create/CreatePage.tsx
@@ -59,8 +59,7 @@ function with_defaults(config: InstanceConfig): 
Partial<Entity> {
   return {
     inventoryProducts: {},
     products: [],
-    pricing: {
-    },
+    pricing: {},
     payments: {
       max_wire_fee: config.default_max_wire_fee,
       max_fee: config.default_max_deposit_fee,
@@ -68,6 +67,7 @@ function with_defaults(config: InstanceConfig): 
Partial<Entity> {
       pay_deadline: defaultPayDeadline,
       refund_deadline: defaultPayDeadline,
     },
+    shipping: {},
     extra: ''
   };
 }
diff --git a/packages/frontend/src/paths/instance/orders/list/index.tsx 
b/packages/frontend/src/paths/instance/orders/list/index.tsx
index a4e8b15..47e143f 100644
--- a/packages/frontend/src/paths/instance/orders/list/index.tsx
+++ b/packages/frontend/src/paths/instance/orders/list/index.tsx
@@ -100,9 +100,9 @@ export default function ({ onUnauthorized, onLoadError, 
onCreate, onSelect, onNo
       onSearchOrderById={testIfOrderExistAndSelect}
       onSelectDate={setNewDate}
       onShowAll={() => setFilter({})}
-      onShowNotWired={() => setFilter({ paid: 'yes' })}
-      onShowPaid={() => setFilter({ refunded: 'yes' })}
-      onShowRefunded={() => setFilter({ wired: 'no' })}
+      onShowPaid={() => setFilter({ paid: 'yes' })}
+      onShowRefunded={() => setFilter({ refunded: 'yes' })}
+      onShowNotWired={() => setFilter({ wired: 'no' })}
 
     />
 
diff --git 
a/packages/frontend/src/paths/instance/reserves/create/CreatedSuccessfully.tsx 
b/packages/frontend/src/paths/instance/reserves/create/CreatedSuccessfully.tsx
index 3712bd7..255486d 100644
--- 
a/packages/frontend/src/paths/instance/reserves/create/CreatedSuccessfully.tsx
+++ 
b/packages/frontend/src/paths/instance/reserves/create/CreatedSuccessfully.tsx
@@ -13,12 +13,12 @@
  You should have received a copy of the GNU General Public License along with
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
+
 import { h, VNode } from "preact";
-import { useEffect, useRef, useState } from "preact/hooks";
 import { CreatedSuccessfully as Template } from 
"../../../../components/notifications/CreatedSuccessfully";
 import { MerchantBackend } from "../../../../declaration";
 import { Translate } from "../../../../i18n";
-import qrcode from "qrcode-generator"
+import { QR } from "../../../../components/exception/QR";
 
 type Entity = { request: MerchantBackend.Tips.ReserveCreateRequest, response: 
MerchantBackend.Tips.ReserveCreateConfirmation };
 
@@ -69,7 +69,6 @@ export function CreatedSuccessfully({ entity, onConfirm, 
onCreateAnother }: Prop
       </div>
     </div>
     <p class="is-size-5"><Translate>To complete the setup of the reserve, you 
must now initiate a wire transfer using the given wire transfer subject and 
crediting the specified amount to the indicated account of the 
exchange.</Translate></p>
-    
     <p class="is-size-5"><Translate>If your system supports RFC 8905, you can 
do this by opening this URI:</Translate></p>
     <pre>
       <a target="_blank" rel="noreferrer" href={link}>{link}</a>
@@ -78,19 +77,3 @@ export function CreatedSuccessfully({ entity, onConfirm, 
onCreateAnother }: Prop
   </Template>;
 }
 
-const QR = ({ text }: { text: string }) => {
-  const divRef = useRef<HTMLDivElement>(null);
-  useEffect(() => {
-    const qr = qrcode(0, 'L')
-    qr.addData(text)
-    qr.make()
-    divRef.current.innerHTML = qr.createSvgTag({
-      scalable: true,
-    })
-  })
-
-  return <div style={{ width: '100%', display: 'flex', flexDirection: 
'column', alignItems: 'center' }}>
-    <div style={{ width: '50%', minWidth: 200, maxWidth: 300 }} ref={divRef} />
-  </div>
-}
-
diff --git 
a/packages/frontend/src/paths/instance/reserves/details/DetailPage.tsx 
b/packages/frontend/src/paths/instance/reserves/details/DetailPage.tsx
index d3170a4..573d689 100644
--- a/packages/frontend/src/paths/instance/reserves/details/DetailPage.tsx
+++ b/packages/frontend/src/paths/instance/reserves/details/DetailPage.tsx
@@ -22,6 +22,7 @@
 import { Amounts } from "@gnu-taler/taler-util";
 import { format } from "date-fns";
 import { Fragment, h, VNode } from "preact";
+import { QR } from "../../../../components/exception/QR";
 import { FormProvider } from "../../../../components/form/FormProvider";
 import { Input } from "../../../../components/form/Input";
 import { InputCurrency } from "../../../../components/form/InputCurrency";
@@ -43,6 +44,8 @@ interface Props {
 export function DetailPage({ id, selected, onBack }: Props): VNode {
   const i18n = useTranslator()
   const didExchangeAckTransfer = 
Amounts.isNonZero(Amounts.parseOrThrow(selected.exchange_initial_amount))
+  const link = 
`${selected.payto_uri}?message=${id}&amount=${selected.merchant_initial_amount}`
+
   return <div class="columns">
     <div class="column" />
     <div class="column is-four-fifths">
@@ -82,11 +85,12 @@ export function DetailPage({ id, selected, onBack }: 
Props): VNode {
             </div>
           </div>
         </Fragment> : <Fragment>
-          <p class="is-size-5"><Translate>Now you should transfer to the 
exchange into the account address indicated above and the transaction must 
carry the subject message.</Translate></p>
-          <p class="is-size-5"><Translate>For example :</Translate></p>
+          <p class="is-size-5"><Translate>To complete the setup of the 
reserve, you must now initiate a wire transfer using the given wire transfer 
subject and crediting the specified amount to the indicated account of the 
exchange.</Translate></p>
+          <p class="is-size-5"><Translate>If your system supports RFC 8905, 
you can do this by opening this URI:</Translate></p>
           <pre>
-            
{selected.payto_uri}?message={id}&amount={selected.merchant_initial_amount}
+            <a target="_blank" rel="noreferrer" href={link}>{link}</a>
           </pre>
+          <QR text={link} />
         </Fragment>
         }
 
@@ -110,10 +114,6 @@ function EmptyTable(): VNode {
 }
 
 
-async function copyToClipboard(text: string) {
-  return navigator.clipboard.writeText(text)
-}
-
 interface TableProps {
   tips: MerchantBackend.Tips.TipStatusEntry[];
 }
diff --git 
a/packages/frontend/src/paths/instance/transfers/create/CreatePage.tsx 
b/packages/frontend/src/paths/instance/transfers/create/CreatePage.tsx
index 566483e..d0f5c5e 100644
--- a/packages/frontend/src/paths/instance/transfers/create/CreatePage.tsx
+++ b/packages/frontend/src/paths/instance/transfers/create/CreatePage.tsx
@@ -25,12 +25,9 @@ import { AsyncButton } from 
"../../../../components/exception/AsyncButton";
 import { FormErrors, FormProvider } from 
"../../../../components/form/FormProvider";
 import { Input } from "../../../../components/form/Input";
 import { InputCurrency } from "../../../../components/form/InputCurrency";
-import { InputPayto } from "../../../../components/form/InputPayto";
 import { InputSelector } from "../../../../components/form/InputSelector";
-import { InputWithAddon } from "../../../../components/form/InputWithAddon";
 import { useConfigContext } from "../../../../context/config";
 import { MerchantBackend } from "../../../../declaration";
-import { useInstanceDetails } from "../../../../hooks/instance";
 import { Translate, useTranslator } from "../../../../i18n";
 import { CROCKFORD_BASE32_REGEX, URL_REGEX } from 
"../../../../utils/constants";
 
@@ -80,6 +77,7 @@ export function CreatePage({ accounts, onCreate, onBack }: 
Props): VNode {
           <FormProvider object={state} valueHandler={setState} errors={errors}>
             <InputSelector name="payto_uri" label={i18n`Credited bank account`}
               values={accounts}
+              placeholder={i18n`Select one account`}
               tooltip={i18n`Bank account of the merchant where the payment was 
received`}
             />
             <Input<Entity> name="wtid" label={i18n`Wire transfer ID`} help="" 
tooltip={i18n`unique identifier of the wire transfer used by the exchange, must 
be 52 characters long`} />

-- 
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]