From d2cf75b782b63d7b217b14c0a3bdc953c5e3bca9 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 6 Sep 2021 14:55:55 -0300 Subject: rendring pending transation item --- packages/taler-wallet-webextension/.gitignore | 1 + .../src/components/TransactionItem.tsx | 12 +- .../src/components/styled/index.tsx | 4 +- .../src/popup/BackupPage.tsx | 8 +- .../src/popup/ProviderAddPage.tsx | 4 +- .../src/popup/ProviderDetailPage.tsx | 4 +- .../src/wallet/BackupPage.tsx | 8 +- .../src/wallet/History.stories.tsx | 124 +++------------------ .../src/wallet/ProviderAddPage.tsx | 4 +- .../src/wallet/ProviderDetailPage.tsx | 4 +- .../src/wallet/Transaction.tsx | 8 +- 11 files changed, 43 insertions(+), 138 deletions(-) diff --git a/packages/taler-wallet-webextension/.gitignore b/packages/taler-wallet-webextension/.gitignore index 0974a77aa..2897bd5d0 100644 --- a/packages/taler-wallet-webextension/.gitignore +++ b/packages/taler-wallet-webextension/.gitignore @@ -1,3 +1,4 @@ extension/ /storybook-static/ /.linaria-cache/ +/lib diff --git a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx index e5545b950..8ddfd0e32 100644 --- a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx +++ b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx @@ -7,7 +7,7 @@ import imageRefresh from '../../static/img/ri-refresh-line.svg'; import imageRefund from '../../static/img/ri-refund-2-line.svg'; import imageShoppingCart from '../../static/img/ri-shopping-cart-line.svg'; import { Pages } from "../NavigationBar"; -import { Column, ExtraLargeText, HistoryRow, SmallTextLight, LargeText } from './styled/index'; +import { Column, ExtraLargeText, HistoryRow, SmallLightText, LargeText, LightText } from './styled/index'; export function TransactionItem(props: { tx: Transaction, multiCurrency: boolean }): JSX.Element { const tx = props.tx; @@ -103,11 +103,11 @@ function TransactionLayout(props: TransactionLayoutProps): JSX.Element { {props.title} - {props.pending ? ( - (Pending) - ) : null} - {dateStr} + {props.pending && + Waiting for confirmation + } + {dateStr} {props.multiCurrency &&
{currency}
} + {props.pending &&
PENDING
} ); } diff --git a/packages/taler-wallet-webextension/src/components/styled/index.tsx b/packages/taler-wallet-webextension/src/components/styled/index.tsx index 8f795ce83..de045584c 100644 --- a/packages/taler-wallet-webextension/src/components/styled/index.tsx +++ b/packages/taler-wallet-webextension/src/components/styled/index.tsx @@ -366,7 +366,7 @@ export const ExtraLargeText = styled.div` font-size: x-large; ` -export const SmallTextLight = styled(SmallText)` +export const SmallLightText = styled(SmallText)` color: gray; ` @@ -375,7 +375,7 @@ export const CenteredText = styled.div` text-align: center; ` -export const CenteredTextBold = styled(CenteredText)` +export const CenteredBoldText = styled(CenteredText)` white-space: nowrap; text-align: center; font-weight: bold; diff --git a/packages/taler-wallet-webextension/src/popup/BackupPage.tsx b/packages/taler-wallet-webextension/src/popup/BackupPage.tsx index 695f3abaa..dcc5e5313 100644 --- a/packages/taler-wallet-webextension/src/popup/BackupPage.tsx +++ b/packages/taler-wallet-webextension/src/popup/BackupPage.tsx @@ -21,8 +21,8 @@ import { differenceInMonths, formatDuration, intervalToDuration } from "date-fns import { Fragment, JSX, VNode, h } from "preact"; import { BoldLight, ButtonPrimary, ButtonSuccess, Centered, - CenteredText, CenteredTextBold, PopupBox, RowBorderGray, - SmallText, SmallTextLight + CenteredText, CenteredBoldText, PopupBox, RowBorderGray, + SmallText, SmallLightText } from "../components/styled"; import { useBackupStatus } from "../hooks/useBackupStatus"; import { Pages } from "../NavigationBar"; @@ -99,7 +99,7 @@ function BackupLayout(props: TransactionLayoutProps): JSX.Element { {props.title} {dateStr && Last synced: {dateStr}} - {!dateStr && Not synced} + {!dateStr && Not synced}
{props.status?.type === 'paid' ? @@ -114,7 +114,7 @@ function BackupLayout(props: TransactionLayoutProps): JSX.Element { function ExpirationText({ until }: { until: Timestamp }) { return Expires in - {daysUntil(until)} + {daysUntil(until)} } diff --git a/packages/taler-wallet-webextension/src/popup/ProviderAddPage.tsx b/packages/taler-wallet-webextension/src/popup/ProviderAddPage.tsx index 050614978..ffefaedb5 100644 --- a/packages/taler-wallet-webextension/src/popup/ProviderAddPage.tsx +++ b/packages/taler-wallet-webextension/src/popup/ProviderAddPage.tsx @@ -4,7 +4,7 @@ import { VNode, h } from "preact"; import { useEffect, useState } from "preact/hooks"; import { Checkbox } from "../components/Checkbox"; import { ErrorMessage } from "../components/ErrorMessage"; -import { Button, ButtonPrimary, Input, LightText, PopupBox, SmallTextLight } from "../components/styled/index"; +import { Button, ButtonPrimary, Input, LightText, PopupBox, SmallLightText } from "../components/styled/index"; import * as wxApi from "../wxApi"; interface Props { @@ -129,7 +129,7 @@ export function ConfirmProviderView({ url, provider, onCancel, onConfirm }: Conf

Review terms of service

Provider URL: {url}
- Please review and accept this provider's terms of service + Please review and accept this provider's terms of service

1. Pricing

{Amounts.isZero(provider.annual_fee) ? 'free of charge' : `${provider.annual_fee} per year of service`} diff --git a/packages/taler-wallet-webextension/src/popup/ProviderDetailPage.tsx b/packages/taler-wallet-webextension/src/popup/ProviderDetailPage.tsx index 83d94ac0f..04adbb21c 100644 --- a/packages/taler-wallet-webextension/src/popup/ProviderDetailPage.tsx +++ b/packages/taler-wallet-webextension/src/popup/ProviderDetailPage.tsx @@ -20,7 +20,7 @@ import { ProviderInfo, ProviderPaymentStatus, ProviderPaymentType } from "@gnu-t import { format, formatDuration, intervalToDuration } from "date-fns"; import { Fragment, VNode, h } from "preact"; import { ErrorMessage } from "../components/ErrorMessage"; -import { Button, ButtonDestructive, ButtonPrimary, PaymentStatus, PopupBox, SmallTextLight } from "../components/styled"; +import { Button, ButtonDestructive, ButtonPrimary, PaymentStatus, PopupBox, SmallLightText } from "../components/styled"; import { useProviderStatus } from "../hooks/useProviderStatus"; interface Props { @@ -60,7 +60,7 @@ export function ProviderView({ info, onDelete, onSync, onBack, onExtend }: ViewP

-

{info.name} {info.syncProviderBaseUrl}

+

{info.name} {info.syncProviderBaseUrl}

{isPaid ? 'Paid' : 'Unpaid'}
diff --git a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx index 8b88432e0..ffc4418e0 100644 --- a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx @@ -21,8 +21,8 @@ import { differenceInMonths, formatDuration, intervalToDuration } from "date-fns import { Fragment, JSX, VNode, h } from "preact"; import { BoldLight, ButtonPrimary, ButtonSuccess, Centered, - CenteredText, CenteredTextBold, PopupBox, RowBorderGray, - SmallText, SmallTextLight, WalletBox + CenteredText, CenteredBoldText, PopupBox, RowBorderGray, + SmallText, SmallLightText, WalletBox } from "../components/styled"; import { useBackupStatus } from "../hooks/useBackupStatus"; import { Pages } from "../NavigationBar"; @@ -99,7 +99,7 @@ function BackupLayout(props: TransactionLayoutProps): JSX.Element { {props.title} {dateStr && Last synced: {dateStr}} - {!dateStr && Not synced} + {!dateStr && Not synced}
{props.status?.type === 'paid' ? @@ -114,7 +114,7 @@ function BackupLayout(props: TransactionLayoutProps): JSX.Element { function ExpirationText({ until }: { until: Timestamp }) { return Expires in - {daysUntil(until)} + {daysUntil(until)} } diff --git a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx index 32499a264..c2b3bcd51 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx @@ -130,6 +130,19 @@ export const One = createExample(TestedComponent, { }] }); +export const OnePending = createExample(TestedComponent, { + list: [{...exampleData.withdraw, + pending: true + }], + balances: [{ + available: 'USD:10', + pendingIncoming: 'USD:0', + pendingOutgoing: 'USD:0', + hasPendingTransactions: false, + requiresUserInput: false, + }] +}); + export const Several = createExample(TestedComponent, { list: [ exampleData.withdraw, @@ -176,114 +189,3 @@ export const SeveralWithTwoCurrencies = createExample(TestedComponent, { }] }); -// export const WithdrawPending = createExample(TestedComponent, { -// transaction: { ...exampleData.withdraw, pending: true }, -// }); - - -// export const Payment = createExample(TestedComponent, { -// transaction: exampleData.payment -// }); - -// export const PaymentWithoutFee = createExample(TestedComponent, { -// transaction: { -// ...exampleData.payment, -// amountRaw: 'USD:11', - -// } -// }); - -// export const PaymentPending = createExample(TestedComponent, { -// transaction: { ...exampleData.payment, pending: true }, -// }); - -// export const PaymentWithProducts = createExample(TestedComponent, { -// transaction: { -// ...exampleData.payment, -// info: { -// ...exampleData.payment.info, -// summary: 'this order has 5 products', -// products: [{ -// description: 't-shirt', -// unit: 'shirts', -// quantity: 1, -// }, { -// description: 't-shirt', -// unit: 'shirts', -// quantity: 1, -// }, { -// description: 'e-book', -// }, { -// description: 'beer', -// unit: 'pint', -// quantity: 15, -// }, { -// description: 'beer', -// unit: 'pint', -// quantity: 15, -// }] -// } -// } as TransactionPayment, -// }); - -// export const PaymentWithLongSummary = createExample(TestedComponent, { -// transaction: { -// ...exampleData.payment, -// info: { -// ...exampleData.payment.info, -// summary: 'this is a very long summary that will occupy severals lines, this is a very long summary that will occupy severals lines, this is a very long summary that will occupy severals lines, this is a very long summary that will occupy severals lines, ', -// products: [{ -// description: 'an xl sized t-shirt with some drawings on it, color pink', -// unit: 'shirts', -// quantity: 1, -// }, { -// description: 'beer', -// unit: 'pint', -// quantity: 15, -// }] -// } -// } as TransactionPayment, -// }); - - -// export const Deposit = createExample(TestedComponent, { -// transaction: exampleData.deposit -// }); - -// export const DepositPending = createExample(TestedComponent, { -// transaction: { ...exampleData.deposit, pending: true } -// }); - -// export const Refresh = createExample(TestedComponent, { -// transaction: exampleData.refresh -// }); - -// export const Tip = createExample(TestedComponent, { -// transaction: exampleData.tip -// }); - -// export const TipPending = createExample(TestedComponent, { -// transaction: { ...exampleData.tip, pending: true } -// }); - -// export const Refund = createExample(TestedComponent, { -// transaction: exampleData.refund -// }); - -// export const RefundPending = createExample(TestedComponent, { -// transaction: { ...exampleData.refund, pending: true } -// }); - -// export const RefundWithProducts = createExample(TestedComponent, { -// transaction: { -// ...exampleData.refund, -// info: { -// ...exampleData.refund.info, -// products: [{ -// description: 't-shirt', -// }, { -// description: 'beer', -// }] -// } -// } as TransactionRefund, -// }); diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx b/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx index 2b205ebee..aa87c91e5 100644 --- a/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx @@ -4,7 +4,7 @@ import { VNode, h } from "preact"; import { useEffect, useState } from "preact/hooks"; import { Checkbox } from "../components/Checkbox"; import { ErrorMessage } from "../components/ErrorMessage"; -import { Button, ButtonPrimary, Input, LightText, WalletBox, SmallTextLight } from "../components/styled/index"; +import { Button, ButtonPrimary, Input, LightText, WalletBox, SmallLightText } from "../components/styled/index"; import * as wxApi from "../wxApi"; interface Props { @@ -129,7 +129,7 @@ export function ConfirmProviderView({ url, provider, onCancel, onConfirm }: Conf

Review terms of service

Provider URL: {url}
- Please review and accept this provider's terms of service + Please review and accept this provider's terms of service

1. Pricing

{Amounts.isZero(provider.annual_fee) ? 'free of charge' : `${provider.annual_fee} per year of service`} diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx index 871e30b71..c45458eb7 100644 --- a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx @@ -20,7 +20,7 @@ import { ProviderInfo, ProviderPaymentStatus, ProviderPaymentType } from "@gnu-t import { format, formatDuration, intervalToDuration } from "date-fns"; import { Fragment, VNode, h } from "preact"; import { ErrorMessage } from "../components/ErrorMessage"; -import { Button, ButtonDestructive, ButtonPrimary, PaymentStatus, WalletBox, SmallTextLight } from "../components/styled"; +import { Button, ButtonDestructive, ButtonPrimary, PaymentStatus, WalletBox, SmallLightText } from "../components/styled"; import { useProviderStatus } from "../hooks/useProviderStatus"; interface Props { @@ -60,7 +60,7 @@ export function ProviderView({ info, onDelete, onSync, onBack, onExtend }: ViewP

-

{info.name} {info.syncProviderBaseUrl}

+

{info.name} {info.syncProviderBaseUrl}

{isPaid ? 'Paid' : 'Unpaid'}
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index ad00b3d1b..cc5430d0d 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -22,7 +22,7 @@ import { useEffect, useState } from "preact/hooks"; import * as wxApi from "../wxApi"; import { Pages } from "../NavigationBar"; import emptyImg from "../../static/img/empty.png" -import { Button, ButtonBox, ButtonBoxDestructive, ButtonDestructive, ButtonPrimary, ExtraLargeText, FontIcon, LargeText, ListOfProducts, PopupBox, Row, RowBorderGray, SmallTextLight, WalletBox } from "../components/styled"; +import { Button, ButtonBox, ButtonBoxDestructive, ButtonDestructive, ButtonPrimary, ExtraLargeText, FontIcon, LargeText, ListOfProducts, PopupBox, Row, RowBorderGray, SmallLightText, WalletBox } from "../components/styled"; import { ErrorMessage } from "../components/ErrorMessage"; export function TransactionPage({ tid }: { tid: string; }): JSX.Element { @@ -94,7 +94,7 @@ export function TransactionView({ transaction, onDelete, onRetry, onBack }: Wall function Part({ text, title, kind, big }: { title: string, text: AmountLike, kind: Kind, big?: boolean }) { const Text = big ? ExtraLargeText : LargeText; return
- {title} + {title} {text} @@ -153,7 +153,7 @@ export function TransactionView({ transaction, onDelete, onRetry, onBack }: Wall
- {p.quantity && p.quantity > 0 && x {p.quantity} {p.unit}} + {p.quantity && p.quantity > 0 && x {p.quantity} {p.unit}}
{p.description}
)} @@ -235,7 +235,7 @@ export function TransactionView({ transaction, onDelete, onRetry, onBack }: Wall
- {p.quantity && p.quantity > 0 && x {p.quantity} {p.unit}} + {p.quantity && p.quantity > 0 && x {p.quantity} {p.unit}}
{p.description}
)} -- cgit v1.2.3