Skip to content

Commit

Permalink
feat(web): link-to-explorer-for-address-in-account-display
Browse files Browse the repository at this point in the history
  • Loading branch information
Harman-singh-waraich committed Sep 13, 2024
1 parent 94a4e79 commit 1d71c4b
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions web/src/layout/Header/navbar/Menu/Settings/General.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useMemo } from "react";
import styled from "styled-components";
import { useAccount, useDisconnect } from "wagmi";
import { Button } from "@kleros/ui-components-library";
Expand Down Expand Up @@ -64,13 +64,29 @@ const UserContainer = styled.div`
gap: 12px;
`;

const StyledA = styled.a`
text-decoration: none;
label {
cursor: pointer;
color: ${({ theme }) => theme.primaryBlue};
}
:hover {
text-decoration: underline;
}
`;

export const DisconnectWalletButton: React.FC = () => {
const { disconnect } = useDisconnect();
return <Button text={`Disconnect`} onClick={() => disconnect()} />;
};

const General: React.FC = () => {
const { address } = useAccount();
const { address, chain } = useAccount();

const addressExplorerLink = useMemo(() => {
return `${chain?.blockExplorers?.default.url}/address/${address}`;
}, [address, chain]);

return (
<EnsureChainContainer>
<EnsureChain>
Expand All @@ -81,7 +97,9 @@ const General: React.FC = () => {
<IdenticonOrAvatar size="48" />
</StyledAvatarContainer>
<StyledAddressContainer>
<AddressOrName />
<StyledA href={addressExplorerLink} rel="noreferrer" target="_blank">
<AddressOrName />
</StyledA>
</StyledAddressContainer>
<StyledChainContainer>
<ChainDisplay />
Expand Down

0 comments on commit 1d71c4b

Please sign in to comment.