diff --git a/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintEditor.tsx b/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintEditor.tsx index b1d46d509f..179193d7b5 100644 --- a/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintEditor.tsx +++ b/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintEditor.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ import styled from 'styled-components'; import { Input } from 'components/Guilds/common/Form/Input'; import Avatar from 'components/Guilds/Avatar'; @@ -16,6 +15,7 @@ import { useState } from 'react'; import { useERC20Info } from 'hooks/Guilds/ether-swr/erc20/useERC20Info'; import { useGuildConfig } from 'hooks/Guilds/ether-swr/guild/useGuildConfig'; import { useParams } from 'react-router-dom'; +import NumericalInput from 'components/Guilds/common/Form/NumericalInput'; const Control = styled(Box)` display: flex; @@ -39,7 +39,7 @@ const ControlRow = styled(Box)` height: 100%; `; -const RepMintInput = styled(Input)` +const RepMintInput = styled(NumericalInput)` ${baseInputStyles} display: flex; align-items: center; @@ -57,8 +57,8 @@ interface REPMintState { const Mint: React.FC = ({ decodedCall, updateCall }) => { // parse transfer state from calls - const [repPercent, setRepPercent] = useState(null); - const [repAmount, setRepAmount] = useState(null); + const [repPercent, setRepPercent] = useState(0); + const [repAmount, setRepAmount] = useState(0); const { guild_id: guildId } = useParams<{ chain_name?: string; guild_id?: string }>(); const { data } = useGuildConfig(guildId); @@ -93,9 +93,9 @@ const Mint: React.FC = ({ decodedCall, updateCall }) => { } }, [repPercent, repAmount, totalSupply]); - const handleRepChange = (e: React.ChangeEvent) => { - if (e.target.value) { - setRepPercent(parseFloat(e.target.value)); + const handleRepChange = (e: number) => { + if (e) { + setRepPercent(e); } }; return ( @@ -125,7 +125,7 @@ const Mint: React.FC = ({ decodedCall, updateCall }) => { Reputation in % - + @@ -135,7 +135,11 @@ const Mint: React.FC = ({ decodedCall, updateCall }) => { Reputation Amount - + diff --git a/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintInfoLine.tsx b/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintInfoLine.tsx index 831dc515c6..1ead7cc7c3 100644 --- a/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintInfoLine.tsx +++ b/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintInfoLine.tsx @@ -41,7 +41,7 @@ const REPMintInfoLine: React.FC = ({ decodedCall }) => { }, [decodedCall]); const { ensName, imageUrl } = useENSAvatar(parsedData?.toAddress, MAINNET_ID); - const roundedRepAmount = useBigNumberToNumber(parsedData?.amount, 16); + const roundedRepAmount = useBigNumberToNumber(parsedData?.amount, 16, 3); const roundedRepPercent = roundedRepAmount / totalSupply; return ( diff --git a/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintSummary.tsx b/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintSummary.tsx index 9235bd1d38..4698c7cbd2 100644 --- a/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintSummary.tsx +++ b/src/components/Guilds/ActionsBuilder/SupportedActions/REPMint/REPMintSummary.tsx @@ -2,7 +2,10 @@ import Avatar from 'components/Guilds/Avatar'; import { BigNumber } from 'ethers'; import useBigNumberToNumber from 'hooks/Guilds/conversions/useBigNumberToNumber'; import useENSAvatar from 'hooks/Guilds/ether-swr/ens/useENSAvatar'; +import { useERC20Info } from 'hooks/Guilds/ether-swr/erc20/useERC20Info'; +import { useGuildConfig } from 'hooks/Guilds/ether-swr/guild/useGuildConfig'; import { useMemo } from 'react'; +import { useParams } from 'react-router-dom'; import { MAINNET_ID, shortenAddress } from 'utils'; import { ActionViewProps } from '..'; import { Segment } from '../common/infoLine'; @@ -14,6 +17,12 @@ interface REPMintState { } const REPMintSummary: React.FC = ({ decodedCall }) => { + const { guild_id: guildId } = + useParams<{ chain_name?: string; guild_id?: string }>(); + const { data } = useGuildConfig(guildId); + const { data: tokenData } = useERC20Info(data?.token); + console.log({ tokenData }); + console.log(tokenData.symbol); const parsedData = useMemo(() => { if (!decodedCall) return null; return { @@ -24,7 +33,7 @@ const REPMintSummary: React.FC = ({ decodedCall }) => { const { ensName, imageUrl } = useENSAvatar(parsedData?.toAddress, MAINNET_ID); - const roundedRepAmount = useBigNumberToNumber(parsedData?.amount, 18); + const roundedRepAmount = useBigNumberToNumber(parsedData?.amount, 18, 3); return ( <> @@ -44,7 +53,9 @@ const REPMintSummary: React.FC = ({ decodedCall }) => { {ensName || shortenAddress(parsedData?.toAddress)} - {roundedRepAmount} REP + + {roundedRepAmount} {tokenData?.name} + ); diff --git a/src/components/Guilds/ActionsModal/ContractsList.tsx b/src/components/Guilds/ActionsModal/ContractsList.tsx index 8c18661624..178cc052fd 100644 --- a/src/components/Guilds/ActionsModal/ContractsList.tsx +++ b/src/components/Guilds/ActionsModal/ContractsList.tsx @@ -16,6 +16,8 @@ import { SectionWrapper, Wrapper, } from './styles'; +import useGuildImplementationTypeConfig from 'hooks/Guilds/guild/useGuildImplementationType'; +import { useParams } from 'react-router-dom'; interface ContractsListProps { onSelect: (contract: RegistryContract) => void; @@ -28,7 +30,9 @@ const ContractsList: React.FC = ({ }) => { const { chainId } = useWeb3React(); const { contracts } = useContractRegistry(chainId); - + const { guild_id: guildAddress } = + useParams<{ chain_name?: string; guild_id?: string }>(); + const { isRepGuild } = useGuildImplementationTypeConfig(guildAddress); return ( @@ -43,14 +47,16 @@ const ContractsList: React.FC = ({ Transfer & Mint - onSupportedActionSelect(SupportedAction.REP_MINT)} - > - - - Mint REP - - + {isRepGuild ? ( + onSupportedActionSelect(SupportedAction.REP_MINT)} + > + + + Mint REP + + + ) : null} External Contracts