feat: instrument analysis

This commit is contained in:
OpenSquared
2026-07-24 17:17:20 +02:00
parent adfe520863
commit de0675705b
3 changed files with 37 additions and 8 deletions

View File

@@ -140,8 +140,15 @@ function NormalRoutes() {
const location = useLocation()
if (KEEP_ALIVE_PATHS.has(location.pathname)) return null
// On instrument paths the keep-alive layer renders the UI; this Routes just registers the tab
const isInstrument = /^\/instruments\/\w/.test(location.pathname)
// On instrument paths the keep-alive layer renders the UI; this Routes just registers the tab.
// Was `/^\/instruments\/\w/` (required a word char right after the slash) — encoded ids
// that start with a character encodeURIComponent escapes (^GSPC -> %5EGSPC) begin with
// "%", which isn't \w, so this evaluated false for that tab. isInstrument then picked
// 'flex-1 overflow-auto' instead of 'hidden' for this otherwise-empty div, and — since
// InstrumentKeepAlive's own div is ALSO flex-1 in the same flex column — the two split
// the available height roughly 50/50 instead of the instrument page getting all of it,
// which is exactly the "page only fills half the screen" symptom.
const isInstrument = location.pathname.startsWith('/instruments/')
return (
<div className={isInstrument ? 'hidden' : 'flex-1 overflow-auto'}>

View File

@@ -69,7 +69,13 @@ export default function TabBar() {
{/* Dynamic instrument tabs */}
{instrumentIds.map(id => {
const path = `/instruments/${id}`
const isActive = activePath.toLowerCase() === path.toLowerCase()
// activePath keeps its percent-encoding (EURUSD=X -> /instruments/EURUSD%3DX)
// while `id` is already decoded — same mismatch fixed in App.tsx's
// InstrumentKeepAlive, needed again here or this tab never lights up as active
// for any id containing a character encodeURIComponent escapes ("=").
let decodedActivePath = activePath
try { decodedActivePath = decodeURIComponent(activePath) } catch { /* malformed sequence, compare as-is */ }
const isActive = decodedActivePath.toLowerCase() === path.toLowerCase()
return (
<button
key={id}