Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/StakingVaults/EarnOpportunities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import qs from 'qs'
import { useCallback, useEffect, useMemo } from 'react'
import { useLocation } from 'react-router-dom'

import { useFetchOpportunities } from './hooks/useFetchOpportunities'
import { StakingTable } from './StakingTable'

import { Text } from '@/components/Text'
Expand All @@ -30,6 +31,9 @@ type EarnOpportunitiesProps = {
}

export const EarnOpportunitiesContent = ({ assetId, accountId }: EarnOpportunitiesProps) => {
// Account/asset pages render this section without the earn dashboard mounted, so fetch here too
useFetchOpportunities()

const { navigate } = useBrowserRouter()
const location = useLocation()
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ export const Status: React.FC<StatusProps> = ({ accountId }) => {
}, [accountId, appDispatch, contextDispatch, getOpportunitiesUserData, state?.txid])

const handleViewPosition = useCallback(() => {
if (!accountId) return
// The full-page earn dashboard is mobile-only - the account page shows the position on both layouts
navigate(`/accounts/${accountId}`)
}, [accountId, navigate])
if (!accountId || !assetId) return
// The full-page earn dashboard is mobile-only - the asset account page shows the position on both layouts
navigate(`/accounts/${accountId}/${assetId}`)
}, [accountId, assetId, navigate])
Comment thread
coderabbitai[bot] marked this conversation as resolved.

const handleCancel = useCallback(() => {
navigate(-1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ export const Status: React.FC<StatusProps> = ({ accountId }) => {
}, [accountId, appDispatch, contextDispatch, getOpportunitiesUserData, state?.txid])

const handleViewPosition = useCallback(() => {
if (!accountId) return
// The full-page earn dashboard is mobile-only - the account page shows the position on both layouts
navigate(`/accounts/${accountId}`)
}, [accountId, navigate])
if (!accountId || !assetId) return
// The full-page earn dashboard is mobile-only - the asset account page shows the position on both layouts
navigate(`/accounts/${accountId}/${assetId}`)
}, [accountId, assetId, navigate])

const handleCancel = useCallback(() => {
navigate(-1)
Expand Down
Loading