aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-03-21 12:49:41 -0300
committerSebastian <sebasjm@gmail.com>2022-03-21 12:49:41 -0300
commit32cd54e11d80bde0274b3c0238f8f5bd00ff83cb (patch)
treefb38117e25476aff1848ed74e98cf653ba7e94e2 /packages/taler-wallet-webextension
parentf7cabbf479c9703e4565ae610a68e652ba9e95b5 (diff)
fix: handle new optional parameter for settings_exchange_add page
Diffstat (limited to 'packages/taler-wallet-webextension')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx10
-rw-r--r--packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx3
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Settings.tsx4
-rw-r--r--packages/taler-wallet-webextension/src/walletEntryPoint.tsx36
4 files changed, 27 insertions, 26 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx b/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx
index 1996687ba..068135ae0 100644
--- a/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx
@@ -67,9 +67,9 @@ export function useComponentState(
const initialExchange =
foundExchangeForCurrency !== -1
? exchangeSelectList[foundExchangeForCurrency]
- : // : exchangeSelectList.length > 0
- // ? exchangeSelectList[0]
- undefined;
+ : !initialCurrency && exchangeSelectList.length > 0
+ ? exchangeSelectList[0]
+ : undefined;
const [exchange, setExchange] = useState(initialExchange || "");
const [currency, setCurrency] = useState(
@@ -188,7 +188,7 @@ export function CreateManualWithdraw({
<i18n.Translate>No exchange configured</i18n.Translate>
</BoldLight>
<LinkPrimary
- href={Pages.settings_exchange_add}
+ href={Pages.settings_exchange_add.replace(":currency?", "")}
style={{ marginLeft: "auto" }}
>
<i18n.Translate>Add Exchange</i18n.Translate>
@@ -234,7 +234,7 @@ export function CreateManualWithdraw({
</Input>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<LinkPrimary
- href={Pages.settings_exchange_add}
+ href={Pages.settings_exchange_add.replace(":currency?", "")}
style={{ marginLeft: "auto" }}
>
<i18n.Translate>Add Exchange</i18n.Translate>
diff --git a/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx b/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx
index 62d7e15b8..fae309ba7 100644
--- a/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx
@@ -177,8 +177,7 @@ export function ExchangeSetUrlPage({
disabled={
!result ||
!!error ||
- (expectedCurrency !== undefined &&
- expectedCurrency !== result.currency)
+ (!!expectedCurrency && expectedCurrency !== result.currency)
}
onClick={() => {
const url = canonicalizeBaseUrl(endpoint);
diff --git a/packages/taler-wallet-webextension/src/wallet/Settings.tsx b/packages/taler-wallet-webextension/src/wallet/Settings.tsx
index f806da6a7..840e95651 100644
--- a/packages/taler-wallet-webextension/src/wallet/Settings.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Settings.tsx
@@ -177,7 +177,9 @@ export function SettingsView({
)}
<div style={{ display: "flex", justifyContent: "space-between" }}>
<div />
- <LinkPrimary href={Pages.settings_exchange_add}>
+ <LinkPrimary
+ href={Pages.settings_exchange_add.replace(":currency?", "")}
+ >
<i18n.Translate>Add an exchange</i18n.Translate>
</LinkPrimary>
</div>
diff --git a/packages/taler-wallet-webextension/src/walletEntryPoint.tsx b/packages/taler-wallet-webextension/src/walletEntryPoint.tsx
index 9a1d8699a..2f53917e4 100644
--- a/packages/taler-wallet-webextension/src/walletEntryPoint.tsx
+++ b/packages/taler-wallet-webextension/src/walletEntryPoint.tsx
@@ -113,23 +113,23 @@ function Application(): VNode {
<Fragment>
<LogoHeader />
<WalletNavBar path={path} />
+ <div
+ style={{
+ backgroundColor: "lightcyan",
+ display: "flex",
+ justifyContent: "center",
+ }}
+ >
+ <PendingTransactions
+ goToTransaction={(txId: string) =>
+ route(Pages.balance_transaction.replace(":tid", txId))
+ }
+ />
+ </div>
</Fragment>
);
}}
</Match>
- <div
- style={{
- backgroundColor: "lightcyan",
- display: "flex",
- justifyContent: "center",
- }}
- >
- <PendingTransactions
- goToTransaction={(txId: string) =>
- route(Pages.balance_transaction.replace(":tid", txId))
- }
- />
- </div>
<WalletBox>
{globalNotification && (
<SuccessBox onClick={clearNotification}>
@@ -166,7 +166,7 @@ function Application(): VNode {
component={TransactionPage}
goToWalletHistory={(currency?: string) => {
route(
- Pages.balance_history.replace(":currency", currency || ""),
+ Pages.balance_history.replace(":currency?", currency || ""),
);
}}
/>
@@ -183,10 +183,10 @@ function Application(): VNode {
path={Pages.balance_deposit}
component={DepositPage}
onCancel={(currency: string) => {
- route(Pages.balance_history.replace(":currency", currency));
+ route(Pages.balance_history.replace(":currency?", currency));
}}
onSuccess={(currency: string) => {
- route(Pages.balance_history.replace(":currency", currency));
+ route(Pages.balance_history.replace(":currency?", currency));
setGlobalNotification(
<i18n.Translate>
All done, your transaction is in progress
@@ -268,13 +268,13 @@ function Application(): VNode {
<Route
path={Pages.balance}
component={Redirect}
- to={Pages.balance_history.replace(":currency", "")}
+ to={Pages.balance_history.replace(":currency?", "")}
/>
<Route
default
component={Redirect}
- to={Pages.balance_history.replace(":currency", "")}
+ to={Pages.balance_history.replace(":currency?", "")}
/>
</Router>
</WalletBox>