gendesign/frontend/src/components/site-finder/ptica/PticaMap.tsx
Light1YT ba05a4cb62
All checks were successful
CI / changes (pull_request) Successful in 6s
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Successful in 49s
CI / openapi-codegen-check (pull_request) Successful in 1m48s
feat(ptica): rich dark cockpit map + ПТИЦА as the default analysis route
Fix two regressions vs the prototype:
1. PticaMapInner: render real data layers over the dark base by REUSING the
   existing analysis-map components — POI by category, competitors/pipeline
   (MarketLayers), connection points + colored polylines (ConnectionPointsLayer),
   ЗОУИТ (ZouitLayer), custom POI add/edit/delete (CustomPoiLayer + mutation hooks).
   Add Спутник/Схема base toggle (Esri default + --map-filter-sat); legend rows
   toggle layers; «Точки подключения» driven by real CP data. Isochrones left
   «скоро» (ORS is on-demand, not in /analyze).
2. /site-finder/analysis/[cad] now renders the ПТИЦА cockpit — every parcel entry
   opens ПТИЦА, not the old design. [cad]/ptica redirects to the parent (single
   cockpit copy). Old AnalysisPageContent kept in repo; legacy UI at /legacy/site-finder.
3. Surface 3D massing: new «Инсоляция · 3D-масса» scan card + 3D legend row + 3D
   map tool all open the insolation/future3d drawers.

SSR-safe (Leaflet only behind dynamic ssr:false); real POI from score_breakdown;
no redirect loop. tsc/lint/prettier/build green. code-reviewer APPROVE.
2026-06-21 00:04:00 +05:00

51 lines
1.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";
/**
* PticaMap — SSR-safe wrapper around the rich Leaflet cockpit map. Leaflet
* touches `window`, so PticaMapInner is loaded via dynamic(ssr:false) with a
* dark loading placeholder (never imported into a server component).
*
* This wrapper owns the client-only data the rich map needs beyond the /analyze
* payload: connection points (utility structures + distances) and the user's
* custom POIs. Both are cached TanStack queries keyed by cad; they hydrate the
* map's «Точки подключения ресурсов» list and the custom-POI layer.
*/
import dynamic from "next/dynamic";
import styles from "@/app/site-finder/analysis/[cad]/ptica/ptica.module.css";
import type { ParcelAnalysis } from "@/types/site-finder";
import { useConnectionPoints } from "@/hooks/useConnectionPoints";
import { useCustomPois } from "@/hooks/useCustomPois";
import type { DrawerKey } from "@/components/site-finder/ptica/drawers/drawer-keys";
const PticaMapInner = dynamic(
() => import("@/components/site-finder/ptica/PticaMapInner"),
{
ssr: false,
loading: () => <div className={styles.mapLoading}>Загрузка карты</div>,
},
);
interface Props {
analysis: ParcelAnalysis;
onOpenDrawer?: (key: DrawerKey) => void;
}
export function PticaMap({ analysis, onOpenDrawer }: Props) {
const cad = analysis.cad_num;
const { data: connectionPoints } = useConnectionPoints(cad);
const { data: customPois } = useCustomPois(cad);
return (
<div className={styles.mapCard}>
<PticaMapInner
analysis={analysis}
cad={cad}
connectionPoints={connectionPoints}
customPois={customPois}
onOpenDrawer={onOpenDrawer}
/>
</div>
);
}