Merge branch 'feature/map_fix' into 'dev'

map fix

See merge request spatial/postamates_frontend!28
dev
Timofey Malinin 3 years ago
commit ef4b6ca03d

@ -25,7 +25,7 @@ export const OnApprovalPoints = () => {
{...approvePointLayer} {...approvePointLayer}
id={LAYER_IDS.approve} id={LAYER_IDS.approve}
source={"points"} source={"points"}
source-layer={"public.service_points_with_dist"} source-layer={"public.points_with_dist"}
layout={{ layout={{
visibility: isVisible[LAYER_IDS.approve] ? "visible" : "none", visibility: isVisible[LAYER_IDS.approve] ? "visible" : "none",
}} }}

@ -10,7 +10,7 @@ import {
useHasManualEdits, useHasManualEdits,
usePointSelection, usePointSelection,
} from "../../../stores/usePointSelection"; } from "../../../stores/usePointSelection";
import { usePendingPointsFilters } from "../../../stores/usePendingPointsFilters"; import {RANGE_FILTERS_KEYS, usePendingPointsFilters} from "../../../stores/usePendingPointsFilters";
import { ClearFiltersButton } from "../../../components/ClearFiltersButton"; import { ClearFiltersButton } from "../../../components/ClearFiltersButton";
import { getDynamicActiveFilters } from "../utils"; import { getDynamicActiveFilters } from "../utils";
import { useCanEdit } from "../../../api"; import { useCanEdit } from "../../../api";
@ -19,7 +19,7 @@ import { AdvancedFiltersWrapper } from "./AdvancedFilters/AdvancedFiltersWrapper
export const PendingPointsFilters = () => { export const PendingPointsFilters = () => {
const hasManualEdits = useHasManualEdits(); const hasManualEdits = useHasManualEdits();
const { reset: resetPointSelection } = usePointSelection(); const { reset: resetPointSelection } = usePointSelection();
const { ranges, filters, setRegion, clear } = usePendingPointsFilters(); const { ranges, filters, setRegion, setFilterWithKey, setPrediction, setCategories } = usePendingPointsFilters();
const [isSelectionEmpty, setIsSelectionEmpty] = useState(false); const [isSelectionEmpty, setIsSelectionEmpty] = useState(false);
@ -51,7 +51,14 @@ export const PendingPointsFilters = () => {
"prediction", "prediction",
]); ]);
const clearFilters = () => clear(ranges); const clearFilters = () => {
RANGE_FILTERS_KEYS.map((key) => {
setFilterWithKey(ranges[key], key);
});
setPrediction(ranges.prediction);
setCategories([]);
setRegion(null);
};
const hasActiveFilters = const hasActiveFilters =
filters.region || filters.region ||

@ -5,14 +5,12 @@ import { persist } from "zustand/middleware";
const INITIAL_STATE = { const INITIAL_STATE = {
[LAYER_IDS.initial]: true, [LAYER_IDS.initial]: true,
[LAYER_IDS.approve]: false, [LAYER_IDS.approve]: true,
[LAYER_IDS.working]: false, [LAYER_IDS.working]: true,
[LAYER_IDS.filteredWorking]: false, [LAYER_IDS.filteredWorking]: false,
[LAYER_IDS.cancelled]: false, [LAYER_IDS.cancelled]: true,
[LAYER_IDS.pvz]: true, [LAYER_IDS.pvz]: true,
[LAYER_IDS.other]: true, [LAYER_IDS.other]: true,
[`${LAYER_IDS.pvz_category}1`]: true,
[`${LAYER_IDS.pvz_category}2`]: true,
}; };
const STATIC_LAYERS = [LAYER_IDS.pvz, LAYER_IDS.other]; const STATIC_LAYERS = [LAYER_IDS.pvz, LAYER_IDS.other];

Loading…
Cancel
Save