Skip to content

Commit

Permalink
fix(Links): conditional /token or /address path
Browse files Browse the repository at this point in the history
  • Loading branch information
BrickheadJohnny committed Jan 28, 2025
1 parent 3700963 commit f54d847
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/[guild]/collect/components/Details/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useNftDetails from "../../hooks/useNftDetails"
import BlockExplorerLink from "./components/BlockExplorerLink"
import InfoBlock from "./components/InfoBlock"

const ADDRESS_PATHS = ["IOTA"] as Chain[]
export const NFT_BLOCK_EXPLORER_ADDRESS_PATHS = ["IOTA"] as Chain[]

const Details = () => {
const { chain, nftAddress } = useCollectNftContext()
Expand All @@ -21,7 +21,9 @@ const Details = () => {
<BlockExplorerLink
chain={chain}
address={nftAddress}
path={ADDRESS_PATHS.includes(chain) ? "address" : "token"}
path={
NFT_BLOCK_EXPLORER_ADDRESS_PATHS.includes(chain) ? "address" : "token"
}
/>
</InfoBlock>

Expand Down
7 changes: 6 additions & 1 deletion src/components/[guild]/collect/components/Links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ import capitalize from "utils/capitalize"
import { openseaBaseUrl } from "utils/guildCheckout/constants"
import { CHAIN_CONFIG } from "wagmiConfig/chains"
import useNftDetails from "../hooks/useNftDetails"
import { NFT_BLOCK_EXPLORER_ADDRESS_PATHS } from "./Details/Details"

const Links = () => {
const { colorMode } = useColorMode()
const { chain, nftAddress } = useCollectNftContext()
const { totalSupply } = useNftDetails(chain, nftAddress)
const { socialLinks } = useGuild()

const blockExplorerPath = NFT_BLOCK_EXPLORER_ADDRESS_PATHS.includes(chain)
? "address"
: "token"

return (
<Section title="Links" spacing={3}>
<Wrap spacingX={6} spacingY={3}>
Expand Down Expand Up @@ -46,7 +51,7 @@ const Links = () => {
)}

<Link
href={`${CHAIN_CONFIG[chain].blockExplorerUrl}/token/${nftAddress}`}
href={`${CHAIN_CONFIG[chain].blockExplorerUrl}/${blockExplorerPath}/${nftAddress}`}
isExternal
colorScheme="gray"
fontWeight="medium"
Expand Down

0 comments on commit f54d847

Please sign in to comment.