-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(refactor): Use Staking API for validator era points (#2417)
- Loading branch information
Showing
14 changed files
with
141 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/app/src/overlay/modals/ValidatorMetrics/ActiveGraph.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
import type { NetworkId } from 'common-types' | ||
import { EraPoints } from 'library/Graphs/EraPoints' | ||
import { useValidatorEraPoints } from 'plugin-staking-api' | ||
|
||
interface Props { | ||
network: NetworkId | ||
validator: string | ||
fromEra: number | ||
} | ||
export const ActiveGraph = ({ network, validator, fromEra }: Props) => { | ||
const { data, loading, error } = useValidatorEraPoints({ | ||
chain: network, | ||
validator, | ||
fromEra, | ||
}) | ||
|
||
const list = | ||
loading || error || data?.validatorEraPoints === undefined | ||
? [] | ||
: data.validatorEraPoints | ||
|
||
const sorted = [...list].sort((a, b) => a.era - b.era) | ||
|
||
return <EraPoints items={sorted} height={250} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.