diff --git a/packages/taler-wallet-webextension/src/components/styled/index.tsx b/packages/taler-wallet-webextension/src/components/styled/index.tsx index 7cef8789b..4c2367008 100644 --- a/packages/taler-wallet-webextension/src/components/styled/index.tsx +++ b/packages/taler-wallet-webextension/src/components/styled/index.tsx @@ -613,6 +613,14 @@ export const LightText = styled.div` color: gray; `; +export const SuccessText = styled.div` + color: #388e3c; +`; + +export const DestructiveText = styled.div` + color: rgb(202, 60, 60); +`; + export const WarningText = styled.div` color: rgb(223, 117, 20); `; diff --git a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx index 5eddde64f..5109055e8 100644 --- a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx +++ b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx @@ -8,6 +8,7 @@ import { LinkSuccess, TermsOfService, WarningBox, + WarningText, } from "../components/styled"; import { TermsState } from "../utils"; @@ -28,10 +29,27 @@ export function TermsOfServiceSection({ if (!reviewing) { if (!reviewed) { if (!onReview) { - return
Terms of service status: {terms.status}
; + return ( + + {terms.status === "notfound" && ( +
+ + {i18n.str`Exchange doesn't have terms of service`} + +
+ )} +
+ ); } return ( + {terms.status === "notfound" && ( +
+ + {i18n.str`Exchange doesn't have terms of service`} + +
+ )} {terms.status === "new" && (
onReview(true)}> @@ -64,7 +82,6 @@ export function TermsOfServiceSection({ enabled={reviewed} label={i18n.str`I accept the exchange terms of service`} onToggle={() => { - console.log("asdasd", reviewed); onAccept(!reviewed); if (onReview) onReview(false); }} diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx index fbbecd6f3..3915dc126 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx +++ b/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { amountFractionalBase } from "@gnu-taler/taler-util"; +import { amountFractionalBase, ExchangeListItem } from "@gnu-taler/taler-util"; import { createExample } from "../test-utils"; import { termsHtml, termsPdf, termsPlain, termsXml } from "./termsExample"; import { View as TestedComponent } from "./Withdraw"; @@ -32,24 +32,38 @@ export default { }, }; +const exchangeList: ExchangeListItem[] = [ + { + currency: "USD", + exchangeBaseUrl: "exchange.demo.taler.net", + tos: { + currentVersion: "1", + acceptedVersion: "1", + content: "terms of service content", + contentType: "text/plain", + }, + paytoUris: ["asd"], + }, + { + currency: "USD", + exchangeBaseUrl: "exchange.test.taler.net", + tos: { + currentVersion: "1", + acceptedVersion: "1", + content: "terms of service content", + contentType: "text/plain", + }, + paytoUris: ["asd"], + }, +]; + export const NewTerms = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", fraction: 0, - value: 0, + value: 1, }, amount: { currency: "USD", @@ -71,18 +85,7 @@ export const NewTerms = createExample(TestedComponent, { }); export const TermsReviewingPLAIN = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -110,18 +113,7 @@ export const TermsReviewingPLAIN = createExample(TestedComponent, { }); export const TermsReviewingHTML = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -151,18 +143,7 @@ export const TermsReviewingHTML = createExample(TestedComponent, { }); export const TermsReviewingPDF = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -192,18 +173,7 @@ export const TermsReviewingPDF = createExample(TestedComponent, { }); export const TermsReviewingXML = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -231,18 +201,7 @@ export const TermsReviewingXML = createExample(TestedComponent, { }); export const NewTermsAccepted = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -269,18 +228,7 @@ export const NewTermsAccepted = createExample(TestedComponent, { }); export const TermsShowAgainXML = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -309,18 +257,7 @@ export const TermsShowAgainXML = createExample(TestedComponent, { }); export const TermsChanged = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -347,18 +284,7 @@ export const TermsChanged = createExample(TestedComponent, { }); export const TermsNotFound = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -382,18 +308,7 @@ export const TermsNotFound = createExample(TestedComponent, { }); export const TermsAlreadyAccepted = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -417,18 +332,7 @@ export const TermsAlreadyAccepted = createExample(TestedComponent, { }); export const WithoutFee = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx index 4ebbe11c6..eead51690 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx +++ b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx @@ -38,7 +38,6 @@ import { ButtonWarning, LinkSuccess, WalletAction, - WarningText, } from "../components/styled"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook"; import { amountToString, buildTermsOfServiceState, TermsState } from "../utils"; @@ -98,17 +97,19 @@ export function View({ text={amountToString(Amounts.sub(amount, withdrawalFee).amount)} kind="positive" /> - {Amounts.isNonZero(withdrawalFee) && ( - + + + + )} {exchangeBaseUrl && ( @@ -140,13 +141,6 @@ export function View({ )}
)} - {terms.status === "notfound" && ( -
- - {i18n.str`Exchange doesn't have terms of service`} - -
- )} ); } @@ -37,15 +33,11 @@ export function SettingsPage(): VNode { export interface ViewProps { permissionsEnabled: boolean; togglePermissions: () => void; - developerMode: boolean; - toggleDeveloperMode: () => void; } export function SettingsView({ permissionsEnabled, togglePermissions, - developerMode, - toggleDeveloperMode, }: ViewProps): VNode { return ( @@ -60,14 +52,6 @@ export function SettingsView({ enabled={permissionsEnabled} onToggle={togglePermissions} /> -

Config

-