ghost-portal/packages/react-query/src/TotalInactive.tsx
Jaco 92960c935a
Display inactive issuance summary (#8534)
* Display inactive issuance summary

* Referenda issuance

* Adjust item availability

* active only on inactive availability

* optional explore inactive
2022-12-14 13:09:40 +02:00

37 lines
823 B
TypeScript

// Copyright 2017-2022 @polkadot/react-query authors & contributors
// SPDX-License-Identifier: Apache-2.0
import React from 'react';
import { useApi, useCall } from '@polkadot/react-hooks';
import FormatBalance from './FormatBalance';
interface Props {
children?: React.ReactNode;
className?: string;
label?: React.ReactNode;
}
function TotalInactive ({ children, className = '', label }: Props): React.ReactElement<Props> | null {
const { api } = useApi();
const inactiveIssuance = useCall<string>(api.query.balances?.inactiveIssuance);
if (!inactiveIssuance) {
return null;
}
return (
<div className={className}>
{label || ''}
<FormatBalance
value={inactiveIssuance}
withSi
/>
{children}
</div>
);
}
export default React.memo(TotalInactive);