/* This file is part of GNU Taler (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see */ import { Attention, useTranslationContext } from "@gnu-taler/web-util/browser"; import { format } from "date-fns"; import { Fragment, VNode, h } from "preact"; import { useBankCoreApiContext } from "../../context/config.js"; import { RenderAmount } from "../../pages/PaytoWireTransferForm.js"; import { Time } from "../Time.js"; import { State } from "./index.js"; export function ReadyView({ transactions, routeCreateWireTransfer, onGoNext, onGoStart, }: State.Ready): VNode { const { i18n, dateLocale } = useTranslationContext(); const { config } = useBankCoreApiContext(); if (!transactions.length) { return (

Transactions history

You can start sending a wire transfer or withdrawing to your wallet.
); } const txByDate = transactions.reduce( (prev, cur) => { const d = cur.when.t_ms === "never" ? "" : format(cur.when.t_ms, "dd/MM/yyyy", { locale: dateLocale }); if (!prev[d]) { prev[d] = []; } prev[d].push(cur); return prev; }, {} as Record, ); return (

Transactions history

{Object.entries(txByDate).map(([date, txs], idx) => { return ( {txs.map((item) => { return ( ); })} ); })}
{i18n.str`Date`}
{date}
Amount
{item.negative ? i18n.str`sent` : i18n.str`received`}{" "} {item.amount ? ( ) : ( <{i18n.str`Invalid value`}> )}
Counterpart
{item.negative ? i18n.str`to` : i18n.str`from`}{" "} {!routeCreateWireTransfer ? ( item.counterpart ) : ( {item.counterpart} )}
                                {item.subject}
                              
); }