feat(tradein-ui): mock-disclaimer + progressive enrichment + UX polish #517

Merged
lekss361 merged 2 commits from feat/tradein-ui-mock-disclaimer-enrichment into main 2026-05-24 12:58:39 +00:00
2 changed files with 79 additions and 57 deletions
Showing only changes of commit 81dd103cb4 - Show all commits

View file

@ -59,12 +59,6 @@ export default function TradeInPage() {
});
}
function handleResubmit(patch: { house_type?: HouseType; repair_state?: RepairState }) {
if (!resultData) return;
const enrichedInput: TradeInEstimateInput = { ...resultData.input, ...patch };
handleSubmit(enrichedInput);
}
const apiError = mutation.error?.message ?? null;
const resultData =
freshResult ??
@ -81,6 +75,12 @@ export default function TradeInPage() {
}
: null);
function handleResubmit(patch: { house_type?: HouseType; repair_state?: RepairState }) {
if (!resultData) return;
const enrichedInput: TradeInEstimateInput = { ...resultData.input, ...patch };
handleSubmit(enrichedInput);
}
const isPending = mutation.isPending;
return (

View file

@ -102,8 +102,21 @@ export function HeroSummary({ estimate, input, onResubmit, isResubmitting = fals
return (
<article className="card hero-card">
{showMockDisclaimer && (
<div className="rounded-lg border border-amber-500/40 bg-amber-50 px-4 py-3 text-sm text-amber-900" style={{ margin: "16px 16px 0" }}>
Адрес распознан неточно оценка может быть приближённой.
<div
role="status"
aria-live="polite"
style={{
margin: "16px 16px 0",
padding: "12px 16px",
border: "1px solid var(--accent-2)",
background: "var(--accent-2-soft)",
color: "var(--fg)",
borderRadius: "var(--radius)",
fontSize: 13,
lineHeight: 1.4,
}}
>
Адрес распознан неточно оценка может быть приближённой.
Уточните адрес и пересчитайте для более точного результата.
</div>
)}
@ -323,9 +336,19 @@ export function HeroSummary({ estimate, input, onResubmit, isResubmitting = fals
)}
{showEnrichment && (
<div style={{ margin: "0 16px 16px" }}>
<div className="rounded-lg border border-slate-200 bg-slate-50 p-4 space-y-3">
<p className="text-sm font-medium" style={{ fontSize: 13, fontWeight: 600, marginBottom: 10 }}>
<div
style={{
margin: "16px 16px 0",
padding: 16,
border: "1px solid var(--border, #e5e7eb)",
background: "var(--surface-2, #f8fafc)",
borderRadius: "var(--radius, 8px)",
display: "flex",
flexDirection: "column",
gap: 12,
}}
>
<p style={{ fontSize: 13, fontWeight: 500, margin: 0 }}>
Уточните для повышения точности оценки:
</p>
<form onSubmit={handleEnrichSubmit}>
@ -372,7 +395,6 @@ export function HeroSummary({ estimate, input, onResubmit, isResubmitting = fals
</button>
</form>
</div>
</div>
)}
</article>
);