Fix poposal breakdown (#2272)
This commit is contained in:
parent
344fcb6f27
commit
44e6a32c8e
@ -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) {
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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;
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user