-
Notifications
You must be signed in to change notification settings - Fork 22
/
useGovDaoTabs.ts
62 lines (58 loc) · 1.66 KB
/
useGovDaoTabs.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import {
AccountBalanceWalletOutlined,
AccountBalanceWalletRounded,
FiberSmartRecordOutlined,
FiberSmartRecordRounded,
HowToVoteOutlined,
HowToVoteRounded,
} from '@mui/icons-material'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { useChain } from '@dao-dao/stateless'
import { DaoTabId, DaoTabWithComponent, LoadingData } from '@dao-dao/types'
import { isSupportedChain } from '@dao-dao/utils'
import {
GovCommunityPoolTab,
GovProposalsTab,
GovSubDaosTab,
} from '../components/gov'
export const useGovDaoTabs = (): LoadingData<DaoTabWithComponent[]> => {
const { t } = useTranslation()
const { chainId } = useChain()
return useMemo(
() => ({
loading: false,
updating: false,
data: [
{
id: DaoTabId.Proposals,
label: t('title.proposals'),
Component: GovProposalsTab,
Icon: HowToVoteOutlined,
IconFilled: HowToVoteRounded,
},
{
id: DaoTabId.Treasury,
label: t('title.communityPool'),
Component: GovCommunityPoolTab,
Icon: AccountBalanceWalletOutlined,
IconFilled: AccountBalanceWalletRounded,
lazy: true,
},
// If chain has DAO DAO deployed and thus can create SubDAOs, show tab.
...(isSupportedChain(chainId)
? [
{
id: DaoTabId.SubDaos,
label: t('title.subDaos'),
Component: GovSubDaosTab,
Icon: FiberSmartRecordOutlined,
IconFilled: FiberSmartRecordRounded,
},
]
: []),
],
}),
[chainId, t]
)
}