fix: one recommendation, one card, and a rate quoted to the basis point

The Advisor's recommendation was rendering twice — EvidencePanel had carried a
'Suggested structure' section since before AdvisorPanel existed. Two cards
holding one recommendation read as two separate recommendations. AdvisorPanel
keeps it, because it also reports whether the manager departed from the advice;
the older section is gone.

Rate was displayed through pct() at one decimal, so a 15.25% loan showed as
15.3% — a different rate, sitting inches from the correct figure. Two decimals.
This commit is contained in:
Yashas 2026-08-18 12:06:11 +05:30
parent 083ee9e8e4
commit f90d5b5d53
2 changed files with 7 additions and 26 deletions

View File

@ -81,7 +81,7 @@ export function AdvisorPanel({ row }: { row: Row }) {
<div className="space-y-4 px-4 py-4">
<div className="grid grid-cols-2 gap-4">
<Row2 label="Amount" value={money(amount)} />
<Row2 label="Rate" value={pct(roi)} hint={roi !== null && roi > 14.5 ? 'deviation-priced' : 'standard grid'} />
<Row2 label="Rate" value={pct(roi, 2)} hint={roi !== null && roi > 14.5 ? 'deviation-priced' : 'standard grid'} />
<Row2 label="Tenor" value={tenure !== null ? `${tenure} months` : ''} hint="shortest that stays in policy" />
<Row2 label="Instalment" value={money(emi)} />
</div>

View File

@ -2,7 +2,7 @@ import { AlertTriangle, Check, Cpu, Scale, X } from 'lucide-react';
import { Badge, Card, Facts } from './core';
import type { Row } from '../api/types';
import { POLICY } from '../api/config';
import { money, moneyShort, num, pct, ratio, ratioPct, reasonCodes, str } from '../format';
import { moneyShort, num, pct, ratio, ratioPct, reasonCodes, str } from '../format';
/**
* The evidence panel why the machine decided what it decided.
@ -323,30 +323,11 @@ export function EvidencePanel({ row }: { row: Row }) {
</section>
)}
{/* The advisory offer, if the advisor has run. Also violet it is a
suggestion, and it lives in different columns from the committed
offer precisely so it can never be mistaken for one. */}
{num(row.ai_suggested_amount) !== null && (
<section className="lift rounded-lg border border-ai-edge bg-ai-soft">
<header className="flex items-center gap-2 border-b border-ai-edge px-4 py-3">
<Cpu className="h-4 w-4 text-ai" />
<h2 className="text-sm font-semibold text-ai">Suggested structure</h2>
<span className="ml-auto text-[11px] text-ai/70">non-binding the RM decides</span>
</header>
<div className="px-4 py-4">
<Facts
cols={2}
rows={[
{ label: 'Amount', value: money(row.ai_suggested_amount) },
{ label: 'Rate', value: `${ratio(row.ai_suggested_roi)}%` },
{ label: 'Tenure', value: `${str(row.ai_suggested_tenure)} months` },
{ label: 'Indicative EMI', value: money(row.ai_suggested_emi) },
{ label: 'Rationale', value: str(row.ai_rationale), wide: true },
]}
/>
</div>
</section>
)}
{/* NB: the advisory structure used to be rendered here too. It now lives
ONLY in AdvisorPanel (right-hand column), which shows the same figures
plus whether the manager who issued the offer took the advice or
departed from it. Two cards carrying one recommendation made the
screen look like two separate recommendations. */}
</div>
);
}