feat: instrument analysis

This commit is contained in:
OpenSquared
2026-06-28 23:43:52 +02:00
parent 3d7b3e47c9
commit 3bcecdab09
2 changed files with 22 additions and 14 deletions

View File

@@ -170,13 +170,14 @@ const CAT_TO_CAUSAL_INST: Record<string, string[]> = {
crypto: [],
}
const CAUSAL_CAT_TW: Record<string, string> = {
macro_us: 'text-blue-400 border-blue-700/30 bg-blue-900/20',
macro_eu: 'text-cyan-400 border-cyan-700/30 bg-cyan-900/20',
geopolitical: 'text-red-400 border-red-700/30 bg-red-900/20',
report: 'text-amber-400 border-amber-700/30 bg-amber-900/20',
sentiment: 'text-violet-400 border-violet-700/30 bg-violet-900/20',
commodity: 'text-orange-400 border-orange-700/30 bg-orange-900/20',
// Keyed by market_event.category — same palette as the ★ stars on the chart
const EV_CAT_TW: Record<string, string> = {
event_calendar: 'text-amber-400 border-amber-700/40 bg-amber-900/20',
geopolitical: 'text-red-400 border-red-700/40 bg-red-900/20',
fundamental: 'text-emerald-400 border-emerald-700/40 bg-emerald-900/20',
report: 'text-blue-400 border-blue-700/40 bg-blue-900/20',
sentiment: 'text-violet-400 border-violet-700/40 bg-violet-900/20',
technical: 'text-cyan-400 border-cyan-700/40 bg-cyan-900/20',
}
// ── Macro regime colour mapping ───────────────────────────────────────────────
@@ -852,7 +853,7 @@ function CausalFrise({
{/* Chips */}
{placed.map(({ ev, tmpl, x1, w, lane, active }) => {
const catTw = CAUSAL_CAT_TW[tmpl.category] ?? 'text-slate-400 border-slate-700/30 bg-slate-800/40'
const catTw = EV_CAT_TW[ev.category] ?? 'text-slate-400 border-slate-700/30 bg-slate-800/40'
const chipY = lane * FRISE_LANE_H + FRISE_CHIP_PAD
const isOpen = activeChip?.ev.id === ev.id && activeChip?.tmpl.id === tmpl.id
const charsFit = Math.floor((w - 18) / 5.5)
@@ -905,8 +906,8 @@ function CausalFrise({
<div className="flex items-start gap-2 mb-1.5 pr-4">
<span className="flex-1 text-xs font-semibold text-slate-200 leading-tight line-clamp-2">{tmpl.name}</span>
<span className={clsx('text-[9px] px-1 py-0.5 rounded border shrink-0',
CAUSAL_CAT_TW[tmpl.category] ?? 'text-slate-500 border-slate-700/30'
)}>{tmpl.category}</span>
EV_CAT_TW[ev.category] ?? 'text-slate-500 border-slate-700/30'
)}>{ev.category}</span>
</div>
<div className="text-[10px] text-slate-400 truncate mb-1.5">{ev.title}</div>