Skip to content

Commit

Permalink
replace: 'council' with 'members' in header (#2380)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xShuk authored Jul 11, 2024
1 parent 5be5e09 commit 50a3316
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions components/RealmHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,13 @@ import Link from 'next/link'
import useQueryContext from 'hooks/useQueryContext'
import { ExternalLinkIcon } from '@heroicons/react/outline'
import { getRealmExplorerHost } from 'tools/routing'

import { tryParsePublicKey } from '@tools/core/pubkey'
import { useRealmQuery } from '@hooks/queries/realm'
import { useRealmConfigQuery } from '@hooks/queries/realmConfig'
import { GoverningTokenType } from '@solana/spl-governance'
import { determineVotingPowerType } from '@hooks/queries/governancePower'
import { useAsync } from 'react-async-hook'
import useSelectedRealmPubkey from '@hooks/selectedRealm/useSelectedRealmPubkey'
import { useConnection } from '@solana/wallet-adapter-react'

const RealmHeader = () => {
const { fmtUrlWithCluster } = useQueryContext()
const realm = useRealmQuery().data?.result
const config = useRealmConfigQuery().data?.result
const { REALM } = process.env
const { connection } = useConnection()

Expand All @@ -30,17 +23,6 @@ const RealmHeader = () => {

const [isBackNavVisible, setIsBackNavVisible] = useState(true)

const realmPk = useSelectedRealmPubkey()

const { result: kind } = useAsync(async () => {
if (realmPk === undefined) return undefined
return determineVotingPowerType(connection, realmPk, 'community')
}, [connection, realmPk])
const membersTabIsCouncilOnly = !(kind === 'vanilla' || kind === 'NFT')
const councilExists =
realm?.account.config.councilMint !== undefined &&
config?.account.councilTokenConfig?.tokenType !== GoverningTokenType.Dormant

useEffect(() => {
setIsBackNavVisible(realmInfo?.symbol !== REALM)
}, [realmInfo?.symbol, REALM])
Expand Down Expand Up @@ -95,14 +77,12 @@ const RealmHeader = () => {
</a>
</Link>
)}
{(!membersTabIsCouncilOnly || councilExists) && (
<Link href={fmtUrlWithCluster(`/dao/${symbol}/members`)}>
<a className="flex items-center text-sm cursor-pointer default-transition text-fgd-2 hover:text-fgd-3">
<UsersIcon className="flex-shrink-0 w-5 h-5 mr-1" />
{membersTabIsCouncilOnly ? 'Council' : 'Members'}
</a>
</Link>
)}
<Link href={fmtUrlWithCluster(`/dao/${symbol}/members`)}>
<a className="flex items-center text-sm cursor-pointer default-transition text-fgd-2 hover:text-fgd-3">
<UsersIcon className="flex-shrink-0 w-5 h-5 mr-1" />
Members
</a>
</Link>
<Link href={fmtUrlWithCluster(`/dao/${symbol}/params`)}>
<a className="flex items-center text-sm cursor-pointer default-transition text-fgd-2 hover:text-fgd-3">
<CogIcon className="flex-shrink-0 w-5 h-5 mr-1" />
Expand Down

0 comments on commit 50a3316

Please sign in to comment.