feat(tradein): «Росреестр» button — copy address + open EGRN request form (#550)
This commit is contained in:
parent
967e7185ca
commit
5bfacd51b0
4 changed files with 50 additions and 1 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* DealsCard — Секция 3 «Сделки» из mockup. Реальные сделки из Росреестра / ДомКлик.
|
||||
*/
|
||||
import type { AggregatedEstimate, AnalogLot } from "@/types/trade-in";
|
||||
import { openRosreestrWithAddress } from "@/lib/rosreestr";
|
||||
|
||||
interface Props {
|
||||
estimate: AggregatedEstimate;
|
||||
|
|
@ -124,6 +125,7 @@ export function DealsCard({ estimate }: Props) {
|
|||
<th className="num">₽ / м²</th>
|
||||
<th className="num">Цена сделки</th>
|
||||
<th className="num">Дата</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -168,6 +170,16 @@ function DealRow({ deal }: { deal: AnalogLot }) {
|
|||
<td className="num">{fmtRub(deal.price_per_m2)}</td>
|
||||
<td className="num">{fmtRub(deal.price_rub)}</td>
|
||||
<td className="num">{fmtDate(deal.listing_date)}</td>
|
||||
<td>
|
||||
<button
|
||||
type="button"
|
||||
className="rosreestr-btn"
|
||||
onClick={() => void openRosreestrWithAddress(deal.address)}
|
||||
title="Скопировать адрес и открыть форму запроса выписки ЕГРН"
|
||||
>
|
||||
Росреестр ↗
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { useMemo } from "react";
|
|||
import type { AggregatedEstimate, AnalogLot, CianPriceChangeStats } from "@/types/trade-in";
|
||||
import { safeUrl } from "@/lib/safeUrl";
|
||||
import { useEstimateCianPriceChanges } from "@/lib/trade-in-api";
|
||||
import { openRosreestrWithAddress } from "@/lib/rosreestr";
|
||||
|
||||
interface Props {
|
||||
estimate: AggregatedEstimate;
|
||||
|
|
@ -328,7 +329,7 @@ function AnalogRow({
|
|||
)}
|
||||
</td>
|
||||
<td className="num">{distance}</td>
|
||||
<td>
|
||||
<td style={{ whiteSpace: "nowrap" }}>
|
||||
{externalUrl && (
|
||||
<a
|
||||
href={externalUrl}
|
||||
|
|
@ -344,6 +345,14 @@ function AnalogRow({
|
|||
</svg>
|
||||
</a>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="rosreestr-btn"
|
||||
onClick={() => void openRosreestrWithAddress(lot.address)}
|
||||
title="Скопировать адрес и открыть форму запроса выписки ЕГРН"
|
||||
>
|
||||
Росреестр ↗
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1595,3 +1595,20 @@
|
|||
color: var(--fg-secondary, #5b6066);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* ── Росреестр deeplink button ── */
|
||||
|
||||
.rosreestr-btn {
|
||||
background: transparent;
|
||||
border: 1px solid var(--border);
|
||||
color: var(--muted);
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 11px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.rosreestr-btn:hover {
|
||||
color: var(--fg);
|
||||
border-color: var(--fg);
|
||||
}
|
||||
|
|
|
|||
11
tradein-mvp/frontend/src/lib/rosreestr.ts
Normal file
11
tradein-mvp/frontend/src/lib/rosreestr.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export const ROSREESTR_REQUEST_URL =
|
||||
"https://rosreestr.gov.ru/eservices/request_info_from_egrn/";
|
||||
|
||||
export async function openRosreestrWithAddress(address: string): Promise<void> {
|
||||
try {
|
||||
await navigator.clipboard.writeText(address);
|
||||
} catch {
|
||||
// clipboard may be unavailable — open form anyway
|
||||
}
|
||||
window.open(ROSREESTR_REQUEST_URL, "_blank", "noopener,noreferrer");
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue