@@ -35,7 +35,7 @@ import {
35import FormError from 'form/FormError';
35import FormError from 'form/FormError';
37import { useActivateFlow } from './ActivateFlow';
37import { useActivateFlow } from './ActivateFlow';
38−import { hasWarnings } from 'form/helpers';
38+import { WARNING } from 'form/helpers';
40export default function ActivateCode() {
40export default function ActivateCode() {
41 const history = useHistory();
41 const history = useHistory();
@@ -43,7 +43,7 @@ export default function ActivateCode() {
43 const { contracts } = useNetwork();
43 const { contracts } = useNetwork();
44 const impliedTicket = useImpliedTicket();
44 const impliedTicket = useImpliedTicket();
45 const [hasDisclaimed] = useHasDisclaimed();
45 const [hasDisclaimed] = useHasDisclaimed();
46− const warnings = useRef({});
46+ const didWarn = useRef(false);
49 setDerivedWallet,
49 setDerivedWallet,
@@ -71,7 +71,7 @@ export default function ActivateCode() {
71 }, [hasDisclaimed, names.DISCLAIMER, names.PASSPORT, push]);
71 }, [hasDisclaimed, names.DISCLAIMER, names.PASSPORT, push]);
73 const validateForm = useCallback((values, errors) => {
73 const validateForm = useCallback((values, errors) => {
74− warnings.current.ticket = null;
74+ didWarn.current = false;
76 if (hasErrors(errors)) {
76 if (hasErrors(errors)) {
77 return errors;
77 return errors;
@@ -106,10 +106,14 @@ export default function ActivateCode() {
106 const incoming = [...owned, ...transferring];
106 const incoming = [...owned, ...transferring];
108 if (incoming.length > 0) {
108 if (incoming.length > 0) {
109− if (incoming.length > 1) {
109+ if (incoming.length > 1 && !didWarn.current) {
110− warnings.current.ticket =
110+ didWarn.current = true;
111− 'This invite code has multiple points available.\n' +
113+ 'This invite code has multiple points available. ' +
114+ "Once you've activated this point, " +
112− "Once you've activated this point, activate the next with the same process.";
115+ 'activate the next with the same process.',
115 const point = parseInt(incoming[0], 10);
119 const point = parseInt(incoming[0], 10);
@@ -128,14 +132,6 @@ export default function ActivateCode() {
128 [contracts, setDerivedPoint, setDerivedWallet, setInviteWallet]
132 [contracts, setDerivedPoint, setDerivedWallet, setInviteWallet]
131− const afterSubmit = useCallback(() => {
132− if (hasWarnings(warnings.current)) {
139 const initialValues = useMemo(() => ({ ticket: impliedTicket || '' }), [
135 const initialValues = useMemo(() => ({ ticket: impliedTicket || '' }), [
140 impliedTicket,
136 impliedTicket,
@@ -150,9 +146,9 @@ export default function ActivateCode() {
150 <BridgeForm
146 <BridgeForm
151 validate={validate}
147 validate={validate}
152 onSubmit={onSubmit}
148 onSubmit={onSubmit}
153− afterSubmit={afterSubmit}
149+ afterSubmit={goToPassport}
154 initialValues={initialValues}>
150 initialValues={initialValues}>
155− {({ validating, submitting, submitSucceeded, handleSubmit }) => (
151+ {({ validating, submitting, handleSubmit }) => (
157 <Grid.Item
153 <Grid.Item
@@ -160,33 +156,25 @@ export default function ActivateCode() {
160 name="ticket"
156 name="ticket"
161 label="Activation Code"
157 label="Activation Code"
162 disabled={!activationAllowed}
158 disabled={!activationAllowed}
163− warning={warnings.current.ticket}
166 <Grid.Item full as={FormError} />
161 <Grid.Item full as={FormError} />
168− {submitSucceeded ? (
169− <Grid.Item
163+ <Grid.Item
174− onClick={goToPassport}>
180− as={SubmitButton}
165+ as={SubmitButton}
181− className="mt4"
166+ className="mt4"
182− handleSubmit={handleSubmit}>
167+ handleSubmit={handleSubmit}>
183− {validating
169+ validating
184 ? 'Deriving...'
170 ? 'Deriving...'
185 : submitting
171 : submitting
186 ? 'Generating...'
172 ? 'Generating...'
174+ ? 'Continue Activation'
188− </Grid.Item>
177+ </Grid.Item>
191 {!activationAllowed && (
179 {!activationAllowed && (
192 <Grid.Item full as={WarningBox} className="mt4">
180 <Grid.Item full as={WarningBox} className="mt4">