Skip to content

Commit 388952c

Browse files
authored
fix: Navigate Valuation Rules stat chip to /reference-data/valuation-rules (#1657)
Replace scroll-to-graph behavior with navigation to the dedicated Valuation Rules list page, consistent with other stat chips. Remove unused scrollToGraph callback and useCallback import. Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>
1 parent 36b6352 commit 388952c

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

frontend/src/features/economy/pages/economy-overview-page.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,18 @@ describe('EconomyOverviewPage', () => {
238238
expect(statsBar.querySelector('[data-testid="stat-instruments"]')).toBeInTheDocument()
239239
})
240240

241+
it('clicking Valuation Rules stat chip navigates to /reference-data/valuation-rules', async () => {
242+
renderPage()
243+
244+
await waitFor(() => {
245+
expect(screen.getByTestId('stat-valuation-rules')).toBeInTheDocument()
246+
})
247+
248+
const chip = screen.getByTestId('stat-valuation-rules').closest('button')!
249+
await userEvent.click(chip)
250+
expect(mockNavigate).toHaveBeenCalledWith('/reference-data/valuation-rules')
251+
})
252+
241253
it('stat cards are clickable buttons', async () => {
242254
renderPage()
243255

frontend/src/features/economy/pages/economy-overview-page.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useCallback } from 'react'
21
import { useQuery } from '@tanstack/react-query'
32
import { useNavigate } from 'react-router-dom'
43
import { ConnectError, Code } from '@connectrpc/connect'
@@ -94,10 +93,6 @@ export function EconomyOverviewPage() {
9493
queryFn: () => manifestHistory.getCurrentManifest({}),
9594
})
9695

97-
const scrollToGraph = useCallback(() => {
98-
document.getElementById('relationship-graph')?.scrollIntoView({ behavior: 'smooth' })
99-
}, [])
100-
10196
const isNotFound = error instanceof ConnectError && error.code === Code.NotFound
10297

10398
const content = (() => {
@@ -149,7 +144,7 @@ export function EconomyOverviewPage() {
149144
<StatChip label="Instruments" value={instruments.length} testId="stat-instruments" onClick={() => navigate('/reference-data/instruments')} />
150145
<StatChip label="Account Types" value={accountTypes.length} testId="stat-account-types" onClick={() => navigate('/reference-data/account-types')} />
151146
<StatChip label="Sagas" value={sagas.length} testId="stat-sagas" onClick={() => navigate('/starlark-config')} />
152-
<StatChip label="Valuation Rules" value={valuationRules.length} testId="stat-valuation-rules" onClick={scrollToGraph} />
147+
<StatChip label="Valuation Rules" value={valuationRules.length} testId="stat-valuation-rules" onClick={() => navigate('/reference-data/valuation-rules')} />
153148
</div>
154149

155150
{/* Relationship graph */}

0 commit comments

Comments
 (0)