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/popup/History.tsx | 57 ++++++++++++++-------- 1 file changed, 38 insertions(+), 19 deletions(-) (limited to 'packages/taler-wallet-webextension/src/popup/History.tsx') diff --git a/packages/taler-wallet-webextension/src/popup/History.tsx b/packages/taler-wallet-webextension/src/popup/History.tsx index b23b4781f..f897299d8 100644 --- a/packages/taler-wallet-webextension/src/popup/History.tsx +++ b/packages/taler-wallet-webextension/src/popup/History.tsx @@ -23,10 +23,11 @@ import { } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; -import { PopupBox } from "../components/styled"; +import { ButtonPrimary } from "../components/styled/index"; import { TransactionItem } from "../components/TransactionItem"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook"; import * as wxApi from "../wxApi"; +import { AddNewActionView } from "./AddNewActionView"; export function HistoryPage(): VNode { const [transactions, setTransactions] = useState< @@ -45,6 +46,12 @@ export function HistoryPage(): VNode { fetchData(); }, []); + const [addingAction, setAddingAction] = useState(false); + + if (addingAction) { + return setAddingAction(false)} />; + } + if (!transactions) { return
Loading ...
; } @@ -53,6 +60,7 @@ export function HistoryPage(): VNode { setAddingAction(true)} /> ); } @@ -65,31 +73,42 @@ function amountToString(c: AmountString): string { export function HistoryView({ list, balances, + onAddNewAction, }: { list: Transaction[]; balances: Balance[]; + onAddNewAction: () => void; }): VNode { const multiCurrency = balances.length > 1; return ( - {balances.length > 0 && ( -
- {multiCurrency ? ( -
- Balance:{" "} -
    - {balances.map((b, i) => ( -
  • {b.available}
  • - ))} -
-
- ) : ( -
- Balance: {amountToString(balances[0].available)} -
- )} -
- )} +
+ {balances.length > 0 ? ( + + {multiCurrency ? ( +
+ Balance:{" "} +
    + {balances.map((b, i) => ( +
  • {b.available}
  • + ))} +
+
+ ) : ( +
+ Balance: {amountToString(balances[0].available)} +
+ )} +
+ ) : ( +
+ )} +
+ + + + +
+
{list.length === 0 ? (

-- cgit v1.2.3