gendesign/frontend/src/components/site-finder/ptica-v2/V2Map.tsx
Light1YT c3e091c811
All checks were successful
CI / backend-tests (pull_request) Has been skipped
CI / changes (pull_request) Successful in 7s
CI / frontend-tests (pull_request) Successful in 52s
CI / openapi-codegen-check (pull_request) Successful in 1m48s
feat(site-finder/v2): resource legend overlay + light theme polish
— V2MapLegend overlay над cockpit-картой (электр/вода/канал/тепло/газ)
  с nearest_m + статус-точка, источник utilities.summary (subtype-buckets
  зеркалят backend _nearest() aliases; electric расширен power_line, gas
  включает legacy generic pipeline).
— Per-theme заголовок карты: dark «СПУТНИК · СВЕЖИЙ СНИМОК», light
  «СПУТНИК · СХЕМА ПОДКЛЮЧЕНИЙ» (toggle через CSS [data-theme], без JS).
— Точечный light-theme contrast в v2.module.css: kv/eng значения,
  drawer eyebrow, .more / .ver / активная вкладка с cyan→accent-blue,
  status-dot halo off на белом. Dark не тронут.

Scope: только ptica-v2/* и v2.module.css. PticaMapInner (шарится со
старым ptica) не тронут.
2026-06-22 11:26:13 +05:00

69 lines
2.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client";
/**
* V2Map — the cockpit map card. Reuses the existing rich Leaflet plumbing
* (PticaMapInner — parcel polygon, POI / ЖК / pipeline glyph pins, ЗОУИТ zones,
* connection-point lines, custom POI, dark/satellite tiles) via a SINGLE shared
* implementation loaded through dynamic(ssr:false) so Leaflet never touches the
* server. Connection points + custom POIs are fetched here (same TanStack hooks
* as PticaMap) and threaded into the inner map.
*
* The inner map brings its own overlay/legend/controls + base-layer toggle
* (Спутник | Схема) and dark CartoDB tiles, matching the prototype map block.
* The map title chip is rendered here over the card per the prototype `.map-head`.
*/
import dynamic from "next/dynamic";
import styles from "@/app/site-finder/analysis/[cad]/v2/v2.module.css";
import type { ParcelAnalysis } from "@/types/site-finder";
import { useConnectionPoints } from "@/hooks/useConnectionPoints";
import { useCustomPois } from "@/hooks/useCustomPois";
import { V2MapLegend } from "@/components/site-finder/ptica-v2/V2MapLegend";
const PticaMapInner = dynamic(
() => import("@/components/site-finder/ptica/PticaMapInner"),
{
ssr: false,
loading: () => <div className={styles.mapLoading}>Загрузка карты</div>,
},
);
interface Props {
analysis: ParcelAnalysis;
}
export function V2Map({ analysis }: Props) {
const cad = analysis.cad_num;
const { data: connectionPoints } = useConnectionPoints(cad);
const { data: customPois } = useCustomPois(cad);
return (
<div className={`${styles.card} ${styles.mapCard} ${styles.brk}`}>
<span className={styles.bc1} />
<span className={styles.bc2} />
<div className={styles.mapMount}>
<PticaMapInner
analysis={analysis}
cad={cad}
connectionPoints={connectionPoints}
customPois={customPois}
/>
</div>
{/* Map title — text differs per theme; only one span is shown at a time
via the [data-theme="..."] selectors in v2.module.css (mirrors the
prototype `.tnum-d` / `.tnum-l` toggle pattern). */}
<div className={styles.mapHead}>
<span className={`${styles.ttl} ${styles.mapTitleDark}`}>
СПУТНИК · СВЕЖИЙ СНИМОК
</span>
<span className={`${styles.ttl} ${styles.mapTitleLight}`}>
СПУТНИК · СХЕМА ПОДКЛЮЧЕНИЙ
</span>
</div>
{/* Resource legend overlay (sibling of PticaMapInner, sits on top of the
map via absolute positioning — does not touch the shared inner map). */}
<V2MapLegend analysis={analysis} />
</div>
);
}