feat: score-history chart on the regime tab
Plots the index, early-warning, and combined scores over time beneath the live gauges, with a 1M/3M/6M/All range toggle and band reference lines — so the trend and any divergence between the scores is visible, not just today's snapshot. - Backend: GET /regime/history + get_regime_history (the three scores per snapshot date from regime_snapshots). - Frontend: recharts line chart, lazy-loaded so recharts ships in its own regime-tab chunk instead of nearly doubling the main bundle. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState, type ReactNode } from 'react';
|
||||
import { useState, lazy, Suspense, type ReactNode } from 'react';
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { PageHeader } from '../components/ui/PageHeader';
|
||||
import { Callout } from '../components/ui/Callout';
|
||||
@@ -15,6 +15,9 @@ import {
|
||||
refreshRegimeFundamentals,
|
||||
getEventStudy,
|
||||
} from '../api/regime';
|
||||
|
||||
// Lazy so recharts (heavy) ships in its own chunk, loaded only on this tab.
|
||||
const ScoreHistoryChart = lazy(() => import('../components/regime/ScoreHistoryChart'));
|
||||
import type {
|
||||
RegimeBand,
|
||||
RegimeSignal,
|
||||
@@ -562,6 +565,9 @@ export default function RegimePage() {
|
||||
regime config.</>
|
||||
}
|
||||
/>
|
||||
<Suspense fallback={<SkeletonCard className="h-72" />}>
|
||||
<ScoreHistoryChart />
|
||||
</Suspense>
|
||||
{monitor.data.breakdown && <Breakdown breakdown={monitor.data.breakdown} />}
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user