From e4d788ff69ae3479d748fb6837ba20afdb8e7222 Mon Sep 17 00:00:00 2001 From: NotEternal Date: Fri, 25 Jun 2021 09:09:27 -0500 Subject: [PATCH 1/4] Delete router links --- src/front/shared/helpers/links.ts | 5 ----- src/front/shared/localisation/en.json | 2 +- src/front/shared/localisation/es.json | 2 +- src/front/shared/localisation/nl.json | 2 +- src/front/shared/localisation/pl.json | 2 +- src/front/shared/localisation/ru.json | 2 +- .../pages/CurrencyWallet/CurrencyWallet.tsx | 20 ++++--------------- 7 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/front/shared/helpers/links.ts b/src/front/shared/helpers/links.ts index 70f998bca1..99de8a0951 100644 --- a/src/front/shared/helpers/links.ts +++ b/src/front/shared/helpers/links.ts @@ -17,7 +17,6 @@ const linksManager = { farm: 'https://farm.wpmix.net/', localStorage: '/localStorage', - creditCardDeposit: '/creditCardDeposit', wallets: '/wallets', send: '/withdraw', savePrivateSeed: '/savePrivateSeed', @@ -29,13 +28,9 @@ const linksManager = { test: 'https://testnet.swaponline.io', main: 'https://swaponline.io/', wallet: '/wallet', - coins: '/coins', - partial: '/partial', notFound: '/NotFound', multisign: '/multisign', createInvoice: '/createinvoice', - BtcWallet: '/Bitcoin-wallet', - EthWallet: '/Ethereum-wallet', // social networks medium: '#', diff --git a/src/front/shared/localisation/en.json b/src/front/shared/localisation/en.json index 8a9a3ae489..528d62d6ff 100644 --- a/src/front/shared/localisation/en.json +++ b/src/front/shared/localisation/en.json @@ -1332,7 +1332,7 @@ }, { "id": "CurrencyWalletTitle", - "message": "{fullName} ({currency}) Web Wallet with Atomic Swap.", + "message": "Swap.Online - {fullName} ({currency}) Web Wallet with Atomic Swap.", "files": [ "src/front/shared/pages/CurrencyWallet/CurrencyWallet.tsx" ] diff --git a/src/front/shared/localisation/es.json b/src/front/shared/localisation/es.json index afb9ec2e7e..e80b03a4f4 100644 --- a/src/front/shared/localisation/es.json +++ b/src/front/shared/localisation/es.json @@ -1220,7 +1220,7 @@ }, { "id": "CurrencyWalletTitle", - "message": "{fullName} ({currency}) Billetera web con Atomic Swap.", + "message": "Swap.Online - {fullName} ({currency}) Billetera web con Atomic Swap.", "files": [ "src/front/shared/pages/CurrencyWallet/CurrencyWallet.tsx" ] diff --git a/src/front/shared/localisation/nl.json b/src/front/shared/localisation/nl.json index 1065ba6bf5..606e31ceff 100644 --- a/src/front/shared/localisation/nl.json +++ b/src/front/shared/localisation/nl.json @@ -1213,7 +1213,7 @@ }, { "id": "CurrencyWalletTitle", - "message": "{fullName} ({currency}) Web Wallet with Atomic Swap.", + "message": "Swap.Online - {fullName} ({currency}) Web Wallet with Atomic Swap.", "files": [ "src/front/shared/pages/CurrencyWallet/CurrencyWallet.tsx" ] diff --git a/src/front/shared/localisation/pl.json b/src/front/shared/localisation/pl.json index 0a903e7a59..0339489d50 100644 --- a/src/front/shared/localisation/pl.json +++ b/src/front/shared/localisation/pl.json @@ -1220,7 +1220,7 @@ }, { "id": "CurrencyWalletTitle", - "message": "{fullName} ({currency}) Web Wallet with Atomic Swap.", + "message": "Swap.Online - {fullName} ({currency}) Web Wallet with Atomic Swap.", "files": [ "src/front/shared/pages/CurrencyWallet/CurrencyWallet.tsx" ] diff --git a/src/front/shared/localisation/ru.json b/src/front/shared/localisation/ru.json index 2315131eb7..b5ec157932 100644 --- a/src/front/shared/localisation/ru.json +++ b/src/front/shared/localisation/ru.json @@ -1398,7 +1398,7 @@ }, { "id": "CurrencyWalletTitle", - "message": "{fullName} ({currency}) онлайн кошелек, работащюий на технологии Atomic Swap", + "message": "Swap.Online - {fullName} ({currency}) онлайн кошелек, работащюий на технологии Atomic Swap", "files": [ "src/front/shared/pages/CurrencyWallet/CurrencyWallet.tsx" ] diff --git a/src/front/shared/pages/CurrencyWallet/CurrencyWallet.tsx b/src/front/shared/pages/CurrencyWallet/CurrencyWallet.tsx index c883b7b03c..744b2bc43e 100644 --- a/src/front/shared/pages/CurrencyWallet/CurrencyWallet.tsx +++ b/src/front/shared/pages/CurrencyWallet/CurrencyWallet.tsx @@ -65,7 +65,7 @@ class CurrencyWallet extends Component { const { match: { - params: { fullName = null, ticker = null, address = null }, + params: { ticker = null, address = null }, }, hiddenCoinsList, } = props @@ -73,12 +73,6 @@ class CurrencyWallet extends Component { const items = actions.core.getWallets({}) const walletAddress = address - // оставляю запасной вариант для старых ссылок - if (fullName) { - //@ts-ignore - ticker = fullName - } - let itemCurrency = this.filterCurrencies({ items, ticker, @@ -198,7 +192,7 @@ class CurrencyWallet extends Component { let { match: { - params: { address = null, fullName = null, ticker = null, action = null }, + params: { address = null, ticker = null, action = null }, }, activeCurrency } = this.props @@ -220,11 +214,6 @@ class CurrencyWallet extends Component { ) { const items = actions.core.getWallets({}) const walletAddress = address - - // оставляю запасной вариант для старых ссылок - if (fullName) { - ticker = fullName - } let itemCurrency = this.filterCurrencies({ items, @@ -464,7 +453,6 @@ class CurrencyWallet extends Component { currency, itemCurrency, balance, - fullName, infoAboutCurrency, txItems, filterValue, @@ -536,11 +524,11 @@ class CurrencyWallet extends Component { From 702d7b7cd7b3288cc50b8d852bfe7760fd0e6915 Mon Sep 17 00:00:00 2001 From: NotEternal Date: Tue, 6 Jul 2021 10:51:19 -0500 Subject: [PATCH 2/4] Delete prop-types: first part --- src/front/global.d.ts | 19 ++++--- src/front/shared/components/Avatar/Avatar.tsx | 23 ++++---- src/front/shared/components/Coins/Coins.tsx | 29 +++++----- .../shared/components/Confirm/Confirm.tsx | 57 ++++++++++--------- .../shared/components/controls/Flip/Flip.tsx | 28 ++++----- .../components/controls/Toggle/Toggle.tsx | 27 +++++---- 6 files changed, 91 insertions(+), 92 deletions(-) diff --git a/src/front/global.d.ts b/src/front/global.d.ts index a660539110..9f1e821be4 100644 --- a/src/front/global.d.ts +++ b/src/front/global.d.ts @@ -2,23 +2,24 @@ import 'react' declare module 'react' { interface Attributes { - styleName?: string; - type?: string; - title?: any; + styleName?: string + type?: string + title?: any + alt?: string } } declare global { interface IEtheriumProvider { - [key: string]: any; - isLiquality?: boolean; - isTrust?: boolean; - isMetaMask?: boolean; + [key: string]: any + isLiquality?: boolean + isTrust?: boolean + isMetaMask?: boolean } interface Window { - [key: string]: any; - ethereum?: IEtheriumProvider; + [key: string]: any + ethereum?: IEtheriumProvider } interface Navigator { diff --git a/src/front/shared/components/Avatar/Avatar.tsx b/src/front/shared/components/Avatar/Avatar.tsx index bfffbf128b..cad20c56c7 100644 --- a/src/front/shared/components/Avatar/Avatar.tsx +++ b/src/front/shared/components/Avatar/Avatar.tsx @@ -1,5 +1,4 @@ import React, { Fragment } from 'react' -import PropTypes from 'prop-types' import config from 'helpers/externalConfig' import { toSvg } from 'jdenticon' @@ -21,8 +20,17 @@ const hasGravatar = (ethAddress) => { return false } -const Avatar = ({ value, className, size, ownerEthAddress }) => { +type ComponentProps = { + value: string + size?: number + className?: string + ownerEthAddress?: string +} + +const Avatar = (props: ComponentProps) => { + const { value, className, size = 35, ownerEthAddress } = props let avatarUrl = `data:image/svg+xml,${encodeURIComponent(toSvg(value, size))}` + if (ownerEthAddress) { const gravatar = hasGravatar(ownerEthAddress) if (gravatar) { @@ -42,15 +50,4 @@ const Avatar = ({ value, className, size, ownerEthAddress }) => { ) } -Avatar.defaultProps = { - size: 35, -} - -Avatar.propTypes = { - value: PropTypes.string.isRequired, - size: PropTypes.number, - className: PropTypes.string, - ownerEthAddress: PropTypes.string, -} - export default CSSModules(Avatar, styles) diff --git a/src/front/shared/components/Coins/Coins.tsx b/src/front/shared/components/Coins/Coins.tsx index 3eec0232ce..6204e2fe15 100644 --- a/src/front/shared/components/Coins/Coins.tsx +++ b/src/front/shared/components/Coins/Coins.tsx @@ -1,27 +1,24 @@ import React from 'react' -import PropTypes from 'prop-types' - import CSSModules from 'react-css-modules' import styles from './Coins.scss' import Coin from 'components/Coin/Coin' - -const Coins = ({ className, names, size }) => ( -
- - -
-) - -Coins.defaultProps = { - size: 40, +type ComponentProps = { + names: string[] + size?: number + className?: string } -Coins.propTypes = { - names: PropTypes.array.isRequired, - size: PropTypes.number, - className: PropTypes.string, +const Coins = (props: ComponentProps) => { + const { className, names, size = 40 } = props + + return ( +
+ + +
+ ) } export default CSSModules(Coins, styles) diff --git a/src/front/shared/components/Confirm/Confirm.tsx b/src/front/shared/components/Confirm/Confirm.tsx index 7ac0bcf27e..16f5fd002e 100644 --- a/src/front/shared/components/Confirm/Confirm.tsx +++ b/src/front/shared/components/Confirm/Confirm.tsx @@ -1,6 +1,4 @@ import React from 'react' -import PropTypes from 'prop-types' - import cssModules from 'react-css-modules' import styles from './Confirm.scss' @@ -9,33 +7,36 @@ import Button from 'components/controls/Button/Button' import Center from 'components/layout/Center/Center' import { FormattedMessage } from 'react-intl' -const Confirm = ({ rootClassName, isConfirm, isReject, title, animation }) => ( -
-
- {title} -
- - -
-
-
-) +type ComponentProps = { + rootClassName: string + isConfirm: () => void + isReject: () => void + title: () => JSX.Element + animation: boolean +} -Confirm.propTypes = { - Center: PropTypes.node, - rootClassName: PropTypes.string, - isConfirm: PropTypes.func.isRequired, - isReject: PropTypes.func.isRequired, - title: PropTypes.string.isRequired, - animation: PropTypes.bool, +const Confirm = (props: ComponentProps) => { + const { rootClassName, isConfirm, isReject, title, animation } = props + + return ( +
+
+ {title} +
+ + +
+
+
+ ) } export default cssModules(Confirm, styles, { allowMultiple: true }) diff --git a/src/front/shared/components/controls/Flip/Flip.tsx b/src/front/shared/components/controls/Flip/Flip.tsx index 501933f9a5..21145f3a3b 100644 --- a/src/front/shared/components/controls/Flip/Flip.tsx +++ b/src/front/shared/components/controls/Flip/Flip.tsx @@ -1,23 +1,23 @@ import React from 'react' -import PropTypes from 'prop-types' - import CSSModules from 'react-css-modules' import styles from './Flip.scss' - -const Flip = ({ onClick, className }) => ( - //@ts-ignore - ) - - //@ts-ignore - WithdrawButton.propTypes = { - onClick: PropTypes.func.isRequired, - className: PropTypes.string, - disabled: PropTypes.bool, - } } + export default CSSModules(WithdrawButton, styles, { allowMultiple: true }) diff --git a/src/front/shared/components/layout/Overlay/Overlay.tsx b/src/front/shared/components/layout/Overlay/Overlay.tsx index 1128e70c47..3d62be71e0 100644 --- a/src/front/shared/components/layout/Overlay/Overlay.tsx +++ b/src/front/shared/components/layout/Overlay/Overlay.tsx @@ -1,16 +1,26 @@ -import React from 'react' -import PropTypes from 'prop-types' - +import React, { useEffect } from 'react' import cssModules from 'react-css-modules' import styles from './Overlay.scss' +type ComponentProps = { + children: JSX.Element | JSX.Element[] + onClick?: () => void + dashboardView?: boolean +} + +const Overlay = (props: ComponentProps) => { + const { + children, + onClick = () => undefined, + dashboardView = false, + } = props + + const [evaluatedHeight, setEvaluatedHeight] = React.useState(400) -const Overlay = ({ children, onClick, dashboardView }) => { - let [evaluatedHeight, setEvaluatedHeight] = React.useState(400) - React.useEffect(() => { + useEffect(() => { if (dashboardView) { - //@ts-ignore: strictNullChecks - const elWithHeight: HTMLElement = document.querySelector('.__modalConductorProvided__ .contentHeightEvaluateHere') + const elWithHeight: HTMLElement | null = document.querySelector('.__modalConductorProvided__ .contentHeightEvaluateHere') + if (elWithHeight) { setEvaluatedHeight(elWithHeight.clientHeight || elWithHeight.offsetHeight || @@ -26,9 +36,4 @@ const Overlay = ({ children, onClick, dashboardView }) => { ) } -Overlay.propTypes = { - children: PropTypes.node, - onClick: PropTypes.func, -} - export default cssModules(Overlay, styles) diff --git a/src/front/shared/components/loaders/RequestLoader/RequestLoader.tsx b/src/front/shared/components/loaders/RequestLoader/RequestLoader.tsx index e0ef9f51d5..7f9639dbdc 100644 --- a/src/front/shared/components/loaders/RequestLoader/RequestLoader.tsx +++ b/src/front/shared/components/loaders/RequestLoader/RequestLoader.tsx @@ -1,11 +1,17 @@ import React from 'react' -import PropTypes from 'prop-types' - import { connect } from 'redaction' import Loader from '../Loader/Loader' +type ComponentProps = { + isVisible?: boolean + data: { + txId: string + } +} + +const RequestLoader = (props: ComponentProps) => { + const { isVisible = false, data } = props -const RequestLoader = ({ isVisible, data }) => { if (!isVisible) { return null } @@ -13,14 +19,6 @@ const RequestLoader = ({ isVisible, data }) => { return } -RequestLoader.propTypes = { - isVisible: PropTypes.bool.isRequired, -} - -RequestLoader.defaultProps = { - isVisible: false, -} - export default connect({ isVisible: 'loader.isVisible', data: 'loader.data', From 9146ffd7694811895ea8e64722222437250345a8 Mon Sep 17 00:00:00 2001 From: NotEternal Date: Tue, 6 Jul 2021 11:41:42 -0500 Subject: [PATCH 4/4] Delete prop-types: third part --- src/front/shared/components/QR/QR.tsx | 19 ++++++------ src/front/shared/components/Timer/Timer.ts | 24 +++++++-------- .../DeclineOrdersModal/DeclineOrdersModal.tsx | 18 +++--------- .../History/Filter/FilterLink/FilterLink.tsx | 29 ++++++++++--------- 4 files changed, 38 insertions(+), 52 deletions(-) diff --git a/src/front/shared/components/QR/QR.tsx b/src/front/shared/components/QR/QR.tsx index 6ab85c186c..e024b1ff9a 100644 --- a/src/front/shared/components/QR/QR.tsx +++ b/src/front/shared/components/QR/QR.tsx @@ -1,17 +1,20 @@ import React, { Component } from 'react' import CSSModules from 'react-css-modules' import cx from 'classnames' -import PropTypes from 'prop-types' -import InlineLoader from 'components/loaders/InlineLoader/InlineLoader' import animateFetching from 'components/loaders/ContentLoader/ElementLoading.scss' import styles from './QR.scss' -/** - * @todo Amount support? - */ +type ComponentProps = { + address: string +} + +type ComponentState = { + renderQr: boolean +} + @CSSModules({ ...styles, ...animateFetching }, { allowMultiple: true }) -export default class QR extends Component { +export default class QR extends Component { constructor(props) { super(props) @@ -21,10 +24,6 @@ export default class QR extends Component { } } - static propTypes = { - address: PropTypes.string.isRequired, - } - componentDidMount() { setTimeout(() => { this.setState({ renderQr: true }) diff --git a/src/front/shared/components/Timer/Timer.ts b/src/front/shared/components/Timer/Timer.ts index da16f1efc4..20fb901c07 100644 --- a/src/front/shared/components/Timer/Timer.ts +++ b/src/front/shared/components/Timer/Timer.ts @@ -1,25 +1,21 @@ -import React, { Component } from 'react' +import { Component } from 'react' -import PropTypes from 'prop-types' - - -export default class TimerButton extends Component { - - static propTypes = { - timeLeft: PropTypes.number, // seconds - handleClick: PropTypes.func, - } +type ComponentProps = { + timeLeft?: number // seconds + handleClick: () => void +} - static defaultProps = { - timeLeft: 10, - } +type ComponentState = { + timeLeft: number +} +export default class TimerButton extends Component { timer = null constructor(props) { super(props) - const { timeLeft } = props + const { timeLeft = 10 } = props this.state = { timeLeft, diff --git a/src/front/shared/components/modals/DeclineOrdersModal/DeclineOrdersModal.tsx b/src/front/shared/components/modals/DeclineOrdersModal/DeclineOrdersModal.tsx index c3cc38e086..07ee4fb10e 100644 --- a/src/front/shared/components/modals/DeclineOrdersModal/DeclineOrdersModal.tsx +++ b/src/front/shared/components/modals/DeclineOrdersModal/DeclineOrdersModal.tsx @@ -1,23 +1,13 @@ -import React, { Fragment, Component } from 'react' -import PropTypes from 'prop-types' - -import { connect } from 'redaction' +import React, { Component } from 'react' +import { withRouter } from 'react-router-dom' +import { FormattedMessage, injectIntl, defineMessages } from 'react-intl' import actions from 'redux/actions' import { localisedUrl } from 'helpers/locale' - import links from 'helpers/links' - import cssModules from 'react-css-modules' import styles from './DeclineOrdersModal.scss' import Modal from 'components/modal/Modal/Modal' -import Button from 'components/controls/Button/Button' -import CopyToClipboard from 'react-copy-to-clipboard' - -import { FormattedMessage, injectIntl, defineMessages } from 'react-intl' - -import { withRouter } from 'react-router-dom' - const title = defineMessages({ downloadModal: { @@ -52,7 +42,7 @@ class DeclineOrdersModal extends Component {
-

+

diff --git a/src/front/shared/pages/History/Filter/FilterLink/FilterLink.tsx b/src/front/shared/pages/History/Filter/FilterLink/FilterLink.tsx index df1860defe..f3c3600deb 100644 --- a/src/front/shared/pages/History/Filter/FilterLink/FilterLink.tsx +++ b/src/front/shared/pages/History/Filter/FilterLink/FilterLink.tsx @@ -1,23 +1,24 @@ import React from 'react' -import PropTypes from 'prop-types' - import CSSModules from 'react-css-modules' import styles from './FilterLink.scss' +type ComponentProps = { + name: string + filter: string + onClick: () => void +} -const FilterLink = ({ name, filter, onClick }) => ( - - {name} - -) +const FilterLink = (props: ComponentProps) => { + const { name, filter, onClick } = props -FilterLink.propTypes = { - name: PropTypes.string.isRequired, - filter: PropTypes.string.isRequired, - onClick: PropTypes.func.isRequired, + return ( + + {name} + + ) } export default CSSModules(FilterLink, styles, { allowMultiple: true })