diff --git a/src/pages/dao/index.module.scss b/src/pages/dao/index.module.scss
index 166f8bffd..2bde7b637 100644
--- a/src/pages/dao/index.module.scss
+++ b/src/pages/dao/index.module.scss
@@ -57,7 +57,3 @@
margin-bottom: 30px;
}
}
-
-.ipfs_link {
- word-break: break-word;
-}
diff --git a/src/pages/dao/tabs/Parameters.jsx b/src/pages/dao/tabs/Parameters.jsx
index c765b2fe4..bb36dee1a 100644
--- a/src/pages/dao/tabs/Parameters.jsx
+++ b/src/pages/dao/tabs/Parameters.jsx
@@ -2,40 +2,40 @@ import { DAO_GOVERNANCE_CONTRACT, DAO_TOKEN_DECIMALS } from '@constants'
import { useUserStore } from '@context/userStore'
import { Loading } from '@atoms/loading'
import { Line } from '@atoms/line'
-import styles from '@style'
-import { TeiaUserLink, TezosAddressLink } from '../links'
+import { TeiaUserLink, TezosAddressLink } from '@atoms/link'
import {
useBalance,
- useTokenBalance,
+ useDaoTokenBalance,
useStorage,
- useGovernanceParameters,
- useProposals,
- useRepresentatives,
- useUserVotes,
- useCommunityVotes,
- useUsersAliases,
+ useDaoGovernanceParameters,
+ useDaoProposals,
+ useDaoRepresentatives,
+ useDaoUserVotes,
+ useDaoCommunityVotes,
+ useDaoUsersAliases,
useDaoMemberCount,
-} from '../hooks'
+} from '@data/swr'
+import styles from '@style'
export const DaoParameters = () => {
// Get all the required DAO information
const [daoStorage] = useStorage(DAO_GOVERNANCE_CONTRACT)
- const [governanceParameters] = useGovernanceParameters(daoStorage)
- const [proposals] = useProposals(daoStorage)
- const [representatives] = useRepresentatives(daoStorage)
- const [daoMemberCount] = useDaoMemberCount()
+ const [governanceParameters] = useDaoGovernanceParameters(daoStorage)
+ const [proposals] = useDaoProposals(daoStorage)
+ const [representatives] = useDaoRepresentatives(daoStorage)
+ const [daoMemberCount] = useDaoMemberCount(0)
const [daoBalance] = useBalance(DAO_GOVERNANCE_CONTRACT)
- const [daoTokenBalance] = useTokenBalance(DAO_GOVERNANCE_CONTRACT)
+ const [daoTokenBalance] = useDaoTokenBalance(DAO_GOVERNANCE_CONTRACT)
// Get all the required user information
const userAddress = useUserStore((st) => st.address)
const userCommunity = representatives?.[userAddress]
- const [userTokenBalance] = useTokenBalance(userAddress)
- const [userVotes] = useUserVotes(userAddress, daoStorage)
- const [userCommunityVotes] = useCommunityVotes(userCommunity, daoStorage)
+ const [userTokenBalance] = useDaoTokenBalance(userAddress)
+ const [userVotes] = useDaoUserVotes(userAddress, daoStorage)
+ const [userCommunityVotes] = useDaoCommunityVotes(userCommunity, daoStorage)
// Get all the relevant users aliases
- const [usersAliases] = useUsersAliases(
+ const [usersAliases] = useDaoUsersAliases(
userAddress,
representatives,
proposals
diff --git a/src/pages/dao/tabs/Proposals.jsx b/src/pages/dao/tabs/Proposals.jsx
index d3bb9dcc6..6f4bf2bf8 100644
--- a/src/pages/dao/tabs/Proposals.jsx
+++ b/src/pages/dao/tabs/Proposals.jsx
@@ -7,20 +7,25 @@ import { useDaoStore } from '@context/daoStore'
import { Button } from '@atoms/button'
import { Line } from '@atoms/line'
import { Select } from '@atoms/select'
+import {
+ TeiaUserLink,
+ TezosAddressLink,
+ TokenLink,
+ IpfsLink,
+} from '@atoms/link'
+import {
+ useDaoTokenBalance,
+ useStorage,
+ useDaoGovernanceParameters,
+ useDaoProposals,
+ useDaoRepresentatives,
+ useDaoUserVotes,
+ useDaoCommunityVotes,
+ useDaoUsersAliases,
+} from '@data/swr'
import { hexToString } from '@utils/string'
import { getWordDate } from '@utils/time'
import styles from '@style'
-import { TeiaUserLink, TezosAddressLink, TokenLink, IpfsLink } from '../links'
-import {
- useTokenBalance,
- useStorage,
- useGovernanceParameters,
- useProposals,
- useRepresentatives,
- useUserVotes,
- useCommunityVotes,
- useUsersAliases,
-} from '../hooks'
const PROPOSAL_STATUS_OPTIONS = {
toVote: 'Proposals to vote',
@@ -39,18 +44,18 @@ export function DaoProposals() {
// Get all the required DAO information
const [daoStorage] = useStorage(DAO_GOVERNANCE_CONTRACT)
- const [governanceParameters] = useGovernanceParameters(daoStorage)
- const [proposals] = useProposals(daoStorage)
- const [representatives] = useRepresentatives(daoStorage)
+ const [governanceParameters] = useDaoGovernanceParameters(daoStorage)
+ const [proposals] = useDaoProposals(daoStorage)
+ const [representatives] = useDaoRepresentatives(daoStorage)
// Get all the required user information
const userAddress = useUserStore((st) => st.address)
const userCommunity = representatives?.[userAddress]
- const [userVotes] = useUserVotes(userAddress, daoStorage)
- const [userCommunityVotes] = useCommunityVotes(userCommunity, daoStorage)
+ const [userVotes] = useDaoUserVotes(userAddress, daoStorage)
+ const [userCommunityVotes] = useDaoCommunityVotes(userCommunity, daoStorage)
// Get all the relevant users aliases
- const [usersAliases] = useUsersAliases(
+ const [usersAliases] = useDaoUsersAliases(
userAddress,
representatives,
proposals
@@ -477,15 +482,15 @@ function ProposalContent({ content }) {
function ProposalVotesSummary({ proposal }) {
// Get all the required DAO information
const [daoStorage] = useStorage(DAO_GOVERNANCE_CONTRACT)
- const [governanceParameters] = useGovernanceParameters(daoStorage)
- const [representatives] = useRepresentatives(daoStorage)
+ const [governanceParameters] = useDaoGovernanceParameters(daoStorage)
+ const [representatives] = useDaoRepresentatives(daoStorage)
// Get all the required user information
const userAddress = useUserStore((st) => st.address)
const userCommunity = representatives?.[userAddress]
- const [userTokenBalance] = useTokenBalance(userAddress)
- const [userVotes] = useUserVotes(userAddress, daoStorage)
- const [userCommunityVotes] = useCommunityVotes(userCommunity, daoStorage)
+ const [userTokenBalance] = useDaoTokenBalance(userAddress)
+ const [userVotes] = useDaoUserVotes(userAddress, daoStorage)
+ const [userCommunityVotes] = useDaoCommunityVotes(userCommunity, daoStorage)
// Get the proposal quorum and governance parameters
const quorum = proposal.quorum
@@ -671,17 +676,17 @@ function VotesDisplay({ title, yes, no, abstain }) {
function ProposalActions(props) {
// Get all the required DAO information
const [daoStorage] = useStorage(DAO_GOVERNANCE_CONTRACT)
- const [governanceParameters] = useGovernanceParameters(daoStorage)
- const [representatives] = useRepresentatives(daoStorage)
- const [, updateProposals] = useProposals(daoStorage)
+ const [governanceParameters] = useDaoGovernanceParameters(daoStorage)
+ const [representatives] = useDaoRepresentatives(daoStorage)
+ const [, updateProposals] = useDaoProposals(daoStorage)
// Get all the required user information
const userAddress = useUserStore((st) => st.address)
const userCommunity = representatives?.[userAddress]
const [userTokenBalance, updateUserTokenBalance] =
- useTokenBalance(userAddress)
- const [userVotes, updateUserVotes] = useUserVotes(userAddress, daoStorage)
- const [communityVotes, updateCommunityVotes] = useCommunityVotes(
+ useDaoTokenBalance(userAddress)
+ const [userVotes, updateUserVotes] = useDaoUserVotes(userAddress, daoStorage)
+ const [communityVotes, updateCommunityVotes] = useDaoCommunityVotes(
userCommunity,
daoStorage
)
diff --git a/src/pages/dao/tabs/Submit.jsx b/src/pages/dao/tabs/Submit.jsx
index 2493df568..cf9028e08 100644
--- a/src/pages/dao/tabs/Submit.jsx
+++ b/src/pages/dao/tabs/Submit.jsx
@@ -7,13 +7,13 @@ import { Button } from '@atoms/button'
import { Line } from '@atoms/line'
import { Select } from '@atoms/select'
import { DaoInput, Textarea } from '@atoms/input'
-import styles from '@style'
import {
- useTokenBalance,
+ useDaoTokenBalance,
useStorage,
- useGovernanceParameters,
- useProposals,
-} from '../hooks'
+ useDaoGovernanceParameters,
+ useDaoProposals,
+} from '@data/swr'
+import styles from '@style'
const PROPOSAL_KINDS = {
text: 'Text proposal',
@@ -28,13 +28,13 @@ export function SubmitDaoProposals() {
// Get all the required DAO information
const [daoStorage] = useStorage(DAO_GOVERNANCE_CONTRACT)
- const [governanceParameters] = useGovernanceParameters(daoStorage)
- const [, updateProposals] = useProposals(daoStorage)
+ const [governanceParameters] = useDaoGovernanceParameters(daoStorage)
+ const [, updateProposals] = useDaoProposals(daoStorage)
// Get all the required user information
const userAddress = useUserStore((st) => st.address)
const [userTokenBalance, updateUserTokenBalance] =
- useTokenBalance(userAddress)
+ useDaoTokenBalance(userAddress)
// Define the callback function to be triggered when a proposal is submitted
const callback = () => {
diff --git a/src/pages/profile/index.jsx b/src/pages/profile/index.jsx
index 4ba468327..0203ee077 100644
--- a/src/pages/profile/index.jsx
+++ b/src/pages/profile/index.jsx
@@ -5,7 +5,7 @@ import { Page } from '@atoms/layout'
import { useParams, useSearchParams, Outlet } from 'react-router-dom'
import useSWR from 'swr'
import { getUser } from '@data/api'
-import { GetUserMetadata, getDaoTokenBalance } from '@data/api'
+import { GetUserMetadata } from '@data/api'
import useSettings from '@hooks/use-settings'
import { validateAddress, ValidationResult } from '@taquito/utils'
import Profile from './profile'
@@ -55,9 +55,6 @@ async function fetchUserInfo(addressOrSubjkt, type = 'user_address') {
user.subjkt = holder.name
}
- const daoTokenBalance = await getDaoTokenBalance(user.address)
- user.daoTokenBalance = daoTokenBalance
-
return user
}
export const useDisplayStore = create(
diff --git a/src/pages/profile/profile.jsx b/src/pages/profile/profile.jsx
index 2c714c440..0e2604c4f 100644
--- a/src/pages/profile/profile.jsx
+++ b/src/pages/profile/profile.jsx
@@ -2,6 +2,7 @@ import useClipboard from 'react-use-clipboard'
import { Button } from '@atoms/button'
import { walletPreview } from '@utils/string'
import Identicon from '@atoms/identicons'
+import { useDaoTokenBalance } from '@data/swr'
import styles from '@style'
import { useDisplayStore } from '.'
import ParticipantList from '@components/collab/manage/ParticipantList'
@@ -11,6 +12,7 @@ export default function Profile({ user }) {
const [isAddressCopied, setAddressCopied] = useClipboard(user.address, {
successDuration: 2500,
})
+ const [daoTokenBalance] = useDaoTokenBalance(user.address)
const coreParticipants = useDisplayStore((st) => st.coreParticipants)
@@ -40,10 +42,9 @@ export default function Profile({ user }) {
{isAddressCopied && 'Copied!'}
- {user.daoTokenBalance >= 0 && (
+ {daoTokenBalance >= 0 && (
- {Math.round(user.daoTokenBalance * 10) / 10}{' '}
- TEIA
+ {Math.round(daoTokenBalance * 10) / 10} TEIA
)}