summaryrefslogtreecommitdiff
path: root/packages/anastasis-webui/src/pages/home/CountrySelectionScreen.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-10-22 01:31:46 -0300
committerSebastian <sebasjm@gmail.com>2021-10-22 01:31:46 -0300
commit2ec2161a7e1c0787b5e9ea14311f19c6b6a52d63 (patch)
treeef06a4edcb6b35f1743878f3a4cd77edc752a76f /packages/anastasis-webui/src/pages/home/CountrySelectionScreen.tsx
parent3740010117df56c0ab8cfa97c983d9cf0143daf1 (diff)
downloadwallet-core-2ec2161a7e1c0787b5e9ea14311f19c6b6a52d63.tar.gz
wallet-core-2ec2161a7e1c0787b5e9ea14311f19c6b6a52d63.tar.bz2
wallet-core-2ec2161a7e1c0787b5e9ea14311f19c6b6a52d63.zip
some storybook exmaples
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/CountrySelectionScreen.tsx')
-rw-r--r--packages/anastasis-webui/src/pages/home/CountrySelectionScreen.tsx20
1 files changed, 12 insertions, 8 deletions
diff --git a/packages/anastasis-webui/src/pages/home/CountrySelectionScreen.tsx b/packages/anastasis-webui/src/pages/home/CountrySelectionScreen.tsx
index dbe4b7616..555622c1d 100644
--- a/packages/anastasis-webui/src/pages/home/CountrySelectionScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/CountrySelectionScreen.tsx
@@ -1,19 +1,23 @@
/* eslint-disable @typescript-eslint/camelcase */
import { h, VNode } from "preact";
-import { CommonReducerProps, AnastasisClientFrame, withProcessLabel } from "./index";
+import { useAnastasisContext } from "../../context/anastasis";
+import { AnastasisClientFrame, withProcessLabel } from "./index";
-export function CountrySelectionScreen(props: CommonReducerProps): VNode {
- const { reducer, reducerState } = props;
+export function CountrySelectionScreen(): VNode {
+ const reducer = useAnastasisContext()
+ if (!reducer) {
+ return <div>no reducer in context</div>
+ }
+ if (!reducer.currentReducerState || !("countries" in reducer.currentReducerState)) {
+ return <div>invalid state</div>
+ }
const sel = (x: any): void => reducer.transition("select_country", {
country_code: x.code,
currencies: [x.currency],
});
return (
- <AnastasisClientFrame
- hideNext
- title={withProcessLabel(reducer, "Select Country")}
- >
- {reducerState.countries.map((x: any) => (
+ <AnastasisClientFrame hideNext title={withProcessLabel(reducer, "Select Country")} >
+ {reducer.currentReducerState.countries.map((x: any) => (
<button onClick={() => sel(x)} key={x.name}>
{x.name} ({x.currency})
</button>