From 54d4a1efe0a55a80ed594f14698da16dfded8c47 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 30 Nov 2021 17:29:33 -0300 Subject: add a taler action from the history page --- .../src/wallet/History.tsx | 60 ++++++++++++++-------- 1 file changed, 40 insertions(+), 20 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet/History.tsx') diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx index bc8ef734a..58db0360b 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.tsx @@ -21,10 +21,12 @@ import { Transaction, } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; -import { DateSeparator } from "../components/styled"; +import { useState } from "preact/hooks"; +import { ButtonPrimary, DateSeparator } from "../components/styled"; import { Time } from "../components/Time"; import { TransactionItem } from "../components/TransactionItem"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook"; +import { AddNewActionView } from "../popup/AddNewActionView"; import * as wxApi from "../wxApi"; export function HistoryPage(): VNode { @@ -37,6 +39,12 @@ export function HistoryPage(): VNode { NotificationType.WithdrawGroupFinished, ]); + const [addingAction, setAddingAction] = useState(false); + + if (addingAction) { + return setAddingAction(false)} />; + } + if (!transactionQuery) { return
Loading ...
; } @@ -48,6 +56,7 @@ export function HistoryPage(): VNode { setAddingAction(true)} /> ); } @@ -65,9 +74,11 @@ function normalizeToDay(x: number): number { export function HistoryView({ list, balances, + onAddNewAction, }: { list: Transaction[]; balances: Balance[]; + onAddNewAction: () => void; }): VNode { const byDate = list.reduce((rv, x) => { const theDate = @@ -83,25 +94,34 @@ export function HistoryView({ return ( - {balances.length > 0 && ( -
- {balances.length === 1 && ( -
- Balance: {amountToString(balances[0].available)} -
- )} - {balances.length > 1 && ( -
- Balance:{" "} -
    - {balances.map((b, i) => ( -
  • {b.available}
  • - ))} -
-
- )} -
- )} +
+ {balances.length > 0 ? ( + + {balances.length === 1 && ( +
+ Balance: {amountToString(balances[0].available)} +
+ )} + {balances.length > 1 && ( +
+ Balance:{" "} +
    + {balances.map((b, i) => ( +
  • {b.available}
  • + ))} +
+
+ )} +
+ ) : ( +
+ )} +
+ + + + +
+
{Object.keys(byDate).map((d, i) => { return ( -- cgit v1.2.3