@@ -1,5 +1,4 @@
1−import React from 'react';
2−import { Input } from 'indigo-react';
1+import React, { useState } from 'react';
32import * as bip39 from 'bip39';
43
54import InputSigil from 'components/InputSigil';
@@ -85,34 +84,6 @@ export function useHdPathInput(props) {
8584// transformers: [prependSig],
8685// });
8786
88−export function PointInput(props) {
89− const input = usePointInput({
90− name: 'point',
91− label: 'Point Name',
92− autoFocus: true,
93− });
94− const { data: validPointName, pass, focused, error } = input;
95−
96− return (
97− <Input
98− {...props}
99− {...input}
100− accessory={
101− validPointName && (
102− <InputSigil
103− patp={validPointName}
104− size={68}
105− margin={8}
106− pass={pass}
107− focused={focused}
108− error={error}
109− />
110− )
111− }
112− />
113− );
114−}
115−
11687const kTicketValidators = [validateTicket, validateNotEmpty];
11788const kTicketTransformers = [prependSig];
11889//TODO needs to be fancier, displaying sig and dashes instead of •ing all
@@ -135,7 +106,8 @@ export function useTicketInput({ initialValue = '~', ...rest }) {
135106const kPointValidators = [validatePoint, validateNotEmpty];
136107const kPointTransformers = [prependSig];
137108export function usePointInput({ initialValue = '~', ...rest }) {
138− return firstOf(
109+ const [lastValidPoint, setLastValidPoint] = useState('');
110+ const input = firstOf(
139111 useForm([
140112 {
141113 type: 'text',
@@ -144,10 +116,27 @@ export function usePointInput({ initialValue = '~', ...rest }) {
144116 transformers: kPointTransformers,
145117 mono: true,
146118 initialValue,
119+ onValue: setLastValidPoint,
147120 ...rest,
148121 },
149122 ])
150123 );
124+
125+ const { pass, focused, error } = input;
126+
127+ return {
128+ ...input,
129+ accessory: lastValidPoint && (
130+ <InputSigil
131+ patp={lastValidPoint}
132+ size={68}
133+ margin={8}
134+ pass={pass}
135+ focused={focused}
136+ error={error}
137+ />
138+ ),
139+ };
151140}
152141
153142const kEmailValidators = [validateEmail, validateNotEmpty];