diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet')
6 files changed, 38 insertions, 67 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx b/packages/taler-wallet-webextension/src/wallet/Application.tsx index 37ea80d96..84aa0dd84 100644 --- a/packages/taler-wallet-webextension/src/wallet/Application.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx @@ -93,10 +93,8 @@ export function Application(): VNode { }} > <PendingTransactions - goToTransaction={(txId: string) => - redirectTo( - Pages.balance_transaction.replace(":tid", txId), - ) + goToTransaction={(tid: string) => + redirectTo(Pages.balanceTransaction({ tid })) } /> </div> @@ -122,50 +120,37 @@ export function Application(): VNode { */} <Route - path={Pages.balance_history} + path={Pages.balanceHistory.pattern} component={HistoryPage} goToWalletDeposit={(currency: string) => - redirectTo( - Pages.balance_deposit.replace(":currency", currency), - ) + redirectTo(Pages.balanceDeposit({ currency })) } goToWalletManualWithdraw={(currency?: string) => - redirectTo( - Pages.balance_manual_withdraw.replace( - ":currency?", - currency || "", - ), - ) + redirectTo(Pages.balanceManualWithdraw({ currency })) } /> <Route - path={Pages.balance_transaction} + path={Pages.balanceTransaction.pattern} component={TransactionPage} goToWalletHistory={(currency?: string) => - redirectTo( - Pages.balance_history.replace(":currency?", currency || ""), - ) + redirectTo(Pages.balanceHistory({ currency })) } /> <Route - path={Pages.balance_manual_withdraw} + path={Pages.balanceManualWithdraw.pattern} component={ManualWithdrawPage} onCancel={() => redirectTo(Pages.balance)} /> <Route - path={Pages.balance_deposit} + path={Pages.balanceDeposit.pattern} component={DepositPage} onCancel={(currency: string) => { - redirectTo( - Pages.balance_history.replace(":currency?", currency), - ); + redirectTo(Pages.balanceHistory({ currency })); }} onSuccess={(currency: string) => { - redirectTo( - Pages.balance_history.replace(":currency?", currency), - ); + redirectTo(Pages.balanceHistory({ currency })); setGlobalNotification( <i18n.Translate> All done, your transaction is in progress @@ -184,15 +169,15 @@ export function Application(): VNode { <Route path={Pages.backup} component={BackupPage} - onAddProvider={() => redirectTo(Pages.backup_provider_add)} + onAddProvider={() => redirectTo(Pages.backupProviderAdd)} /> <Route - path={Pages.backup_provider_detail} + path={Pages.backupProviderDetail.pattern} component={ProviderDetailPage} onBack={() => redirectTo(Pages.backup)} /> <Route - path={Pages.backup_provider_add} + path={Pages.backupProviderAdd} component={ProviderAddPage} onBack={() => redirectTo(Pages.backup)} /> @@ -201,7 +186,7 @@ export function Application(): VNode { * SETTINGS */} <Route - path={Pages.settings_exchange_add} + path={Pages.settingsExchangeAdd.pattern} component={ExchangeAddPage} onBack={() => redirectTo(Pages.balance)} /> @@ -216,22 +201,17 @@ export function Application(): VNode { * CALL TO ACTION */} <Route - path={Pages.cta_pay} + path={Pages.ctaPay} component={PayPage} goToWalletManualWithdraw={(currency?: string) => - redirectTo( - Pages.balance_manual_withdraw.replace( - ":currency?", - currency || "", - ), - ) + redirectTo(Pages.balanceManualWithdraw({ currency })) } goBack={() => redirectTo(Pages.balance)} /> - <Route path={Pages.cta_refund} component={RefundPage} /> - <Route path={Pages.cta_tips} component={TipPage} /> - <Route path={Pages.cta_withdraw} component={WithdrawPage} /> - <Route path={Pages.cta_deposit} component={DepositPageCTA} /> + <Route path={Pages.ctaRefund} component={RefundPage} /> + <Route path={Pages.ctaTips} component={TipPage} /> + <Route path={Pages.ctaWithdraw} component={WithdrawPage} /> + <Route path={Pages.ctaDeposit} component={DepositPageCTA} /> {/** * NOT FOUND @@ -240,13 +220,13 @@ export function Application(): VNode { <Route path={Pages.balance} component={Redirect} - to={Pages.balance_history.replace(":currency?", "")} + to={Pages.balanceHistory({})} /> <Route default component={Redirect} - to={Pages.balance_history.replace(":currency?", "")} + to={Pages.balanceHistory({})} /> </Router> </WalletBox> @@ -268,5 +248,7 @@ function Redirect({ to }: { to: string }): null { } function shouldShowPendingOperations(path: string): boolean { + // FIXME: replace includes with a match API like preact router does + // [Pages.balanceHistory, Pages.dev, Pages.settings, Pages.backup] return ["/balance/history/", "/dev", "/settings", "/backup"].includes(path); } diff --git a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx index 1f23be856..b1c34c213 100644 --- a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx @@ -167,10 +167,9 @@ function BackupLayout(props: TransactionLayoutProps): VNode { <RowBorderGray> <div style={{ color: !props.active ? "grey" : undefined }}> <a - href={Pages.backup_provider_detail.replace( - ":pid", - encodeURIComponent(props.id), - )} + href={Pages.backupProviderDetail({ + pid: encodeURIComponent(props.id), + })} > <span>{props.title}</span> </a> diff --git a/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx b/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx index 502e9f8ad..d2a9c1366 100644 --- a/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx +++ b/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx @@ -165,10 +165,7 @@ export function CreateManualWithdraw({ </i18n.Translate> </BoldLight> <LinkPrimary - href={Pages.settings_exchange_add.replace( - ":currency?", - initialCurrency, - )} + href={Pages.settingsExchangeAdd({ currency: initialCurrency })} style={{ marginLeft: "auto" }} > <i18n.Translate>Add Exchange</i18n.Translate> @@ -194,7 +191,7 @@ export function CreateManualWithdraw({ <i18n.Translate>No exchange configured</i18n.Translate> </BoldLight> <LinkPrimary - href={Pages.settings_exchange_add.replace(":currency?", "")} + href={Pages.settingsExchangeAdd({})} style={{ marginLeft: "auto" }} > <i18n.Translate>Add Exchange</i18n.Translate> @@ -242,7 +239,7 @@ export function CreateManualWithdraw({ </Input> <div style={{ display: "flex", justifyContent: "space-between" }}> <LinkPrimary - href={Pages.settings_exchange_add.replace(":currency?", "")} + href={Pages.settingsExchangeAdd({})} style={{ marginLeft: "auto" }} > <i18n.Translate>Add Exchange</i18n.Translate> diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx index e71ea48f0..074b0d356 100644 --- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx @@ -156,9 +156,6 @@ export function View({ [exchange_name: string]: CalculatedCoinfInfo[]; }, ); - function Item({ children }: any) { - return <div>{children}</div>; - } return ( <div> <p> diff --git a/packages/taler-wallet-webextension/src/wallet/Settings.tsx b/packages/taler-wallet-webextension/src/wallet/Settings.tsx index be75c1eac..55f046259 100644 --- a/packages/taler-wallet-webextension/src/wallet/Settings.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Settings.tsx @@ -178,9 +178,7 @@ export function SettingsView({ )} <div style={{ display: "flex", justifyContent: "space-between" }}> <div /> - <LinkPrimary - href={Pages.settings_exchange_add.replace(":currency?", "")} - > + <LinkPrimary href={Pages.settingsExchangeAdd({})}> <i18n.Translate>Add an exchange</i18n.Translate> </LinkPrimary> </div> diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index b78039ddd..89f7064c5 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -352,10 +352,9 @@ export function TransactionView({ <td> {<Amount value={r.amountEffective} />}{" "} <a - href={Pages.balance_transaction.replace( - ":tid", - r.transactionId, - )} + href={Pages.balanceTransaction({ + tid: r.transactionId, + })} > was refunded </a>{" "} @@ -556,10 +555,9 @@ export function TransactionView({ title={<i18n.Translate>Original order ID</i18n.Translate>} text={ <a - href={Pages.balance_transaction.replace( - ":tid", - transaction.refundedTransactionId, - )} + href={Pages.balanceTransaction({ + tid: transaction.refundedTransactionId, + })} > {transaction.info.orderId} </a> |