mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-08-01 18:45:43 +00:00
d21bfb1320
Rebranded terminology: - Polkadot → Pezkuwi - Kusama → Dicle - Westend → Zagros - Rococo → PezkuwiChain - Substrate → Bizinikiwi - parachain → teyrchain Custom logos with Kurdistan brand colors (#e6007a → #86e62a): - bizinikiwi-hexagon.svg - sora-bizinikiwi.svg - hezscanner.svg - heztreasury.svg - pezkuwiscan.svg - pezkuwistats.svg - pezkuwiassembly.svg - pezkuwiholic.svg
82 lines
1.9 KiB
TypeScript
82 lines
1.9 KiB
TypeScript
// Copyright 2017-2025 @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<Props> {
|
|
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 (
|
|
<main className='treasury--App'>
|
|
<Tabs
|
|
basePath={basePath}
|
|
items={items}
|
|
/>
|
|
<Routes>
|
|
<Route path={basePath}>
|
|
<Route
|
|
element={
|
|
<Tips
|
|
hashes={tipHashes}
|
|
isMember={isMember}
|
|
members={members}
|
|
/>
|
|
}
|
|
path='tips'
|
|
/>
|
|
<Route
|
|
element={
|
|
<Overview
|
|
isMember={isMember}
|
|
members={members}
|
|
/>
|
|
}
|
|
index
|
|
/>
|
|
</Route>
|
|
</Routes>
|
|
</main>
|
|
);
|
|
}
|
|
|
|
export default React.memo(TreasuryApp);
|