From 2ec2161a7e1c0787b5e9ea14311f19c6b6a52d63 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 22 Oct 2021 01:31:46 -0300
Subject: some storybook exmaples

---
 .../src/pages/home/PoliciesPayingScreen.tsx            | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

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

diff --git a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx
index be74729eb..8a39cf0e4 100644
--- a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx
@@ -1,9 +1,17 @@
 import { h, VNode } from "preact";
-import { BackupReducerProps, AnastasisClientFrame } from "./index";
-
-export function PoliciesPayingScreen(props: BackupReducerProps): VNode {
-  const payments = props.backupState.policy_payment_requests ?? [];
+import { useAnastasisContext } from "../../context/anastasis";
+import { AnastasisClientFrame } from "./index";
 
+export function PoliciesPayingScreen(): VNode {
+  const reducer = useAnastasisContext()
+  if (!reducer) {
+    return <div>no reducer in context</div>
+  }
+  if (!reducer.currentReducerState || reducer.currentReducerState.backup_state === undefined) {
+    return <div>invalid state</div>
+  }
+  const payments = reducer.currentReducerState.policy_payment_requests ?? [];
+  
   return (
     <AnastasisClientFrame hideNext title="Backup: Recovery Document Payments">
       <p>
@@ -19,7 +27,7 @@ export function PoliciesPayingScreen(props: BackupReducerProps): VNode {
           );
         })}
       </ul>
-      <button onClick={() => props.reducer.transition("pay", {})}>
+      <button onClick={() => reducer.transition("pay", {})}>
         Check payment status now
       </button>
     </AnastasisClientFrame>
-- 
cgit v1.2.3

