From be8307f34d8d3e314c53ac0b577451ddc87c4e51 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 2 Nov 2020 19:18:21 +0100 Subject: [PATCH] User pool transactions on asset details (#193) * refactored pool transactions component, output pool transactions on asset details * styling * remove sticky around asset actions * hasAddedLiquidity simplification * owner from useMetadata * refactor, styling, number formatting * refactor * toggle pattern --- src/components/atoms/SuccessConfetti.tsx | 8 +- src/components/atoms/Table.module.css | 2 + src/components/atoms/Table.tsx | 6 +- src/components/atoms/Time.tsx | 5 +- .../molecules/PoolTransactions.module.css | 3 + src/components/molecules/PoolTransactions.tsx | 127 ++++++++++++++++++ .../AssetActions/Pool/Actions.module.css | 2 +- .../organisms/AssetActions/Pool/Actions.tsx | 1 + .../AssetActions/Pool/TokenList.module.css | 4 +- .../AssetActions/Pool/Transactions.module.css | 45 +++++++ .../AssetActions/Pool/Transactions.tsx | 37 +++++ .../AssetActions/Pool/index.module.css | 19 ++- .../organisms/AssetActions/Pool/index.tsx | 20 ++- .../organisms/AssetContent/index.module.css | 4 +- .../organisms/AssetContent/index.tsx | 6 +- .../pages/History/PoolTransactions.tsx | 81 ----------- src/components/pages/History/index.tsx | 2 +- 17 files changed, 257 insertions(+), 115 deletions(-) create mode 100644 src/components/molecules/PoolTransactions.module.css create mode 100644 src/components/molecules/PoolTransactions.tsx create mode 100644 src/components/organisms/AssetActions/Pool/Transactions.module.css create mode 100644 src/components/organisms/AssetActions/Pool/Transactions.tsx delete mode 100644 src/components/pages/History/PoolTransactions.tsx diff --git a/src/components/atoms/SuccessConfetti.tsx b/src/components/atoms/SuccessConfetti.tsx index 4bd47c285..329080741 100644 --- a/src/components/atoms/SuccessConfetti.tsx +++ b/src/components/atoms/SuccessConfetti.tsx @@ -25,10 +25,12 @@ const confettiConfig = { export default function SuccessConfetti({ success, - action + action, + className }: { success: string action?: ReactNode + className?: string }): ReactElement { // Have some confetti upon success useEffect(() => { @@ -41,11 +43,11 @@ export default function SuccessConfetti({ }, [success]) return ( - <> +
{action} - +
) } diff --git a/src/components/atoms/Table.module.css b/src/components/atoms/Table.module.css index e67114932..30804dd25 100644 --- a/src/components/atoms/Table.module.css +++ b/src/components/atoms/Table.module.css @@ -6,6 +6,7 @@ .table [role='row'] { color: var(--font-color-text); font-size: var(--font-size-small); + min-width: 0; } .table [class~='rdt_TableCol'] { @@ -26,6 +27,7 @@ font-size: var(--font-size-small); color: var(--color-secondary); background: none; + min-height: 0; } .table + div [class*='rdt_Pagination'] svg { diff --git a/src/components/atoms/Table.tsx b/src/components/atoms/Table.tsx index 09570b710..9fd807aea 100644 --- a/src/components/atoms/Table.tsx +++ b/src/components/atoms/Table.tsx @@ -17,6 +17,8 @@ export default function Table({ columns, isLoading, emptyMessage, + pagination, + paginationPerPage, ...props }: TableProps): ReactElement { return ( @@ -25,8 +27,8 @@ export default function Table({ data={data} className={styles.table} noHeader - pagination={data?.length >= 9} - paginationPerPage={10} + pagination={pagination || data?.length >= 9} + paginationPerPage={paginationPerPage || 10} paginationComponentOptions={{ noRowsPerPage: true }} noDataComponent={} progressPending={isLoading} diff --git a/src/components/atoms/Time.tsx b/src/components/atoms/Time.tsx index 8d18e5608..f6f54354d 100644 --- a/src/components/atoms/Time.tsx +++ b/src/components/atoms/Time.tsx @@ -4,11 +4,13 @@ import { format, formatDistance } from 'date-fns' export default function Time({ date, relative, - isUnix + isUnix, + className }: { date: string relative?: boolean isUnix?: boolean + className?: string }): ReactElement { const dateNew = isUnix ? new Date(Number(date) * 1000) : new Date(date) const dateIso = dateNew.toISOString() @@ -19,6 +21,7 @@ export default function Time({