From 39cbca23b3d8fe97b34dba53ae7acea40d30ccfb Mon Sep 17 00:00:00 2001 From: J M Rossy Date: Sat, 2 Mar 2024 17:52:27 -0500 Subject: [PATCH] Add options dropdown to DelegationsTable --- src/features/delegation/DelegationsTable.tsx | 47 +++++++++++++++++++- src/features/staking/ActiveStakesTable.tsx | 4 +- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/features/delegation/DelegationsTable.tsx b/src/features/delegation/DelegationsTable.tsx index 02ac23b..4aa357c 100644 --- a/src/features/delegation/DelegationsTable.tsx +++ b/src/features/delegation/DelegationsTable.tsx @@ -1,14 +1,17 @@ +import Image from 'next/image'; import { useMemo } from 'react'; import { FullWidthSpinner } from 'src/components/animation/Spinner'; import { SolidButton } from 'src/components/buttons/SolidButton'; import { PLACEHOLDER_BAR_CHART_ITEM, StackedBarChart } from 'src/components/charts/StackedBarChart'; import { sortAndCombineChartData } from 'src/components/charts/chartData'; import { HeaderAndSubheader } from 'src/components/layout/HeaderAndSubheader'; +import { DropdownMenu } from 'src/components/menus/Dropdown'; import { formatNumberString } from 'src/components/numbers/Amount'; -import { Delegatee, DelegationAmount } from 'src/features/delegation/types'; +import { DelegateActionType, Delegatee, DelegationAmount } from 'src/features/delegation/types'; import { TransactionFlowType } from 'src/features/transactions/TransactionFlowType'; import { useTransactionModal } from 'src/features/transactions/TransactionModal'; import { ValidatorGroupLogoAndName } from 'src/features/validators/ValidatorGroupLogo'; +import Ellipsis from 'src/images/icons/ellipsis.svg'; import { tableClasses } from 'src/styles/common'; import { fromWei } from 'src/utils/amount'; import { objKeys, objLength } from 'src/utils/objects'; @@ -71,6 +74,7 @@ export function DelegationsTable({ Name Amount % + @@ -81,6 +85,9 @@ export function DelegationsTable({ {formatNumberString(amount, 2) + ' CELO'} {percentage + '%'} + + + ))} @@ -88,3 +95,41 @@ export function DelegationsTable({ ); } + +function OptionsDropdown({ delegatee }: { delegatee: Address }) { + const showTxModal = useTransactionModal(); + const onClickItem = (action: DelegateActionType) => { + showTxModal(TransactionFlowType.Delegate, { delegatee, action }); + }; + + return ( + } + menuClasses="flex flex-col items-start space-y-3 p-3 right-0" + menuItems={[ + , + , + , + ]} + /> + ); +} diff --git a/src/features/staking/ActiveStakesTable.tsx b/src/features/staking/ActiveStakesTable.tsx index 22f8033..0b9c9f0 100644 --- a/src/features/staking/ActiveStakesTable.tsx +++ b/src/features/staking/ActiveStakesTable.tsx @@ -107,7 +107,7 @@ export function ActiveStakesTable({ {formatNumberString(stake, 2) + ' CELO'} {percentage + '%'} -