Use tech comm useMembers (#2436)

This commit is contained in:
Jaco Greeff 2020-03-22 17:52:22 +01:00 committed by GitHub
parent 4c538710f5
commit ca4ec5816f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 12 deletions

View File

@ -21,7 +21,7 @@ const ONE_MIN = (1 * 60) / 6;
const DEF_DELAY = new BN(ONE_MIN);
const DEF_VOTING = new BN(ONE_MIN * 60 * 3);
function Fasttrack ({ hash, threshold }: Props): React.ReactElement<Props> | null {
function Fasttrack ({ hash }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const { isMember, members } = useMembers('technicalCommittee');
@ -37,8 +37,8 @@ function Fasttrack ({ hash, threshold }: Props): React.ReactElement<Props> | nul
);
useEffect((): void => {
setAllowFast(isMember && threshold.isSimplemajority);
}, [isMember, threshold]);
setAllowFast(isMember); // && threshold.isSimplemajority);
}, [isMember]);
useEffect((): void => {
setProposal(

View File

@ -12,7 +12,7 @@ import { useTranslation } from '../translate';
interface Props {
className?: string;
members?: AccountId[];
members: string[];
prime?: AccountId | null;
}
@ -21,7 +21,7 @@ function Members ({ className, members, prime }: Props): React.ReactElement<Prop
return (
<div className={className}>
{members?.length
{members.length
? (
<Table>
<Table.Body>

View File

@ -21,7 +21,7 @@ export default function Summary ({ className, members, proposals }: Props): Reac
return (
<SummaryBox className={className}>
<CardSummary label={t('members')}>
{formatNumber(members?.length)}
{formatNumber(members.length)}
</CardSummary>
<section>
<CardSummary label={t('proposals')}>

View File

@ -21,7 +21,7 @@ export default function Proposals ({ className, members, prime, proposals }: Pro
<div className={className}>
{isProposeOpen && (
<Propose
memberCount={members?.length}
memberCount={members.length}
onClose={togglePropose}
/>
)}

View File

@ -8,7 +8,7 @@ import { AppProps, BareProps } from '@polkadot/react-components/types';
import React, { useMemo } from 'react';
import { Route, Switch } from 'react-router';
import { useApi, useCall } from '@polkadot/react-hooks';
import { useApi, useCall, useMembers } from '@polkadot/react-hooks';
import { Tabs } from '@polkadot/react-components';
import Overview from './Overview';
@ -22,9 +22,9 @@ interface Props extends AppProps, BareProps {}
export default function TechCommApp ({ basePath, className }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const members = useCall<AccountId[]>(api.query.technicalCommittee.members);
const prime = useCall<AccountId | null>(api.query.council.prime, [], {
transform: (result: Option<AccountId>): AccountId | null => result?.unwrapOr(null) || null
const { members } = useMembers('technicalCommittee');
const prime = useCall<AccountId | null>(api.query.technicalCommittee.prime, [], {
transform: (result: Option<AccountId>): AccountId | null => result.unwrapOr(null)
}) || null;
const proposals = useCall<Hash[]>(api.query.technicalCommittee.proposals);
const items = useMemo(() => [

View File

@ -8,5 +8,5 @@ export interface ComponentProps {
className?: string;
prime?: AccountId | null;
proposals?: Hash[];
members?: AccountId[];
members: string[];
}