Adjust democracy display detection (#8383)

This commit is contained in:
Jaco 2022-11-21 17:55:40 +02:00 committed by GitHub
parent e47f486671
commit 27964a4101
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -25,7 +25,7 @@ export default function create (t: TFunction): Route {
Component,
display: {
needsApi: [
'tx.democracy.notePreimage'
'tx.democracy.propose'
],
needsApiCheck
},

View File

@ -7,7 +7,7 @@ import type { HexString } from '@polkadot/util/types';
import React from 'react';
import { Button } from '@polkadot/react-components';
import { useToggle } from '@polkadot/react-hooks';
import { useApi, useToggle } from '@polkadot/react-hooks';
import { useTranslation } from '../translate';
import PreImage from './PreImage';
@ -19,12 +19,14 @@ interface Props {
function PreImageButton ({ imageHash, isImminent }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const [isPreimageOpen, togglePreimage] = useToggle();
return (
<>
<Button
icon='plus'
isDisabled={!api.tx.democracy.notePreimage}
label={t<string>('Image')}
onClick={togglePreimage}
/>