'use client'; import { useQuery } from '@tanstack/react-query'; import { apiFetch, type FinancialSignal } from '../../../lib/api'; import { useSession } from '../../../components/session-provider'; const SEVERITY_COLOR: Record = { critical: 'bg-red-500/10 text-red-600 border-red-500/30', high: 'bg-orange-500/10 text-orange-600 border-orange-500/30', medium: 'bg-yellow-500/10 text-yellow-700 border-yellow-500/30', low: 'bg-green-500/10 text-green-700 border-green-500/30', info: 'bg-blue-500/10 text-blue-600 border-blue-500/30', }; const CATEGORY_LABEL: Record = { macro: 'Macro', fx: 'FX', rates: 'Rate', commodity: 'Commodity', news: 'Știri', }; export default function MarketPage() { const { activeTenant } = useSession(); const tenantId = activeTenant?.tenantId ?? null; const { data: signals = [], isLoading, error } = useQuery({ queryKey: ['financial-signals', tenantId], queryFn: () => apiFetch('/v1/financial-intelligence/signals?limit=100', { tenantId }), enabled: true, staleTime: 5 * 60 * 1000, }); const byCategory = signals.reduce>((acc, s) => { const cat = s.category ?? 'other'; if (!acc[cat]) acc[cat] = []; acc[cat].push(s); return acc; }, {}); if (isLoading) return (
{[...Array(3)].map((_, i) => (
))}
); if (error) return (
Nu pot încărca semnalele de piață.
); if (signals.length === 0) return (

Market Intelligence

Nicio dată disponibilă

Activează workflow-ul 08 Economic Data API din n8n pentru a incepe colectarea automată a datelor macro, FX și știri la fiecare 6h.

  1. Deschide n8n → căutați "08 Economic Data API"
  2. Toggle ON → datele apar în ~1 minut
); return (

Market Intelligence

{signals.length} semnale · actualizat automat la 6h

{Object.entries(byCategory).map(([cat, items]) => (

{CATEGORY_LABEL[cat] ?? cat}

{items.map((s) => (

{s.title}

{s.severity}
{s.summary && (

{s.summary}

)}
{s.rawValue != null && ( {Number(s.rawValue).toLocaleString('ro-RO', { maximumFractionDigits: 2 })} {s.unit ? ` ${s.unit}` : ''} {s.changePercent != null ? ` (${Number(s.changePercent) >= 0 ? '+' : ''}${Number(s.changePercent).toFixed(2)}%)` : ''} )} {s.region} {new Date(s.publishedAt).toLocaleDateString('ro-RO')}
))}
))}
); }