mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-06-13 22:11:08 +00:00
d21bfb1320
Rebranded terminology: - Polkadot → Pezkuwi - Kusama → Dicle - Westend → Zagros - Rococo → PezkuwiChain - Substrate → Bizinikiwi - parachain → teyrchain Custom logos with Kurdistan brand colors (#e6007a → #86e62a): - bizinikiwi-hexagon.svg - sora-bizinikiwi.svg - hezscanner.svg - heztreasury.svg - pezkuwiscan.svg - pezkuwistats.svg - pezkuwiassembly.svg - pezkuwiholic.svg
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
// Copyright 2017-2025 @pezkuwi/app-referenda authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { BN } from '@pezkuwi/util';
|
|
|
|
import React from 'react';
|
|
|
|
import { useBestNumberRelay, useStakingAsyncApis } from '@pezkuwi/react-hooks';
|
|
import { BlockToTime } from '@pezkuwi/react-query';
|
|
import { formatNumber } from '@pezkuwi/util';
|
|
|
|
interface Props {
|
|
className?: string;
|
|
label: string;
|
|
when: BN | null;
|
|
}
|
|
|
|
function RefEnd ({ className = '', label, when }: Props): React.ReactElement<Props> {
|
|
const bestNumber = useBestNumberRelay();
|
|
const { isStakingAsync, rcApi } = useStakingAsyncApis();
|
|
|
|
return (
|
|
<td className={`${className} number`}>
|
|
{bestNumber && when && (
|
|
<>
|
|
<div>{label}</div>
|
|
{/* Remaining period should be decided based on Relay chain */}
|
|
{when.gt(bestNumber) && (
|
|
<BlockToTime
|
|
api={isStakingAsync ? rcApi : undefined}
|
|
value={when.sub(bestNumber)}
|
|
/>
|
|
)}
|
|
<div>#{formatNumber(when)}</div>
|
|
</>
|
|
)}
|
|
</td>
|
|
);
|
|
}
|
|
|
|
export default React.memo(RefEnd);
|