import grouping and sorting with Prettier plugin

This commit is contained in:
Timothy Armes
2023-09-11 09:09:34 +02:00
parent 4984639f23
commit 7111f000e5
43 changed files with 589 additions and 210 deletions
+6 -5
View File
@@ -1,12 +1,13 @@
import { useMap } from "react-leaflet";
import { useEffect, useMemo } from "react";
import { useTranslations } from "next-intl";
import L from "leaflet";
import { useAtomValue } from "jotai";
import { TimeControl } from "@/types";
import { useAtomValue } from "jotai";
import L from "leaflet";
import { useTranslations } from "next-intl";
import { useMap } from "react-leaflet";
import { filteredTournamentsByTimeControlAtom } from "@/app/atoms";
import { TimeControlColours } from "@/app/constants";
import { TimeControl } from "@/types";
const Legend = () => {
const t = useTranslations("Tournaments");
+3 -2
View File
@@ -1,11 +1,12 @@
"use client";
import { ScrollableElement } from "@/types";
import { useEffect, useRef, useState } from "react";
import { FaArrowUp } from "react-icons/fa";
import { handleScrollToTop } from "@/handlers/scrollHandlers";
import { useEffect, useRef, useState } from "react";
import { useBreakpoint } from "@/hooks/tailwind";
import { ScrollableElement } from "@/types";
const ScrollToTopButton = () => {
const scrollToTopElementRef = useRef<ScrollableElement | null>(null);
+2 -1
View File
@@ -1,6 +1,7 @@
import { useTranslations } from "next-intl";
import { useAtom } from "jotai/index";
import { useTranslations } from "next-intl";
import { IoCloseOutline } from "react-icons/io5";
import { searchStringAtom } from "@/app/atoms";
const SearchBar = () => {
+3 -3
View File
@@ -1,13 +1,13 @@
import { useAtom, useAtomValue } from "jotai";
import { useTranslations } from "next-intl";
import {
classicAtom,
rapidAtom,
blitzAtom,
classicAtom,
otherAtom,
rapidAtom,
tournamentsAtom,
} from "@/app/atoms";
import { useTranslations } from "next-intl";
import { TimeControl } from "@/types";
const TimeControlFilters = () => {
+21 -23
View File
@@ -1,34 +1,32 @@
"use client";
import { TimeControl } from "@/types";
import { useCallback, useEffect, useMemo, useRef } from "react";
import { useMemo, useRef, useCallback, useEffect } from "react";
import L, { LatLngLiteral, Marker, DomUtil } from "leaflet";
import { MapContainer, TileLayer, LayerGroup } from "react-leaflet";
import MarkerClusterGroup from "react-leaflet-cluster";
import { FaAngleDoubleDown } from "react-icons/fa";
import { useAtomValue, useSetAtom } from "jotai";
import L, { DomUtil, LatLngLiteral, Marker } 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 {
mapBoundsAtom,
debouncedHoveredListTournamentIdAtom,
filteredTournamentsByTimeControlAtom,
normsOnlyAtom,
} from "@/app/atoms";
import { generatePieSVG } from "@/lib/pie";
import { TimeControlColours } from "@/app/constants";
import Legend from "./Legend";
import { TournamentMarker, TournamentMarkerRef } from "./TournamentMarker";
import TimeControlFilters from "./TimeControlFilters";
import { FaAngleDoubleDown } from "react-icons/fa";
import { LayerGroup, MapContainer, TileLayer } from "react-leaflet";
import MarkerClusterGroup from "react-leaflet-cluster";
import MapEvents from "@/app/[lang]/components/MapEvents";
import {
debouncedHoveredListTournamentIdAtom,
filteredTournamentsByTimeControlAtom,
mapBoundsAtom,
normsOnlyAtom,
} from "@/app/atoms";
import { TimeControlColours } from "@/app/constants";
import { generatePieSVG } from "@/lib/pie";
import { TimeControl } from "@/types";
import "leaflet/dist/leaflet.css";
import "leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css";
import "leaflet-defaulticon-compatibility";
import "leaflet.smooth_marker_bouncing";
import Legend from "./Legend";
import TimeControlFilters from "./TimeControlFilters";
import { TournamentMarker, TournamentMarkerRef } from "./TournamentMarker";
// Declare a class type that adds in methods etc. defined by leaflet.smooth_marker_bouncing
// to keep Typescript happy
+10 -9
View File
@@ -1,17 +1,18 @@
"use client";
import { forwardRef, useMemo, useImperativeHandle, useRef } from "react";
import { Tournament } from "@/types";
import L from "leaflet";
import { Marker, Popup, MarkerProps } from "react-leaflet";
import { useTranslations } from "next-intl";
import { useSetAtom } from "jotai";
import { FaTrophy } from "react-icons/fa";
import { last } from "lodash";
import { forwardRef, useImperativeHandle, useMemo, useRef } from "react";
import { useSetAtom } from "jotai";
import L from "leaflet";
import { last } from "lodash";
import { useTranslations } from "next-intl";
import { FaTrophy } from "react-icons/fa";
import { Marker, MarkerProps, Popup } from "react-leaflet";
import type { BouncingMarker } from "@/leafletTypes";
import { debouncedHoveredMapTournamentGroupIdAtom } from "@/app/atoms";
import { TimeControlColours } from "@/app/constants";
import type { BouncingMarker } from "@/leafletTypes";
import { Tournament } from "@/types";
export type TournamentMarkerRef = {
getMarker: () => L.Marker<any>;
+9 -8
View File
@@ -1,26 +1,27 @@
"use client";
import { useEffect } from "react";
import { useAtom, useAtomValue, useSetAtom } from "jotai";
import { useTranslations } from "next-intl";
import { useAtomValue, useSetAtom, useAtom } from "jotai";
import { twMerge } from "tailwind-merge";
import { FaExternalLinkAlt } from "react-icons/fa";
import { FaTrophy } from "react-icons/fa";
import { Tooltip } from "react-tooltip";
import { twMerge } from "tailwind-merge";
import {
filteredTournamentsListAtom,
syncVisibleAtom,
normsOnlyAtom,
hoveredMapTournamentGroupIdAtom,
debouncedHoveredMapTournamentGroupIdAtom,
debouncedHoveredListTournamentIdAtom,
debouncedHoveredMapTournamentGroupIdAtom,
filteredTournamentsListAtom,
hoveredMapTournamentGroupIdAtom,
normsOnlyAtom,
syncVisibleAtom,
} from "@/app/atoms";
import { useBreakpoint } from "@/hooks/tailwind";
import ScrollToTopButton from "./ScrollToTopButton";
import SearchBar from "./SearchBar";
import TimeControlFilters from "./TimeControlFilters";
import ScrollToTopButton from "./ScrollToTopButton";
export default function TournamentTable() {
const t = useTranslations("Tournaments");
+9 -9
View File
@@ -1,18 +1,18 @@
"use client";
import { useHydrateAtoms } from "jotai/utils";
import dynamic from "next/dynamic";
import LoadingMap from "@/app/[lang]/components/LoadingMap";
import { tournamentsAtom } from "@/app/atoms";
import { Tournament } from "@/types";
import TournamentTable from "./TournamentTable";
type TournamentsDisplayProps = {
tournaments: Tournament[];
};
import { Tournament } from "@/types";
import dynamic from "next/dynamic";
import { useHydrateAtoms } from "jotai/utils";
import { tournamentsAtom } from "@/app/atoms";
import TournamentTable from "./TournamentTable";
import LoadingMap from "@/app/[lang]/components/LoadingMap";
/**
* Imports the tournament map component, ensuring CSR only.
* @remarks SSR is not supported by react-leaflet
+6 -6
View File
@@ -1,12 +1,12 @@
import clientPromise from "@/lib/mongodb";
import { errorLog } from "@/utils/logger";
import { Tournament, TimeControl } from "@/types";
import { differenceInDays, isSameDay, parse } from "date-fns";
import { groupBy } from "lodash";
import { parse, differenceInDays, isSameDay } from "date-fns";
import { ObjectId } from "mongodb";
import clientPromise from "@/lib/mongodb";
import { TimeControl, Tournament } from "@/types";
import { errorLog } from "@/utils/logger";
import TournamentsDisplay from "./TournamentsDisplay";
import { ObjectId } from "mongodb";
export const revalidate = 3600; // Revalidate cache every 6 hours