gendesign/frontend/src/components/site-finder/entry/ParcelLegend.tsx
lekss361 0084773abf feat(sf-fe-a2): EntryMap + MapFilterBar + ParcelDrawer + RecentParcels + ParcelLegend
- EntryMap: Leaflet карта ЕКБ с CircleMarker парцелей, bbox-aware refetch (TanStack Query),
  click-to-select, deselect on backdrop, isFetching indicator
- MapFilterBar: chip-фильтры (status/area/vri) + district select + counter, bbox-linked
  counter через FilterBarBridge без ремаунта карты
- ParcelDrawer: slide-in panel 360px — 4 KPI (status/area/district/vri) + coords +
  CTA «Открыть анализ» -> /site-finder/analysis/[cad], fallback ПКК Росреестр
- RecentParcels: TanStack Query hook с localStorage fallback (gd_recent_parcels),
  merges B2 server list + local-only items; empty state + hover effects
- ParcelLegend: status color legend (free/in_progress/favorite) + STATUS_COLORS export
  reused in EntryMap markers
- site-finder-api.ts: useParcelsBboxQuery + useRecentParcels hooks, mock fallback via
  MOCK_PARCELS_BBOX / MOCK_RECENT_PARCELS; getLocalRecentParcels / addLocalRecentParcel
- parcels-bbox.json: 20 ЕКБ-парцелей фикстура (6 районов, все статусы, разные ВРИ)
- page.tsx: заменены MapPlaceholder + SidebarPlaceholder на реальные компоненты
2026-05-18 01:12:32 +03:00

67 lines
1.6 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";
// Status color constants — kept in sync with EntryMap marker colours
export const STATUS_COLORS: Record<string, string> = {
free: "#0A7A3A",
in_progress: "#9A6700",
favorite: "#1D4ED8",
};
export const STATUS_LABELS: Record<string, string> = {
free: "Свободный",
in_progress: "В работе",
favorite: "Избранный",
};
export function ParcelLegend() {
const entries = Object.keys(STATUS_LABELS) as Array<
keyof typeof STATUS_LABELS
>;
return (
<div
style={{
background: "var(--bg-card)",
border: "1px solid var(--border-card)",
borderRadius: 8,
padding: "8px 12px",
display: "flex",
flexDirection: "column",
gap: 6,
minWidth: 148,
}}
>
<span
style={{
fontSize: 11,
fontWeight: 500,
textTransform: "uppercase",
letterSpacing: "0.04em",
color: "var(--fg-secondary)",
}}
>
Статус участка
</span>
{entries.map((status) => (
<div
key={status}
style={{ display: "flex", alignItems: "center", gap: 8 }}
>
<span
style={{
width: 12,
height: 12,
borderRadius: "50%",
background: STATUS_COLORS[status],
flexShrink: 0,
display: "inline-block",
}}
/>
<span style={{ fontSize: 12, color: "var(--fg-primary)" }}>
{STATUS_LABELS[status]}
</span>
</div>
))}
</div>
);
}