Skip to content

Commit

Permalink
fix links, link search results
Browse files Browse the repository at this point in the history
  • Loading branch information
samepant committed Jan 18, 2024
1 parent bab15a2 commit 85c6338
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/NFTGridItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const NFTGridItem: React.FC<Props> = ({ nft, chainId }) => {
<div className={classes.header}>
<p className={classes.tokenName}>
<Link
to={`mechs/${chain.prefix}:${nft.token_address}/${nft.token_id}`}
to={`/mech/${chain.prefix}:${nft.token_address}/${nft.token_id}`}
>
{name || "..."}
</Link>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/NFTItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const NFTItem: React.FC<Props> = ({ nft, chainId }) => {
chainId,
})

console.log(data)
const mechBalances = data ? [data.native, ...data.erc20s] : []

const { deployed } = useDeployMech(getNFTContext(nft), chainId)
const name = nft.name || nft.metadata?.name || "..."
return (
Expand Down
26 changes: 20 additions & 6 deletions frontend/src/components/Search/SearchResults/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ const SearchResults = ({ results }: { results: SearchResult[] }) => {
<li className={classes.category} key={`mech-${result.address}`}>
<h2>Deployed Mech</h2>
<ul className={classes.categoryResults}>
<li key={index} className={classes.result}>
{result.type === "nft" && <NFTResult result={result} />}
<li>
<a href={`/mech/${result.address}`} className={classes.result}>
{result.type === "mech" && <NFTResult result={result} />}
</a>
</li>
</ul>
</li>
Expand All @@ -30,8 +32,13 @@ const SearchResults = ({ results }: { results: SearchResult[] }) => {
<li className={classes.category} key={`nft-${result.address}`}>
<h2>NFT Collection</h2>
<ul className={classes.categoryResults}>
<li key={index} className={classes.result}>
{result.type === "nft" && <NFTResult result={result} />}
<li>
<a
href={`/collection/${result.address}`}
className={classes.result}
>
{result.type === "nft" && <NFTResult result={result} />}
</a>
</li>
</ul>
</li>
Expand All @@ -42,8 +49,15 @@ const SearchResults = ({ results }: { results: SearchResult[] }) => {
<li className={classes.category} key={`account-${result.address}`}>
<h2>Account</h2>
<ul className={classes.categoryResults}>
<li key={index} className={classes.result}>
{result.type === "account" && <AccountResult result={result} />}
<li>
<a
href={`/account/${result.address}`}
className={classes.result}
>
{result.type === "account" && (
<AccountResult result={result} />
)}
</a>
</li>
</ul>
</li>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/useTokenBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const useTokenBalances = ({ accountAddress, chainId }: Props) => {
throw new Error("ERC20 request failed")
}
const erc20Json = await erc20Res.json()
const erc20Data = erc20Json.result as MoralisFungible[]
const erc20Data = erc20Json as MoralisFungible[]

// get native balance
const nativeRes = await fetch(
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/useTokenMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const useNFTMetadata = ({ tokenAddress, tokenId, chainId }: Props) => {

// get nfts
const nftRes = await fetch(
`${process.env.REACT_APP_PROXY_URL}/${chainId}/moralis/nft/${tokenAddress}/${tokenId}}`
`${process.env.REACT_APP_PROXY_URL}/${chainId}/moralis/nft/${tokenAddress}/${tokenId}`
)
if (!nftRes.ok) {
throw new Error("NFT request failed")
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default createBrowserRouter([
element: <Landing />,
},
{
path: "mechs/:token/:tokenId",
path: "mech/:token/:tokenId",
element: <Mech />,
},
{
Expand Down

0 comments on commit 85c6338

Please sign in to comment.