Global filters (#40)

This commit is contained in:
Timothy Armes
2023-07-05 17:27:53 +02:00
parent caaad4e229
commit 15ead0b877
11 changed files with 168 additions and 71 deletions
+4 -9
View File
@@ -13,11 +13,11 @@ import {
debouncedHoveredMapTournamentIdAtom,
} from "@/app/atoms";
const coordinateRandomisation = (lat: number, lng: number): LatLngLiteral => {
const coordinateRandomisation = (latLng: LatLngLiteral): LatLngLiteral => {
const randomisation = () => Math.random() * (-0.01 - 0.01) + 0.01;
return {
lat: lat + randomisation(),
lng: lng + randomisation(),
lat: latLng.lat + randomisation(),
lng: latLng.lng + randomisation(),
};
};
@@ -33,12 +33,7 @@ export const TournamentMarker = ({
}: TournamentMarkerProps) => {
const t = useTranslations("Tournaments");
const markerRef = useRef<L.Marker<any> | null>(null);
const position = useRef(
coordinateRandomisation(
tournament.coordinates[0],
tournament.coordinates[1]
)
);
const position = useRef(coordinateRandomisation(tournament.latLng));
const hoveredListTournamentId = useAtomValue(
debouncedHoveredListTournamentIdAtom