From 623b8fb6c4d093c356dc6e642f57dc262e84fd09 Mon Sep 17 00:00:00 2001 From: Patrick Tajima Date: Fri, 1 Apr 2022 14:48:26 -0700 Subject: [PATCH] fix: Make getWalletURL util function --- .../common/VerifyWalletDomainBanner.js | 22 ++++--------------- packages/frontend/src/utils/getWalletURL.js | 14 ++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 packages/frontend/src/utils/getWalletURL.js diff --git a/packages/frontend/src/components/common/VerifyWalletDomainBanner.js b/packages/frontend/src/components/common/VerifyWalletDomainBanner.js index 788d712745..a97b03413f 100644 --- a/packages/frontend/src/components/common/VerifyWalletDomainBanner.js +++ b/packages/frontend/src/components/common/VerifyWalletDomainBanner.js @@ -3,6 +3,7 @@ import { Translate } from 'react-localize-redux'; import styled from 'styled-components'; import { IS_MAINNET, SHOW_PRERELEASE_WARNING } from '../../config'; +import getWalletURL from '../../utils/getWalletURL'; import LockIcon from '../svg/LockIcon'; const StyledContainer = styled.div` @@ -51,22 +52,7 @@ const StyledContainer = styled.div` } `; -const getWalletURL = () => { - let networkName = ''; - - if (SHOW_PRERELEASE_WARNING) { - networkName = 'staging.'; - } - if (!IS_MAINNET) { - networkName = 'testnet.'; - } - - return ( - <> - https://wallet.{networkName}near.org - - ); -}; +const getWalletURLString = () => <>https://{getWalletURL(false)}; export default () => { return ( @@ -75,13 +61,13 @@ export default () => {   - {getWalletURL()} + {getWalletURLString()}
- {getWalletURL()} + {getWalletURLString()}
diff --git a/packages/frontend/src/utils/getWalletURL.js b/packages/frontend/src/utils/getWalletURL.js new file mode 100644 index 0000000000..6697514c15 --- /dev/null +++ b/packages/frontend/src/utils/getWalletURL.js @@ -0,0 +1,14 @@ +import { IS_MAINNET, SHOW_PRERELEASE_WARNING } from '../config'; + +export default (https = true) => { + let networkName = ''; + + if (SHOW_PRERELEASE_WARNING) { + networkName = 'staging.'; + } + if (!IS_MAINNET) { + networkName = 'testnet.'; + } + + return `${https ? 'https://' : ''}wallet.${networkName}near.org`; +};