From 0ac7433ea7fa952c46062daef1c3de535d92b7f3 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 10 Nov 2021 18:10:45 -0300 Subject: confirm personal information fix #7090 --- .../src/pages/home/AttributeEntryScreen.tsx | 25 ++++++++-- .../src/pages/home/AuthenticationEditorScreen.tsx | 58 +--------------------- .../src/pages/home/ConfirmModal.tsx | 52 +++++++++++++++++++ 3 files changed, 73 insertions(+), 62 deletions(-) create mode 100644 packages/anastasis-webui/src/pages/home/ConfirmModal.tsx (limited to 'packages') diff --git a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx index 0918c2db5..4b26c38b7 100644 --- a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx @@ -6,6 +6,7 @@ import { DateInput } from "../../components/fields/DateInput"; import { PhoneNumberInput } from "../../components/fields/NumberInput"; import { TextInput } from "../../components/fields/TextInput"; import { useAnastasisContext } from "../../context/anastasis"; +import { ConfirmModal } from "./ConfirmModal"; import { AnastasisClientFrame, withProcessLabel } from "./index"; export function AttributeEntryScreen(): VNode { @@ -18,6 +19,7 @@ export function AttributeEntryScreen(): VNode { const [attrs, setAttrs] = useState>( currentIdentityAttributes, ); + const [askUserIfSure, setAskUserIfSure] = useState(false); if (!reducer) { return
no reducer in context
; @@ -51,12 +53,25 @@ export function AttributeEntryScreen(): VNode { - reducer.transition("enter_user_attributes", { - identity_attributes: attrs, - }) - } + onNext={async () => setAskUserIfSure(true) } > + {askUserIfSure ? ( + setAskUserIfSure(false)} + description="You can not forget what you had entered" + label="I am sure" + cancelLabel="Wait, I want to check" + onConfirm={() => reducer.transition("enter_user_attributes", { + identity_attributes: attrs, + })} + > + You personal information is used to define the location where your + secret will be safely stored. If you forget what you have entered or + if there is a misspell you will be unable to recover your secret again. + + ) : null} +
{fieldList}
diff --git a/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx b/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx index 1ef326773..2da7d52f3 100644 --- a/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx @@ -10,6 +10,7 @@ import { isKnownAuthMethods, KnownAuthMethods, } from "./authMethod"; +import { ConfirmModal } from "./ConfirmModal"; import { AnastasisClientFrame } from "./index"; const getKeys = Object.keys as (obj: T) => Array; @@ -246,60 +247,3 @@ function AuthMethodNotImplemented(props: AuthMethodSetupProps): VNode { ); } -function ConfirmModal({ - active, - description, - onCancel, - onConfirm, - children, - danger, - disabled, - label = "Confirm", -}: ConfirmModelProps): VNode { - return ( -
- - ); -} - -interface ConfirmModelProps { - active?: boolean; - description?: string; - onCancel?: () => void; - onConfirm?: () => void; - label?: string; - children?: ComponentChildren; - danger?: boolean; - disabled?: boolean; -} diff --git a/packages/anastasis-webui/src/pages/home/ConfirmModal.tsx b/packages/anastasis-webui/src/pages/home/ConfirmModal.tsx new file mode 100644 index 000000000..cab70de63 --- /dev/null +++ b/packages/anastasis-webui/src/pages/home/ConfirmModal.tsx @@ -0,0 +1,52 @@ +import { ComponentChildren, h, VNode } from "preact"; + +export interface ConfirmModelProps { + active?: boolean; + description?: string; + onCancel?: () => void; + onConfirm?: () => void; + label?: string; + cancelLabel?: string; + children?: ComponentChildren; + danger?: boolean; + disabled?: boolean; +} + +export function ConfirmModal({ + active, description, onCancel, onConfirm, children, danger, disabled, label = "Confirm", cancelLabel = "Dismiss" +}: ConfirmModelProps): VNode { + return ( +
+ + ); +} -- cgit v1.2.3