Spaces:
Sleeping
Sleeping
fix: web/app/dashboard-pages/analyze/page.tsx — NOT_APPLICABLE regulation rendering
Browse files
web/app/dashboard-pages/analyze/page.tsx
CHANGED
|
@@ -20,7 +20,7 @@ interface Entity { text: string; type: string; score?: number; source?: string;
|
|
| 20 |
interface Contradiction { type: string; explanation: string; severity: string; confidence?: number; source?: string; }
|
| 21 |
interface Obligation { type: string; party: string; description: string; deadline: string; priority?: number; }
|
| 22 |
interface ComplianceCheck { requirement: string; description: string; severity: string; status: string; matched_keywords: string[]; context?: string[]; }
|
| 23 |
-
interface ComplianceReg { description: string; compliance_rate: number; checks: ComplianceCheck[]; overall_status: string; negated_count?: number; ambiguous_count?: number; }
|
| 24 |
interface Redline {
|
| 25 |
original_text: string;
|
| 26 |
clause_label: string;
|
|
@@ -101,6 +101,7 @@ const COMPLIANCE_STATUS: Record<string, { bg: string; text: string; border: stri
|
|
| 101 |
PARTIAL: { bg: "bg-amber-50", text: "text-amber-700", border: "border-amber-200" },
|
| 102 |
"NON-COMPLIANT": { bg: "bg-red-50", text: "text-red-700", border: "border-red-200" },
|
| 103 |
WARNING: { bg: "bg-orange-50", text: "text-orange-700", border: "border-orange-200" },
|
|
|
|
| 104 |
};
|
| 105 |
|
| 106 |
function SourceBadge({ isML, confidence }: { isML: boolean; confidence?: number | null }) {
|
|
@@ -659,8 +660,9 @@ export default function AnalyzePage() {
|
|
| 659 |
</div>
|
| 660 |
) : Object.entries(results.compliance).map(([regName, reg]) => {
|
| 661 |
const status = COMPLIANCE_STATUS[reg.overall_status] || COMPLIANCE_STATUS.PARTIAL;
|
|
|
|
| 662 |
return (
|
| 663 |
-
<div key={regName} className=
|
| 664 |
<div className={`flex flex-col sm:flex-row sm:items-center justify-between p-4 border-b ${status.bg} ${status.border}`}>
|
| 665 |
<div>
|
| 666 |
<div className="flex items-center gap-2 flex-wrap">
|
|
@@ -679,10 +681,15 @@ export default function AnalyzePage() {
|
|
| 679 |
<p className="text-[11px] text-zinc-500 mt-0.5">{reg.description}</p>
|
| 680 |
</div>
|
| 681 |
<div className="text-left sm:text-right mt-2 sm:mt-0">
|
| 682 |
-
<span className={`text-lg font-bold ${status.text}`}>{reg.compliance_rate}%</span>
|
| 683 |
<span className={`text-[11px] font-medium block ${status.text}`}>{reg.overall_status}</span>
|
| 684 |
</div>
|
| 685 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 686 |
<div className="p-3 space-y-0.5">
|
| 687 |
{reg.checks.map((check, i) => {
|
| 688 |
const sev = SEV_CONFIG[check.severity] || SEV_CONFIG.MEDIUM;
|
|
@@ -709,6 +716,7 @@ export default function AnalyzePage() {
|
|
| 709 |
);
|
| 710 |
})}
|
| 711 |
</div>
|
|
|
|
| 712 |
</div>
|
| 713 |
);
|
| 714 |
})}
|
|
|
|
| 20 |
interface Contradiction { type: string; explanation: string; severity: string; confidence?: number; source?: string; }
|
| 21 |
interface Obligation { type: string; party: string; description: string; deadline: string; priority?: number; }
|
| 22 |
interface ComplianceCheck { requirement: string; description: string; severity: string; status: string; matched_keywords: string[]; context?: string[]; }
|
| 23 |
+
interface ComplianceReg { description: string; compliance_rate: number; checks: ComplianceCheck[]; overall_status: string; negated_count?: number; ambiguous_count?: number; note?: string; }
|
| 24 |
interface Redline {
|
| 25 |
original_text: string;
|
| 26 |
clause_label: string;
|
|
|
|
| 101 |
PARTIAL: { bg: "bg-amber-50", text: "text-amber-700", border: "border-amber-200" },
|
| 102 |
"NON-COMPLIANT": { bg: "bg-red-50", text: "text-red-700", border: "border-red-200" },
|
| 103 |
WARNING: { bg: "bg-orange-50", text: "text-orange-700", border: "border-orange-200" },
|
| 104 |
+
NOT_APPLICABLE: { bg: "bg-zinc-50", text: "text-zinc-400", border: "border-zinc-200" },
|
| 105 |
};
|
| 106 |
|
| 107 |
function SourceBadge({ isML, confidence }: { isML: boolean; confidence?: number | null }) {
|
|
|
|
| 660 |
</div>
|
| 661 |
) : Object.entries(results.compliance).map(([regName, reg]) => {
|
| 662 |
const status = COMPLIANCE_STATUS[reg.overall_status] || COMPLIANCE_STATUS.PARTIAL;
|
| 663 |
+
const isNA = reg.overall_status === "NOT_APPLICABLE";
|
| 664 |
return (
|
| 665 |
+
<div key={regName} className={`bg-white border border-zinc-200 rounded-xl overflow-hidden ${isNA ? "opacity-60" : ""}`}>
|
| 666 |
<div className={`flex flex-col sm:flex-row sm:items-center justify-between p-4 border-b ${status.bg} ${status.border}`}>
|
| 667 |
<div>
|
| 668 |
<div className="flex items-center gap-2 flex-wrap">
|
|
|
|
| 681 |
<p className="text-[11px] text-zinc-500 mt-0.5">{reg.description}</p>
|
| 682 |
</div>
|
| 683 |
<div className="text-left sm:text-right mt-2 sm:mt-0">
|
| 684 |
+
<span className={`text-lg font-bold ${status.text}`}>{isNA ? "N/A" : `${reg.compliance_rate}%`}</span>
|
| 685 |
<span className={`text-[11px] font-medium block ${status.text}`}>{reg.overall_status}</span>
|
| 686 |
</div>
|
| 687 |
</div>
|
| 688 |
+
{isNA ? (
|
| 689 |
+
<div className="p-3 text-xs text-zinc-400 italic">
|
| 690 |
+
{reg.note || `${regName} does not appear applicable to this contract type.`}
|
| 691 |
+
</div>
|
| 692 |
+
) : (
|
| 693 |
<div className="p-3 space-y-0.5">
|
| 694 |
{reg.checks.map((check, i) => {
|
| 695 |
const sev = SEV_CONFIG[check.severity] || SEV_CONFIG.MEDIUM;
|
|
|
|
| 716 |
);
|
| 717 |
})}
|
| 718 |
</div>
|
| 719 |
+
)}
|
| 720 |
</div>
|
| 721 |
);
|
| 722 |
})}
|