Skip to content

Commit

Permalink
DAO Details for Etherlink
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutoshpw committed Aug 21, 2024
1 parent 8b75c04 commit 19bb3e8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/modules/lite/explorer/components/DaoCardDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useHistory } from "react-router"
import { useTezos } from "services/beacon/hooks/useTezos"
import { DashboardContext } from "../context/ActionSheets/explorer"
import { updateCount } from "services/services/lite/lite-services"
import { useIsMember } from "../hooks/useIsMember"
import { useHoldersTotalCount } from "../hooks/useHolderTotalCount"
import ReactHtmlParser from "react-html-parser"

Expand Down Expand Up @@ -64,11 +63,10 @@ interface DaoCardDetailProps {
}

export const DaoCardDetail: React.FC<DaoCardDetailProps> = ({ community, setIsUpdated }) => {
console.log("Community", { community })
const navigate = useHistory()
const { network, account } = useTezos()
const theme = useTheme()
const { isConnected } = useContext(DashboardContext)
const isMember = useIsMember(network, community?.tokenAddress || "", account)
const count = useHoldersTotalCount(
network,
community?.tokenAddress || "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ interface ContextProps {
export const DashboardContext = createContext({} as ContextProps)

export const AppContextProvider = ({ children }: any) => {
const { account } = useTezos()
const { account, etherlink } = useTezos()
const [isConnected, setIsConnected] = useState(false)

useEffect(() => {
if (etherlink?.isConnected) return setIsConnected(true)
if (account === undefined || !account) {
return setIsConnected(false)
}
return setIsConnected(true)
}, [account])
}, [account, etherlink])

const values = {
isConnected,
Expand Down
7 changes: 6 additions & 1 deletion src/modules/lite/explorer/hooks/useIsMember.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export const useIsMember = (network: Network, tokenAddress: string, memberAddres
return
}
}
fetIsMember()
// TODO: Should be fixed
if (network?.startsWith("etherlink")) {
setIsMember(true)
} else {
fetIsMember()
}
return
}, [network, tokenAddress, memberAddress])
return isMember
Expand Down
2 changes: 1 addition & 1 deletion src/services/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const getTokenHoldersCount = async (network: Network, address: string, to

// Temporary fix for etherlink
if (network.startsWith("etherlink")) {
return 0
return 1
}

const response = await fetch(url)
Expand Down

0 comments on commit 19bb3e8

Please sign in to comment.