Skip to content

Commit

Permalink
fix: Display Activate now button in sidebar for counterfactual safes
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Oct 2, 2024
1 parent 6cd64f8 commit a623664
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/sidebar/NewTxButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ActivateAccountButton from '@/features/counterfactual/ActivateAccountButton'
import useIsCounterfactualSafe from '@/features/counterfactual/hooks/useIsCounterfactualSafe'
import { type ReactElement, useContext } from 'react'
import Button from '@mui/material/Button'
import { OVERVIEW_EVENTS, trackEvent } from '@/services/analytics'
Expand All @@ -8,12 +10,17 @@ import WatchlistAddButton from '../WatchlistAddButton'

const NewTxButton = (): ReactElement => {
const { setTxFlow } = useContext(TxModalContext)
const isCounterfactualSafe = useIsCounterfactualSafe()

const onClick = () => {
setTxFlow(<NewTxFlow />, undefined, false)
trackEvent({ ...OVERVIEW_EVENTS.NEW_TRANSACTION, label: 'sidebar' })
}

if (isCounterfactualSafe) {
return <ActivateAccountButton />
}

return (
<CheckWallet allowSpendingLimit noTooltip>
{(isOk) =>
Expand Down
1 change: 1 addition & 0 deletions src/features/counterfactual/ActivateAccountButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const ActivateAccountButton = () => {
data-testid="activate-account-btn-cf"
variant="contained"
size="small"
fullWidth
onClick={activateAccount}
disabled={isProcessing || !isOk}
sx={{ minHeight: '40px' }}
Expand Down

0 comments on commit a623664

Please sign in to comment.