Skip to content

Commit

Permalink
Merge branch 'james/acx-1624-update-rewards-page' into james/acx-1625…
Browse files Browse the repository at this point in the history
…-update-referrals-page
  • Loading branch information
james-a-morris committed Nov 20, 2023
2 parents 27a4efc + 0deddd3 commit 9bb9963
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/views/Bridge/components/BridgeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const BridgeForm = ({
</RowWrapper>
</CardWrapper>
<CardWrapper>
{isConnected && <ReferralCTA />}
<ReferralCTA />
<EstimatedTable
fromChainId={selectedRoute.fromChain}
toChainId={selectedRoute.toChain}
Expand Down
14 changes: 10 additions & 4 deletions src/views/Bridge/components/ReferralCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ import { PrimaryButton, Text } from "components";
import copy from "copy-to-clipboard";
import { useReferralLink } from "hooks/useReferralLink";
import { useCallback } from "react";
import { useConnection } from "hooks";

const ReferralCTA = () => {
const { referralLinkWithProtocol } = useReferralLink();
const { isConnected, connect } = useConnection();
const handleCopy = useCallback(() => {
if (referralLinkWithProtocol) {
if (!isConnected) {
connect({
trackSection: "bridgeForm",
});
} else if (referralLinkWithProtocol) {
copy(referralLinkWithProtocol);
}
}, [referralLinkWithProtocol]);
}, [connect, isConnected, referralLinkWithProtocol]);
return (
<Wrapper>
<LogoContainer>
Expand All @@ -35,10 +41,10 @@ const ReferralCTA = () => {
backgroundColor="black-700"
textColor="aqua"
>
Copy link
{isConnected ? "Copy link" : "Connect"}
</StyledCopyButton>
<TextButton size="md" weight={500} onClick={handleCopy}>
Copy
{isConnected ? "copy" : "Connect"}
</TextButton>
</Wrapper>
);
Expand Down

0 comments on commit 9bb9963

Please sign in to comment.