diff options
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx')
-rw-r--r-- | packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx b/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx index 5b8a835b8..319f590a0 100644 --- a/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx @@ -1,8 +1,16 @@ import { h, VNode } from "preact"; -import { BackupReducerProps, AnastasisClientFrame } from "./index"; +import { useAnastasisContext } from "../../context/anastasis"; +import { AnastasisClientFrame } from "./index"; -export function TruthsPayingScreen(props: BackupReducerProps): VNode { - const payments = props.backupState.payments ?? []; +export function TruthsPayingScreen(): 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.payments ?? []; return ( <AnastasisClientFrame hideNext @@ -17,7 +25,7 @@ export function TruthsPayingScreen(props: BackupReducerProps): VNode { return <li key={i}>{x}</li>; })} </ul> - <button onClick={() => props.reducer.transition("pay", {})}> + <button onClick={() => reducer.transition("pay", {})}> Check payment status now </button> </AnastasisClientFrame> |