diff --git a/app/components/LiquidityPoolTable.module.css b/app/components/LiquidityPoolTable.module.css new file mode 100644 index 000000000..d8406eb25 --- /dev/null +++ b/app/components/LiquidityPoolTable.module.css @@ -0,0 +1,30 @@ +.asset-image { + width: 20px; + height: 20px; + margin-right: 5px; +} + +.asset-code { + display: inline-block; + width: 150px; +} + +.asset-url { + font-size: 12px; +} + +.amount { + display: inline-block; + width: 80px; + text-align: right; +} + +.shares { + width: 50px; + text-align: center; +} + +.trustlines { + width: 50px; + text-align: center; +} diff --git a/app/components/LiquidityPoolTable.tsx b/app/components/LiquidityPoolTable.tsx new file mode 100644 index 000000000..baa525034 --- /dev/null +++ b/app/components/LiquidityPoolTable.tsx @@ -0,0 +1,125 @@ +import Table from 'react-bootstrap/Table' +import { FormattedMessage } from 'react-intl' +import type { Horizon } from 'stellar-sdk' + +import { type LiquidityPoolProps } from './operations/LiquidityPool' +import { liquidityPoolAsset } from '~/data/liquidity_pool_asset' +import { formatAmountToHumanReadable, getAssetCode } from '~/lib/utilities' + +import styles from './LiquidityPoolTable.module.css' + +interface ParentProps { + compact: boolean + // horizonURL: string +} + +interface LiquidityPoolRowProps extends LiquidityPoolProps, ParentProps {} + +interface LiquidityPoolTableProps { + compact: boolean + records: ReadonlyArray + // horizonURL?: string +} + +const fallBackAssetIcon = 'img/circle.svg' + +const PoolAsset = ({ + reserves, +}: { + reserves: Horizon.Reserve[] +}): React.JSX.Element => { + return ( +
+ + {reserves.map(({ asset, amount }, index) => { + const assetCode = getAssetCode(asset) + + const icon = liquidityPoolAsset[assetCode]?.icon || fallBackAssetIcon + const url = liquidityPoolAsset[assetCode]?.url + + return ( +
+ {assetCode} + + {assetCode} {url} + + + {formatAmountToHumanReadable(amount)} + +
+ ) + })} +
+
+ ) +} + +const LiquidityPoolRow = ({ + // compact, + id, + totalTrustlines, + totalShares, + reserves, +}: LiquidityPoolRowProps): React.JSX.Element => ( + + + + + + {formatAmountToHumanReadable(totalShares)} + + {totalTrustlines} + +) + +export default function LiquidityPoolTable({ + compact, + records, // horizonURL, +}: LiquidityPoolTableProps) { + return ( +
+ + + + + {/* commented out as it's not certain how to display the values. */} + {/* we also might need to reconsider what to be displayed. */} + {/* + + + */} + + + + + + {records.map((pool) => ( + + ))} + +
+ + + + + + + + + + + + + + +
+
+ ) +} diff --git a/app/components/layout/Header.tsx b/app/components/layout/Header.tsx index 8d7043b2a..ccba2acd4 100644 --- a/app/components/layout/Header.tsx +++ b/app/components/layout/Header.tsx @@ -81,6 +81,11 @@ export default function Header({ + + + + +