mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-08-09 03:15:40 +00:00
971df8edba
- Remove all 3rd party parachain configurations from endpoints: - productionRelayPolkadot.ts: Keep only system parachains - productionRelayDicle.ts: Keep only system parachains - testingRelayZagros.ts: Keep only system parachains - testingRelayTeyrChain.ts: Keep only system parachains - Update domain references: - polkadot.js.org → pezkuwichain.app - wiki.polkadot.network → wiki.pezkuwichain.io - dotapps.io → pezkuwichain.app - statement.polkadot.network → docs.pezkuwichain.io/statement - support.polkadot.network → docs.pezkuwichain.io - Update repository references: - github.com/pezkuwi-js/apps → github.com/pezkuwichain/pwap - Rename system parachains to Pezkuwi ecosystem: - PolkadotAssetHub → PezkuwiAssetHub - polkadotBridgeHub → pezkuwiBridgeHub - polkadotCollectives → pezkuwiCollectives - polkadotCoretime → pezkuwiCoretime - polkadotPeople → pezkuwiPeople - Update network name in claims utility: - Polkadot → Pezkuwi
119 lines
3.3 KiB
TypeScript
119 lines
3.3 KiB
TypeScript
// Copyright 2017-2026 @pezkuwi/app-staking authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { DeriveStakingOverview } from '@pezkuwi/api-derive/types';
|
|
import type { SortedTargets } from '../types.js';
|
|
|
|
import React from 'react';
|
|
|
|
import SummarySession from '@pezkuwi/app-explorer/SummarySession';
|
|
import { CardSummary, styled, SummaryBox } from '@pezkuwi/react-components';
|
|
import { formatNumber } from '@pezkuwi/util';
|
|
|
|
import { useTranslation } from '../translate.js';
|
|
|
|
interface Props {
|
|
className?: string;
|
|
nominators?: string[];
|
|
stakingOverview?: DeriveStakingOverview;
|
|
targets: SortedTargets;
|
|
}
|
|
|
|
function Summary ({ className = '', stakingOverview, targets: { counterForNominators, inflation: { idealStake, inflation, stakedFraction }, nominators, waitingIds } }: Props): React.ReactElement<Props> {
|
|
const { t } = useTranslation();
|
|
|
|
const percent = <span className='percent'>%</span>;
|
|
|
|
return (
|
|
<StyledSummaryBox className={className}>
|
|
<section>
|
|
<CardSummary label={t('validators')}>
|
|
{stakingOverview
|
|
? <>{formatNumber(stakingOverview.validators.length)} / {formatNumber(stakingOverview.validatorCount)}</>
|
|
: <span className='--tmp'>999 / 999</span>
|
|
}
|
|
</CardSummary>
|
|
<CardSummary
|
|
className='media--900'
|
|
label={t('waiting')}
|
|
>
|
|
{waitingIds
|
|
? formatNumber(waitingIds.length)
|
|
: <span className='--tmp'>99</span>
|
|
}
|
|
</CardSummary>
|
|
<CardSummary
|
|
className='media--1000'
|
|
label={
|
|
counterForNominators
|
|
? t('active / nominators')
|
|
: t('nominators')
|
|
}
|
|
>
|
|
{nominators
|
|
? (
|
|
<>
|
|
{formatNumber(nominators.length)}
|
|
{counterForNominators && (
|
|
<> / {formatNumber(counterForNominators)}</>
|
|
)}
|
|
</>
|
|
)
|
|
: <span className='--tmp'>999 / 999</span>
|
|
}
|
|
</CardSummary>
|
|
</section>
|
|
<section>
|
|
{(idealStake > 0) && Number.isFinite(idealStake) && (
|
|
<CardSummary
|
|
className='media--1400'
|
|
label={t('ideal staked')}
|
|
>
|
|
<>{(idealStake * 100).toFixed(1)}{percent}</>
|
|
</CardSummary>
|
|
)}
|
|
{(stakedFraction > 0) && (
|
|
<CardSummary
|
|
className='media--1300'
|
|
label={t('staked')}
|
|
>
|
|
<>{(stakedFraction * 100).toFixed(1)}{percent}</>
|
|
</CardSummary>
|
|
)}
|
|
{(inflation > 0) && Number.isFinite(inflation) && (
|
|
<CardSummary
|
|
className='media--1200'
|
|
label={t('inflation')}
|
|
>
|
|
<>{inflation.toFixed(1)}{percent}</>
|
|
</CardSummary>
|
|
)}
|
|
</section>
|
|
<section>
|
|
<SummarySession />
|
|
</section>
|
|
</StyledSummaryBox>
|
|
);
|
|
}
|
|
|
|
const StyledSummaryBox = styled(SummaryBox)`
|
|
.validator--Account-block-icon {
|
|
display: inline-block;
|
|
margin-right: 0.75rem;
|
|
margin-top: -0.25rem;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.validator--Summary-authors {
|
|
.validator--Account-block-icon+.validator--Account-block-icon {
|
|
margin-left: -1.5rem;
|
|
}
|
|
}
|
|
|
|
.percent {
|
|
font-size: var(--font-percent-tiny);
|
|
}
|
|
`;
|
|
|
|
export default React.memo(Summary);
|