on master help sign in
chore: minor updates to comments, code re-org
6b3335eMatt Condon (shrugs)
src/indigo-react/components/Input.js+7−7
@@ -54,8 +54,8 @@ export default function Input({
54
54
55 return (
55 return (
56 <Flex
56 <Flex
57− className={cn(className, 'mb1')}
58 col
57 col
58+ className={cn(className, 'mb1')}
59 style={{
59 style={{
60 ...(disabled && {
60 ...(disabled && {
61 pointerEvents: 'none',
61 pointerEvents: 'none',
@@ -71,8 +71,9 @@ export default function Input({
71 htmlFor={name}>
71 htmlFor={name}>
72 {label}
72 {label}
73 </Flex.Item>
73 </Flex.Item>
74− <Flex.Item as={Flex} className="rel" row>
74+ <Flex.Item as={Flex} row className="rel">
75 <Flex.Item
75 <Flex.Item
76+ flex
76 as={type === 'textarea' ? 'textarea' : 'input'}
77 as={type === 'textarea' ? 'textarea' : 'input'}
77 type={type === 'textarea' ? undefined : type}
78 type={type === 'textarea' ? undefined : type}
78 {...rest}
79 {...rest}
@@ -86,21 +87,20 @@ export default function Input({
86 'bg-gray1': disabled,
87 'bg-gray1': disabled,
87 },
88 },
88 {
89 {
89− gray4: !active && !touched,
90+ gray4: !(active || touched),
90 black: active || touched,
91 black: active || touched,
91 },
92 },
92 {
93 {
93 'b-green3': valid,
94 'b-green3': valid,
94− 'b-black': active && !valid,
95+ 'b-black': !valid && active,
95− 'b-yellow3': !active && touched && error,
96+ 'b-yellow3': !valid && !active && touched && error,
96− 'b-gray2': !active && !error && !valid,
97+ 'b-gray2': !valid && !active && !touched && !error,
97 }
98 }
98 )}
99 )}
99 id={name}
100 id={name}
100 name={name}
101 name={name}
101 onKeyPress={onKeyPress}
102 onKeyPress={onKeyPress}
102 {...input}
103 {...input}
103− flex
104 />
104 />
105 {accessory && (
105 {accessory && (
106 <div
106 <div
src/views/Activate/ActivateCode.js+6−2
@@ -54,6 +54,9 @@ export default function ActivateCode() {
54 }
54 }
55 }, [names, push, hasDisclaimed]);
55 }, [names, push, hasDisclaimed]);
56
56
57+ // validate should be a pure function but we don't want to have to recompute
58+ // all of this information on submit, so cache the invite wallet and avoid
59+ // re-renders that may trigger re-validations (causing infinite loop)
57 const validate = useCallback(
60 const validate = useCallback(
58 async ticket => {
61 async ticket => {
59 await timeout(100); // allow the ui changes to flush before we lag it out
62 await timeout(100); // allow the ui changes to flush before we lag it out
@@ -99,6 +102,7 @@ export default function ActivateCode() {
99 [contracts, setDerivedPoint]
102 [contracts, setDerivedPoint]
100 );
103 );
101
104
105+ // set our state on submission
102 const onSubmit = useCallback(
106 const onSubmit = useCallback(
103 async values => {
107 async values => {
104 setInviteWallet(cachedInviteWallet.current);
108 setInviteWallet(cachedInviteWallet.current);
@@ -112,8 +116,8 @@ export default function ActivateCode() {
112 return (
116 return (
113 <View inset>
117 <View inset>
114 <Grid>
118 <Grid>
115− <Grid.Item as={Passport} point={derivedPoint} full />
119+ <Grid.Item full as={Passport} point={derivedPoint} />
116− <Grid.Item as={H4} className="mt3 mb2" full>
120+ <Grid.Item full as={H4} className="mt3 mb2">
117 Activate
121 Activate
118 </Grid.Item>
122 </Grid.Item>
119 <BridgeForm
123 <BridgeForm
src/views/Login/Mnemonic.js+1−2
@@ -24,7 +24,6 @@ export default function Mnemonic({ className }) {
24 // when the properties change, re-derive wallet and set global state
24 // when the properties change, re-derive wallet and set global state
25 const onValues = useCallback(
25 const onValues = useCallback(
26 ({ valid, values }) => {
26 ({ valid, values }) => {
27− console.log(valid, values);
28 if (valid) {
27 if (valid) {
29 setWalletHdPath(values.hdpath);
28 setWalletHdPath(values.hdpath);
30 setAuthMnemonic(Just(values.mnemonic));
29 setAuthMnemonic(Just(values.mnemonic));
@@ -44,7 +43,7 @@ export default function Mnemonic({ className }) {
44 <BridgeForm
43 <BridgeForm
45 onValues={onValues}
44 onValues={onValues}
46 onSubmit={() => undefined}
45 onSubmit={() => undefined}
47− initialValues={{ hdpath: walletHdPath, advanced: false }}>
46+ initialValues={{ hdpath: walletHdPath }}>
48 {() => (
47 {() => (
49 <>
48 <>
50 <Grid.Item
49 <Grid.Item