feat: instrument analysis
This commit is contained in:
@@ -100,7 +100,7 @@ function KeepAlivePage({ path, component: Component }: { path: string; component
|
||||
|
||||
// Registers the instrument tab on navigation (renders nothing itself)
|
||||
function InstrumentRoute() {
|
||||
const { id = 'EURUSD' } = useParams<{ id: string }>()
|
||||
const { id = localStorage.getItem('last_instrument') || 'EURUSD' } = useParams<{ id: string }>()
|
||||
const { openInstrument } = useTabs()
|
||||
useEffect(() => { openInstrument(id.toUpperCase()) }, [id, openInstrument])
|
||||
return null
|
||||
@@ -112,7 +112,7 @@ function InstrumentKeepAlive({ id }: { id: string }) {
|
||||
const isActive = location.pathname.toLowerCase() === `/instruments/${id.toLowerCase()}`
|
||||
return (
|
||||
<div className={isActive ? 'flex-1 min-h-0 overflow-y-auto' : 'hidden'}>
|
||||
<InstrumentDashboard instrumentIdProp={id} />
|
||||
<InstrumentDashboard instrumentIdProp={id} isVisible={isActive} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -129,7 +129,7 @@ function NormalRoutes() {
|
||||
return (
|
||||
<div className={isInstrument ? 'hidden' : 'flex-1 overflow-auto'}>
|
||||
<Routes>
|
||||
<Route path="/instruments" element={<Navigate to="/instruments/EURUSD" replace />} />
|
||||
<Route path="/instruments" element={<Navigate to={`/instruments/${localStorage.getItem('last_instrument') || 'EURUSD'}`} replace />} />
|
||||
<Route path="/instruments/:id" element={<InstrumentRoute />} />
|
||||
{/* Legacy redirects */}
|
||||
<Route path="/impact" element={<Navigate to="/market-events" replace />} />
|
||||
|
||||
Reference in New Issue
Block a user