diff --git a/src/app/communities/HolderColumn.tsx b/src/app/communities/HolderColumn.tsx new file mode 100644 index 00000000..222a173d --- /dev/null +++ b/src/app/communities/HolderColumn.tsx @@ -0,0 +1,23 @@ +import { Span } from '@/components/Typography' +import { EXPLORER_URL } from '@/lib/constants' +import { RxExternalLink } from 'react-icons/rx' + +interface HolderColumnProps { + address: string + rns?: string + image?: string +} + +export const HolderColumn = ({ address, rns, image }: HolderColumnProps) => ( + + Holders Image + + {rns || address} + + + +) diff --git a/src/app/communities/NftHoldersSection.tsx b/src/app/communities/NftHoldersSection.tsx index 03f996d3..64c67c98 100644 --- a/src/app/communities/NftHoldersSection.tsx +++ b/src/app/communities/NftHoldersSection.tsx @@ -10,27 +10,7 @@ import { useState } from 'react' import { TableIcon } from '@/app/communities/TableIcon' import { SquareIcon } from '@/app/communities/SquareIcon' import { ErrorMessageAlert } from '@/components/ErrorMessageAlert/ErrorMessageAlert' - -interface HolderColumnProps { - address: string - rns?: string - image?: string -} -const HolderColumn = ({ address, rns, image }: HolderColumnProps) => { - return ( - - Holders Image - - {rns || address} - - - - ) -} +import { HolderColumn } from './HolderColumn' interface IdNumberColumnProps { id: string diff --git a/src/app/user/Delegation/DelegationSection.tsx b/src/app/user/Delegation/DelegationSection.tsx new file mode 100644 index 00000000..1fa8fe15 --- /dev/null +++ b/src/app/user/Delegation/DelegationSection.tsx @@ -0,0 +1,29 @@ +import { HolderColumn } from '@/app/communities/HolderColumn' +import { Table } from '@/components/Table' +import { HeaderTitle } from '@/components/Typography' +import { useAccount } from 'wagmi' +import { RenderTotalBalance } from '../Balances/RenderTotalBalance' +import { BalancesProvider } from '../Balances/context/BalancesContext' +import { useGetDelegates } from './hooks/useGetDelegates' + +export const DelegationSection = () => { + const { address } = useAccount() + const { delegateeAddress } = useGetDelegates(address) + + if (!delegateeAddress || delegateeAddress === address) { + return null + } + + const delegatee = { + 'Voting Power Delegated': , + Amount: , + } + return ( + <> + Delegation + + + + + ) +} diff --git a/src/app/user/Delegation/hooks/useGetDelegates.tsx b/src/app/user/Delegation/hooks/useGetDelegates.tsx new file mode 100644 index 00000000..5073ce66 --- /dev/null +++ b/src/app/user/Delegation/hooks/useGetDelegates.tsx @@ -0,0 +1,21 @@ +import { StRIFTokenAbi } from '@/lib/abis/StRIFTokenAbi' +import { tokenContracts } from '@/lib/contracts' +import { Address } from 'viem' +import { useReadContract } from 'wagmi' + +const stRifContract = { + abi: StRIFTokenAbi, + address: tokenContracts.stRIF, +} + +export const useGetDelegates = (address: Address | undefined) => { + const { data: delegateeAddress } = useReadContract( + address && { + ...stRifContract, + functionName: 'delegates', + args: [address], + }, + ) + + return { delegateeAddress } +} diff --git a/src/app/user/Delegation/index.ts b/src/app/user/Delegation/index.ts new file mode 100644 index 00000000..2f903119 --- /dev/null +++ b/src/app/user/Delegation/index.ts @@ -0,0 +1 @@ +export * from './DelegationSection' diff --git a/src/app/user/page.tsx b/src/app/user/page.tsx index fe175e8b..6c331eec 100644 --- a/src/app/user/page.tsx +++ b/src/app/user/page.tsx @@ -9,6 +9,7 @@ import { withBuilderButton, useGetBuilderToGauge } from '@/app/collective-reward import { TxStatusMessage } from '@/components/TxStatusMessage' import { zeroAddress } from 'viem' import { useHandleErrors } from '@/app/collective-rewards/utils' +import { DelegationSection } from './Delegation' type MyHoldingsProps = { showBuilderButton?: boolean @@ -18,6 +19,7 @@ const MyHoldings = ({ showBuilderButton = false }: MyHoldingsProps) => ( <> + ) diff --git a/src/components/Table/index.ts b/src/components/Table/index.ts index c55a8cb2..6c3e3747 100644 --- a/src/components/Table/index.ts +++ b/src/components/Table/index.ts @@ -1,2 +1,2 @@ export * from './components' -export { Table } from './Table' +export * from './Table'