diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index 80cda23d..0cd1d7c9 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -70,7 +70,7 @@ export default function Layout(): JSX.Element | null { - +
diff --git a/src/components/Wallet/index.tsx b/src/components/Wallet/index.tsx index 699cfbdd..aa0180ee 100644 --- a/src/components/Wallet/index.tsx +++ b/src/components/Wallet/index.tsx @@ -12,8 +12,12 @@ import MetamaskWallet from './MetamaskWallet'; import NovaWallet from './NovaWallet'; import WalletConnect from './WalletConnect'; -const OpenWallet = ({ dAppName }: { dAppName: string }): JSX.Element => { - const { walletAccount, setWalletAccount, removeWalletAccount } = useGlobalState(); +interface Props { + isHeader?: boolean; +} + +const OpenWallet = (props: Props): JSX.Element => { + const { walletAccount, dAppName, setWalletAccount, removeWalletAccount } = useGlobalState(); const { wallet, address } = walletAccount || {}; const { query, balance } = useAccountBalance(); const { ss58Format, tokenSymbol } = useNodeInfoState().state; @@ -64,7 +68,12 @@ const OpenWallet = ({ dAppName }: { dAppName: string }): JSX.Element => { open={false} showAccountsList={true} triggerComponent={ - } diff --git a/src/components/nabla/Pools/Backstop/AddLiquidity/index.tsx b/src/components/nabla/Pools/Backstop/AddLiquidity/index.tsx index 6e8555fc..32ca47ec 100644 --- a/src/components/nabla/Pools/Backstop/AddLiquidity/index.tsx +++ b/src/components/nabla/Pools/Backstop/AddLiquidity/index.tsx @@ -14,6 +14,8 @@ import { FormProvider } from 'react-hook-form'; import { AmountSelector } from '../../../common/AmountSelector'; import { calcSharePercentage } from '../../../../../helpers/calc'; import { TokenBalance } from '../../../common/TokenBalance'; +import { useGlobalState } from '../../../../../GlobalStateProvider'; +import OpenWallet from '../../../../Wallet'; interface AddLiquidityProps { data: NablaInstanceBackstopPool; @@ -23,6 +25,8 @@ const AddLiquidity = ({ data }: AddLiquidityProps): JSX.Element | null => { const { toggle, onSubmit, mutation, depositQuery, balanceQuery, amountString, amountBigDecimal, form } = useAddLiquidity(data.id, data.token.id, data.token.decimals, data.lpTokenDecimals); + const { walletAccount } = useGlobalState(); + const { formState: { errors }, } = form; @@ -45,14 +49,16 @@ const AddLiquidity = ({ data }: AddLiquidityProps): JSX.Element | null => {
-
-

- Deposited: -

-

- Balance: -

-
+ {walletAccount && ( +
+

+ Deposited: +

+

+ Balance: +

+
+ )}
@@ -62,17 +68,19 @@ const AddLiquidity = ({ data }: AddLiquidityProps): JSX.Element | null => { {stringifyBigWithSignificantDecimals(totalSupplyOfLpTokens, 2)} {data.symbol}
-
-
Your pool Share
-
- {depositQuery.data === undefined ? ( - - ) : ( - calcSharePercentage(totalSupplyOfLpTokens, depositQuery.data.preciseBigDecimal) - )} - % + {walletAccount && ( +
+
Your pool Share
+
+ {depositQuery.data === undefined ? ( + + ) : ( + calcSharePercentage(totalSupplyOfLpTokens, depositQuery.data.preciseBigDecimal) + )} + % +
-
+ )}
{ decimalAmount={amountBigDecimal} enabled={submitEnabled} > - + {walletAccount ? ( + + ) : ( + + )}
-
-
Your backstop pool share
-
- {depositQuery.data === undefined ? ( - - ) : ( - calcSharePercentage(totalSupplyOfLpTokens, depositQuery.data.preciseBigDecimal) - )} - % + {walletAccount && ( +
+
Your backstop pool share
+
+ {depositQuery.data === undefined ? ( + + ) : ( + calcSharePercentage(totalSupplyOfLpTokens, depositQuery.data.preciseBigDecimal) + )} + % +
-
+ )}
- + {walletAccount ? ( + + ) : ( + + )} diff --git a/src/components/nabla/Pools/Backstop/index.tsx b/src/components/nabla/Pools/Backstop/index.tsx index e655875b..8a24342c 100644 --- a/src/components/nabla/Pools/Backstop/index.tsx +++ b/src/components/nabla/Pools/Backstop/index.tsx @@ -6,11 +6,14 @@ import { backstopPoolAbi } from '../../../../contracts/nabla/BackstopPool'; import { Erc20Balance } from '../../common/Erc20Balance'; import { BackstopPoolModals, LiquidityModalProps } from './BackstopPoolModals'; import { NablaFootnote } from '../../common/NablaFootnote'; +import { useGlobalState } from '../../../../GlobalStateProvider'; const BackstopPoolsBody = (): JSX.Element | null => { const toggle = useModalToggle(); const { nabla, isLoading } = useNablaInstance(); + const { walletAccount } = useGlobalState(); + if (isLoading) return ; const pool = nabla?.backstopPool; if (!pool) return

No backstop pools

; @@ -20,19 +23,21 @@ const BackstopPoolsBody = (): JSX.Element | null => {
-
-

My pool balance

-
- + {walletAccount && ( +
+

My pool balance

+
+ +
-
+ )}
-
-

- Deposited: -

-

- Balance: -

-
+ {walletAccount && ( +
+

+ Deposited: +

+

+ Balance: +

+
+ )}
@@ -62,17 +68,19 @@ const AddLiquidity = ({ data }: AddLiquidityProps): JSX.Element | null => { {stringifyBigWithSignificantDecimals(totalSupplyOfLpTokens, 2)} {data.symbol}
-
-
Your pool Share
-
- {depositQuery.data === undefined ? ( - - ) : ( - calcSharePercentage(totalSupplyOfLpTokens, depositQuery.data.preciseBigDecimal) - )} - % + {walletAccount && ( +
+
Your pool Share
+
+ {depositQuery.data === undefined ? ( + + ) : ( + calcSharePercentage(totalSupplyOfLpTokens, depositQuery.data.preciseBigDecimal) + )} + % +
-
+ )}
{ decimalAmount={amountBigDecimal} enabled={submitEnabled} > - + {walletAccount ? ( + + ) : ( + + )}
-
-

- Deposited: -

-

- Balance: -

-
+ {walletAccount && ( +
+

+ Deposited: +

+

+ Balance: +

+
+ )}
@@ -106,17 +112,19 @@ const Redeem = ({ data }: RedeemProps): JSX.Element | null => { {stringifyBigWithSignificantDecimals(totalSupplyOfLpTokens, 2)} {data.symbol}
-
-
Your swap pool share
-
- {depositQuery.data === undefined ? ( - - ) : ( - calcSharePercentage(totalSupplyOfLpTokens, depositQuery.data.preciseBigDecimal) - )} - % + {walletAccount && ( +
+
Your swap pool share
+
+ {depositQuery.data === undefined ? ( + + ) : ( + calcSharePercentage(totalSupplyOfLpTokens, depositQuery.data.preciseBigDecimal) + )} + % +
-
+ )}
@@ -133,14 +141,18 @@ const Redeem = ({ data }: RedeemProps): JSX.Element | null => { Withdraw from swap pool
- + {walletAccount ? ( + + ) : ( + + )}
-
-
Your pool share
-
- {depositQuery.data === undefined ? ( - - ) : ( - calcSharePercentage(totalSupplyOfLpTokens, depositQuery.data.preciseBigDecimal) - )} - % + {walletAccount && ( +
+
Your pool share
+
+ {depositQuery.data === undefined ? ( + + ) : ( + calcSharePercentage(totalSupplyOfLpTokens, depositQuery.data.preciseBigDecimal) + )} + % +
-
+ )}
{backstopBurnIsPossible && ( @@ -96,14 +104,18 @@ const WithdrawLiquidity = ({ data }: WithdrawLiquidityProps): JSX.Element | null
)} - + {walletAccount ? ( + + ) : ( + + )} ) : ( - + )} diff --git a/src/pages/bridge/Redeem/index.tsx b/src/pages/bridge/Redeem/index.tsx index 067479cb..b63c5a72 100644 --- a/src/pages/bridge/Redeem/index.tsx +++ b/src/pages/bridge/Redeem/index.tsx @@ -194,7 +194,7 @@ function Redeem(props: RedeemProps): JSX.Element { Bridge ) : ( - + )}
diff --git a/src/pages/gas/SubmitButton.tsx b/src/pages/gas/SubmitButton.tsx index 65971c6a..b99d5fe4 100644 --- a/src/pages/gas/SubmitButton.tsx +++ b/src/pages/gas/SubmitButton.tsx @@ -20,7 +20,7 @@ export const SubmitButton = ({ loading, disabled }: { loading?: boolean; disable {tokenSymbol && !loading ? `Get ${tokenSymbol}` : ''} ) : ( - + )} );