Filtering by zone

This commit is contained in:
Timothy Armes
2024-10-21 15:19:28 +02:00
parent 45ea8960e0
commit d44110649b
17 changed files with 336 additions and 136 deletions
+3 -5
View File
@@ -1,22 +1,20 @@
"use client";
import { useCallback, useMemo } from "react";
import { useMemo } from "react";
import { useAtomValue } from "jotai";
import L, { LatLngLiteral } from "leaflet";
import "leaflet-defaulticon-compatibility";
import "leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css";
import "leaflet.smooth_marker_bouncing";
import "leaflet/dist/leaflet.css";
import { countBy, groupBy } from "lodash";
import { clubsAtom } from "@/atoms";
import { filteredClubsByZoneAtom } from "@/atoms";
import { Map, MapMarker } from "@/components/Map";
import { ClubMarker } from "./ClubMarker";
const ClubMap = () => {
const clubs = useAtomValue(clubsAtom);
const clubs = useAtomValue(filteredClubsByZoneAtom);
const markers: MapMarker[] = useMemo(
() =>
+8 -16
View File
@@ -2,7 +2,7 @@
import { useEffect } from "react";
import { useAtom, useAtomValue, useSetAtom } from "jotai";
import { useAtomValue, useSetAtom } from "jotai";
import { useTranslations } from "next-intl";
import { FaExternalLinkAlt } from "react-icons/fa";
import { twMerge } from "tailwind-merge";
@@ -12,17 +12,15 @@ import {
debouncedHoveredMapIdAtom,
filteredClubsListAtom,
hoveredMapIdAtom,
syncVisibleAtom,
} from "@/atoms";
import { RegionSelect } from "@/components/RegionSelect";
import SearchBar from "@/components/SearchBar";
import { useBreakpoint } from "@/hooks/tailwind";
const ClubTable = () => {
const t = useTranslations("Clubs");
const at = useTranslations("App");
const filteredClubs = useAtomValue(filteredClubsListAtom);
const [syncVisible, setSyncVisible] = useAtom(syncVisibleAtom);
const hoveredMapId = useAtomValue(hoveredMapIdAtom);
const debouncedHoveredMapId = useAtomValue(debouncedHoveredMapIdAtom);
const setHoveredListId = useSetAtom(debouncedHoveredListIdAtom);
@@ -45,18 +43,12 @@ const ClubTable = () => {
>
<div className="z-10 flex w-full flex-wrap items-center justify-between gap-3 p-3">
<SearchBar />
<div className="flex flex-col gap-0 text-gray-900 dark:text-white">
<label>
<input
type="checkbox"
className="mr-2 h-4 w-4 rounded border-gray-400 text-primary focus:ring-primary"
checked={syncVisible}
onChange={() => setSyncVisible(!syncVisible)}
/>
{t("syncWithMapCheckbox")}
</label>
</div>
<RegionSelect
classNameOverrides={{
container: () => "flex flex-1",
}}
/>
<div className="flex flex-col gap-0 text-gray-900 dark:text-white"></div>
</div>
<div className="overflow-x-scroll bg-red-50">