Skip to content

Commit

Permalink
Feature/ss 499 (#93)
Browse files Browse the repository at this point in the history
* [SS-499] Fix subscan button

* remove test codes

* [SS-499] Fix validator address link
  • Loading branch information
Sanggon-Kim authored Feb 6, 2024
1 parent 9206258 commit 5f73fb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/library/SubscanButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ import { useActiveAccounts } from 'contexts/ActiveAccounts';
import { useNetwork } from 'contexts/Network';
import { Wrapper } from './Wrapper';

export const SubscanButton = () => {
export const SubscanButton = ({ validatorAddress = '' }) => {
const { plugins } = usePlugins();
const { activeAccount } = useActiveAccounts();
const { networkData } = useNetwork();

const isSubscanActive = activeAccount !== null && plugins.includes('subscan');
const subscanTypeName = validatorAddress ? 'validator' : 'account';
const address = validatorAddress || activeAccount;
return (
<>
<Wrapper $active={isSubscanActive}>
<FontAwesomeIcon icon={faProjectDiagram} transform="shrink-4" />
{isSubscanActive ? (
<a
href={`${networkData.subscanUrl}/account/${activeAccount}`}
href={`${networkData.subscanUrl}/${subscanTypeName}/${address}`}
target="_blank"
rel="nofollow noopener noreferrer"
>
Expand Down
2 changes: 1 addition & 1 deletion src/modals/ValidatorMetrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const ValidatorMetrics = () => {
className="body"
style={{ position: 'relative', marginTop: '0.5rem' }}
>
<SubscanButton />
<SubscanButton validatorAddress={address} />
<CardWrapper
className="transparent"
style={{
Expand Down

0 comments on commit 5f73fb6

Please # to comment.