From 867d2ca76b2ca8903b2263a68243899749de7011 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 10 Mar 2023 01:27:31 -0300 Subject: fix encoded uri, add pay template cta --- .../src/popup/TalerActionFound.tsx | 149 +++++++++++---------- 1 file changed, 81 insertions(+), 68 deletions(-) (limited to 'packages/taler-wallet-webextension/src/popup') diff --git a/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx b/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx index 5c435a9a5..205e42d20 100644 --- a/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx +++ b/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx @@ -31,6 +31,86 @@ export interface Props { onDismiss: () => Promise; } +function ContentByUriType({ + type, + onConfirm, +}: { + type: TalerUriType; + onConfirm: () => Promise; +}) { + const { i18n } = useTranslationContext(); + switch (type) { + case TalerUriType.TalerWithdraw: + return ( +
+

+ This page has a withdrawal action. +

+ +
+ ); + + case TalerUriType.TalerPayTemplate: + case TalerUriType.TalerPay: + return ( +
+

+ This page has pay action. +

+ +
+ ); + case TalerUriType.TalerTip: + return ( +
+

+ This page has a tip action. +

+ +
+ ); + + case TalerUriType.TalerRefund: + return ( +
+

+ This page has a refund action. +

+ +
+ ); + + case TalerUriType.TalerDevExperiment: + case TalerUriType.TalerTemplate: + case TalerUriType.TalerPayPull: + case TalerUriType.TalerPayPush: + case TalerUriType.TalerRecovery: + case TalerUriType.Unknown: + return ( +
+

+ + This page has a malformed taler uri. + +

+
+ ); + + default: { + const error: never = type; + return null; + } + } +} + export function TalerActionFound({ url, onDismiss }: Props): VNode { const uriType = classifyTalerUri(url); const { i18n } = useTranslationContext(); @@ -43,74 +123,7 @@ export function TalerActionFound({ url, onDismiss }: Props): VNode { <i18n.Translate>Taler Action</i18n.Translate> - {uriType === TalerUriType.TalerPay && ( -
-

- This page has pay action. -

- -
- )} - {uriType === TalerUriType.TalerWithdraw && ( -
-

- - This page has a withdrawal action. - -

- -
- )} - {uriType === TalerUriType.TalerTip && ( -
-

- This page has a tip action. -

- -
- )} - {uriType === TalerUriType.TalerRefund && ( -
-

- This page has a refund action. -

- -
- )} - {uriType === TalerUriType.Unknown && ( -
-

- - This page has a malformed taler uri. - -

-

{url}

-
- )} +