summaryrefslogtreecommitdiff
path: root/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.tsx
blob: 94c0409da6208f22f455763603aa042bbd3ed7bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { h, VNode } from "preact";
import { useAnastasisContext } from "../../context/anastasis";
import { AnastasisClientFrame, withProcessLabel } from "./index";

export function ContinentSelectionScreen(): VNode {
  const reducer = useAnastasisContext()
  if (!reducer || !reducer.currentReducerState || !("continents" in reducer.currentReducerState)) {
    return <div />
  }
  const select = (continent: string) => (): void => reducer.transition("select_continent", { continent });
  return (
    <AnastasisClientFrame hideNext title={withProcessLabel(reducer, "Select Continent")}>
      {reducer.currentReducerState.continents.map((x: any) => (
        <button class="button" onClick={select(x.name)} key={x.name}>
          {x.name}
        </button>
      ))}
    </AnastasisClientFrame>
  );
}