From 6d7f6711fd4d5ca7fc1a2dac5fcc9bbe94f00489 Mon Sep 17 00:00:00 2001 From: Taylan Date: Thu, 4 Feb 2021 07:13:26 +0000 Subject: [PATCH 1/9] Update asset value tooltip precision for #344 (#352) --- .../components/ActiveLoanTableDesktop/index.tsx | 3 ++- src/app/components/AssetWalletBalance/index.tsx | 4 ++-- .../LiquidityAddContainer/ExpectedPoolTokens.tsx | 4 ++-- src/app/containers/LiquidityRemoveContainer/index.tsx | 4 ++-- .../containers/RepayPositionHandler/RepayPositionForm.tsx | 8 ++------ 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/app/components/ActiveUserLoanContainer/components/ActiveLoanTableDesktop/index.tsx b/src/app/components/ActiveUserLoanContainer/components/ActiveLoanTableDesktop/index.tsx index 34f23875b..6e26cf55d 100644 --- a/src/app/components/ActiveUserLoanContainer/components/ActiveLoanTableDesktop/index.tsx +++ b/src/app/components/ActiveUserLoanContainer/components/ActiveLoanTableDesktop/index.tsx @@ -11,6 +11,7 @@ import { faLongArrowAltUp, faLongArrowAltDown, } from '@fortawesome/free-solid-svg-icons'; +import { weiTo18 } from '../../../../../utils/blockchain/math-helpers'; import { useTranslation } from 'react-i18next'; import { translations } from '../../../../../locales/i18n'; import { LoadableValue } from '../../../LoadableValue'; @@ -146,7 +147,7 @@ export function ActiveLoanTableDesktop(props: Props) { {item.currency} } - tooltip={item.positionSize} + tooltip={weiTo18(item.positionSize)} /> diff --git a/src/app/components/AssetWalletBalance/index.tsx b/src/app/components/AssetWalletBalance/index.tsx index 0a2f44c8e..72015f1a3 100644 --- a/src/app/components/AssetWalletBalance/index.tsx +++ b/src/app/components/AssetWalletBalance/index.tsx @@ -6,7 +6,7 @@ import React, { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { Asset } from 'types/asset'; -import { weiToFixed } from 'utils/blockchain/math-helpers'; +import { weiTo18, weiToFixed } from 'utils/blockchain/math-helpers'; import { useAssetBalanceOf } from 'app/hooks/useAssetBalanceOf'; import { useIsConnected } from 'app/hooks/useAccount'; import { translations } from 'locales/i18n'; @@ -41,7 +41,7 @@ export function AssetWalletBalance(props: Props) { {value}} + tooltip={<>{weiTo18(value)}} /> diff --git a/src/app/containers/LiquidityAddContainer/ExpectedPoolTokens.tsx b/src/app/containers/LiquidityAddContainer/ExpectedPoolTokens.tsx index 9a385ca5b..76defc8a0 100644 --- a/src/app/containers/LiquidityAddContainer/ExpectedPoolTokens.tsx +++ b/src/app/containers/LiquidityAddContainer/ExpectedPoolTokens.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { Text } from '@blueprintjs/core'; import { LoadableValue } from '../../components/LoadableValue'; -import { weiTo4 } from '../../../utils/blockchain/math-helpers'; +import { weiTo4, weiTo18 } from '../../../utils/blockchain/math-helpers'; import { translations } from '../../../locales/i18n'; import { useExpectedPoolTokens } from '../../hooks/amm/useExpectedPoolTokens'; import { Asset } from '../../../types/asset'; @@ -28,7 +28,7 @@ export function ExpectedPoolTokens({ pool, asset, amount }: Props) { {weiTo4(expectedPoolTokens.value)} } - tooltip={expectedPoolTokens.value} + tooltip={weiTo18(expectedPoolTokens.value)} />
{t(translations.liquidity.token)}
diff --git a/src/app/containers/LiquidityRemoveContainer/index.tsx b/src/app/containers/LiquidityRemoveContainer/index.tsx index fb565653f..88824bef7 100644 --- a/src/app/containers/LiquidityRemoveContainer/index.tsx +++ b/src/app/containers/LiquidityRemoveContainer/index.tsx @@ -137,7 +137,7 @@ export function LiquidityRemoveContainer(props: Props) { {weiTo4(targetValue[0])} {sourceToken} } - tooltip={targetValue[0]} + tooltip={weiTo18(targetValue[0])} />
@@ -153,7 +153,7 @@ export function LiquidityRemoveContainer(props: Props) { {weiTo4(targetValue[1])} {sourceToken} } - tooltip={targetValue[1]} + tooltip={weiTo18(targetValue[1])} />
{t(translations.liquidity.fee)}
diff --git a/src/app/containers/RepayPositionHandler/RepayPositionForm.tsx b/src/app/containers/RepayPositionHandler/RepayPositionForm.tsx index dc4332b2d..754958cec 100644 --- a/src/app/containers/RepayPositionHandler/RepayPositionForm.tsx +++ b/src/app/containers/RepayPositionHandler/RepayPositionForm.tsx @@ -17,11 +17,7 @@ import { TradeButton } from '../../components/TradeButton'; import { AssetWalletBalance } from '../../components/AssetWalletBalance'; import { AssetsDictionary } from '../../../utils/dictionaries/assets-dictionary'; import { useAssetBalanceOf } from '../../hooks/useAssetBalanceOf'; -import { - normalizeWei, - weiTo18, - weiTo4, -} from '../../../utils/blockchain/math-helpers'; +import { weiTo4, weiTo18 } from '../../../utils/blockchain/math-helpers'; import { DummyField } from '../../components/DummyField'; import { useApproveAndCloseWithDeposit } from '../../hooks/trading/useApproveAndCloseWithDeposit'; import { LoadableValue } from '../../components/LoadableValue'; @@ -111,7 +107,7 @@ export function RepayPositionForm({ loan }: Props) { {normalizeWei(receiveAmount)}} + tooltip={<>{weiTo18(receiveAmount)}} />{' '} {collateralAsset} From 99c0d3081f9dfedcb94c9101581e82bd39f66930 Mon Sep 17 00:00:00 2001 From: Taylan Date: Sun, 7 Feb 2021 17:09:33 +0000 Subject: [PATCH 2/9] Add testnet settings to EngageWalletDialog setup tutorial (#361) --- .../component/screen2/index.tsx | 18 ++++++++++++------ .../component/screen4/index.tsx | 16 +++++++++++----- src/utils/classifiers.ts | 5 +++++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/app/containers/EngageWalletDialog/component/screen2/index.tsx b/src/app/containers/EngageWalletDialog/component/screen2/index.tsx index df0e8dd10..e7b1ec2b2 100644 --- a/src/app/containers/EngageWalletDialog/component/screen2/index.tsx +++ b/src/app/containers/EngageWalletDialog/component/screen2/index.tsx @@ -15,6 +15,12 @@ import crater from 'assets/images/tutorial/crater.svg'; import { Icon } from '@blueprintjs/core'; import { useContent } from '../../../../hooks/tutorial/useContent'; import { CopyToClipboard } from 'react-copy-to-clipboard'; +import { + blockExplorers, + currentChainId, + networkNames, + rpcWalletURLs, +} from '../../../../../utils/classifiers'; interface Props { onNetwork: boolean; @@ -102,16 +108,16 @@ export function Screen2(props: Props) {
{t(translations.rskConnectTutorial.input_settings.network)}
-
RSK Mainnet
+
{networkNames[currentChainId]}
{t(translations.rskConnectTutorial.input_settings.new_RPC)}
- + - https://public-node.rsk.co + {rpcWalletURLs[currentChainId]}
@@ -120,7 +126,7 @@ export function Screen2(props: Props) {
{t(translations.rskConnectTutorial.input_settings.chain_Id)}
-
30
+
{currentChainId}
@@ -133,9 +139,9 @@ export function Screen2(props: Props) { {t(translations.rskConnectTutorial.input_settings.explorer_url)}
- + - https://explorer.rsk.co + {blockExplorers[currentChainId]}
diff --git a/src/app/containers/EngageWalletDialog/component/screen4/index.tsx b/src/app/containers/EngageWalletDialog/component/screen4/index.tsx index 35f7ca1fd..6ef321950 100644 --- a/src/app/containers/EngageWalletDialog/component/screen4/index.tsx +++ b/src/app/containers/EngageWalletDialog/component/screen4/index.tsx @@ -15,6 +15,12 @@ import scanQR from 'assets/images/tutorial/scanQr.svg'; import { Icon } from '@blueprintjs/core'; import { useContent } from '../../../../hooks/tutorial/useContent'; import { CopyToClipboard } from 'react-copy-to-clipboard'; +import { + blockExplorers, + currentChainId, + networkNames, + rpcWalletURLs, +} from '../../../../../utils/classifiers'; export function Screen4(props) { const { t } = useTranslation(); @@ -69,7 +75,7 @@ export function Screen4(props) {
{t(translations.rskConnectTutorial.input_settings.network)}
-
RSK Mainnet
+
{networkNames[currentChainId]}
@@ -77,11 +83,11 @@ export function Screen4(props) {
alert('Copied!')} > - https://public-node.rsk.co + {rpcWalletURLs[currentChainId]}
@@ -90,7 +96,7 @@ export function Screen4(props) {
{t(translations.rskConnectTutorial.input_settings.chain_Id)}
-
30
+
{currentChainId}
@@ -108,7 +114,7 @@ export function Screen4(props) { onCopy={() => alert('Copied!')} > - https://explorer.rsk.co + {blockExplorers[currentChainId]}
diff --git a/src/utils/classifiers.ts b/src/utils/classifiers.ts index d6dec7e52..0a92e4923 100644 --- a/src/utils/classifiers.ts +++ b/src/utils/classifiers.ts @@ -36,6 +36,11 @@ export const rpcNodes = { 31: 'https://testnet2.sovryn.app/rpc', }; +export const rpcWalletURLs = { + 30: 'https://public-node.rsk.co', + 31: 'https://public-node.testnet.rsk.co', +}; + export const readNodes = { 30: 'wss://mainnet2.sovryn.app/ws', 31: 'wss://testnet2.sovryn.app/ws', From 83956f6fedfe6319efde7d52aebd0de633dbdf2a Mon Sep 17 00:00:00 2001 From: pietro-maximoff Date: Wed, 10 Feb 2021 11:17:41 +0300 Subject: [PATCH 3/9] [issue328] - added fix for issue #328 --- .../MarginTradeForm/TradeConfirmationDialog.module.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/containers/MarginTradeForm/TradeConfirmationDialog.module.css b/src/app/containers/MarginTradeForm/TradeConfirmationDialog.module.css index bb8951f33..619173dbb 100644 --- a/src/app/containers/MarginTradeForm/TradeConfirmationDialog.module.css +++ b/src/app/containers/MarginTradeForm/TradeConfirmationDialog.module.css @@ -8,7 +8,7 @@ } .summary { - padding: 15px 40px; + padding: 15px 0; border-top: 1px solid #D9D9D9; border-bottom: 1px solid #D9D9D9; font-size: 14px; @@ -117,4 +117,3 @@ margin-bottom: 15px; text-align: center; } -.txHash {} From 7e6cef3f394042970888bfdad1c9bc83ab12bac0 Mon Sep 17 00:00:00 2001 From: pietro-maximoff Date: Wed, 10 Feb 2021 11:49:37 +0300 Subject: [PATCH 4/9] [issue304] - added fix to issue #304 --- src/app/components/Header/index.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/components/Header/index.tsx b/src/app/components/Header/index.tsx index d10941403..111ef70ec 100644 --- a/src/app/components/Header/index.tsx +++ b/src/app/components/Header/index.tsx @@ -37,6 +37,8 @@ export function Header() { top: 0; left: 0; right: 0; + bottom: 0; + overflow-y: auto; transition: transform 0.3s ease-in-out; z-index: 9; width: 100%; @@ -147,6 +149,7 @@ export function Header() { useEffect(() => { const body = document.body; if (open) { + window.scrollTo(0, 0); body.classList.add('overflow-hidden'); } else { body.classList.remove('overflow-hidden'); From 03f2ffa19f72ae6871e08a2400dca85b301a5b1e Mon Sep 17 00:00:00 2001 From: pietro-maximoff Date: Thu, 11 Feb 2021 21:16:29 +0300 Subject: [PATCH 5/9] [issue300] - fix #300 --- src/app/components/FormSelect/index.tsx | 9 +++++++++ src/app/containers/SwapTradeForm/index.tsx | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/app/components/FormSelect/index.tsx b/src/app/components/FormSelect/index.tsx index 6d4583fbe..b2dbc9130 100644 --- a/src/app/components/FormSelect/index.tsx +++ b/src/app/components/FormSelect/index.tsx @@ -26,6 +26,7 @@ interface Props { innerClasses?: string; onChange: (customer: SelectItem) => void; inputFocus?: boolean; + isItemDisabled?: string; } export function FormSelect(props: Props) { @@ -40,6 +41,13 @@ export function FormSelect(props: Props) { getSelected(), ); + const isItemDisabled = (item: SelectItem) => { + if (props.isItemDisabled === item.key) { + return true; + } + return false; + }; + useEffect(() => { setSelected(getSelected()); }, [getSelected, props.value, props.items]); @@ -64,6 +72,7 @@ export function FormSelect(props: Props) { filterable={props.filterable} itemRenderer={renderItem} itemPredicate={filterItem} + itemDisabled={isItemDisabled} onItemSelect={onItemSelect} itemsEqual={areOptionsEqual} activeItem={selected} diff --git a/src/app/containers/SwapTradeForm/index.tsx b/src/app/containers/SwapTradeForm/index.tsx index 328e89525..fe22b143c 100644 --- a/src/app/containers/SwapTradeForm/index.tsx +++ b/src/app/containers/SwapTradeForm/index.tsx @@ -155,6 +155,7 @@ export function SwapTradeForm() { placeholder={t(s.fields.currency_placeholder)} value={sourceToken} items={sourceOptions} + isItemDisabled={targetToken} />
@@ -180,6 +181,7 @@ export function SwapTradeForm() { placeholder={t(s.fields.currency_placeholder)} value={targetToken} items={targetOptions} + isItemDisabled={sourceToken} /> From 1317b80f77b685b22e1f99cc88124ca9a23c8a52 Mon Sep 17 00:00:00 2001 From: pietro-maximoff Date: Thu, 11 Feb 2021 23:30:21 +0300 Subject: [PATCH 6/9] [issue304] - fix #304 --- src/app/components/Header/index.tsx | 4 ++++ src/styles/global-styles.ts | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/components/Header/index.tsx b/src/app/components/Header/index.tsx index 111ef70ec..c003f9f4c 100644 --- a/src/app/components/Header/index.tsx +++ b/src/app/components/Header/index.tsx @@ -148,14 +148,18 @@ export function Header() { useEffect(() => { const body = document.body; + const root = document.getElementById('root'); if (open) { window.scrollTo(0, 0); body.classList.add('overflow-hidden'); + root?.classList.add('openedMenu'); } else { body.classList.remove('overflow-hidden'); + root?.classList.remove('openedMenu'); } return () => { body.classList.remove('overflow-hidden'); + root?.classList.remove('openedMenu'); }; }, [open]); diff --git a/src/styles/global-styles.ts b/src/styles/global-styles.ts index d4969d942..84000004b 100644 --- a/src/styles/global-styles.ts +++ b/src/styles/global-styles.ts @@ -26,6 +26,11 @@ export const GlobalStyle = createGlobalStyle` #root { min-height: 100vh; overflow: auto; + &.openedMenu { + overflow: hidden; + height: 0; + min-height: 0; + } } p, @@ -138,10 +143,10 @@ input[type=number] { .opaque { opacity: 0.2 } - + .mw-tooltip { max-width: 250px; ${media.lg`max-width: 600px;`} } - + `; From 2ee796093add0b54115ad5b5a77c4cdb22c241dd Mon Sep 17 00:00:00 2001 From: soulBit Date: Fri, 12 Feb 2021 07:51:03 +0000 Subject: [PATCH 7/9] Update rpcNode urls (and removed duplicate node defs) (#368) --- .../EngageWalletDialog/component/screen2/index.tsx | 6 +++--- .../EngageWalletDialog/component/screen4/index.tsx | 6 +++--- src/utils/classifiers.ts | 9 ++------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/app/containers/EngageWalletDialog/component/screen2/index.tsx b/src/app/containers/EngageWalletDialog/component/screen2/index.tsx index e7b1ec2b2..c610e601b 100644 --- a/src/app/containers/EngageWalletDialog/component/screen2/index.tsx +++ b/src/app/containers/EngageWalletDialog/component/screen2/index.tsx @@ -19,7 +19,7 @@ import { blockExplorers, currentChainId, networkNames, - rpcWalletURLs, + rpcNodes, } from '../../../../../utils/classifiers'; interface Props { @@ -115,9 +115,9 @@ export function Screen2(props: Props) { {t(translations.rskConnectTutorial.input_settings.new_RPC)}
- + - {rpcWalletURLs[currentChainId]} + {rpcNodes[currentChainId]}
diff --git a/src/app/containers/EngageWalletDialog/component/screen4/index.tsx b/src/app/containers/EngageWalletDialog/component/screen4/index.tsx index 6ef321950..85210abbf 100644 --- a/src/app/containers/EngageWalletDialog/component/screen4/index.tsx +++ b/src/app/containers/EngageWalletDialog/component/screen4/index.tsx @@ -19,7 +19,7 @@ import { blockExplorers, currentChainId, networkNames, - rpcWalletURLs, + rpcNodes, } from '../../../../../utils/classifiers'; export function Screen4(props) { @@ -83,11 +83,11 @@ export function Screen4(props) {
alert('Copied!')} > - {rpcWalletURLs[currentChainId]} + {rpcNodes[currentChainId]}
diff --git a/src/utils/classifiers.ts b/src/utils/classifiers.ts index 0a92e4923..316f5b07e 100644 --- a/src/utils/classifiers.ts +++ b/src/utils/classifiers.ts @@ -32,13 +32,8 @@ export const networkNames = { }; export const rpcNodes = { - 30: 'https://mainnet2.sovryn.app/rpc', - 31: 'https://testnet2.sovryn.app/rpc', -}; - -export const rpcWalletURLs = { - 30: 'https://public-node.rsk.co', - 31: 'https://public-node.testnet.rsk.co', + 30: 'https://mainnet.sovryn.app/rpc', + 31: 'https://testnet.sovryn.app/rpc', }; export const readNodes = { From 9102ff923e42326f3ce3a8af7a294d3b6d5b968e Mon Sep 17 00:00:00 2001 From: soulBit Date: Wed, 17 Feb 2021 08:35:17 +0000 Subject: [PATCH 8/9] Add git commit id to app for #362 (#380) * Add git commit id to app for #362 * Shorten visible commit id, add prefix, add condition to hide nodes when not present for #362 * Update styling and text for #362 * Fix broken classes --- config/webpack.config.js | 8 ++++++++ package.json | 1 + public/index.html | 4 ++++ src/app/components/Footer/index.tsx | 16 ++++++++++++++++ src/locales/en/translation.json | 3 ++- src/locales/es/translation.json | 7 ++++++- src/locales/pt_br/translation.json | 3 ++- yarn.lock | 5 +++++ 8 files changed, 44 insertions(+), 3 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index 43f62d8cc..538576f7e 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -24,6 +24,7 @@ const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpack const typescriptFormatter = require('react-dev-utils/typescriptFormatter'); const SentryWebpackPlugin = require('@sentry/webpack-plugin'); const SriPlugin = require('webpack-subresource-integrity'); +const GitRevisionPlugin = require('git-revision-webpack-plugin'); const postcssNormalize = require('postcss-normalize'); @@ -54,6 +55,8 @@ const cssModuleRegex = /\.module\.css$/; const sassRegex = /\.(scss|sass)$/; const sassModuleRegex = /\.module\.(scss|sass)$/; +const gitRevisionPlugin = new GitRevisionPlugin(); + // This is the production and development configuration. // It is focused on developer experience, fast rebuilds, and a minimal bundle. module.exports = function (webpackEnv) { @@ -674,6 +677,11 @@ module.exports = function (webpackEnv) { new SriPlugin({ hashFuncNames: ['sha256', 'sha384'], }), + new webpack.DefinePlugin({ + 'process.env.REACT_APP_GIT_COMMIT_ID': JSON.stringify( + gitRevisionPlugin.commithash(), + ), + }), ].filter(Boolean), // Some libraries import Node modules but don't use them in the browser. // Tell webpack to provide empty mocks for them so importing them works. diff --git a/package.json b/package.json index eecb122e2..8b6c49de6 100644 --- a/package.json +++ b/package.json @@ -270,6 +270,7 @@ "@sentry/webpack-plugin": "1.13.0", "@types/mathjs": "6.0.5", "@types/socket.io-client": "1.4.34", + "git-revision-webpack-plugin": "3.0.6", "node-sass": "4.14.1", "webpack-subresource-integrity": "1.5.2" }, diff --git a/public/index.html b/public/index.html index 53414ab53..33a10779e 100644 --- a/public/index.html +++ b/public/index.html @@ -26,6 +26,10 @@ type="text/javascript" src="https://s3.tradingview.com/tv.js" > + Sovryn diff --git a/src/app/components/Footer/index.tsx b/src/app/components/Footer/index.tsx index d7a25c845..bc20e7d35 100644 --- a/src/app/components/Footer/index.tsx +++ b/src/app/components/Footer/index.tsx @@ -6,9 +6,12 @@ import React, { useEffect, useState } from 'react'; import { Trans } from 'react-i18next'; import { translations } from 'locales/i18n'; +import { useTranslation } from 'react-i18next'; export function Footer() { + const { t } = useTranslation(); const [hasMatomo, setHasMatomo] = useState(false); + const commitHash = process.env.REACT_APP_GIT_COMMIT_ID || ''; useEffect(() => { setHasMatomo(window.hasOwnProperty('Matomo')); @@ -63,6 +66,19 @@ export function Footer() {

+ {commitHash && ( +
+ {t(translations.footer.buildID)}:{' '} + + {commitHash.substr(0, 7)} + +
+ )} {hasMatomo && (