Commit d4793d80 authored by ThinhNC's avatar ThinhNC

refactor(ocr): consolidate duplicate warning boxes into a single unified disclaimer card

parent 150d32cb
......@@ -181,6 +181,17 @@ export const ReceiptScannerView: React.FC<ReceiptScannerViewProps> = ({ onTransa
return trimmed;
};
const standardWarningTexts = [
"please verify extracted values against the original receipt before creating a transaction.",
"vui lòng đối chiếu các giá trị đã trích xuất với hóa đơn gốc trước khi tạo giao dịch.",
];
const specificWarnings = Array.isArray(extractedData?.warnings)
? extractedData.warnings.filter(
(w) => !standardWarningTexts.includes(w.trim().toLowerCase())
)
: [];
return (
<div className="flex flex-col gap-5 px-2 pb-4 pt-2">
<section className="text-center">
......@@ -400,24 +411,21 @@ export const ReceiptScannerView: React.FC<ReceiptScannerViewProps> = ({ onTransa
</details>
)}
{/* Warnings */}
{Array.isArray(extractedData.warnings) && extractedData.warnings.length > 0 && (
<div className="mt-4 rounded-clay-sm bg-clay-warning/10 p-3 border border-clay-warning/30 text-xs font-medium text-clay-text space-y-1">
<span className="block font-bold text-clay-warning">
{t("ai.ocr.warnings")}:
</span>
{extractedData.warnings.map((warn, i) => (
<p key={i}>• {localizeWarning(warn)}</p>
))}
{/* AI Accuracy Disclaimer & Warnings */}
<div className="mt-4 rounded-xl border border-clay-warning/30 bg-clay-warning/10 p-3 text-left">
<div className="flex items-start gap-2.5">
<AlertTriangleIcon size={16} className="shrink-0 text-clay-warning mt-0.5" />
<p className="font-nunito text-xs text-clay-text-muted leading-relaxed">
{t("ai.ocr.disclaimer")}
</p>
</div>
)}
{/* AI Accuracy Disclaimer Notice */}
<div className="mt-4 flex items-center gap-2 rounded-xl border border-clay-warning/30 bg-clay-warning/10 p-2.5 px-3 text-left">
<AlertTriangleIcon size={15} className="shrink-0 text-clay-warning" />
<p className="font-nunito text-[11px] text-clay-text-muted leading-tight">
{t("ai.ocr.disclaimer")}
</p>
{specificWarnings.length > 0 && (
<div className="mt-2 pt-2 border-t border-clay-warning/20 font-nunito text-[11px] text-clay-text-muted space-y-1 pl-6">
{specificWarnings.map((warn, i) => (
<p key={i}>• {localizeWarning(warn)}</p>
))}
</div>
)}
</div>
{/* Confirm Create Transaction Action */}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment