From 5883d42d800c7b444c59d626bcaa5abca7dc83d0 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 19 Oct 2021 10:56:52 -0300 Subject: add template from merchant backoffice --- .../src/pages/home/AttributeEntryScreen.tsx | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx (limited to 'packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx') diff --git a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx new file mode 100644 index 000000000..4df99db9a --- /dev/null +++ b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx @@ -0,0 +1,55 @@ +/* eslint-disable @typescript-eslint/camelcase */ +import { h, VNode } from "preact"; +import { useState } from "preact/hooks"; +import { AnastasisReducerApi, ReducerStateRecovery, ReducerStateBackup } from "../../hooks/use-anastasis-reducer"; +import { AnastasisClientFrame, withProcessLabel, LabeledInput } from "./index"; + +export function AttributeEntryScreen(props: AttributeEntryProps): VNode { + const { reducer, reducerState: backupState } = props; + const [attrs, setAttrs] = useState>( + props.reducerState.identity_attributes ?? {} + ); + return ( + reducer.transition("enter_user_attributes", { + identity_attributes: attrs, + })} + > + {backupState.required_attributes.map((x: any, i: number) => { + return ( + setAttrs({ ...attrs, [x.name]: v })} + spec={x} + value={attrs[x.name]} /> + ); + })} + + ); +} + +interface AttributeEntryProps { + reducer: AnastasisReducerApi; + reducerState: ReducerStateRecovery | ReducerStateBackup; +} + +export interface AttributeEntryFieldProps { + isFirst: boolean; + value: string; + setValue: (newValue: string) => void; + spec: any; +} + +export function AttributeEntryField(props: AttributeEntryFieldProps): VNode { + return ( +
+ +
+ ); +} -- cgit v1.2.3