Skip to content

Commit

Permalink
Merge pull request #4933 from thematters/feat/ipns-dialog
Browse files Browse the repository at this point in the history
feat(ipns): show IPNS (RSS) dialog only if user has ENS
  • Loading branch information
gitwoz authored Nov 6, 2024
2 parents 18096d7 + ce92c6d commit 481c3cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/common/utils/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Chain, configureChains, createConfig } from 'wagmi'
import {
goerli,
mainnet,
optimism,
optimismSepolia,
polygon,
polygonMumbai,
sepolia,
} from 'wagmi/chains'
import { InjectedConnector } from 'wagmi/connectors/injected'
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect'
Expand All @@ -20,7 +20,7 @@ const alchemyId = process.env.NEXT_PUBLIC_ALCHEMY_KEY!
export const featureSupportedChains = {
billboard: isProd ? [optimism] : [optimismSepolia],
curation: isProd ? [optimism] : [optimismSepolia],
ens: isProd ? [mainnet] : [goerli],
ens: isProd ? [mainnet] : [sepolia],
}

export const explorers = {
Expand All @@ -34,7 +34,7 @@ export const explorers = {

const defaultChains: Chain[] = isProd
? [mainnet, optimism]
: [goerli, optimismSepolia]
: [sepolia, optimismSepolia]

export const { publicClient, chains } = configureChains(defaultChains, [
alchemyProvider({ apiKey: alchemyId }),
Expand Down
10 changes: 9 additions & 1 deletion src/views/User/UserProfile/DropdownActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import _pickBy from 'lodash/pickBy'
import dynamic from 'next/dynamic'
import { useContext } from 'react'
import { FormattedMessage, useIntl } from 'react-intl'
import { useEnsName } from 'wagmi'

import { ReactComponent as IconMore } from '@/public/static/icons/24px/more.svg'
import { ReactComponent as IconRss } from '@/public/static/icons/24px/rss.svg'
import { ReactComponent as IconShare } from '@/public/static/icons/24px/share.svg'
import { featureSupportedChains } from '~/common/utils'
import {
Button,
Dropdown,
Expand Down Expand Up @@ -230,11 +232,17 @@ const BaseDropdownActions = ({

const DropdownActions = ({ user, isMe, isInAside }: DropdownActionsProps) => {
const viewer = useContext(ViewerContext)
const targetNetwork = featureSupportedChains.ens[0]
const { data: ensName } = useEnsName({
address: user.info.ethAddress as `0x${string}`,
chainId: targetNetwork.id,
})

const controls = {
hasEditProfile: isMe,
hasBlockUser: !!viewer.id && !isMe,
hasRssFeed: user?.articles.totalCount > 0 && !!user?.info.ipnsKey,
hasRssFeed:
ensName && user?.articles.totalCount > 0 && !!user?.info.ipnsKey,
}

const WithShare = withDialog<Omit<ShareDialogProps, 'children'>>(
Expand Down

0 comments on commit 481c3cf

Please sign in to comment.