Skip to content

Commit

Permalink
fix: add copy button
Browse files Browse the repository at this point in the history
  • Loading branch information
yasha-black committed Sep 28, 2023
1 parent de0968c commit db63715
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions src/pages/Rewards/Rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ 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';
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 (
<Flex col align="center">
Expand Down Expand Up @@ -82,9 +88,28 @@ export const Rewards: FC = () => {
<Flex.Item marginBottom={4} display="flex" justify="space-between">
<Typography.Title level={4}>Rewards</Typography.Title>
{applicationConfig.isRewardsAvailable && (
<Button href={SPECTRUM_DISCORD_LINK} target="_blank">
Support
</Button>
<Flex>
{addresses && (
<Flex.Item marginRight={1}>
<CopyButton
text={addresses.reduce((acc, addr) => {
return `${acc}\n${addr},`;
}, '')}
>
<Trans>Copy</Trans>
</CopyButton>
</Flex.Item>
)}
<Flex.Item>
<Button
href={SPECTRUM_DISCORD_LINK}
size="small"
target="_blank"
>
<Trans>Support</Trans>
</Button>
</Flex.Item>
</Flex>
)}
</Flex.Item>
{applicationConfig.isRewardsAvailable ? (
Expand Down

0 comments on commit db63715

Please sign in to comment.