summaryrefslogtreecommitdiff
path: root/packages/anastasis-webui/src/pages/home/CountrySelectionScreen.tsx
blob: dbe4b7616127a94c792236c741f57262f8be6e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* eslint-disable @typescript-eslint/camelcase */
import { h, VNode } from "preact";
import { CommonReducerProps, AnastasisClientFrame, withProcessLabel } from "./index";

export function CountrySelectionScreen(props: CommonReducerProps): VNode {
  const { reducer, reducerState } = props;
  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) => (
        <button onClick={() => sel(x)} key={x.name}>
          {x.name} ({x.currency})
        </button>
      ))}
    </AnastasisClientFrame>
  );
}