Skip to content

Commit

Permalink
Do not load the NFT holders table if the holders amount is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoncalves committed Dec 4, 2024
1 parent b970ac8 commit b0b1138
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/treasury/HoldersSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const HoldersSection = () => {
{isError && (
<ErrorMessageAlert message="An error occurred loading Token Holders. Please try again shortly." />
)}
{!isError && holders && holders?.length > 0 && (
{!isError && holders?.length > 0 && (
<>
<Table data={holders} />
{paginationElement}
Expand Down
21 changes: 20 additions & 1 deletion src/app/user/Delegation/DelegateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { isAddressRegex, isChecksumValid } from '@/app/proposals/shared/utils'
import { useAlertContext } from '@/app/providers'
import { TX_MESSAGES } from '@/shared/txMessages'
import { CHAIN_ID } from '@/lib/constants'
import { Address, checksumAddress } from 'viem'

interface DelegateModalProps {
onClose: () => void
Expand Down Expand Up @@ -81,7 +82,25 @@ export const DelegateModal = ({ onClose, onDelegateTxStarted }: DelegateModalPro
fullWidth
labelWrapperProps={{ className: 'text-left mb-[10px]' }}
/>
{error && <p className="text-st-error">{error}</p>}
{error && (
<p className="text-st-error">
{error === 'Address has invalid checksum.' ? (
<>
{error + ' '}
<span
className="font-normal underline cursor-pointer"
onClick={() =>
onAddressChange(checksumAddress(addressToDelegateTo as Address, Number(CHAIN_ID)))
}
>
Fix address.
</span>
</>
) : (
error
)}
</p>
)}
</div>
{/* Button */}
<div className="flex flex-row justify-center gap-4">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/communities/nft/[address].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export default function Page() {
</div>
</div>
{/* Holders list */}
<NftHoldersSection address={nftAddress} />
{membersCount > 0 && <NftHoldersSection address={nftAddress} />}
</MainContainer>
)
}
Expand Down

0 comments on commit b0b1138

Please sign in to comment.