Fix poposal breakdown (#2272)

This commit is contained in:
Jaco Greeff 2020-02-11 22:31:19 +01:00 committed by GitHub
parent 344fcb6f27
commit 44e6a32c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -33,7 +33,7 @@ function onChange ({ onChange }: Props): (_: RawParamOnChangeValue) => void {
};
}
export default function Code (props: Props): React.ReactNode {
export default function Code (props: Props): React.ReactElement<Props> {
const { className, defaultValue, isDisabled, isError, label, onEnter, onEscape, style, type, withLabel } = props;
if (isDisabled) {

View File

@ -20,7 +20,7 @@ function onChange ({ onChange }: Props): (_: string) => void {
};
}
export default function Text (props: Props): React.ReactNode {
export default function Text (props: Props): React.ReactElement<Props> {
const { className, defaultValue: { value }, isDisabled, isError, label, onEnter, onEscape, style, withLabel } = props;
const defaultValue = (value || '').toString();

View File

@ -35,17 +35,17 @@ import Vote from './Vote';
import VoteThreshold from './VoteThreshold';
interface TypeToComponent {
c: React.ComponentType<Props>;
c: React.ComponentType<any>;
t: string[];
}
const components: ComponentMap = ([
const componentDef: TypeToComponent[] = [
{ c: Account, t: ['AccountId', 'AccountIdOf', 'Address', 'AuthorityId', 'LookupSource', 'LookupTarget', 'SessionKey', 'ValidatorId'] },
{ c: Amount, t: ['AccountIndex', 'AssetId', 'BlockNumber', 'Gas', 'Index', 'Nonce', 'ParaId', 'ProposalIndex', 'PropIndex', 'ReferendumIndex', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'u256', 'VoteIndex'] },
{ c: Balance, t: ['Amount', 'AssetOf', 'Balance', 'BalanceOf'] },
{ c: Bool, t: ['bool'] },
{ c: Bytes, t: ['Bytes'] },
{ C: Call, t: ['Call', 'Proposal'] },
{ c: Call, t: ['Call', 'Proposal'] },
{ c: Code, t: ['Code'] },
{ c: DispatchError, t: ['DispatchError'] },
{ c: Raw, t: ['Raw', 'Keys'] },
@ -64,7 +64,9 @@ const components: ComponentMap = ([
{ c: Vote, t: ['Vote'] },
{ c: VoteThreshold, t: ['VoteThreshold'] },
{ c: Unknown, t: ['Unknown'] }
] as TypeToComponent[]).reduce((components, { c, t }): ComponentMap => {
];
const components: ComponentMap = componentDef.reduce((components, { c, t }): ComponentMap => {
t.forEach((type): void => {
components[type] = c;
});