summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/components
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-03-18 15:32:41 +0100
committerFlorian Dold <florian@dold.me>2022-03-21 19:20:48 +0100
commitf8d12f7b0d4af1b1769b89e80c87f9c169678564 (patch)
tree2478696c7bc1efc6d090b93aa340de542a7dccd9 /packages/taler-wallet-webextension/src/components
parent32cd54e11d80bde0274b3c0238f8f5bd00ff83cb (diff)
downloadwallet-core-f8d12f7b0d4af1b1769b89e80c87f9c169678564.tar.gz
wallet-core-f8d12f7b0d4af1b1769b89e80c87f9c169678564.tar.bz2
wallet-core-f8d12f7b0d4af1b1769b89e80c87f9c169678564.zip
wallet: t_s/d_us migration
Diffstat (limited to 'packages/taler-wallet-webextension/src/components')
-rw-r--r--packages/taler-wallet-webextension/src/components/PendingTransactions.stories.tsx62
-rw-r--r--packages/taler-wallet-webextension/src/components/PendingTransactions.tsx13
-rw-r--r--packages/taler-wallet-webextension/src/components/Time.tsx4
-rw-r--r--packages/taler-wallet-webextension/src/components/TransactionItem.tsx16
4 files changed, 40 insertions, 55 deletions
diff --git a/packages/taler-wallet-webextension/src/components/PendingTransactions.stories.tsx b/packages/taler-wallet-webextension/src/components/PendingTransactions.stories.tsx
index 658a41aa8..ea29d4a78 100644
--- a/packages/taler-wallet-webextension/src/components/PendingTransactions.stories.tsx
+++ b/packages/taler-wallet-webextension/src/components/PendingTransactions.stories.tsx
@@ -22,7 +22,11 @@
import { PendingTransactionsView as TestedComponent } from "./PendingTransactions";
import { Fragment, h, VNode } from "preact";
import { createExample } from "../test-utils";
-import { Transaction, TransactionType } from "@gnu-taler/taler-util";
+import {
+ TalerProtocolTimestamp,
+ Transaction,
+ TransactionType,
+} from "@gnu-taler/taler-util";
export default {
title: "component/PendingTransactions",
@@ -34,9 +38,7 @@ export const OnePendingTransaction = createExample(TestedComponent, {
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
],
});
@@ -46,23 +48,17 @@ export const ThreePendingTransactions = createExample(TestedComponent, {
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
],
});
@@ -72,72 +68,52 @@ export const TenPendingTransactions = createExample(TestedComponent, {
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1)
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
],
});
diff --git a/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx b/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx
index eed31beb4..7923eb6ad 100644
--- a/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx
+++ b/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx
@@ -1,4 +1,9 @@
-import { Amounts, NotificationType, Transaction } from "@gnu-taler/taler-util";
+import {
+ AbsoluteTime,
+ Amounts,
+ NotificationType,
+ Transaction,
+} from "@gnu-taler/taler-util";
import { PendingTaskInfo } from "@gnu-taler/taler-wallet-core";
import { Fragment, h, JSX } from "preact";
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
@@ -70,7 +75,11 @@ export function PendingTransactionsView({
<b>
{amount.currency} {Amounts.stringifyValue(amount)}
</b>{" "}
- - <Time timestamp={t.timestamp} format="dd MMMM yyyy" />
+ -{" "}
+ <Time
+ timestamp={AbsoluteTime.fromTimestamp(t.timestamp)}
+ format="dd MMMM yyyy"
+ />
</Typography>
),
};
diff --git a/packages/taler-wallet-webextension/src/components/Time.tsx b/packages/taler-wallet-webextension/src/components/Time.tsx
index 452b08334..902187aa3 100644
--- a/packages/taler-wallet-webextension/src/components/Time.tsx
+++ b/packages/taler-wallet-webextension/src/components/Time.tsx
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { Timestamp } from "@gnu-taler/taler-util";
+import { AbsoluteTime } from "@gnu-taler/taler-util";
import { formatISO, format } from "date-fns";
import { h, VNode } from "preact";
@@ -22,7 +22,7 @@ export function Time({
timestamp,
format: formatString,
}: {
- timestamp: Timestamp | undefined;
+ timestamp: AbsoluteTime | undefined;
format: string;
}): VNode {
return (
diff --git a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
index 12ed4139b..d7eae7bb6 100644
--- a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
+++ b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
@@ -18,7 +18,7 @@ import {
AmountJson,
Amounts,
AmountString,
- Timestamp,
+ AbsoluteTime,
Transaction,
TransactionType,
} from "@gnu-taler/taler-util";
@@ -46,7 +46,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
amount={tx.amountEffective}
debitCreditIndicator={"credit"}
title={new URL(tx.exchangeBaseUrl).hostname}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"W"}
pending={tx.pending}
/>
@@ -59,7 +59,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
debitCreditIndicator={"debit"}
title={tx.info.merchant.name}
subtitle={tx.info.summary}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"P"}
pending={tx.pending}
/>
@@ -72,7 +72,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
debitCreditIndicator={"credit"}
subtitle={tx.info.summary}
title={tx.info.merchant.name}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"R"}
pending={tx.pending}
/>
@@ -84,7 +84,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
amount={tx.amountEffective}
debitCreditIndicator={"credit"}
title={new URL(tx.merchantBaseUrl).hostname}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"T"}
pending={tx.pending}
/>
@@ -96,7 +96,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
amount={tx.amountEffective}
debitCreditIndicator={"credit"}
title={new URL(tx.exchangeBaseUrl).hostname}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"R"}
pending={tx.pending}
/>
@@ -108,7 +108,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
amount={tx.amountEffective}
debitCreditIndicator={"debit"}
title={tx.targetPaytoUri}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"D"}
pending={tx.pending}
/>
@@ -165,7 +165,7 @@ function TransactionLayout(props: TransactionLayoutProps): VNode {
interface TransactionLayoutProps {
debitCreditIndicator: "debit" | "credit" | "unknown";
amount: AmountString | "unknown";
- timestamp: Timestamp;
+ timestamp: AbsoluteTime;
title: string;
subtitle?: string;
id: string;