From 16777ba20564d8b002e33a01afa3ea49ca715cce Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 17 Aug 2022 16:12:21 -0300 Subject: some fixes --- .../src/wallet/DestinationSelection.stories.tsx | 7 ++ .../src/wallet/DestinationSelection.tsx | 83 ++++++++++------------ .../src/wallet/History.tsx | 8 ++- .../src/wallet/QrReader.tsx | 1 + .../src/wallet/ReserveCreated.stories.tsx | 13 ++++ 5 files changed, 63 insertions(+), 49 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet') diff --git a/packages/taler-wallet-webextension/src/wallet/DestinationSelection.stories.tsx b/packages/taler-wallet-webextension/src/wallet/DestinationSelection.stories.tsx index ec997dfb3..166b2c007 100644 --- a/packages/taler-wallet-webextension/src/wallet/DestinationSelection.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/DestinationSelection.stories.tsx @@ -23,6 +23,7 @@ import { createExample } from "../test-utils.js"; import { DestinationSelectionGetCash, DestinationSelectionSendCash, + SelectCurrencyView, } from "./DestinationSelection.js"; export default { @@ -35,3 +36,9 @@ export const GetCash = createExample(DestinationSelectionGetCash, { export const SendCash = createExample(DestinationSelectionSendCash, { amount: "eur:1", }); +export const SelectCurrency = createExample(SelectCurrencyView, { + list: { + "": "Select a currency", + USD: "USD", + }, +}); diff --git a/packages/taler-wallet-webextension/src/wallet/DestinationSelection.tsx b/packages/taler-wallet-webextension/src/wallet/DestinationSelection.tsx index ba5dcf1da..c62504538 100644 --- a/packages/taler-wallet-webextension/src/wallet/DestinationSelection.tsx +++ b/packages/taler-wallet-webextension/src/wallet/DestinationSelection.tsx @@ -186,24 +186,37 @@ export function SelectCurrency({ const list: Record = {}; hook.response.exchanges.forEach((e) => (list[e.currency] = e.currency)); list[""] = "Select a currency"; + return ; +} + +export function SelectCurrencyView({ + onChange, + list, +}: { + onChange: (s: string) => void; + list: Record; +}): VNode { + const { i18n } = useTranslationContext(); + return ( -

- Specify the amount and the origin -

+

+ + Choose a currency to proceed or add another exchange + +

- - Choose a currency to proceed or add more exchanges in the settings tab - - - Known currencies} - list={list} - name="lang" - value={""} - onChange={(v) => onChange(v)} - /> - +

+ + Known currencies} + list={list} + name="lang" + value={""} + onChange={(v) => onChange(v)} + /> + +

@@ -320,7 +333,7 @@ export function DestinationSelectionGetCash({ {previous2.length > 0 ? ( -

Previous origins:

+

Use previous origins:

@@ -337,9 +350,9 @@ export function DestinationSelectionGetCash({
) : undefined} -

Create new origin for the money

+

Or specify a new origin for the money

- +

From my bank account

@@ -355,23 +368,11 @@ export function DestinationSelectionGetCash({
-

From someone else

- -
-
- - -

From a business or charity

+

From another wallet

- - -

From a exchange reserve or purse

- -
-
); @@ -441,7 +442,7 @@ export function DestinationSelectionSendCash({ {previous2.length > 0 ? ( -

Previous destinations:

+

Use previous destinations:

@@ -458,9 +459,9 @@ export function DestinationSelectionSendCash({
) : undefined} -

Create a destination for the money

+

Or specify a new destination for the money

- +

To my bank account

@@ -469,22 +470,10 @@ export function DestinationSelectionSendCash({
-

To someone else

+

To another wallet

- - -

To a business or charity

- -
-
-
- - -

To an exchange reserve or purse

- -
diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx index f02e43391..e885a216d 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.tsx @@ -96,6 +96,8 @@ const term = 1000 * 60 * 60 * 24; function normalizeToDay(x: number): number { return Math.round(x / term) * term; } +import DownloadIcon from "../svg/download_24px.svg"; +import UploadIcon from "../svg/upload_24px.svg"; export function HistoryView({ defaultCurrency, @@ -206,17 +208,19 @@ export function HistoryView({
{currencyAmount && Amounts.isNonZero(currencyAmount) && (