on master help sign in
chore: rename some constants to CONSTANTS
commit1119b5265a4fc87d465393abc82de9b2758f2f93 authorMatt Condon (shrugs) <mattgcondon@gmail.com> dateWed 26 Jun 2019, 15:58 (7 years ago) parentf1ff0cf
5 files changed+16−16
src/components/Blinky.js+2−2 src/indigo-react/components/AccessoryIcon.js+6−6 src/lib/txn.js+3−2 src/lib/useMailer.js+3−3 src/views/Invite/InviteEmail.js+2−3
src/components/Blinky.js+2−2
@@ -5,7 +5,7 @@ import useInterval from 'lib/useInterval';
55// TODO: make these characters display as the same width
66export const kLoadingCharacter = '▓';
77export const kInterstitialCharacter = '░';
8−const kBlinkAfterMs = 2500; // ms
8+const BLINK_AFTER_MS = 2500; // ms
99
1010export const matchBlinky = obj =>
1111 obj.matchWith({
@@ -22,7 +22,7 @@ export default function Blinky({
2222
2323 useInterval(() => {
2424 // 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) {
2626 setValue(val => !val);
2727 }
2828 }, 1000);
src/indigo-react/components/AccessoryIcon.js+6−6
@@ -2,9 +2,9 @@ import React from 'react';
22
33import Flex from './Flex';
44
5−const kPendingAccessory = '⋯';
6−const kSuccessAccessory = '✔';
7−const kFailureAccessory = '×';
5+const PENDING_ACCESSORY = '⋯';
6+const SUCCESS_ACCESSORY = '✔';
7+const FAILURE_ACCESSORY = '×';
88
99function AccessoryIcon({ ...props }) {
1010 return (
@@ -18,15 +18,15 @@ function AccessoryIcon({ ...props }) {
1818}
1919
2020AccessoryIcon.Pending = () => (
21− <AccessoryIcon>{kPendingAccessory}</AccessoryIcon>
21+ <AccessoryIcon>{PENDING_ACCESSORY}</AccessoryIcon>
2222);
2323
2424AccessoryIcon.Success = () => (
25− <AccessoryIcon>{kSuccessAccessory}</AccessoryIcon>
25+ <AccessoryIcon>{SUCCESS_ACCESSORY}</AccessoryIcon>
2626);
2727
2828AccessoryIcon.Failure = () => (
29− <AccessoryIcon>{kFailureAccessory}</AccessoryIcon>
29+ <AccessoryIcon>{FAILURE_ACCESSORY}</AccessoryIcon>
3030);
3131
3232export default AccessoryIcon;
src/lib/txn.js+3−2
@@ -9,7 +9,8 @@ import { ledgerSignTransaction } from './ledger';
99import { trezorSignTransaction } from './trezor';
1010import { WALLET_TYPES, addHexPrefix } from './wallet';
1111
12−const kCheckBlockEveryMs = process.env.NODE_ENV === 'development' ? 1000 : 5000;
12+const CHECK_BLOCK_EVERY_MS =
13+ process.env.NODE_ENV === 'development' ? 1000 : 5000;
1314
1415const TXN_PURPOSE = {
1516 SET_MANAGEMENT_PROXY: Symbol('SET_MANAGEMENT_PROXY'),
@@ -196,7 +197,7 @@ const waitForTransactionConfirm = (web3, txHash) => {
196197 console.log('tried, got', receipt);
197198 let confirmed = receipt !== null;
198199 if (confirmed) resolve(receipt.status === true);
199− else setTimeout(checkForConfirm, kCheckBlockEveryMs);
200+ else setTimeout(checkForConfirm, CHECK_BLOCK_EVERY_MS);
200201 };
201202 checkForConfirm();
202203 });
src/lib/useMailer.js+3−3
@@ -4,7 +4,7 @@ import Maybe from 'folktale/maybe';
44import { hasReceived, sendMail } from './inviteMail';
55import useSetState from './useSetState';
66
7−const kStubMailer = process.env.REACT_APP_STUB_MAILER === 'true';
7+const STUB_MAILER = process.env.REACT_APP_STUB_MAILER === 'true';
88
99function useHasReceivedCache() {
1010 const [cache, addToCache] = useSetState();
@@ -21,7 +21,7 @@ function useHasReceivedCache() {
2121 return;
2222 }
2323
24− if (kStubMailer) {
24+ if (STUB_MAILER) {
2525 // always allow sending emails when stubbing
2626 return addToCache({ [email]: Maybe.Just(false) });
2727 }
@@ -41,7 +41,7 @@ export default function useMailer(emails) {
4141 // prefix to avoid clobbering sendMail import
4242 // also throws if return value is false
4343 const _sendMail = useCallback(async (email, ticket, rawTx) => {
44− if (kStubMailer) {
44+ if (STUB_MAILER) {
4545 console.log(`${email} - ${ticket}`);
4646 return;
4747 }
src/views/Invite/InviteEmail.js+2−3
@@ -47,8 +47,7 @@ import useMailer from 'lib/useMailer';
4747const GAS_PRICE_GWEI = 20; // we pay the premium for faster ux
4848const GAS_LIMIT = 400000;
4949const 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.';
5251
5352const STATUS = {
5453 INPUT: 'INPUT',
@@ -145,7 +144,7 @@ export default function InviteEmail() {
145144 config.disabled = !canInput;
146145 const hasReceivedError = getHasRecieved(config.name).matchWith({
147146 Nothing: () => null, // loading
148− Just: p => p.value && kHasReceivedText,
147+ Just: p => p.value && HAS_RECEIVED_TEXT,
149148 });
150149 config.error = hasReceivedError || errors[config.name];
151150 return config;