[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant-backoffice] branch master updated: add tip details and s
From: |
gnunet |
Subject: |
[taler-merchant-backoffice] branch master updated: add tip details and some fixes with time format |
Date: |
Fri, 01 Jul 2022 17:09:34 +0200 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository merchant-backoffice.
The following commit(s) were added to refs/heads/master by this push:
new 07df6b6 add tip details and some fixes with time format
07df6b6 is described below
commit 07df6b6b872aa088b42d716323a208d41243317a
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Jul 1 12:09:23 2022 -0300
add tip details and some fixes with time format
---
.../paths/instance/reserves/details/DetailPage.tsx | 38 ++++++++++++-----
.../TipInfo.tsx} | 48 +++++++++-------------
.../instance/reserves/list/CreatedSuccessfully.tsx | 5 ++-
.../src/paths/instance/reserves/list/Table.tsx | 14 +++++--
.../src/paths/instance/transfers/list/Table.tsx | 5 ++-
5 files changed, 65 insertions(+), 45 deletions(-)
diff --git
a/packages/merchant-backoffice/src/paths/instance/reserves/details/DetailPage.tsx
b/packages/merchant-backoffice/src/paths/instance/reserves/details/DetailPage.tsx
index 59041e7..cbc7017 100644
---
a/packages/merchant-backoffice/src/paths/instance/reserves/details/DetailPage.tsx
+++
b/packages/merchant-backoffice/src/paths/instance/reserves/details/DetailPage.tsx
@@ -22,15 +22,18 @@
import { Amounts } from "@gnu-taler/taler-util";
import { format } from "date-fns";
import { Fragment, h, VNode } from "preact";
+import { useState } from "preact/hooks";
import { QR } from "../../../../components/exception/QR";
import { FormProvider } from "../../../../components/form/FormProvider";
import { Input } from "../../../../components/form/Input";
import { InputCurrency } from "../../../../components/form/InputCurrency";
import { InputDate } from "../../../../components/form/InputDate";
import { TextField } from "../../../../components/form/TextField";
+import { ContinueModal, SimpleModal } from "../../../../components/modal";
import { MerchantBackend } from "../../../../declaration";
import { useTipDetails } from "../../../../hooks/reserves";
import { Translate, useTranslator } from "../../../../i18n";
+import { TipInfo } from "./TipInfo";
type Entity = MerchantBackend.Tips.ReserveDetail;
type CT = MerchantBackend.ContractTerms;
@@ -223,6 +226,7 @@ function TipRow({
id: string;
entry: MerchantBackend.Tips.TipStatusEntry;
}) {
+ const [selected, setSelected] = useState(false);
const result = useTipDetails(id);
if (result.loading) {
return (
@@ -245,16 +249,30 @@ function TipRow({
);
}
const info = result.data;
+ function onSelect() {
+ setSelected(true);
+ }
return (
- <tr>
- <td>{info.total_authorized}</td>
- <td>{info.total_picked_up}</td>
- <td>{info.reason}</td>
- <td>
- {info.expiration.t_s === "never"
- ? "never"
- : format(info.expiration.t_s, "yyyy/MM/dd HH:mm:ss")}
- </td>
- </tr>
+ <Fragment>
+ {selected && (
+ <SimpleModal
+ description="tip"
+ active
+ onCancel={() => setSelected(false)}
+ >
+ <TipInfo id={id} amount={info.total_authorized} entity={info} />
+ </SimpleModal>
+ )}
+ <tr>
+ <td onClick={onSelect}>{info.total_authorized}</td>
+ <td onClick={onSelect}>{info.total_picked_up}</td>
+ <td onClick={onSelect}>{info.reason}</td>
+ <td onClick={onSelect}>
+ {info.expiration.t_s === "never"
+ ? "never"
+ : format(info.expiration.t_s * 1000, "yyyy/MM/dd HH:mm:ss")}
+ </td>
+ </tr>
+ </Fragment>
);
}
diff --git
a/packages/merchant-backoffice/src/paths/instance/reserves/list/CreatedSuccessfully.tsx
b/packages/merchant-backoffice/src/paths/instance/reserves/details/TipInfo.tsx
similarity index 63%
copy from
packages/merchant-backoffice/src/paths/instance/reserves/list/CreatedSuccessfully.tsx
copy to
packages/merchant-backoffice/src/paths/instance/reserves/details/TipInfo.tsx
index 9a64d71..3f38496 100644
---
a/packages/merchant-backoffice/src/paths/instance/reserves/list/CreatedSuccessfully.tsx
+++
b/packages/merchant-backoffice/src/paths/instance/reserves/details/TipInfo.tsx
@@ -15,24 +15,22 @@
*/
import { format } from "date-fns";
import { Fragment, h, VNode } from "preact";
-import { CreatedSuccessfully as Template } from
"../../../../components/notifications/CreatedSuccessfully";
+import { useBackendContext } from "../../../../context/backend";
import { MerchantBackend } from "../../../../declaration";
-type Entity = MerchantBackend.Tips.TipCreateConfirmation;
+type Entity = MerchantBackend.Tips.TipDetails;
interface Props {
+ id: string;
entity: Entity;
- request: MerchantBackend.Tips.TipCreateRequest;
- onConfirm: () => void;
- onCreateAnother?: () => void;
+ amount: string;
}
-export function CreatedSuccessfully({
- request,
- entity,
- onConfirm,
- onCreateAnother,
-}: Props): VNode {
+export function TipInfo({ id, amount, entity }: Props): VNode {
+ const { url } = useBackendContext();
+ const tipHost = url.replace(/.*:\/\//, ""); // remove protocol part
+ const proto = url.startsWith("http://") ? "taler+http" : "taler";
+ const tipURL = `${proto}://tip/${tipHost}/${id}`;
return (
<Fragment>
<div class="field is-horizontal">
@@ -42,19 +40,7 @@ export function CreatedSuccessfully({
<div class="field-body is-flex-grow-3">
<div class="field">
<p class="control">
- <input readonly class="input" value={request.amount} />
- </p>
- </div>
- </div>
- </div>
- <div class="field is-horizontal">
- <div class="field-label is-normal">
- <label class="label">Justification</label>
- </div>
- <div class="field-body is-flex-grow-3">
- <div class="field">
- <p class="control">
- <input readonly class="input" value={request.justification} />
+ <input readonly class="input" value={amount} />
</p>
</div>
</div>
@@ -64,9 +50,11 @@ export function CreatedSuccessfully({
<label class="label">URL</label>
</div>
<div class="field-body is-flex-grow-3">
- <div class="field">
+ <div class="field" style={{ overflowWrap: "anywhere" }}>
<p class="control">
- <input readonly class="input" value={entity.tip_status_url} />
+ <a target="_blank" rel="noreferrer" href={tipURL}>
+ {tipURL}
+ </a>
</p>
</div>
</div>
@@ -82,10 +70,12 @@ export function CreatedSuccessfully({
class="input"
readonly
value={
- !entity.tip_expiration ||
- entity.tip_expiration.t_s === "never"
+ !entity.expiration || entity.expiration.t_s === "never"
? "never"
- : format(entity.tip_expiration.t_s, "yyyy/MM/dd HH:mm:ss")
+ : format(
+ entity.expiration.t_s * 1000,
+ "yyyy/MM/dd HH:mm:ss"
+ )
}
/>
</p>
diff --git
a/packages/merchant-backoffice/src/paths/instance/reserves/list/CreatedSuccessfully.tsx
b/packages/merchant-backoffice/src/paths/instance/reserves/list/CreatedSuccessfully.tsx
index 9a64d71..1e5f075 100644
---
a/packages/merchant-backoffice/src/paths/instance/reserves/list/CreatedSuccessfully.tsx
+++
b/packages/merchant-backoffice/src/paths/instance/reserves/list/CreatedSuccessfully.tsx
@@ -85,7 +85,10 @@ export function CreatedSuccessfully({
!entity.tip_expiration ||
entity.tip_expiration.t_s === "never"
? "never"
- : format(entity.tip_expiration.t_s, "yyyy/MM/dd HH:mm:ss")
+ : format(
+ entity.tip_expiration.t_s * 1000,
+ "yyyy/MM/dd HH:mm:ss"
+ )
}
/>
</p>
diff --git
a/packages/merchant-backoffice/src/paths/instance/reserves/list/Table.tsx
b/packages/merchant-backoffice/src/paths/instance/reserves/list/Table.tsx
index fd1d2e3..b3bb7b0 100644
--- a/packages/merchant-backoffice/src/paths/instance/reserves/list/Table.tsx
+++ b/packages/merchant-backoffice/src/paths/instance/reserves/list/Table.tsx
@@ -161,7 +161,7 @@ function Table({ instances, onNewTip, onSelect, onDelete }:
TableProps): VNode {
>
{i.creation_time.t_s === "never"
? "never"
- : format(i.creation_time.t_s, "yyyy/MM/dd HH:mm:ss")}
+ : format(i.creation_time.t_s * 1000, "yyyy/MM/dd
HH:mm:ss")}
</td>
<td
onClick={(): void => onSelect(i)}
@@ -169,7 +169,10 @@ function Table({ instances, onNewTip, onSelect, onDelete
}: TableProps): VNode {
>
{i.expiration_time.t_s === "never"
? "never"
- : format(i.expiration_time.t_s, "yyyy/MM/dd HH:mm:ss")}
+ : format(
+ i.expiration_time.t_s * 1000,
+ "yyyy/MM/dd HH:mm:ss"
+ )}
</td>
<td
onClick={(): void => onSelect(i)}
@@ -269,7 +272,7 @@ function TableWithoutFund({
>
{i.creation_time.t_s === "never"
? "never"
- : format(i.creation_time.t_s, "yyyy/MM/dd HH:mm:ss")}
+ : format(i.creation_time.t_s * 1000, "yyyy/MM/dd
HH:mm:ss")}
</td>
<td
onClick={(): void => onSelect(i)}
@@ -277,7 +280,10 @@ function TableWithoutFund({
>
{i.expiration_time.t_s === "never"
? "never"
- : format(i.expiration_time.t_s, "yyyy/MM/dd HH:mm:ss")}
+ : format(
+ i.expiration_time.t_s * 1000,
+ "yyyy/MM/dd HH:mm:ss"
+ )}
</td>
<td
onClick={(): void => onSelect(i)}
diff --git
a/packages/merchant-backoffice/src/paths/instance/transfers/list/Table.tsx
b/packages/merchant-backoffice/src/paths/instance/transfers/list/Table.tsx
index 27ad06a..4cb0469 100644
--- a/packages/merchant-backoffice/src/paths/instance/transfers/list/Table.tsx
+++ b/packages/merchant-backoffice/src/paths/instance/transfers/list/Table.tsx
@@ -171,7 +171,10 @@ function Table({
{i.execution_time
? i.execution_time.t_s == "never"
? i18n`never`
- : format(i.execution_time.t_s, "yyyy/MM/dd HH:mm:ss")
+ : format(
+ i.execution_time.t_s * 1000,
+ "yyyy/MM/dd HH:mm:ss"
+ )
: i18n`unknown`}
</td>
<td>
--
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: add tip details and some fixes with time format,
gnunet <=