Compare commits

..
Author SHA1 Message Date
dependabot[bot] bd3777a630 Bump @swc-jotai/react-refresh from 0.2.0 to 0.5.0
Bumps [@swc-jotai/react-refresh](https://github.com/pmndrs/swc-jotai) from 0.2.0 to 0.5.0.
- [Release notes](https://github.com/pmndrs/swc-jotai/releases)
- [Commits](https://github.com/pmndrs/swc-jotai/commits/v0.5.0)

---
updated-dependencies:
- dependency-name: "@swc-jotai/react-refresh"
  dependency-version: 0.5.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-05 19:56:52 +00:00
12 changed files with 10728 additions and 11645 deletions
+1 -1
View File
@@ -1,8 +1,8 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
/.idea/ /.idea/
/.yarn/ /.yarn/
/.codegraph/
# dependencies # dependencies
/node_modules /node_modules
+10304 -11162
View File
File diff suppressed because it is too large Load Diff
+17 -17
View File
@@ -23,9 +23,9 @@
"@auth/mongodb-adapter": "^3.5.2", "@auth/mongodb-adapter": "^3.5.2",
"@headlessui/react": "^2.1.8", "@headlessui/react": "^2.1.8",
"@hookform/resolvers": "^3.9.0", "@hookform/resolvers": "^3.9.0",
"@infra-blocks/zod-utils": "^0.32.0", "@infra-blocks/zod-utils": "^0.31.0",
"@socialgouv/matomo-next": "^1.14.2", "@socialgouv/matomo-next": "^1.14.2",
"@tanstack/react-query": "^5.104.2", "@tanstack/react-query": "^5.29.0",
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.114", "@turf/boolean-point-in-polygon": "^7.0.0-alpha.114",
"autoprefixer": "^10.4.16", "autoprefixer": "^10.4.16",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
@@ -40,16 +40,16 @@
"leaflet.smooth_marker_bouncing": "3.0.3", "leaflet.smooth_marker_bouncing": "3.0.3",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mongodb": "^7.0.0", "mongodb": "^7.0.0",
"next": "^16.4.3", "next": "^16.3.6",
"next-auth": "^5.0.0-beta.32", "next-auth": "^5.0.0-beta.32",
"next-intl": "^4.14.9", "next-intl": "^4.14.7",
"next-safe-action": "^7.9.3", "next-safe-action": "^7.9.3",
"nodemailer": "^10.3.1", "nodemailer": "^10.0.12",
"react": "^19.3.1", "react": "^19.3.0",
"react-date-range": "^2.0.1", "react-date-range": "^2.0.1",
"react-datepicker": "^7.4.0", "react-datepicker": "^7.4.0",
"react-dom": "^19.3.1", "react-dom": "^19.3.0",
"react-hook-form": "^7.90.0", "react-hook-form": "^7.46.1",
"react-icons": "^5.3.0", "react-icons": "^5.3.0",
"react-input-mask": "^2.0.4", "react-input-mask": "^2.0.4",
"react-leaflet": "^4.2.1", "react-leaflet": "^4.2.1",
@@ -57,7 +57,7 @@
"react-leaflet-draw": "^0.20.4", "react-leaflet-draw": "^0.20.4",
"react-select": "^5.7.4", "react-select": "^5.7.4",
"react-tooltip": "^5.18.0", "react-tooltip": "^5.18.0",
"serwist": "^9.5.13", "serwist": "^9.5.12",
"sharp": "^0.35.5", "sharp": "^0.35.5",
"superjson": "^2.2.1", "superjson": "^2.2.1",
"tailwind-merge": "^2.0.0", "tailwind-merge": "^2.0.0",
@@ -65,27 +65,27 @@
}, },
"devDependencies": { "devDependencies": {
"@headlessui/tailwindcss": "^0.2.1", "@headlessui/tailwindcss": "^0.2.1",
"@next/bundle-analyzer": "^16.4.3", "@next/bundle-analyzer": "^16.3.6",
"@serwist/next": "^9.5.13", "@serwist/next": "^9.5.12",
"@swc-jotai/react-refresh": "^0.2.0", "@swc-jotai/react-refresh": "^0.5.0",
"@tailwindcss/forms": "^0.5.4", "@tailwindcss/forms": "^0.5.4",
"@tailwindcss/typography": "^0.5.15", "@tailwindcss/typography": "^0.5.15",
"@testing-library/jest-dom": "^7.0.1", "@testing-library/jest-dom": "^7.0.1",
"@types/leaflet": "^1.9.12", "@types/leaflet": "^1.9.12",
"@types/lodash": "^4.17.26", "@types/lodash": "^4.14.195",
"@types/node": "^26.6.5", "@types/node": "^26.6.4",
"@types/react": "^19.3.0", "@types/react": "^19.3.0",
"@types/react-date-range": "^1.4.9", "@types/react-date-range": "^1.4.9",
"@types/react-dom": "^19.3.0", "@types/react-dom": "^19.3.0",
"@types/react-input-mask": "^3.0.2", "@types/react-input-mask": "^3.0.2",
"knip": "^6.38.0", "knip": "^6.38.0",
"oxfmt": "^0.71.0", "oxfmt": "^0.71.0",
"oxlint": "^1.89.0", "oxlint": "^1.86.0",
"patch-package": "^8.0.1", "patch-package": "^8.0.1",
"postcss": "^8.5.29", "postcss": "^8.4.47",
"tailwindcss": "^3.3.5", "tailwindcss": "^3.3.5",
"typescript": "^7.0.2", "typescript": "^7.0.2",
"vite": "8.3.4", "vite": "8.3.2",
"vitest": "^5.0.3" "vitest": "^5.0.3"
}, },
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610" "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
@@ -1,50 +0,0 @@
import { useAtom, useAtomValue } from "jotai";
import { useTranslations } from "next-intl";
import { twMerge } from "tailwind-merge";
import {
DurationFilter as DurationFilterValue,
durationFilterAtom,
tournamentsAtom,
} from "@/atoms";
const DurationFilter = () => {
const t = useTranslations("Tournaments");
const tournaments = useAtomValue(tournamentsAtom);
const [durationFilter, setDurationFilter] = useAtom(durationFilterAtom);
const show3Plus = tournaments.some((tt) => tt.durationDays >= 3);
const options: { value: DurationFilterValue; label: string }[] = [
{ value: "any", label: t("durationAny") },
{ value: "1", label: t("duration1Day") },
{ value: "2", label: t("duration2Days") },
...(show3Plus ? [{ value: "3+" as const, label: t("duration3PlusDays") }] : []),
];
return (
<div className="flex flex-wrap items-center gap-1">
{options.map(({ value, label }) => {
const isActive = durationFilter === value;
return (
<button
key={value}
type="button"
aria-pressed={isActive}
onClick={() => setDurationFilter(value)}
className={twMerge(
"rounded-full border px-3 py-1 text-sm transition-colors focus:outline-none",
isActive
? "border-primary bg-primary text-white"
: "border-gray-400 text-gray-600 hover:border-primary hover:text-primary dark:border-gray-600 dark:text-gray-300 dark:hover:text-primary",
)}
>
{label}
</button>
);
})}
</div>
);
};
export default DurationFilter;
@@ -4,6 +4,7 @@ import { forwardRef, useImperativeHandle, useMemo, useRef } from "react";
import { useSetAtom } from "jotai"; import { useSetAtom } from "jotai";
import L from "leaflet"; import L from "leaflet";
import { last } from "lodash";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { FaTrophy } from "react-icons/fa"; import { FaTrophy } from "react-icons/fa";
import { Marker, MarkerProps, Popup } from "react-leaflet"; import { Marker, MarkerProps, Popup } from "react-leaflet";
@@ -36,7 +37,7 @@ export const TournamentMarker = forwardRef<MarkerRef, TournamentMarkerProps>(
[], [],
); );
const { startDate, endDate, latLng, groupId, timeControl } = tournamentGroup[0]; const { date, latLng, groupId, timeControl } = tournamentGroup[0];
const setHoveredMapId = useSetAtom(debouncedHoveredMapIdAtom); const setHoveredMapId = useSetAtom(debouncedHoveredMapIdAtom);
@@ -57,6 +58,9 @@ export const TournamentMarker = forwardRef<MarkerRef, TournamentMarkerProps>(
[timeControl], [timeControl],
); );
const startDate = date;
const endDate = last(tournamentGroup)!.date;
return ( return (
<Marker <Marker
ref={markerRef} ref={markerRef}
@@ -70,7 +74,10 @@ export const TournamentMarker = forwardRef<MarkerRef, TournamentMarkerProps>(
> >
<Popup maxWidth={10000}> <Popup maxWidth={10000}>
<div className="flex max-w-[calc(100vw-80px)] flex-col gap-3 lg:max-w-[calc(100vw/2-80px)]"> <div className="flex max-w-[calc(100vw-80px)] flex-col gap-3 lg:max-w-[calc(100vw/2-80px)]">
<b>{startDate !== endDate ? `${startDate} -> ${endDate}` : startDate}</b> <b>
{date}
{endDate !== startDate && ` - ${endDate}`}
</b>
<div className="flex flex-col gap-0"> <div className="flex flex-col gap-0">
{tournamentGroup.map((tournament) => ( {tournamentGroup.map((tournament) => (
@@ -25,7 +25,6 @@ import { useBreakpoint } from "@/hooks/tailwind";
import useDatePickerWidth from "@/hooks/useDatePickerWidth"; import useDatePickerWidth from "@/hooks/useDatePickerWidth";
import { DatePickerDirection } from "@/types"; import { DatePickerDirection } from "@/types";
import DurationFilter from "./DurationFilter";
import TimeControlFilters from "./TimeControlFilters"; import TimeControlFilters from "./TimeControlFilters";
const TournamentTable = () => { const TournamentTable = () => {
@@ -76,7 +75,6 @@ const TournamentTable = () => {
<div className="z-10 flex w-full flex-wrap items-center justify-start gap-3 p-3"> <div className="z-10 flex w-full flex-wrap items-center justify-start gap-3 p-3">
<div className="flex w-full flex-col gap-3 sm:flex-row"> <div className="flex w-full flex-col gap-3 sm:flex-row">
<SearchBar className="w-full sm:w-auto" /> <SearchBar className="w-full sm:w-auto" />
<RegionSelect <RegionSelect
syncTitle={t("syncWithMapOption")} syncTitle={t("syncWithMapOption")}
classNameOverrides={{ classNameOverrides={{
@@ -91,8 +89,6 @@ const TournamentTable = () => {
onClick={handleDatePickerClick} onClick={handleDatePickerClick}
/> />
<DurationFilter />
<div className="flex text-gray-900 dark:text-white"> <div className="flex text-gray-900 dark:text-white">
<label> <label>
<input <input
+8 -13
View File
@@ -7,7 +7,7 @@ import { unstable_cache } from "next/cache";
import { baseUrl } from "@/constants"; import { baseUrl } from "@/constants";
import { tournamentModelSchema } from "@/server/models/tournamentModel"; import { tournamentModelSchema } from "@/server/models/tournamentModel";
import { collections, dbConnect } from "@/server/mongodb"; import { collections, dbConnect } from "@/server/mongodb";
import { tcMap, TimeControl, Tournament } from "@/types"; import { TimeControl, Tournament, tcMap } from "@/types";
import { errorLog } from "@/utils/logger"; import { errorLog } from "@/utils/logger";
import TournamentsDisplay from "./TournamentsDisplay"; import TournamentsDisplay from "./TournamentsDisplay";
@@ -65,7 +65,7 @@ const getTournaments = async () => {
const bad = data.filter((t) => { const bad = data.filter((t) => {
const result = tournamentModelSchema.safeParse(t); const result = tournamentModelSchema.safeParse(t);
if (!result.success) { if (result.success === false) {
console.log(JSON.stringify(result, null, 2)); console.log(JSON.stringify(result, null, 2));
console.log(JSON.stringify(t, null, 2)); console.log(JSON.stringify(t, null, 2));
@@ -93,7 +93,7 @@ const getTournaments = async () => {
} }
} }
return !result.success; return result.success === false;
}); });
const badIds = bad.map((t) => t._id.toString()); const badIds = bad.map((t) => t._id.toString());
@@ -108,7 +108,7 @@ const getTournaments = async () => {
const tournaments = groupedByLocation[location]; const tournaments = groupedByLocation[location];
// Note that this works since the tournaments are sorted by date // Note that this works since the tournaments are sorted by date
dateRangesByLocation[location] = tournaments.reduce<Date[][]>( const dateRanges = tournaments.reduce<Date[][]>(
(acc, tournament) => { (acc, tournament) => {
const group = acc[acc.length - 1]; const group = acc[acc.length - 1];
const date = parse(tournament.date, "dd/MM/yyyy", new Date()); const date = parse(tournament.date, "dd/MM/yyyy", new Date());
@@ -122,6 +122,8 @@ const getTournaments = async () => {
}, },
[[]], [[]],
); );
dateRangesByLocation[location] = dateRanges;
} }
return goodData.map<Tournament>((t) => { return goodData.map<Tournament>((t) => {
@@ -135,11 +137,6 @@ const getTournaments = async () => {
const timeControl = tcMap[t.time_control] ?? TimeControl.Other; const timeControl = tcMap[t.time_control] ?? TimeControl.Other;
const groupId = `${location}_${rangeIndex}_${timeControl}`; const groupId = `${location}_${rangeIndex}_${timeControl}`;
// calculate duration of the tournament in days, parsing the French locale date
const startDateISO = parse(t.start_date, "dd/MM/yyyy", new Date());
const endDateISO = parse(t.end_date, "dd/MM/yyyy", new Date());
const durationDays = differenceInDays(endDateISO, startDateISO) + 1;
return { return {
id: t._id.toString(), id: t._id.toString(),
ffeId: t.tournament_id, ffeId: t.tournament_id,
@@ -154,9 +151,6 @@ const getTournaments = async () => {
norm: t.norm_tournament ?? false, norm: t.norm_tournament ?? false,
pending: t.pending ?? false, pending: t.pending ?? false,
status: t.status, status: t.status,
startDate: t.start_date,
endDate: t.end_date,
durationDays,
}; };
}); });
} catch (error) { } catch (error) {
@@ -168,7 +162,8 @@ const getTournaments = async () => {
export default async function Tournaments() { export default async function Tournaments() {
const tournaments = await unstable_cache( const tournaments = await unstable_cache(
async () => { async () => {
return getTournaments(); const data = await getTournaments();
return data;
}, },
["tournaments"], ["tournaments"],
{ {
-12
View File
@@ -41,9 +41,6 @@ export const searchStringAtom = atom("");
export const tournamentsAtom = atom<Tournament[]>([]); export const tournamentsAtom = atom<Tournament[]>([]);
export const normsOnlyAtom = atom(false); export const normsOnlyAtom = atom(false);
export type DurationFilter = "any" | "1" | "2" | "3+";
export const durationFilterAtom = atom<DurationFilter>("any");
export const classicAtom = atom(true); export const classicAtom = atom(true);
export const rapidAtom = atom(true); export const rapidAtom = atom(true);
export const blitzAtom = atom(true); export const blitzAtom = atom(true);
@@ -72,23 +69,14 @@ export const filteredTournamentsByTimeControlAndZoneAtom = atom((get) => {
const dateRange = get(dateRangeAtom); const dateRange = get(dateRangeAtom);
const { startDate, endDate } = dateRange[0]; const { startDate, endDate } = dateRange[0];
const durationFilter = get(durationFilterAtom);
const filterByTimeControl = tournaments.filter((tournament) => { const filterByTimeControl = tournaments.filter((tournament) => {
const tournamentDate = startOfDay(parse(tournament.date, "dd/MM/yyyy", new Date())); const tournamentDate = startOfDay(parse(tournament.date, "dd/MM/yyyy", new Date()));
const durationMatch =
durationFilter === "any" ||
(durationFilter === "1" && tournament.durationDays === 1) ||
(durationFilter === "2" && tournament.durationDays === 2) ||
(durationFilter === "3+" && tournament.durationDays >= 3);
return ( return (
!isBefore(tournamentDate, startDate) && !isBefore(tournamentDate, startDate) &&
(endDate === undefined || !isAfter(tournamentDate, endDate)) && (endDate === undefined || !isAfter(tournamentDate, endDate)) &&
!tournament.pending && !tournament.pending &&
tournament.status === "scheduled" && tournament.status === "scheduled" &&
durationMatch &&
((tournament.timeControl === TimeControl.Classic && classic) || ((tournament.timeControl === TimeControl.Classic && classic) ||
(tournament.timeControl === TimeControl.Rapid && rapid) || (tournament.timeControl === TimeControl.Rapid && rapid) ||
(tournament.timeControl === TimeControl.Blitz && blitz) || (tournament.timeControl === TimeControl.Blitz && blitz) ||
+2 -6
View File
@@ -82,7 +82,7 @@
"searchLabel": "Search", "searchLabel": "Search",
"searchPlaceholder": "Search", "searchPlaceholder": "Search",
"syncWithMapOption": "Only tournaments visible in the map view", "syncWithMapOption": "Only tournaments visible in the map view",
"normsOnly": "Norms tournaments", "normsOnly": "Only norm tournaments",
"noneFound": "No tournaments found", "noneFound": "No tournaments found",
"date": "Date", "date": "Date",
"town": "Town", "town": "Town",
@@ -91,11 +91,7 @@
"timeControl": "Time Control", "timeControl": "Time Control",
"approx": "Geo-location is approximative", "approx": "Geo-location is approximative",
"norm": "Norm Tournament", "norm": "Norm Tournament",
"clearButton": "Clear", "clearButton": "Clear"
"durationAny": "Any",
"duration1Day": "1 day",
"duration2Days": "2 days",
"duration3PlusDays": "3+ days"
}, },
"Clubs": { "Clubs": {
+2 -6
View File
@@ -81,7 +81,7 @@
"searchLabel": "Rechercher", "searchLabel": "Rechercher",
"searchPlaceholder": "Rechercher", "searchPlaceholder": "Rechercher",
"syncWithMapOption": "Seuls les tournois visibles dans la vue carte", "syncWithMapOption": "Seuls les tournois visibles dans la vue carte",
"normsOnly": "Tournois à normes", "normsOnly": "Uniquement tournois à normes",
"noneFound": "Pas de tournois trouvé", "noneFound": "Pas de tournois trouvé",
"date": "Date", "date": "Date",
"town": "Ville", "town": "Ville",
@@ -90,11 +90,7 @@
"timeControl": "Cadence", "timeControl": "Cadence",
"approx": "Géolocalisation approximative", "approx": "Géolocalisation approximative",
"norm": "Tournoi à norme", "norm": "Tournoi à norme",
"clearButton": "Effacer", "clearButton": "Effacer"
"durationAny": "Tous",
"duration1Day": "1 jour",
"duration2Days": "2 jours",
"duration3PlusDays": "3+ jours"
}, },
"Clubs": { "Clubs": {
-3
View File
@@ -25,9 +25,6 @@ export type Tournament = {
norm: boolean; norm: boolean;
pending: boolean; pending: boolean;
status: Status; status: Status;
startDate: string;
endDate: string;
durationDays: number;
}; };
export const tcMap: Record<TournamentModel["time_control"], TimeControl> = { export const tcMap: Record<TournamentModel["time_control"], TimeControl> = {
+385 -369
View File
File diff suppressed because it is too large Load Diff