rohitsar567 Claude Opus 4.7 (1M context) commited on
Commit
bb734ab
Β·
1 Parent(s): 1e171b7

fix(#66): enrich the sparse POLICY DETAILS expander

Browse files

The expander showed only policy name + insurer + PDF link (user: 'what
is the point of this'). PolicyDetails now takes the resolved
marketplacePolicy and renders the key decision facts when present:
Cover, Grade, No-claim bonus, Pre-existing wait, Initial wait, Room
rent, Co-pay, Network hospitals, Max entry age β€” each row only shown
when the value exists (no fabricated/empty rows). citation-only fallback
unchanged when no marketplace row resolves.

tsc clean; frontend build green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

frontend/src/components/PolicyCompareModal.tsx CHANGED
@@ -679,7 +679,7 @@ function CompareColumn({
679
  </Section>
680
 
681
  {/* POLICY DETAILS expandable */}
682
- <PolicyDetails citation={citation} />
683
  </div>
684
  );
685
  }
@@ -1409,7 +1409,13 @@ function ScorecardFallback({ policyId }: { policyId: string }) {
1409
  );
1410
  }
1411
 
1412
- function PolicyDetails({ citation }: { citation: Citation }) {
 
 
 
 
 
 
1413
  const [open, setOpen] = useState(false);
1414
  const hasSource = !!citation.source_url && citation.source_url.startsWith("http");
1415
  const pageRange =
@@ -1484,6 +1490,54 @@ function PolicyDetails({ citation }: { citation: Citation }) {
1484
  value={citation.insurer_slug.replace(/-/g, " ")}
1485
  />
1486
  {pageRange && <DetailRow label="Cited" value={pageRange} />}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1487
  {hasSource ? (
1488
  <a
1489
  href={citation.source_url}
 
679
  </Section>
680
 
681
  {/* POLICY DETAILS expandable */}
682
+ <PolicyDetails citation={citation} policy={marketplacePolicy} />
683
  </div>
684
  );
685
  }
 
1409
  );
1410
  }
1411
 
1412
+ function PolicyDetails({
1413
+ citation,
1414
+ policy,
1415
+ }: {
1416
+ citation: Citation;
1417
+ policy?: MarketplacePolicy;
1418
+ }) {
1419
  const [open, setOpen] = useState(false);
1420
  const hasSource = !!citation.source_url && citation.source_url.startsWith("http");
1421
  const pageRange =
 
1490
  value={citation.insurer_slug.replace(/-/g, " ")}
1491
  />
1492
  {pageRange && <DetailRow label="Cited" value={pageRange} />}
1493
+ {/* #66 β€” enrich the sparse expander with the key decision facts
1494
+ already on the resolved marketplace row (was just name +
1495
+ insurer + PDF, which the user flagged as pointless). */}
1496
+ {policy &&
1497
+ (() => {
1498
+ const rows: [string, string][] = [];
1499
+ const cov = fmtSumInsured(policy);
1500
+ if (cov) rows.push(["Cover", cov]);
1501
+ if (policy.grade)
1502
+ rows.push([
1503
+ "Grade",
1504
+ `${policy.grade} Β· ${policy.overall_score}/100`,
1505
+ ]);
1506
+ if (policy.no_claim_bonus_pct != null)
1507
+ rows.push([
1508
+ "No-claim bonus",
1509
+ `+${policy.no_claim_bonus_pct}% per claim-free year`,
1510
+ ]);
1511
+ if (policy.pre_existing_disease_waiting_months != null)
1512
+ rows.push([
1513
+ "Pre-existing wait",
1514
+ `${policy.pre_existing_disease_waiting_months} months`,
1515
+ ]);
1516
+ if (policy.initial_waiting_period_days != null)
1517
+ rows.push([
1518
+ "Initial wait",
1519
+ `${policy.initial_waiting_period_days} days`,
1520
+ ]);
1521
+ if (policy.room_rent_capping)
1522
+ rows.push(["Room rent", policy.room_rent_capping]);
1523
+ if (policy.copayment_pct != null)
1524
+ rows.push([
1525
+ "Co-pay",
1526
+ policy.copayment_pct ? `${policy.copayment_pct}%` : "None",
1527
+ ]);
1528
+ if (policy.network_count_official != null)
1529
+ rows.push([
1530
+ "Network",
1531
+ `${policy.network_count_official.toLocaleString(
1532
+ "en-IN",
1533
+ )}+ cashless hospitals`,
1534
+ ]);
1535
+ if (policy.max_entry_age != null)
1536
+ rows.push(["Max entry age", `${policy.max_entry_age} yrs`]);
1537
+ return rows.map(([l, v]) => (
1538
+ <DetailRow key={l} label={l} value={v} />
1539
+ ));
1540
+ })()}
1541
  {hasSource ? (
1542
  <a
1543
  href={citation.source_url}