diff --git a/src/app/demo/[institution]/tx/[id]/page.tsx b/src/app/demo/[institution]/tx/[id]/page.tsx index 6cab7db..f3fd399 100644 --- a/src/app/demo/[institution]/tx/[id]/page.tsx +++ b/src/app/demo/[institution]/tx/[id]/page.tsx @@ -116,7 +116,7 @@ export default function TransactionDetailPage() { {txn.explanation && ( - +

{txn.explanation}

)} diff --git a/src/components/demo/SignalCard.tsx b/src/components/demo/SignalCard.tsx index 08a1b45..0a5740f 100644 --- a/src/components/demo/SignalCard.tsx +++ b/src/components/demo/SignalCard.tsx @@ -1,9 +1,12 @@ "use client"; import { useEffect, useState } from "react"; -import { WarningCircle } from "@phosphor-icons/react"; +import { CheckCircle, WarningCircle } from "@phosphor-icons/react"; import type { Signal } from "@/lib/fable/types"; +/** Signals that lower the score rather than raise it. */ +const IN_FAVOUR = new Set(["tenure"]); + /** * One detected Shield signal. Enters with a staggered slide-up, starting after * the risk score has settled. @@ -22,9 +25,15 @@ export function SignalCard({ signal, index }: { signal: Signal; index: number }) shown ? "translate-y-0 opacity-100" : "translate-y-3 opacity-0" }`} > - - - + {IN_FAVOUR.has(signal.code) ? ( + + + + ) : ( + + + + )}

{signal.label}

{signal.detail}

diff --git a/src/lib/fable/api.ts b/src/lib/fable/api.ts index 5d0a708..b822392 100644 --- a/src/lib/fable/api.ts +++ b/src/lib/fable/api.ts @@ -179,6 +179,7 @@ const SIGNAL_LABELS: Record = { behavioral_anomaly: "Behavioral anomaly", timezone_mismatch: "Timezone mismatch", system_error: "System notice", + tenure: "Long clean history", }; const SIGNAL_WEIGHTS: Record = { amount_anomaly: 0.25, @@ -207,7 +208,7 @@ export function parseApiSignals(raw: string[]): Signal[] { return { code, label: code === "nip_code" ? "NIP risk code" : (SIGNAL_LABELS[code] ?? rawCode.replace(/_/g, " ")), - detail: detail.replace(/\s*\(\+[0-9.]+\)/, "") || "Signal detected", + detail: detail.replace(/\s*\([+-][0-9.]+\)/, "") || "Signal detected", weight: weightMatch ? Number(weightMatch[1]) : (SIGNAL_WEIGHTS[code] ?? 0.1), }; });