Task A (#254): Leaflet click-to-add custom POIs - sessionId.ts: getOrCreateSessionId() from localStorage - types/customPoi.ts: CustomPoi, CustomPoiCreate, CustomPoiUpdate - hooks/useCustomPois.ts: useCustomPois / useAddCustomPoi / useUpdateCustomPoi / useDeleteCustomPoi (TanStack Query, X-Session-Id header) - CustomPoiLayer.tsx: LayerGroup with CircleMarker (green/red/gray by weight), popup with edit/delete - CustomPoiToggleButton.tsx: crosshair mode toggle button - CustomPoiAddModal.tsx: modal form (name, 26 categories, weight -5..+5, notes) - CustomPoiEditModal.tsx: same form for editing existing POI - SiteMap.tsx: MapClickHandler (useMapEvents), integrated all custom POI components - page.tsx: useCustomPois hook + passes customPois + parcelCad to SiteMap Task B (#114): ScoreBreakdownStackedBar - ScoreBreakdownStackedBar.tsx: horizontal stacked bar by category with positive/negative split, toggle between category and factor views, custom POIs highlighted orange with dashed outline - OverviewTab.tsx: renders ScoreBreakdownStackedBar below ScoreBreakdownPanel Requires backend PR with /api/v1/custom-pois endpoints merged before POI CRUD works.
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
interface Props {
|
|
active: boolean;
|
|
onClick: () => void;
|
|
}
|
|
|
|
/**
|
|
* Floating button shown below the map to toggle "add custom POI" click mode.
|
|
* When active, cursor becomes crosshair and next map click opens the add modal.
|
|
*/
|
|
export function CustomPoiToggleButton({ active, onClick }: Props) {
|
|
return (
|
|
<button
|
|
type="button"
|
|
onClick={onClick}
|
|
style={{
|
|
padding: "7px 14px",
|
|
fontSize: 13,
|
|
fontWeight: 600,
|
|
borderRadius: 8,
|
|
border: active ? "2px solid #1d4ed8" : "1px solid #d1d5db",
|
|
background: active ? "#dbeafe" : "#fff",
|
|
color: active ? "#1d4ed8" : "#374151",
|
|
cursor: "pointer",
|
|
transition: "all 0.15s",
|
|
whiteSpace: "nowrap",
|
|
}}
|
|
title={
|
|
active
|
|
? "Кликните на карте для добавления точки. Нажмите снова для отмены"
|
|
: "Кликните для добавления пользовательской точки на карте"
|
|
}
|
|
>
|
|
{active ? "Отмена (нажмите Esc или эту кнопку)" : "+ Добавить точку"}
|
|
</button>
|
|
);
|
|
}
|