summaryrefslogtreecommitdiff
path: root/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.tsx
blob: ad529a4a7943a612d83d2dd0fc23f3fb1d2daa76 (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 sel = (x: string): void => reducer.transition("select_continent", { continent: x });
  return (
    <AnastasisClientFrame hideNext title={withProcessLabel(reducer, "Select Continent")}>
      {reducer.currentReducerState.continents.map((x: any) => (
        <button onClick={() => sel(x.name)} key={x.name}>
          {x.name}
        </button>
      ))}
    </AnastasisClientFrame>
  );
}