1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-14 09:14:52 +01:00

more feedback fixes

This commit is contained in:
Matthias Kretschmann 2020-08-11 09:41:23 +02:00
parent 1c38f30f8a
commit e3892143c5
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 9 additions and 9 deletions

View File

@ -12,9 +12,9 @@ export declare type Web3Error = {
} }
export default function Web3Feedback({ export default function Web3Feedback({
isBalanceInsufficient isBalanceSufficient
}: { }: {
isBalanceInsufficient?: boolean isBalanceSufficient?: boolean
}): ReactElement { }): ReactElement {
const { appConfig } = useSiteMetadata() const { appConfig } = useSiteMetadata()
const { account, status, chainId } = useOcean() const { account, status, chainId } = useOcean()
@ -24,7 +24,7 @@ export default function Web3Feedback({
!account || !account ||
isOceanConnectionError || isOceanConnectionError ||
!correctNetwork || !correctNetwork ||
isBalanceInsufficient === true isBalanceSufficient === false
const desiredNetworkName = appConfig.network.replace(/^\w/, (c: string) => const desiredNetworkName = appConfig.network.replace(/^\w/, (c: string) =>
c.toUpperCase() c.toUpperCase()
@ -34,7 +34,7 @@ export default function Web3Feedback({
? 'error' ? 'error'
: !correctNetwork : !correctNetwork
? 'warning' ? 'warning'
: account && !isBalanceInsufficient : account && isBalanceSufficient
? 'success' ? 'success'
: 'warning' : 'warning'
@ -45,7 +45,7 @@ export default function Web3Feedback({
: !correctNetwork : !correctNetwork
? 'Wrong Network' ? 'Wrong Network'
: account : account
? isBalanceInsufficient === true ? isBalanceSufficient === false
? 'Insufficient balance' ? 'Insufficient balance'
: 'Connected to Ocean' : 'Connected to Ocean'
: 'Something went wrong' : 'Something went wrong'
@ -56,7 +56,7 @@ export default function Web3Feedback({
? 'Please try again.' ? 'Please try again.'
: !correctNetwork : !correctNetwork
? `Please connect to ${desiredNetworkName}.` ? `Please connect to ${desiredNetworkName}.`
: isBalanceInsufficient === true : isBalanceSufficient === false
? 'You do not have enough OCEAN in your wallet to purchase this asset.' ? 'You do not have enough OCEAN in your wallet to purchase this asset.'
: 'Something went wrong.' : 'Something went wrong.'

View File

@ -129,7 +129,7 @@ export default function Compute({
state="success" state="success"
/> />
)} )}
<Web3Feedback isBalanceInsufficient={!isBalanceSufficient} /> <Web3Feedback isBalanceSufficient={isBalanceSufficient} />
</footer> </footer>
</div> </div>
</div> </div>

View File

@ -55,7 +55,7 @@ export default function Consume({
</div> </div>
<footer className={styles.feedback}> <footer className={styles.feedback}>
<Web3Feedback isBalanceInsufficient /> <Web3Feedback isBalanceSufficient={isBalanceSufficient} />
</footer> </footer>
</aside> </aside>
) )

View File

@ -17,7 +17,7 @@ export default function AssetActions({
}): ReactElement { }): ReactElement {
const { balance } = useOcean() const { balance } = useOcean()
const [price, setPrice] = useState<string>() const [price, setPrice] = useState<string>()
const [isBalanceSufficient, setIsBalanceSufficient] = useState(false) const [isBalanceSufficient, setIsBalanceSufficient] = useState<boolean>()
const isCompute = Boolean(ddo.findServiceByType('compute')) const isCompute = Boolean(ddo.findServiceByType('compute'))