mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
import grouping and sorting with Prettier plugin
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
"use client";
|
||||
|
||||
import { MapProps } from "@/types";
|
||||
import { useMemo, useRef, ChangeEvent } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useSetAtom } from "jotai";
|
||||
import { mapBoundsAtom } from "@/app/atoms";
|
||||
import { ChangeEvent, useMemo, useRef } from "react";
|
||||
|
||||
import { useSetAtom } from "jotai";
|
||||
import L from "leaflet";
|
||||
import { MapContainer, TileLayer, Marker } from "react-leaflet";
|
||||
import "leaflet/dist/leaflet.css";
|
||||
import "leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css";
|
||||
import "leaflet-defaulticon-compatibility";
|
||||
import "leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css";
|
||||
import "leaflet/dist/leaflet.css";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { MapContainer, Marker, TileLayer } from "react-leaflet";
|
||||
|
||||
import MapEvents from "@/app/[lang]/components/MapEvents";
|
||||
import { mapBoundsAtom } from "@/app/atoms";
|
||||
import { MapProps } from "@/types";
|
||||
|
||||
const Map = ({ position, setPosition, center }: MapProps) => {
|
||||
const t = useTranslations("Map");
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
"use client";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
import { useState } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
import { useAtomValue } from "jotai";
|
||||
import { franceCenterAtom } from "@/app/atoms";
|
||||
import useTournamentForm from "@/hooks/useTournamentForm";
|
||||
import { useTranslations } from "next-intl";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
import InfoMessage from "@/app/[lang]/components/InfoMessage";
|
||||
import {
|
||||
handleTournamentSubmit,
|
||||
handleClearTournamentForm,
|
||||
} from "@/handlers/formHandlers";
|
||||
import LoadingMap from "@/app/[lang]/components/LoadingMap";
|
||||
import { franceCenterAtom } from "@/app/atoms";
|
||||
import {
|
||||
handleClearTournamentForm,
|
||||
handleTournamentSubmit,
|
||||
} from "@/handlers/formHandlers";
|
||||
import useTournamentForm from "@/hooks/useTournamentForm";
|
||||
|
||||
const Map = dynamic(() => import("./Map"), {
|
||||
ssr: false,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useTranslations } from "next-intl";
|
||||
import Link from "next-intl/link";
|
||||
import { FaGithub, FaRegEnvelope } from "react-icons/fa";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
import ThemeSwitcher from "@/app/[lang]/components/ThemeSwitcher";
|
||||
|
||||
export default function Footer() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useRef, useState } from "react";
|
||||
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
import HamburgerMenu from "./HamburgerMenu";
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import { Dispatch, RefObject, SetStateAction, useRef, useState } from "react";
|
||||
|
||||
import { useTranslations } from "next-intl";
|
||||
import Link from "next-intl/link";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
import useHamburgerClose from "@/hooks/useHamburgerClose";
|
||||
|
||||
interface HamburgerMenuState {
|
||||
menuVisible: boolean;
|
||||
setMenuVisible: Dispatch<SetStateAction<boolean>>;
|
||||
hamburgerButtonRef: RefObject<HTMLDivElement>;
|
||||
}
|
||||
|
||||
import { Dispatch, RefObject, SetStateAction, useRef, useState } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
import Link from "next-intl/link";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
import useHamburgerClose from "@/hooks/useHamburgerClose";
|
||||
|
||||
const HamburgerMenu = ({
|
||||
menuVisible,
|
||||
setMenuVisible,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ResponseMessage } from "@/types";
|
||||
import { Dispatch, SetStateAction } from "react";
|
||||
|
||||
import { ResponseMessage } from "@/types";
|
||||
|
||||
const InfoMessage = ({
|
||||
responseMessage,
|
||||
}: {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { useEffect } from "react";
|
||||
|
||||
import { useSetAtom } from "jotai";
|
||||
import { mapBoundsAtom } from "@/app/atoms";
|
||||
import L from "leaflet";
|
||||
import { useMapEvent } from "react-leaflet";
|
||||
|
||||
import { mapBoundsAtom } from "@/app/atoms";
|
||||
|
||||
const MapEvents = () => {
|
||||
const setMapBounds = useSetAtom(mapBoundsAtom);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Link from "next-intl/link";
|
||||
import { useTranslations } from "next-intl";
|
||||
import Link from "next-intl/link";
|
||||
|
||||
import Hamburger from "./Hamburger";
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { NextIntlClientProvider, AbstractIntlMessages } from "next-intl";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
import { AbstractIntlMessages, NextIntlClientProvider } from "next-intl";
|
||||
|
||||
import "@/css/globals.css";
|
||||
|
||||
import Navbar from "./Navbar";
|
||||
import Footer from "./Footer";
|
||||
import Navbar from "./Navbar";
|
||||
|
||||
const TestableLayout = ({
|
||||
children,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import useDarkMode from "@/hooks/useDarkMode";
|
||||
|
||||
const ThemeSwitcher = () => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
import useContactForm from "@/hooks/useContactForm";
|
||||
import { handleEmailSubmit } from "@/handlers/formHandlers";
|
||||
|
||||
import InfoMessage from "@/app/[lang]/components/InfoMessage";
|
||||
import { handleEmailSubmit } from "@/handlers/formHandlers";
|
||||
import useContactForm from "@/hooks/useContactForm";
|
||||
|
||||
const ContactForm = () => {
|
||||
const t = useTranslations("Contact");
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import Script from "next/script";
|
||||
import { Inter, Julius_Sans_One } from "next/font/google";
|
||||
import { useLocale, NextIntlClientProvider } from "next-intl";
|
||||
import { getTranslator } from "next-intl/server";
|
||||
import { notFound } from "next/navigation";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
import { NextIntlClientProvider, useLocale } from "next-intl";
|
||||
import { getTranslator } from "next-intl/server";
|
||||
import { Inter, Julius_Sans_One } from "next/font/google";
|
||||
import { notFound } from "next/navigation";
|
||||
import Script from "next/script";
|
||||
|
||||
import "@/css/globals.css";
|
||||
|
||||
import Providers from "./providers";
|
||||
import Navbar from "./components/Navbar";
|
||||
import Footer from "./components/Footer";
|
||||
import Navbar from "./components/Navbar";
|
||||
import Providers from "./providers";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"], variable: "--font-inter" });
|
||||
const title = Julius_Sans_One({
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
import { useTranslations } from "next-intl";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
|
||||
import bgImage from "@/public/images/map-bg.jpg";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Link from "next-intl/link";
|
||||
import { useTranslations } from "next-intl";
|
||||
import Link from "next-intl/link";
|
||||
|
||||
export default function About() {
|
||||
const t = useTranslations("About");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user