From db63715b071ac8595f1bab11ac37108b57090b37 Mon Sep 17 00:00:00 2001 From: yashablack Date: Thu, 28 Sep 2023 17:26:53 +0300 Subject: [PATCH] fix: add copy button --- src/pages/Rewards/Rewards.tsx | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/pages/Rewards/Rewards.tsx b/src/pages/Rewards/Rewards.tsx index 756a4dad8..2506f763a 100644 --- a/src/pages/Rewards/Rewards.tsx +++ b/src/pages/Rewards/Rewards.tsx @@ -9,12 +9,15 @@ import { import { Trans } from '@lingui/macro'; import { ElementLocation, ElementName } from '@spectrumlabs/analytics'; import { FC } from 'react'; +import { filter } from 'rxjs'; import { applicationConfig } from '../../applicationConfig'; import { SPECTRUM_DISCORD_LINK } from '../../common/constants/url.ts'; import { useObservable } from '../../common/hooks/useObservable.ts'; import { ConnectWalletButton } from '../../components/common/ConnectWalletButton/ConnectWalletButton.tsx'; +import { CopyButton } from '../../components/common/CopyButton/CopyButton.tsx'; import { Page } from '../../components/Page/Page.tsx'; +import { getAddresses } from '../../gateway/api/addresses.ts'; import { rewards$ } from '../../network/cardano/api/rewards/rewards'; import { Eternl } from '../../network/cardano/api/wallet/eternl/eternl'; import { RewardsBugFixing } from './RewardsBugFixing/RewardsBugFixing'; @@ -22,6 +25,9 @@ import { RewardsDashboard } from './RewardsDashboard/RewardsDashboard.tsx'; export const Rewards: FC = () => { const [rewardsData, loading] = useObservable(rewards$); + const [addresses] = useObservable( + getAddresses().pipe(filter((addresses) => !!addresses?.length)), + ); return ( @@ -82,9 +88,28 @@ export const Rewards: FC = () => { Rewards {applicationConfig.isRewardsAvailable && ( - + + {addresses && ( + + { + return `${acc}\n${addr},`; + }, '')} + > + Copy + + + )} + + + + )} {applicationConfig.isRewardsAvailable ? (