Skip to content

Commit

Permalink
hiding delegate button if no wallet connected
Browse files Browse the repository at this point in the history
  • Loading branch information
Ncookiez committed Jun 21, 2024
1 parent c36e139 commit 2e1d530
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions apps/app/src/components/Vault/VaultPageButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { DelegateButton, DepositButton, WithdrawButton } from '@shared/react-com
import classNames from 'classnames'
import * as fathom from 'fathom-client'
import { useTranslations } from 'next-intl'
import { useAccount } from 'wagmi'
import { FATHOM_EVENTS } from '@constants/config'

interface VaultPageButtonsProps {
Expand All @@ -16,6 +17,8 @@ export const VaultPageButtons = (props: VaultPageButtonsProps) => {
const t_common = useTranslations('Common')
const t_tooltips = useTranslations('Tooltips')

const { address: userAddress } = useAccount()

return (
<div className={classNames('flex items-center gap-2 md:gap-4', className)}>
<DepositButton
Expand All @@ -30,13 +33,15 @@ export const VaultPageButtons = (props: VaultPageButtonsProps) => {
>
{t_common('withdraw')}
</WithdrawButton>
<DelegateButton
vault={vault}
extraOnClick={() => fathom.trackEvent(FATHOM_EVENTS.openedDelegateModal)}
color='transparent'
>
{t_common('delegate')}
</DelegateButton>
{!!userAddress && (
<DelegateButton
vault={vault}
extraOnClick={() => fathom.trackEvent(FATHOM_EVENTS.openedDelegateModal)}
color='transparent'
>
{t_common('delegate')}
</DelegateButton>
)}
</div>
)
}

0 comments on commit 2e1d530

Please sign in to comment.