From 4a83e9639d59d4a3116d17d8633ea0d8c69aaa62 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Thu, 11 Nov 2021 13:22:14 -0300
Subject: changes from feedback

better backup and recovery ending screen
async button on modal and solve challenges
use providers name when possible
---
 .../src/pages/home/ChallengeOverviewScreen.tsx     | 23 ++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

(limited to 'packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx')

diff --git a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx
index c6de00e98..d0c9b2f5d 100644
--- a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx
@@ -3,6 +3,7 @@ import { h, VNode } from "preact";
 import { useAnastasisContext } from "../../context/anastasis";
 import { AnastasisClientFrame } from "./index";
 import { authMethods, KnownAuthMethods } from "./authMethod";
+import { AsyncButton } from "../../components/AsyncButton";
 
 function OverviewFeedbackDisplay(props: { feedback?: ChallengeFeedback }) {
   const { feedback } = props;
@@ -150,13 +151,15 @@ export function ChallengeOverviewScreen(): VNode {
             id: string;
             feedback?: ChallengeFeedback;
           }): VNode {
-            function selectChallenge(): void {
-              if (reducer) reducer.transition("select_challenge", { uuid: id });
+            async function selectChallenge(): Promise<void> {
+              if (reducer) {
+                return reducer.transition("select_challenge", { uuid: id });
+              }
             }
             if (!feedback) {
               return (
                 <div>
-                  <button
+                  <AsyncButton
                     class="button"
                     disabled={
                       atLeastThereIsOnePolicySolved && !policy.isPolicySolved
@@ -164,7 +167,7 @@ export function ChallengeOverviewScreen(): VNode {
                     onClick={selectChallenge}
                   >
                     Solve
-                  </button>
+                  </AsyncButton>
                 </div>
               );
             }
@@ -178,7 +181,7 @@ export function ChallengeOverviewScreen(): VNode {
               case ChallengeFeedbackStatus.Payment:
                 return (
                   <div>
-                    <button
+                    <AsyncButton
                       class="button"
                       disabled={
                         atLeastThereIsOnePolicySolved && !policy.isPolicySolved
@@ -186,13 +189,13 @@ export function ChallengeOverviewScreen(): VNode {
                       onClick={selectChallenge}
                     >
                       Pay
-                    </button>
+                    </AsyncButton>
                   </div>
                 );
               case ChallengeFeedbackStatus.Redirect:
                 return (
                   <div>
-                    <button
+                    <AsyncButton
                       class="button"
                       disabled={
                         atLeastThereIsOnePolicySolved && !policy.isPolicySolved
@@ -200,7 +203,7 @@ export function ChallengeOverviewScreen(): VNode {
                       onClick={selectChallenge}
                     >
                       Go to {feedback.redirect_url}
-                    </button>
+                    </AsyncButton>
                   </div>
                 );
               case ChallengeFeedbackStatus.Solved:
@@ -212,7 +215,7 @@ export function ChallengeOverviewScreen(): VNode {
               default:
                 return (
                   <div>
-                    <button
+                    <AsyncButton
                       class="button"
                       disabled={
                         atLeastThereIsOnePolicySolved && !policy.isPolicySolved
@@ -220,7 +223,7 @@ export function ChallengeOverviewScreen(): VNode {
                       onClick={selectChallenge}
                     >
                       Solve
-                    </button>
+                    </AsyncButton>
                   </div>
                 );
             }
-- 
cgit v1.2.3

