Page MenuHomePhabricator

D11265.id32955.diff
No OneTemporary

D11265.id32955.diff

diff --git a/web/cashtab-v2/extension/src/components/App.js b/web/cashtab-v2/extension/src/components/App.js
--- a/web/cashtab-v2/extension/src/components/App.js
+++ b/web/cashtab-v2/extension/src/components/App.js
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import 'antd/dist/antd.less';
+import PropTypes from 'prop-types';
import { Spin } from 'antd';
import {
CashLoadingIcon,
@@ -355,4 +356,8 @@
);
};
+App.propTypes = {
+ match: PropTypes.string,
+};
+
export default App;
diff --git a/web/cashtab-v2/src/components/Airdrop/Airdrop.js b/web/cashtab-v2/src/components/Airdrop/Airdrop.js
--- a/web/cashtab-v2/src/components/Airdrop/Airdrop.js
+++ b/web/cashtab-v2/src/components/Airdrop/Airdrop.js
@@ -454,6 +454,13 @@
);
};
+/*
+passLoadingStatus must receive a default prop that is a function
+in order to pass the rendering unit test in Airdrop.test.js
+
+status => {console.log(status)} is an arbitrary stub function
+*/
+
Airdrop.defaultProps = {
passLoadingStatus: status => {
console.log(status);
diff --git a/web/cashtab-v2/src/components/App.js b/web/cashtab-v2/src/components/App.js
--- a/web/cashtab-v2/src/components/App.js
+++ b/web/cashtab-v2/src/components/App.js
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import 'antd/dist/antd.less';
+import PropTypes from 'prop-types';
import { Spin } from 'antd';
import {
CashLoadingIcon,
@@ -375,4 +376,8 @@
);
};
+App.propTypes = {
+ match: PropTypes.string,
+};
+
export default App;
diff --git a/web/cashtab-v2/src/components/Authentication/ProtectableComponentWrapper.js b/web/cashtab-v2/src/components/Authentication/ProtectableComponentWrapper.js
--- a/web/cashtab-v2/src/components/Authentication/ProtectableComponentWrapper.js
+++ b/web/cashtab-v2/src/components/Authentication/ProtectableComponentWrapper.js
@@ -1,11 +1,11 @@
import React, { useContext } from 'react';
import { AuthenticationContext } from 'utils/context';
+import PropTypes from 'prop-types';
import SignUp from './SignUp';
import SignIn from './SignIn';
const ProtectableComponentWrapper = ({ children }) => {
const authentication = useContext(AuthenticationContext);
-
if (authentication) {
const { loading, isAuthenticationRequired, isSignedIn } =
authentication;
@@ -29,4 +29,8 @@
return <>{children}</>;
};
+ProtectableComponentWrapper.propTypes = {
+ children: PropTypes.objectOf(PropTypes.node),
+};
+
export default ProtectableComponentWrapper;
diff --git a/web/cashtab-v2/src/components/Common/QRCode.js b/web/cashtab-v2/src/components/Common/QRCode.js
--- a/web/cashtab-v2/src/components/Common/QRCode.js
+++ b/web/cashtab-v2/src/components/Common/QRCode.js
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
+import PropTypes from 'prop-types';
import styled from 'styled-components';
import RawQRCode from 'qrcode.react';
import { currency } from 'components/Common/Ticker.js';
@@ -138,7 +139,6 @@
isCashAddress,
size = 210,
onClick = () => null,
- ...otherProps
}) => {
address = address ? convertToEcashPrefix(address) : '';
@@ -242,3 +242,10 @@
</CopyToClipboard>
);
};
+
+QRCode.propTypes = {
+ address: PropTypes.string,
+ isCashAddress: PropTypes.func,
+ size: PropTypes.number,
+ onClick: PropTypes.func,
+};
diff --git a/web/cashtab-v2/src/components/Common/ScanQRCode.js b/web/cashtab-v2/src/components/Common/ScanQRCode.js
--- a/web/cashtab-v2/src/components/Common/ScanQRCode.js
+++ b/web/cashtab-v2/src/components/Common/ScanQRCode.js
@@ -136,7 +136,6 @@
} else {
scanForQrCode();
}
- // eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible]);
return (
diff --git a/web/cashtab-v2/src/components/Configure/Configure.js b/web/cashtab-v2/src/components/Configure/Configure.js
--- a/web/cashtab-v2/src/components/Configure/Configure.js
+++ b/web/cashtab-v2/src/components/Configure/Configure.js
@@ -1,4 +1,3 @@
-/* eslint-disable react-hooks/exhaustive-deps */
import React, { useState, useEffect } from 'react';
import styled from 'styled-components';
import { Collapse, Form, Input, Modal, Alert, Switch, Tag } from 'antd';
@@ -483,7 +482,7 @@
setConfirmationOfWalletToBeDeleted(value);
};
- const handleAppLockToggle = (checked, e) => {
+ const handleAppLockToggle = checked => {
if (checked) {
// if there is an existing credential, that means user has registered
// simply turn on the Authentication Required flag
diff --git a/web/cashtab-v2/src/components/Home/Tx.js b/web/cashtab-v2/src/components/Home/Tx.js
--- a/web/cashtab-v2/src/components/Home/Tx.js
+++ b/web/cashtab-v2/src/components/Home/Tx.js
@@ -1,7 +1,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
import PropTypes from 'prop-types';
-import styled, { css } from 'styled-components';
+import styled from 'styled-components';
import {
SendIcon,
ReceiveIcon,
@@ -154,24 +154,12 @@
background: ${props.theme.receivedMessage};
`}
`;
-const SentLabel = styled.span`
- font-weight: bold;
- color: ${props => props.theme.secondary} !important;
-`;
+
const ReceivedLabel = styled.span`
font-weight: bold;
color: ${props => props.theme.eCashBlue} !important;
`;
-const GenesisLabel = styled.span`
- font-weight: bold;
- color: ${props => props.theme.genesisGreen} !important;
-`;
-const CashtabMessageLabel = styled.span`
- text-align: left;
- font-weight: bold;
- color: ${props => props.theme.eCashBlue} !important;
- white-space: nowrap;
-`;
+
const EncryptionMessageLabel = styled.span`
font-weight: bold;
font-size: 12px;
@@ -184,15 +172,6 @@
white-space: nowrap;
font-style: italic;
`;
-const MessageLabel = styled.span`
- text-align: left;
- font-weight: bold;
- color: ${props => props.theme.secondary} !important;
- white-space: nowrap;
-`;
-const ReplyMessageLabel = styled.span`
- color: ${props => props.theme.eCashBlue} !important;
-`;
const TxInfo = styled.div`
text-align: right;
diff --git a/web/cashtab-v2/src/components/Home/TxHistory.js b/web/cashtab-v2/src/components/Home/TxHistory.js
--- a/web/cashtab-v2/src/components/Home/TxHistory.js
+++ b/web/cashtab-v2/src/components/Home/TxHistory.js
@@ -1,6 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
-import styled from 'styled-components';
import Tx from './Tx';
const TxHistory = ({ txs, fiatPrice, fiatCurrency }) => {
diff --git a/web/cashtab-v2/src/components/Send/Send.js b/web/cashtab-v2/src/components/Send/Send.js
--- a/web/cashtab-v2/src/components/Send/Send.js
+++ b/web/cashtab-v2/src/components/Send/Send.js
@@ -9,7 +9,7 @@
DestinationAddressMulti,
} from 'components/Common/EnhancedInputs';
import { AdvancedCollapse } from 'components/Common/StyledCollapse';
-import { Form, message, Modal, Alert, Collapse, Input, Button } from 'antd';
+import { Form, message, Modal, Alert, Collapse, Input } from 'antd';
import { Row, Col, Switch } from 'antd';
import PrimaryButton, {
SecondaryButton,
@@ -508,12 +508,6 @@
}));
};
- // true: renders the multi recipient <TextArea>
- // false: renders the single recipient <Input>
- const handleOneToManyXECSend = sendXecMode => {
- setIsOneToManyXECSend(sendXecMode);
- };
-
const handleBchAmountChange = e => {
const { value, name } = e.target;
let bchValue = value;
diff --git a/web/cashtab-v2/src/components/Tokens/CreateTokenForm.js b/web/cashtab-v2/src/components/Tokens/CreateTokenForm.js
--- a/web/cashtab-v2/src/components/Tokens/CreateTokenForm.js
+++ b/web/cashtab-v2/src/components/Tokens/CreateTokenForm.js
@@ -2,7 +2,6 @@
import styled from 'styled-components';
import PropTypes from 'prop-types';
import { AntdFormWrapper } from 'components/Common/EnhancedInputs';
-import { TokenCollapse } from 'components/Common/StyledCollapse';
import { currency } from 'components/Common/Ticker.js';
import {
CropControlModal,
@@ -24,8 +23,6 @@
} from '@ant-design/icons';
import { SmartButton } from 'components/Common/PrimaryButton';
import {
- notification,
- Collapse,
Form,
Input,
Modal,
@@ -216,8 +213,10 @@
const transformTokenIconFile = file => {
return new Promise((resolve, reject) => {
+ // Dragger requires this function to work properly with file as an input;
+ // linter requires file param to be used in the function.
+ console.log(file);
reject();
- // setLoading(false);
});
};
diff --git a/web/cashtab-v2/src/hooks/useWallet.js b/web/cashtab-v2/src/hooks/useWallet.js
--- a/web/cashtab-v2/src/hooks/useWallet.js
+++ b/web/cashtab-v2/src/hooks/useWallet.js
@@ -1,5 +1,3 @@
-/* eslint-disable react-hooks/exhaustive-deps */
-
import { useState, useEffect } from 'react';
import useAsyncTimeout from 'hooks/useAsyncTimeout';
import usePrevious from 'hooks/usePrevious';
diff --git a/web/cashtab-v2/src/hooks/useWebAuthentication.js b/web/cashtab-v2/src/hooks/useWebAuthentication.js
--- a/web/cashtab-v2/src/hooks/useWebAuthentication.js
+++ b/web/cashtab-v2/src/hooks/useWebAuthentication.js
@@ -196,6 +196,7 @@
);
}
} catch (err) {
+ console.log(err);
throw err;
}
},
@@ -217,6 +218,7 @@
);
}
} catch (err) {
+ console.log(err);
throw err;
}
},
diff --git a/web/cashtab-v2/src/utils/GoogleAnalytics.js b/web/cashtab-v2/src/utils/GoogleAnalytics.js
--- a/web/cashtab-v2/src/utils/GoogleAnalytics.js
+++ b/web/cashtab-v2/src/utils/GoogleAnalytics.js
@@ -50,9 +50,8 @@
const RouteTracker = () => <Route component={GoogleAnalytics} />;
-const init = (options = {}) => {
+const init = () => {
const isGAEnabled = process.env.NODE_ENV === 'production';
-
if (isGAEnabled) {
ReactGA.initialize('UA-183678810-1');
}
diff --git a/web/cashtab-v2/src/utils/cashMethods.js b/web/cashtab-v2/src/utils/cashMethods.js
--- a/web/cashtab-v2/src/utils/cashMethods.js
+++ b/web/cashtab-v2/src/utils/cashMethods.js
@@ -2,7 +2,6 @@
import {
isValidXecAddress,
isValidEtokenAddress,
- isValidUtxo,
isValidBchApiUtxoObject,
} from 'utils/validation';
import BigNumber from 'bignumber.js';
diff --git a/web/cashtab-v2/src/utils/context.js b/web/cashtab-v2/src/utils/context.js
--- a/web/cashtab-v2/src/utils/context.js
+++ b/web/cashtab-v2/src/utils/context.js
@@ -1,4 +1,5 @@
import React from 'react';
+import PropTypes from 'prop-types';
import useWallet from '../hooks/useWallet';
import useWebAuthentication from '../hooks/useWebAuthentication';
@@ -19,10 +20,17 @@
export const AuthenticationProvider = ({ children }) => {
// useWebAuthentication returns null if Web Authn is not supported
const authentication = useWebAuthentication();
-
return (
<AuthenticationContext.Provider value={authentication}>
{children}
</AuthenticationContext.Provider>
);
};
+
+WalletProvider.propTypes = {
+ children: PropTypes.objectOf(PropTypes.node),
+};
+
+AuthenticationProvider.propTypes = {
+ children: PropTypes.objectOf(PropTypes.node),
+};
diff --git a/web/cashtab-v2/src/utils/validation.js b/web/cashtab-v2/src/utils/validation.js
--- a/web/cashtab-v2/src/utils/validation.js
+++ b/web/cashtab-v2/src/utils/validation.js
@@ -319,6 +319,8 @@
// XEC airdrop field validations
export const isValidTokenId = tokenId => {
+ // disable no-useless-escape for regex
+ //eslint-disable-next-line
const format = /[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
const specialCharCheck = format.test(tokenId);

File Metadata

Mime Type
text/plain
Expires
Tue, May 20, 22:09 (20 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5866024
Default Alt Text
D11265.id32955.diff (11 KB)

Event Timeline