fix: Résumé IA inline color, tooltip Implied Pts custom renderer, tryUrl cancel

- NarrativeButton: style inline pour forcer #94a3b8 (imbattable vs bundle CDN caché)
- CurrencyCard: Tooltip Implied Pts remplacé par custom content renderer (text visible)
- investinglive.ts: res.body.cancel() en fire-and-forget (ne masque plus le succès)
  + console.log article courant/précédent pour diagnostic dans logs Vercel

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
caty21
2026-06-27 20:12:21 +02:00
co-authored by Claude Sonnet 4.6
parent a978f19088
commit ec248744b1
3 changed files with 23 additions and 10 deletions
+12 -4
View File
@@ -561,10 +561,18 @@ function OISEnhancedBlock({ ratePath }: { ratePath: CBRatePath }) {
tickFormatter={(v: number) => `${v}bps`} /> tickFormatter={(v: number) => `${v}bps`} />
<ReferenceLine y={0} stroke="#334155" strokeWidth={0.5} /> <ReferenceLine y={0} stroke="#334155" strokeWidth={0.5} />
<Tooltip <Tooltip
contentStyle={{ background: "#0f172a", border: "1px solid #334155", borderRadius: 6, fontSize: 9 }} content={({ label, payload }) => {
labelStyle={{ color: "#94a3b8", fontSize: 9 }} if (!payload?.length) return null;
itemStyle={{ color: "#e2e8f0", fontSize: 9 }} const v = payload[0]?.value as number;
formatter={(v: number) => [`${v > 0 ? "+" : ""}${v.toFixed(1)}bps`, "Implied"]} return (
<div style={{ background: "#0f172a", border: "1px solid #334155", borderRadius: 6, padding: "4px 8px" }}>
<p style={{ color: "#94a3b8", fontSize: 9, margin: 0 }}>{label}</p>
<p style={{ color: "#e2e8f0", fontSize: 9, margin: "2px 0 0" }}>
Implied&nbsp;: {v > 0 ? "+" : ""}{typeof v === "number" ? v.toFixed(1) : "—"}bps
</p>
</div>
);
}}
/> />
<Bar dataKey="bps" radius={[2, 2, 0, 0]}> <Bar dataKey="bps" radius={[2, 2, 0, 0]}>
{impliedPtsData.map((entry, i) => ( {impliedPtsData.map((entry, i) => (
+4 -1
View File
@@ -45,7 +45,10 @@ export default function NarrativeButton({ currency, phase, macroScore }: Props)
<button <button
onClick={run} onClick={run}
disabled={loading} disabled={loading}
className="flex items-center gap-1 text-[10px] text-slate-400 hover:text-slate-200 disabled:opacity-50 transition-colors px-2 py-1" style={{ color: '#94a3b8' }}
onMouseEnter={e => (e.currentTarget.style.color = '#e2e8f0')}
onMouseLeave={e => (e.currentTarget.style.color = '#94a3b8')}
className="flex items-center gap-1 text-[10px] disabled:opacity-50 transition-colors px-2 py-1"
> >
<Sparkles size={11} /> <Sparkles size={11} />
{loading ? "Analyse…" : "Résumé IA"} {loading ? "Analyse…" : "Résumé IA"}
+7 -5
View File
@@ -52,19 +52,18 @@ async function tryUrl(daysAgo: number): Promise<ArticleRef | null> {
const dateStr = `${yyyymmdd.slice(0,4)}-${yyyymmdd.slice(4,6)}-${yyyymmdd.slice(6,8)}`; const dateStr = `${yyyymmdd.slice(0,4)}-${yyyymmdd.slice(4,6)}-${yyyymmdd.slice(6,8)}`;
const url = `https://investinglive.com/news/how-have-interest-rate-expectations-changed-after-this-weeks-event-${yyyymmdd}/`; const url = `https://investinglive.com/news/how-have-interest-rate-expectations-changed-after-this-weeks-event-${yyyymmdd}/`;
try { try {
// GET au lieu de HEAD — certains serveurs WordPress refusent HEAD (405/404 même si la page existe)
const res = await fetch(url, { const res = await fetch(url, {
method: "GET", method: "GET",
headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124.0.0.0 Safari/537.36" }, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124.0.0.0 Safari/537.36" },
cache: "no-store", cache: "no-store",
}); });
if (!res.ok) return null; if (!res.ok) return null;
await res.body?.cancel(); // libère la connexion sans télécharger le body // Cancel séparé pour ne pas masquer le succès en cas d'erreur de libération
res.body?.cancel().catch(() => {});
return { url, dateStr, daysAgo }; return { url, dateStr, daysAgo };
} catch { return null; } } catch { return null; }
} }
// Find current article (last 14 days) + previous article (14 days before current, up to 21 days)
async function findArticleRefs(): Promise<{ current: ArticleRef | null; previous: ArticleRef | null }> { async function findArticleRefs(): Promise<{ current: ArticleRef | null; previous: ArticleRef | null }> {
let current: ArticleRef | null = null; let current: ArticleRef | null = null;
@@ -73,15 +72,18 @@ async function findArticleRefs(): Promise<{ current: ArticleRef | null; previous
if (found) { current = found; break; } if (found) { current = found; break; }
} }
console.log(`[IL] article courant : ${current ? `day=${current.daysAgo} url=${current.url}` : "introuvable (014 jours)"}`);
if (!current) return { current: null, previous: null }; if (!current) return { current: null, previous: null };
let previous: ArticleRef | null = null; let previous: ArticleRef | null = null;
// Start the day after the current article and look up to 28 days further back const searchFrom = current.daysAgo + 1;
for (let d = current.daysAgo + 1; d <= current.daysAgo + 28; d++) { const searchTo = current.daysAgo + 28;
for (let d = searchFrom; d <= searchTo; d++) {
const found = await tryUrl(d); const found = await tryUrl(d);
if (found) { previous = found; break; } if (found) { previous = found; break; }
} }
console.log(`[IL] article précédent : ${previous ? `day=${previous.daysAgo} url=${previous.url}` : `introuvable (day ${searchFrom}${searchTo})`}`);
return { current, previous }; return { current, previous };
} }