on master help sign in
chore: rename some constants to CONSTANTS
1119b52Matt Condon (shrugs)
src/components/Blinky.js+2−2
@@ -5,7 +5,7 @@ import useInterval from 'lib/useInterval';
5// TODO: make these characters display as the same width
5// TODO: make these characters display as the same width
6export const kLoadingCharacter = '▓';
6export const kLoadingCharacter = '▓';
7export const kInterstitialCharacter = '░';
7export const kInterstitialCharacter = '░';
8−const kBlinkAfterMs = 2500; // ms
8+const BLINK_AFTER_MS = 2500; // ms
9
9
10export const matchBlinky = obj =>
10export const matchBlinky = obj =>
11 obj.matchWith({
11 obj.matchWith({
@@ -22,7 +22,7 @@ export default function Blinky({
22
22
23 useInterval(() => {
23 useInterval(() => {
24 // only start blinking if we've elapsed enough time
24 // only start blinking if we've elapsed enough time
25− if (new Date() - now.current > kBlinkAfterMs) {
25+ if (new Date() - now.current > BLINK_AFTER_MS) {
26 setValue(val => !val);
26 setValue(val => !val);
27 }
27 }
28 }, 1000);
28 }, 1000);
src/indigo-react/components/AccessoryIcon.js+6−6
@@ -2,9 +2,9 @@ import React from 'react';
2
2
3import Flex from './Flex';
3import Flex from './Flex';
4
4
5−const kPendingAccessory = '⋯';
5+const PENDING_ACCESSORY = '⋯';
6−const kSuccessAccessory = '✔';
6+const SUCCESS_ACCESSORY = '✔';
7−const kFailureAccessory = '×';
7+const FAILURE_ACCESSORY = '×';
8
8
9function AccessoryIcon({ ...props }) {
9function AccessoryIcon({ ...props }) {
10 return (
10 return (
@@ -18,15 +18,15 @@ function AccessoryIcon({ ...props }) {
18}
18}
19
19
20AccessoryIcon.Pending = () => (
20AccessoryIcon.Pending = () => (
21− <AccessoryIcon>{kPendingAccessory}</AccessoryIcon>
21+ <AccessoryIcon>{PENDING_ACCESSORY}</AccessoryIcon>
22);
22);
23
23
24AccessoryIcon.Success = () => (
24AccessoryIcon.Success = () => (
25− <AccessoryIcon>{kSuccessAccessory}</AccessoryIcon>
25+ <AccessoryIcon>{SUCCESS_ACCESSORY}</AccessoryIcon>
26);
26);
27
27
28AccessoryIcon.Failure = () => (
28AccessoryIcon.Failure = () => (
29− <AccessoryIcon>{kFailureAccessory}</AccessoryIcon>
29+ <AccessoryIcon>{FAILURE_ACCESSORY}</AccessoryIcon>
30);
30);
31
31
32export default AccessoryIcon;
32export default AccessoryIcon;
src/lib/txn.js+3−2
@@ -9,7 +9,8 @@ import { ledgerSignTransaction } from './ledger';
9import { trezorSignTransaction } from './trezor';
9import { trezorSignTransaction } from './trezor';
10import { WALLET_TYPES, addHexPrefix } from './wallet';
10import { WALLET_TYPES, addHexPrefix } from './wallet';
11
11
12+const CHECK_BLOCK_EVERY_MS =
12−const kCheckBlockEveryMs = process.env.NODE_ENV === 'development' ? 1000 : 5000;
13+ process.env.NODE_ENV === 'development' ? 1000 : 5000;
13
14
14const TXN_PURPOSE = {
15const TXN_PURPOSE = {
15 SET_MANAGEMENT_PROXY: Symbol('SET_MANAGEMENT_PROXY'),
16 SET_MANAGEMENT_PROXY: Symbol('SET_MANAGEMENT_PROXY'),
@@ -196,7 +197,7 @@ const waitForTransactionConfirm = (web3, txHash) => {
196 console.log('tried, got', receipt);
197 console.log('tried, got', receipt);
197 let confirmed = receipt !== null;
198 let confirmed = receipt !== null;
198 if (confirmed) resolve(receipt.status === true);
199 if (confirmed) resolve(receipt.status === true);
199− else setTimeout(checkForConfirm, kCheckBlockEveryMs);
200+ else setTimeout(checkForConfirm, CHECK_BLOCK_EVERY_MS);
200 };
201 };
201 checkForConfirm();
202 checkForConfirm();
202 });
203 });
src/lib/useMailer.js+3−3
@@ -4,7 +4,7 @@ import Maybe from 'folktale/maybe';
4import { hasReceived, sendMail } from './inviteMail';
4import { hasReceived, sendMail } from './inviteMail';
5import useSetState from './useSetState';
5import useSetState from './useSetState';
6
6
7−const kStubMailer = process.env.REACT_APP_STUB_MAILER === 'true';
7+const STUB_MAILER = process.env.REACT_APP_STUB_MAILER === 'true';
8
8
9function useHasReceivedCache() {
9function useHasReceivedCache() {
10 const [cache, addToCache] = useSetState();
10 const [cache, addToCache] = useSetState();
@@ -21,7 +21,7 @@ function useHasReceivedCache() {
21 return;
21 return;
22 }
22 }
23
23
24− if (kStubMailer) {
24+ if (STUB_MAILER) {
25 // always allow sending emails when stubbing
25 // always allow sending emails when stubbing
26 return addToCache({ [email]: Maybe.Just(false) });
26 return addToCache({ [email]: Maybe.Just(false) });
27 }
27 }
@@ -41,7 +41,7 @@ export default function useMailer(emails) {
41 // prefix to avoid clobbering sendMail import
41 // prefix to avoid clobbering sendMail import
42 // also throws if return value is false
42 // also throws if return value is false
43 const _sendMail = useCallback(async (email, ticket, rawTx) => {
43 const _sendMail = useCallback(async (email, ticket, rawTx) => {
44− if (kStubMailer) {
44+ if (STUB_MAILER) {
45 console.log(`${email} - ${ticket}`);
45 console.log(`${email} - ${ticket}`);
46 return;
46 return;
47 }
47 }
src/views/Invite/InviteEmail.js+2−3
@@ -47,8 +47,7 @@ import useMailer from 'lib/useMailer';
47const GAS_PRICE_GWEI = 20; // we pay the premium for faster ux
47const GAS_PRICE_GWEI = 20; // we pay the premium for faster ux
48const GAS_LIMIT = 400000;
48const GAS_LIMIT = 400000;
49const INVITE_COST = toWei((GAS_PRICE_GWEI * GAS_LIMIT).toString(), 'gwei');
49const INVITE_COST = toWei((GAS_PRICE_GWEI * GAS_LIMIT).toString(), 'gwei');
50−
51−const kHasReceivedText = 'This email has already received an invite.';
50+const HAS_RECEIVED_TEXT = 'This email has already received an invite.';
52
51
53const STATUS = {
52const STATUS = {
54 INPUT: 'INPUT',
53 INPUT: 'INPUT',
@@ -145,7 +144,7 @@ export default function InviteEmail() {
145 config.disabled = !canInput;
144 config.disabled = !canInput;
146 const hasReceivedError = getHasRecieved(config.name).matchWith({
145 const hasReceivedError = getHasRecieved(config.name).matchWith({
147 Nothing: () => null, // loading
146 Nothing: () => null, // loading
148− Just: p => p.value && kHasReceivedText,
147+ Just: p => p.value && HAS_RECEIVED_TEXT,
149 });
148 });
150 config.error = hasReceivedError || errors[config.name];
149 config.error = hasReceivedError || errors[config.name];
151 return config;
150 return config;