Date: Tue, 16 Jul 2024 15:00:31 +0530
Subject: [PATCH 2/2] fix: added current network
---
src/components/bounty/BountyInfo.tsx | 2 +-
src/components/bounty/ProofItem.tsx | 14 +++++++++++++-
src/components/bounty/ProofItemAccount.tsx | 13 ++++++++++++-
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/components/bounty/BountyInfo.tsx b/src/components/bounty/BountyInfo.tsx
index 989313e0..7add95fe 100644
--- a/src/components/bounty/BountyInfo.tsx
+++ b/src/components/bounty/BountyInfo.tsx
@@ -116,7 +116,7 @@ const BountyInfo = ({ bountyId }: { bountyId: string }) => {
bounty issuer:{' '}
{' '}
diff --git a/src/components/bounty/ProofItem.tsx b/src/components/bounty/ProofItem.tsx
index 948a2af4..331b4a86 100644
--- a/src/components/bounty/ProofItem.tsx
+++ b/src/components/bounty/ProofItem.tsx
@@ -10,6 +10,7 @@ import { useBountyContext } from '@/components/bounty/BountyProvider';
import { acceptClaim, getURI, submitClaimForVote } from '@/app/context/web3';
import { applyBreakAllToLongWords } from '@/lib/uiHelpers';
import Link from 'next/link';
+import { usePathname } from 'next/navigation';
interface ProofItemProps {
id: string;
@@ -36,6 +37,9 @@ const ProofItem: React.FC = ({
const { user, primaryWallet } = useDynamicContext();
const [claimsURI, setClaimsURI] = useState('');
const [imageUrl, setImageUrl] = useState(null);
+
+ const path = usePathname();
+ const [currentNetworkName, setCurrentNetworkName] = useState('');
const {
isMultiplayer,
isOwner,
@@ -45,6 +49,11 @@ const ProofItem: React.FC = ({
} = useBountyContext()!;
const issuerDegenOrEnsName = useDegenOrEnsName(issuer);
+ useEffect(() => {
+ const currentUrl = path.split('/')[1];
+ setCurrentNetworkName(currentUrl || 'base');
+ }, []);
+
useEffect(() => {
if (id) {
getURI(id)
@@ -161,7 +170,10 @@ const ProofItem: React.FC = ({
issuer
-
+
{issuerDegenOrEnsName ||
`$` + issuer.slice(0, 5) + '...' + issuer.slice(-6)}
diff --git a/src/components/bounty/ProofItemAccount.tsx b/src/components/bounty/ProofItemAccount.tsx
index d207fa76..29db711f 100644
--- a/src/components/bounty/ProofItemAccount.tsx
+++ b/src/components/bounty/ProofItemAccount.tsx
@@ -5,6 +5,7 @@ import React, { useEffect, useState } from 'react';
import { useDegenOrEnsName } from '@/hooks/useDegenOrEnsName';
import { acceptClaim, getURI, submitClaimForVote } from '@/app/context/web3';
+import { usePathname } from 'next/navigation';
interface ProofItemProps {
id: string;
@@ -35,6 +36,13 @@ const ProofItem: React.FC = ({
// const currentUser = user?.verifiedCredentials[0].address;
// const notOwner = currentUser === issuer ;
+ const path = usePathname();
+ const [currentNetworkName, setCurrentNetworkName] = useState('');
+
+ useEffect(() => {
+ const currentUrl = path.split('/')[1];
+ setCurrentNetworkName(currentUrl || 'base');
+ }, []);
useEffect(() => {
if (id) {
@@ -112,7 +120,10 @@ const ProofItem: React.FC = ({
issuer
-
+
{issuerDegenOrEnsName ||
`$` + issuer.slice(0, 5) + '...' + issuer.slice(-6)}