Rename useClickedPointConfig

dev
Platon Yasev 3 years ago
parent 0e166a490d
commit 0b673f34e2

@ -9,14 +9,14 @@ import { SignOut } from "../SignOut";
import debounce from "lodash.debounce"; import debounce from "lodash.debounce";
import { Table } from "../modules/Table/Table"; import { Table } from "../modules/Table/Table";
import { usePopup } from "../stores/usePopup"; import { usePopup } from "../stores/usePopup";
import { useClickedPointLocationId } from "../stores/useClickedPointLocationId"; import { useClickedPointConfig } from "../stores/useClickedPointConfig";
import { Legend } from "../modules/Sidebar/Legend"; import { Legend } from "../modules/Sidebar/Legend";
export const MapComponent = () => { export const MapComponent = () => {
const mapRef = useRef(null); const mapRef = useRef(null);
const mapContainerRef = useRef(null); const mapContainerRef = useRef(null);
const { popup, setPopup } = usePopup(); const { popup, setPopup } = usePopup();
const { setClickedPointConfig } = useClickedPointLocationId(); const { setClickedPointConfig } = useClickedPointConfig();
const handleClick = (event) => { const handleClick = (event) => {
if (!event.features) { if (!event.features) {

@ -4,7 +4,7 @@ import { twMerge } from "tailwind-merge";
import { usePointSelection } from "../stores/usePointSelection"; import { usePointSelection } from "../stores/usePointSelection";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { CATEGORIES } from "../config"; import { CATEGORIES } from "../config";
import { useClickedPointLocationId } from "../stores/useClickedPointLocationId"; import { useClickedPointConfig } from "../stores/useClickedPointConfig";
const popupConfig = [ const popupConfig = [
{ {
@ -108,7 +108,7 @@ const PopupWrapper = ({ lat, lng, onClose, children }) => {
const SingleFeaturePopup = ({ feature }) => { const SingleFeaturePopup = ({ feature }) => {
const { include, selection, exclude } = usePointSelection(); const { include, selection, exclude } = usePointSelection();
const { setClickedPointConfig } = useClickedPointLocationId(); const { setClickedPointConfig } = useClickedPointConfig();
const doesMatchFilter = feature.layer.id === "match-points"; const doesMatchFilter = feature.layer.id === "match-points";
const featureId = feature.properties.id; const featureId = feature.properties.id;

@ -7,7 +7,7 @@ import parse from "wellknown";
import { useMap } from "react-map-gl"; import { useMap } from "react-map-gl";
import { usePointSelection } from "../../stores/usePointSelection"; import { usePointSelection } from "../../stores/usePointSelection";
import { useFilters } from "../../stores/useFilters"; import { useFilters } from "../../stores/useFilters";
import { useClickedPointLocationId } from "../../stores/useClickedPointLocationId"; import { useClickedPointConfig } from "../../stores/useClickedPointConfig";
import scrollIntoView from "scroll-into-view-if-needed"; import scrollIntoView from "scroll-into-view-if-needed";
const columns = [ const columns = [
@ -75,7 +75,7 @@ const useTableData = (page) => {
const { filters } = useFilters(); const { filters } = useFilters();
const { prediction, status, categories } = filters; const { prediction, status, categories } = filters;
const { selection } = usePointSelection(); const { selection } = usePointSelection();
const { clickedPointConfig } = useClickedPointLocationId(); const { clickedPointConfig } = useClickedPointConfig();
const [finalData, setFinalData] = useState(); const [finalData, setFinalData] = useState();
const { data } = useQuery( const { data } = useQuery(
@ -175,7 +175,7 @@ export const Table = React.memo(({ height = 200 }) => {
const tableRef = useRef(null); const tableRef = useRef(null);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const { selection, include, exclude } = usePointSelection(); const { selection, include, exclude } = usePointSelection();
const { clickedPointConfig } = useClickedPointLocationId(); const { clickedPointConfig } = useClickedPointConfig();
const { data, pageSize, isClickedPointLoading } = useTableData(page); const { data, pageSize, isClickedPointLoading } = useTableData(page);

@ -18,4 +18,4 @@ const store = (set) => ({
}, },
}); });
export const useClickedPointLocationId = create(immer(store)); export const useClickedPointConfig = create(immer(store));
Loading…
Cancel
Save