// Copyright 2017-2026 @pezkuwi/app-treasury authors & contributors // SPDX-License-Identifier: Apache-2.0 import React, { useMemo } from 'react'; import { Route, Routes } from 'react-router'; import { Tabs } from '@pezkuwi/react-components'; import { useApi, useCollectiveMembers } from '@pezkuwi/react-hooks'; import { isFunction } from '@pezkuwi/util'; import Overview from './Overview/index.js'; import Tips from './Tips/index.js'; import { useTranslation } from './translate.js'; import useTipHashes from './useTipHashes.js'; export { default as useCounter } from './useCounter.js'; interface Props { basePath: string; } interface TabItem { count?: number; isRoot?: boolean; name: string; text: string; } function TreasuryApp ({ basePath }: Props): React.ReactElement { const { t } = useTranslation(); const { api } = useApi(); const { isMember, members } = useCollectiveMembers('council'); const tipHashes = useTipHashes(); const items = useMemo(() => [ { isRoot: true, name: 'overview', text: t('Overview') }, isFunction((api.query.tips || api.query.treasury)?.tips) && { count: tipHashes?.length, name: 'tips', text: t('Tips') } ].filter((t: TabItem | false): t is TabItem => !!t), [api, t, tipHashes]); return (
} path='tips' /> } index />
); } export default React.memo(TreasuryApp);