1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 09:44:53 +01:00
This commit is contained in:
Matthias Kretschmann 2020-10-12 12:28:07 +02:00
parent 80901b5bb4
commit 51ab425c35
Signed by: m
GPG Key ID: 606EEEF3C479A91F
5 changed files with 79 additions and 61 deletions

View File

@ -3,6 +3,7 @@ import { Balance } from '.'
import styles from './PoolStatistics.module.css' import styles from './PoolStatistics.module.css'
import Token from './Token' import Token from './Token'
import Conversion from '../../../atoms/Price/Conversion' import Conversion from '../../../atoms/Price/Conversion'
import TokenList from './TokenList'
export default function PoolStatistics({ export default function PoolStatistics({
price, price,
@ -21,24 +22,20 @@ export default function PoolStatistics({
totalBalance.ocean + totalBalance.datatoken * Number(price) totalBalance.ocean + totalBalance.datatoken * Number(price)
return ( return (
<div className={styles.tokeninfo}> <TokenList title="Pool Statistics">
<h3 className={styles.title}>Pool Statistics</h3> <div>
<Token symbol="OCEAN" balance={`${totalBalance.ocean}`} />
<div className={styles.tokens}> <Token symbol={dtSymbol} balance={`${totalBalance.datatoken}`} />
<div>
<Token symbol="OCEAN" balance={`${totalBalance.ocean}`} />
<Token symbol={dtSymbol} balance={`${totalBalance.datatoken}`} />
</div>
<div>
<Token symbol="pool shares" balance={totalPoolTokens} noIcon />
<Token symbol="% swap fee" balance={swapFee} noIcon />
</div>
<Conversion
price={`${totalLiquidityInOcean}`}
className={styles.totalLiquidity}
/>
</div> </div>
</div> <div>
<Token symbol="pool shares" balance={totalPoolTokens} noIcon />
<Token symbol="% swap fee" balance={swapFee} noIcon />
</div>
<Conversion
price={`${totalLiquidityInOcean}`}
className={styles.totalLiquidity}
/>
</TokenList>
) )
} }

View File

@ -0,0 +1,23 @@
.tokeninfo {
padding-top: calc(var(--spacer) / 1.5);
}
.tokens {
display: grid;
grid-template-columns: 1fr 1fr;
grid-auto-flow: row;
}
.title {
font-size: var(--font-size-base);
margin-bottom: calc(var(--spacer) / 3);
}
.highlight {
background: var(--brand-grey-dimmed);
padding: calc(var(--spacer) / 1.5) var(--spacer) calc(var(--spacer) / 2)
var(--spacer);
border-bottom: 1px solid var(--brand-grey-lighter);
margin-left: -2rem;
margin-right: -2rem;
}

View File

@ -0,0 +1,19 @@
import React, { ReactElement, ReactNode } from 'react'
import styles from './TokenList.module.css'
export default function TokenList({
title,
children,
highlight
}: {
title: string | ReactNode
children: ReactNode
highlight?: boolean
}): ReactElement {
return (
<div className={`${styles.tokeninfo} ${highlight ? styles.highlight : ''}`}>
<h3 className={styles.title}>{title}</h3>
<div className={styles.tokens}>{children}</div>
</div>
)
}

View File

@ -21,26 +21,6 @@
margin-right: calc(var(--spacer) / 3); margin-right: calc(var(--spacer) / 3);
} }
.tokeninfo {
background: var(--brand-grey-dimmed);
padding: calc(var(--spacer) / 1.5) var(--spacer) calc(var(--spacer) / 2)
var(--spacer);
border-bottom: 1px solid var(--brand-grey-lighter);
margin-left: -2rem;
margin-right: -2rem;
}
.tokens {
display: grid;
grid-template-columns: 1fr 1fr;
grid-auto-flow: row;
}
.title {
font-size: var(--font-size-base);
margin-bottom: calc(var(--spacer) / 3);
}
.totalLiquidity { .totalLiquidity {
composes: token from './Token.module.css'; composes: token from './Token.module.css';
margin-bottom: 0; margin-bottom: 0;

View File

@ -13,6 +13,7 @@ import Conversion from '../../../atoms/Price/Conversion'
import EtherscanLink from '../../../atoms/EtherscanLink' import EtherscanLink from '../../../atoms/EtherscanLink'
import PoolStatistics from './PoolStatistics' import PoolStatistics from './PoolStatistics'
import Token from './Token' import Token from './Token'
import TokenList from './TokenList'
export interface Balance { export interface Balance {
ocean: number ocean: number
@ -145,30 +146,28 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
</div> </div>
</div> </div>
<div className={styles.tokeninfo}> <TokenList
<h3 className={styles.title}> title={
Your Liquidity <>
<Tooltip content="Explain what this represents, advantage of providing liquidity..." /> Your Liquidity
</h3> <Tooltip content="Explain what this represents, advantage of providing liquidity..." />
</>
<div className={styles.tokens}> }
<div> highlight
<Token symbol="OCEAN" balance={`${userLiquidity.ocean}`} /> >
<Token <div>
symbol={dtSymbol} <Token symbol="OCEAN" balance={`${userLiquidity.ocean}`} />
balance={`${userLiquidity.datatoken}`} <Token symbol={dtSymbol} balance={`${userLiquidity.datatoken}`} />
/>
</div>
<div>
<Token symbol="pool shares" balance={poolTokens} noIcon />
<Token symbol="% of pool" balance={poolShare} noIcon />
</div>
<Conversion
price={`${totalUserLiquidityInOcean}`}
className={styles.totalLiquidity}
/>
</div> </div>
</div> <div>
<Token symbol="pool shares" balance={poolTokens} noIcon />
<Token symbol="% of pool" balance={poolShare} noIcon />
</div>
<Conversion
price={`${totalUserLiquidityInOcean}`}
className={styles.totalLiquidity}
/>
</TokenList>
<PoolStatistics <PoolStatistics
price={`${price.value}`} price={`${price.value}`}