diff --git a/src/components/organisms/AssetActions/Pool/Add.module.css b/src/components/organisms/AssetActions/Pool/Add.module.css new file mode 100644 index 000000000..5534ff930 --- /dev/null +++ b/src/components/organisms/AssetActions/Pool/Add.module.css @@ -0,0 +1,2 @@ +.add { +} diff --git a/src/components/organisms/AssetActions/Pool/Add.tsx b/src/components/organisms/AssetActions/Pool/Add.tsx new file mode 100644 index 000000000..68c8f22ad --- /dev/null +++ b/src/components/organisms/AssetActions/Pool/Add.tsx @@ -0,0 +1,24 @@ +import React, { ReactElement } from 'react' +import styles from './Add.module.css' +import stylesIndex from './index.module.css' +import Button from '../../../atoms/Button' + +export default function Add({ + setShowAdd +}: { + setShowAdd: (show: boolean) => void +}): ReactElement { + return ( +
+ +

Add Liquidity

+
+ ) +} diff --git a/src/components/organisms/AssetActions/Pool/Remove.module.css b/src/components/organisms/AssetActions/Pool/Remove.module.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/components/organisms/AssetActions/Pool/Remove.tsx b/src/components/organisms/AssetActions/Pool/Remove.tsx new file mode 100644 index 000000000..154585bc3 --- /dev/null +++ b/src/components/organisms/AssetActions/Pool/Remove.tsx @@ -0,0 +1,24 @@ +import React, { ReactElement } from 'react' +import styles from './Remove.module.css' +import stylesIndex from './index.module.css' +import Button from '../../../atoms/Button' + +export default function Remove({ + setShowRemove +}: { + setShowRemove: (show: boolean) => void +}): ReactElement { + return ( +
+ +

Remove Liquidity

+
+ ) +} diff --git a/src/components/organisms/AssetActions/Pool/Token.module.css b/src/components/organisms/AssetActions/Pool/Token.module.css index ab5a2da2a..3ecdbf523 100644 --- a/src/components/organisms/AssetActions/Pool/Token.module.css +++ b/src/components/organisms/AssetActions/Pool/Token.module.css @@ -1,6 +1,7 @@ .token { font-weight: var(--font-weight-bold); margin-bottom: calc(var(--spacer) / 4); + white-space: nowrap; } .symbol { diff --git a/src/components/organisms/AssetActions/Pool/index.module.css b/src/components/organisms/AssetActions/Pool/index.module.css index 6ab0d5a4c..322756b86 100644 --- a/src/components/organisms/AssetActions/Pool/index.module.css +++ b/src/components/organisms/AssetActions/Pool/index.module.css @@ -23,3 +23,23 @@ .tokens { } + +.actions { + margin-left: -2rem; + margin-right: -2rem; + padding-left: var(--spacer); + padding-right: var(--spacer); + margin-top: calc(var(--spacer) / 2); + padding-top: calc(var(--spacer) / 1.5); + border-top: 1px solid var(--brand-grey-lighter); + text-align: center; +} + +.actions button { + margin-left: calc(var(--spacer) / 4); + margin-right: calc(var(--spacer) / 4); +} + +.back { + margin-bottom: var(--spacer); +} diff --git a/src/components/organisms/AssetActions/Pool/index.tsx b/src/components/organisms/AssetActions/Pool/index.tsx index 62b7c457f..167ed1f49 100644 --- a/src/components/organisms/AssetActions/Pool/index.tsx +++ b/src/components/organisms/AssetActions/Pool/index.tsx @@ -5,6 +5,9 @@ import styles from './index.module.css' import Token from './Token' import PriceUnit from '../../../atoms/Price/PriceUnit' import Loader from '../../../atoms/Loader' +import Button from '../../../atoms/Button' +import Add from './Add' +import Remove from './Remove' interface Balance { ocean: string @@ -18,8 +21,12 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { const [dtPrice, setDtPrice] = useState() const [dtSymbol, setDtSymbol] = useState() const [userBalance, setUserBalance] = useState() + const [showAdd, setShowAdd] = useState() + const [showRemove, setShowRemove] = useState() const isLoading = !ocean || !totalBalance || !userBalance || !dtPrice + const hasAddedLiquidity = + userBalance && (Number(userBalance.ocean) > 0 || Number(userBalance.dt) > 0) useEffect(() => { async function init() { @@ -67,6 +74,10 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { <> {isLoading ? ( + ) : showAdd ? ( + + ) : showRemove ? ( + ) : ( <>
@@ -87,6 +98,22 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
+ +
+ + + {hasAddedLiquidity && ( + + )} +
)} diff --git a/src/components/organisms/AssetContent/index.module.css b/src/components/organisms/AssetContent/index.module.css index 53dc15e45..aed5069f6 100644 --- a/src/components/organisms/AssetContent/index.module.css +++ b/src/components/organisms/AssetContent/index.module.css @@ -1,6 +1,6 @@ .grid { display: grid; - gap: calc(var(--spacer) * 2); + gap: calc(var(--spacer) * 1.5); position: relative; margin-top: -1.5rem; } diff --git a/src/components/templates/AssetDetails.tsx b/src/components/templates/AssetDetails.tsx index 4a4f03b37..4eed08f0a 100644 --- a/src/components/templates/AssetDetails.tsx +++ b/src/components/templates/AssetDetails.tsx @@ -26,7 +26,6 @@ export default function PageTemplateAssetDetails({ try { const metadataStore = new MetadataStore(config.metadataStoreUri, Logger) const ddo = await metadataStore.retrieveDDO(did) - setDdo(ddo) if (!ddo) { setTitle('Could not retrieve asset') @@ -34,6 +33,8 @@ export default function PageTemplateAssetDetails({ return } + setDdo(ddo) + const { attributes }: ServiceMetadataMarket = ddo.findServiceByType( 'metadata' )