// Copyright 2017-2022 @polkadot/app-tech-comm authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { AccountId, Hash } from '@polkadot/types/interfaces'; import React, { useMemo } from 'react'; import { Route, Switch } from 'react-router'; import { Tabs } from '@polkadot/react-components'; import { useApi, useCall, useCollectiveMembers } from '@polkadot/react-hooks'; import Overview from './Overview'; import Proposals from './Proposals'; import { useTranslation } from './translate'; interface Props { basePath: string; className?: string; type: 'membership' | 'technicalCommittee'; } const HIDDEN_EMPTY: string[] = []; const HIDDEN_PROPOSALS: string[] = ['proposals']; function TechCommApp ({ basePath, className, type }: Props): React.ReactElement { const { t } = useTranslation(); const { api } = useApi(); const { isMember, members } = useCollectiveMembers(type); const prime = useCall(api.derive[type].prime); const hasProposals = useCall(api.derive[type].hasProposals); const proposalHashes = useCall(api.derive[type].proposalHashes); const items = useMemo(() => [ { isRoot: true, name: 'overview', text: t('Overview') }, { name: 'proposals', text: t('Proposals ({{count}})', { replace: { count: (proposalHashes && proposalHashes.length) || 0 } }) } ], [proposalHashes, t]); return (
); } export default React.memo(TechCommApp);