Compare commits

..
21 Commits
Author SHA1 Message Date
dependabot[bot] 8269144df9 Bump oxlint from 1.86.0 to 1.89.0
Bumps [oxlint](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxlint) from 1.86.0 to 1.89.0.
- [Release notes](https://github.com/oxc-project/oxc/releases)
- [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxlint/CHANGELOG.md)
- [Commits](https://github.com/oxc-project/oxc/commits/oxlint_v1.89.0/npm/oxlint)

---
updated-dependencies:
- dependency-name: oxlint
  dependency-version: 1.89.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-31 00:03:33 +01:00
dependabot[bot] 7fb84b5132 Bump the next group with 2 updates
Bumps the next group with 2 updates: [next](https://github.com/vercel/next.js) and [@next/bundle-analyzer](https://github.com/vercel/next.js/tree/HEAD/packages/next-bundle-analyzer).


Updates `next` from 16.4.2 to 16.4.3
- [Release notes](https://github.com/vercel/next.js/releases)
- [Commits](https://github.com/vercel/next.js/compare/v16.4.2...v16.4.3)

Updates `@next/bundle-analyzer` from 16.4.2 to 16.4.3
- [Release notes](https://github.com/vercel/next.js/releases)
- [Commits](https://github.com/vercel/next.js/commits/v16.4.3/packages/next-bundle-analyzer)

---
updated-dependencies:
- dependency-name: next
  dependency-version: 16.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: next
- dependency-name: "@next/bundle-analyzer"
  dependency-version: 16.4.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: next
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-29 23:22:05 +01:00
dependabot[bot] fefa38fc70 Bump react-hook-form from 7.89.0 to 7.90.0
Bumps [react-hook-form](https://github.com/react-hook-form/react-hook-form) from 7.89.0 to 7.90.0.
- [Release notes](https://github.com/react-hook-form/react-hook-form/releases)
- [Changelog](https://github.com/react-hook-form/react-hook-form/blob/master/CHANGELOG.md)
- [Commits](https://github.com/react-hook-form/react-hook-form/compare/v7.89.0...v7.90.0)

---
updated-dependencies:
- dependency-name: react-hook-form
  dependency-version: 7.90.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-23 15:33:46 +02:00
dependabot[bot] 06c7418d6f Bump the react group across 1 directory with 2 updates
Bumps the react group with 2 updates in the / directory: [react](https://github.com/react/react/tree/HEAD/packages/react) and [react-dom](https://github.com/react/react/tree/HEAD/packages/react-dom).


Updates `react` from 19.3.0 to 19.3.1
- [Release notes](https://github.com/react/react/releases)
- [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md)
- [Commits](https://github.com/react/react/commits/v19.3.1/packages/react)

Updates `react-dom` from 19.3.0 to 19.3.1
- [Release notes](https://github.com/react/react/releases)
- [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md)
- [Commits](https://github.com/react/react/commits/v19.3.1/packages/react-dom)

---
updated-dependencies:
- dependency-name: react
  dependency-version: 19.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: react
- dependency-name: react-dom
  dependency-version: 19.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: react
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-23 14:04:17 +02:00
dependabot[bot] 63cd7e6de7 Bump vite from 8.3.2 to 8.3.4
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.3.2 to 8.3.4.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.3.4/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 8.3.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-23 13:19:43 +02:00
dependabot[bot] 14e5038ff4 Bump the next group with 2 updates
Bumps the next group with 2 updates: [next](https://github.com/vercel/next.js) and [@next/bundle-analyzer](https://github.com/vercel/next.js/tree/HEAD/packages/next-bundle-analyzer).


Updates `next` from 16.4.0 to 16.4.2
- [Release notes](https://github.com/vercel/next.js/releases)
- [Commits](https://github.com/vercel/next.js/compare/v16.4.0...v16.4.2)

Updates `@next/bundle-analyzer` from 16.4.0 to 16.4.2
- [Release notes](https://github.com/vercel/next.js/releases)
- [Commits](https://github.com/vercel/next.js/commits/v16.4.2/packages/next-bundle-analyzer)

---
updated-dependencies:
- dependency-name: next
  dependency-version: 16.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: next
- dependency-name: "@next/bundle-analyzer"
  dependency-version: 16.4.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: next
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-22 23:06:29 +02:00
dependabot[bot] 3ad0b2779e Bump @tanstack/react-query from 5.104.0 to 5.104.2
Bumps [@tanstack/react-query](https://github.com/TanStack/query/tree/HEAD/packages/react-query) from 5.104.0 to 5.104.2.
- [Release notes](https://github.com/TanStack/query/releases)
- [Changelog](https://github.com/TanStack/query/blob/main/packages/react-query/CHANGELOG.md)
- [Commits](https://github.com/TanStack/query/commits/@tanstack/react-query@5.104.2/packages/react-query)

---
updated-dependencies:
- dependency-name: "@tanstack/react-query"
  dependency-version: 5.104.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-21 19:26:46 +02:00
dependabot[bot] 888cd01d7c Bump the types group with 2 updates
Bumps the types group with 2 updates: [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) and [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node).


Updates `@types/lodash` from 4.17.25 to 4.17.26
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

Updates `@types/node` from 26.6.4 to 26.6.5
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/lodash"
  dependency-version: 4.17.26
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
- dependency-name: "@types/node"
  dependency-version: 26.6.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-16 23:21:03 +02:00
dependabot[bot] 70571a81a2 Bump the next group with 2 updates
Bumps the next group with 2 updates: [next](https://github.com/vercel/next.js) and [@next/bundle-analyzer](https://github.com/vercel/next.js/tree/HEAD/packages/next-bundle-analyzer).


Updates `next` from 16.3.8 to 16.4.0
- [Release notes](https://github.com/vercel/next.js/releases)
- [Commits](https://github.com/vercel/next.js/compare/v16.3.8...v16.4.0)

Updates `@next/bundle-analyzer` from 16.3.8 to 16.4.0
- [Release notes](https://github.com/vercel/next.js/releases)
- [Commits](https://github.com/vercel/next.js/commits/v16.4.0/packages/next-bundle-analyzer)

---
updated-dependencies:
- dependency-name: next
  dependency-version: 16.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: next
- dependency-name: "@next/bundle-analyzer"
  dependency-version: 16.4.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: next
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-16 07:14:47 +02:00
owenrees ee854151a3 upgrade nodemailer, zod-utils, next-intl 2026-10-15 19:45:54 +02:00
owenrees 3468d5cd50 ignore codegraph folder 2026-10-15 19:45:54 +02:00
dependabot[bot] 9662f6d5b0 Bump postcss from 8.5.28 to 8.5.29
Bumps [postcss](https://github.com/postcss/postcss) from 8.5.28 to 8.5.29.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.5.28...8.5.29)

---
updated-dependencies:
- dependency-name: postcss
  dependency-version: 8.5.29
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-10 00:10:54 +02:00
dependabot[bot] 687d335625 Bump the next group across 1 directory with 4 updates
Bumps the next group with 4 updates in the / directory: [next](https://github.com/vercel/next.js), [serwist](https://github.com/serwist/serwist), [@next/bundle-analyzer](https://github.com/vercel/next.js/tree/HEAD/packages/next-bundle-analyzer) and [@serwist/next](https://github.com/serwist/serwist).


Updates `next` from 16.3.7 to 16.3.8
- [Release notes](https://github.com/vercel/next.js/releases)
- [Commits](https://github.com/vercel/next.js/compare/v16.3.7...v16.3.8)

Updates `serwist` from 9.5.12 to 9.5.13
- [Release notes](https://github.com/serwist/serwist/releases)
- [Commits](https://github.com/serwist/serwist/commits)

Updates `@next/bundle-analyzer` from 16.3.7 to 16.3.8
- [Release notes](https://github.com/vercel/next.js/releases)
- [Commits](https://github.com/vercel/next.js/commits/v16.3.8/packages/next-bundle-analyzer)

Updates `@serwist/next` from 9.5.12 to 9.5.13
- [Release notes](https://github.com/serwist/serwist/releases)
- [Commits](https://github.com/serwist/serwist/commits)

---
updated-dependencies:
- dependency-name: next
  dependency-version: 16.3.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: next
- dependency-name: serwist
  dependency-version: 9.5.13
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: next
- dependency-name: "@next/bundle-analyzer"
  dependency-version: 16.3.8
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: next
- dependency-name: "@serwist/next"
  dependency-version: 9.5.13
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: next
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-08 23:17:14 +02:00
owenrees 6f32be40d4 add tournament duration filter
remove expired tournaments from test data

apply auto formatting rules

condense norm tournament text

revert duration to pill buttons

use select for duration filter

duration filter

show date range on map marker

return start/end dates and calculated duration for tournaments

inline returns etc

new seed data for dev
2026-10-07 23:31:41 +02:00
owenrees 6517af51c9 dep: @types/node -> v26.6.4, @testing-library/jest-dom -> v7.0.1 2026-10-05 21:53:19 +02:00
owenrees 9fb78b2f78 fix: update analytics info to Matomo 2026-10-05 21:53:19 +02:00
owenrees a5112561c5 fix: make typecheck pass in CI for static image imports
- Add next/image-types/global reference to global.d.ts so *.jpeg (and
  other image module) declarations resolve without the gitignored,
  generated next-env.d.ts, which is absent in fresh CI clones
- Run tsc with `--incremental false` in the typeCheck script to bypass
  the stale tsconfig.tsbuildinfo cache that was emitting a phantom
  TS2307 for src/app/[locale]/banner.jpeg
2026-10-05 16:15:25 +02:00
owenrees 2cc5e7f6c3 apply formatting and rename check to verify to avoid yarn collision 2026-10-05 16:15:25 +02:00
owenrees 11113efc9f add CI checks, dependabot, upgrade zod and vitest 2026-10-05 16:15:25 +02:00
owenrees 61dcd11739 upgrade TS to v7
update readme to reflect new lint and format plugins, apply formatting rules
2026-10-05 16:15:25 +02:00
owenrees feadb465eb upgrade Nodemailer to v10
fix dead code with knip

upgrade TS to v6 and fix linting errors

auto apply oxfmt rules

fix linting errors - unused deps etc

ignore file

remove all ignored files in knip

add knip - dead code analysis tool

swap prettier and eslint of oxfmt and oxlint

fix: fix map rendering in react strict mode

fix: headlessUI float replace

fix: disable Matomo if not URL and SITE ID exist

upgrade: 1st pass upgrade to Next.js v16

deps: upgrade react to v19
2026-10-05 16:15:25 +02:00
18 changed files with 11836 additions and 11104 deletions
+12
View File
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule: { interval: weekly }
open-pull-requests-limit: 10
groups:
react: { patterns: ["react", "react-dom", "@types/react", "@types/react-dom"] }
next: { patterns: ["next", "@next/*", "@serwist/*", "serwist"] }
types: { patterns: ["@types/*"] }
leaflet: { patterns: ["leaflet", "leaflet-*", "react-leaflet*", "@types/leaflet"] }
labels: ["dependencies"]
+19
View File
@@ -0,0 +1,19 @@
name: CI
on:
pull_request:
push:
branches: [main]
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn verify
+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
Vendored
+2
View File
@@ -1,3 +1,5 @@
/// <reference types="next/image-types/global" />
// Use type safe message keys with `next-intl` // Use type safe message keys with `next-intl`
type Messages = typeof import("./src/messages/fr.json"); type Messages = typeof import("./src/messages/fr.json");
+11195 -10337
View File
File diff suppressed because it is too large Load Diff
+32 -28
View File
@@ -3,36 +3,35 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"test": "vitest --config vitetest.config.ts", "test": "vitest",
"test:ci": "vitest run",
"test:coverage": "vitest --coverage",
"dev": "next dev", "dev": "next dev",
"build": "next build --webpack", "build": "next build --webpack",
"start": "next start", "start": "next start",
"lint": "oxlint", "lint": "oxlint",
"typeCheck": "tsc -p ./tsconfig.json", "typeCheck": "tsc -p ./tsconfig.json --incremental false",
"postinstall": "patch-package", "postinstall": "patch-package",
"format": "oxfmt --check", "format": "oxfmt --check",
"format:fix": "oxfmt", "format:fix": "oxfmt",
"knip": "knip", "knip": "knip",
"knip:prod": "knip --production", "knip:prod": "knip --production",
"knip:ci": "knip --production --cache" "knip:ci": "knip --production --cache",
"verify": "yarn format && yarn lint && yarn typeCheck && yarn test:ci && yarn knip && yarn knip:prod"
}, },
"dependencies": { "dependencies": {
"@auth/mongodb-adapter": "^3.5.2", "@auth/mongodb-adapter": "^3.5.2",
"@headlessui/react": "^2.1.8", "@headlessui/react": "^2.1.8",
"@headlessui/tailwindcss": "^0.2.1",
"@hookform/resolvers": "^3.9.0", "@hookform/resolvers": "^3.9.0",
"@infra-blocks/zod-utils": "^0.4.2", "@infra-blocks/zod-utils": "^0.32.0",
"@next/bundle-analyzer": "^16.3.6",
"@serwist/next": "^9.5.12",
"@socialgouv/matomo-next": "^1.14.2", "@socialgouv/matomo-next": "^1.14.2",
"@tanstack/react-query": "^5.29.0", "@tanstack/react-query": "^5.104.2",
"@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",
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"geojson": "^0.5.0", "geojson": "^0.5.0",
"jotai": "^2.6.1", "jotai": "^2.6.1",
"knip": "^6.38.0",
"leaflet": "^1.9.4", "leaflet": "^1.9.4",
"leaflet-defaulticon-compatibility": "^0.1.2", "leaflet-defaulticon-compatibility": "^0.1.2",
"leaflet-draw": "^1.0.4", "leaflet-draw": "^1.0.4",
@@ -41,19 +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.3.6", "next": "^16.4.3",
"next-auth": "^5.0.0-beta.32", "next-auth": "^5.0.0-beta.32",
"next-intl": "^4.14.7", "next-intl": "^4.14.9",
"next-safe-action": "^7.9.3", "next-safe-action": "^7.9.3",
"nodemailer": "^10.0.12", "nodemailer": "^10.1.1",
"oxfmt": "^0.71.0", "react": "^19.3.1",
"oxlint": "^1.86.0",
"postcss": "^8.4.47",
"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.0", "react-dom": "^19.3.1",
"react-hook-form": "^7.46.1", "react-hook-form": "^7.90.0",
"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",
@@ -61,28 +57,36 @@
"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.12", "serwist": "^9.5.13",
"sharp": "^0.33.0", "sharp": "^0.35.5",
"superjson": "^2.2.1", "superjson": "^2.2.1",
"tailwind-merge": "^2.0.0", "tailwind-merge": "^2.0.0",
"tailwindcss": "^3.3.5", "zod": "^4.6.5"
"typescript": "^7.0.2",
"vitest": "^4.0.12",
"zod": "^3.22.4"
}, },
"devDependencies": { "devDependencies": {
"@headlessui/tailwindcss": "^0.2.1",
"@next/bundle-analyzer": "^16.4.3",
"@serwist/next": "^9.5.13",
"@swc-jotai/react-refresh": "^0.2.0", "@swc-jotai/react-refresh": "^0.2.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": "^6.1.2", "@testing-library/jest-dom": "^7.0.1",
"@types/leaflet": "^1.9.12", "@types/leaflet": "^1.9.12",
"@types/lodash": "^4.14.195", "@types/lodash": "^4.17.26",
"@types/node": "^24.19.0", "@types/node": "^26.6.5",
"@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",
"patch-package": "^8.0.1" "knip": "^6.38.0",
"oxfmt": "^0.71.0",
"oxlint": "^1.89.0",
"patch-package": "^8.0.1",
"postcss": "^8.5.29",
"tailwindcss": "^3.3.5",
"typescript": "^7.0.2",
"vite": "8.3.4",
"vitest": "^5.0.3"
}, },
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610" "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
} }
+1 -1
View File
@@ -33,7 +33,7 @@ export default function Contact() {
<p> <p>
{t.rich("cookiesInfo", { {t.rich("cookiesInfo", {
link: (str) => ( link: (str) => (
<a href="https://tinyanalytics.io" target="_blank" rel="noopener noreferrer"> <a href="https://matomo.org" target="_blank" rel="noopener noreferrer">
{str} {str}
</a> </a>
), ),
@@ -0,0 +1,50 @@
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,7 +4,6 @@ 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";
@@ -37,7 +36,7 @@ export const TournamentMarker = forwardRef<MarkerRef, TournamentMarkerProps>(
[], [],
); );
const { date, latLng, groupId, timeControl } = tournamentGroup[0]; const { startDate, endDate, latLng, groupId, timeControl } = tournamentGroup[0];
const setHoveredMapId = useSetAtom(debouncedHoveredMapIdAtom); const setHoveredMapId = useSetAtom(debouncedHoveredMapIdAtom);
@@ -58,9 +57,6 @@ export const TournamentMarker = forwardRef<MarkerRef, TournamentMarkerProps>(
[timeControl], [timeControl],
); );
const startDate = date;
const endDate = last(tournamentGroup)!.date;
return ( return (
<Marker <Marker
ref={markerRef} ref={markerRef}
@@ -74,10 +70,7 @@ 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> <b>{startDate !== endDate ? `${startDate} -> ${endDate}` : startDate}</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,6 +25,7 @@ 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 = () => {
@@ -75,6 +76,7 @@ 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={{
@@ -89,6 +91,8 @@ 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
+13 -8
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 { TimeControl, Tournament, tcMap } from "@/types"; import { tcMap, TimeControl, Tournament } 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 === false) { if (!result.success) {
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 === false; return !result.success;
}); });
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
const dateRanges = tournaments.reduce<Date[][]>( dateRangesByLocation[location] = 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,8 +122,6 @@ const getTournaments = async () => {
}, },
[[]], [[]],
); );
dateRangesByLocation[location] = dateRanges;
} }
return goodData.map<Tournament>((t) => { return goodData.map<Tournament>((t) => {
@@ -137,6 +135,11 @@ 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,
@@ -151,6 +154,9 @@ 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) {
@@ -162,8 +168,7 @@ 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 () => {
const data = await getTournaments(); return getTournaments();
return data;
}, },
["tournaments"], ["tournaments"],
{ {
+12
View File
@@ -41,6 +41,9 @@ 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);
@@ -69,14 +72,23 @@ 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) ||
+7 -3
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": "Only norm tournaments", "normsOnly": "Norms tournaments",
"noneFound": "No tournaments found", "noneFound": "No tournaments found",
"date": "Date", "date": "Date",
"town": "Town", "town": "Town",
@@ -91,7 +91,11 @@
"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": {
@@ -319,7 +323,7 @@
"shareTitle": "Data Sharing", "shareTitle": "Data Sharing",
"shareInfo": "We do not share, sell, or provide access to your email address to any third parties. Your information is kept strictly confidential and is only used within our project.", "shareInfo": "We do not share, sell, or provide access to your email address to any third parties. Your information is kept strictly confidential and is only used within our project.",
"cookiesTitle": "Cookies and Tracking", "cookiesTitle": "Cookies and Tracking",
"cookiesInfo": "We do not track users in an intrusive manner. However, we use <link>TinyAnalytics.io</link>, an anonymous, GDPR-friendly analytics tool, to gather anonymized usage statistics. No personally identifiable information is collected by this tool, and its usage is strictly limited to improving user experience.", "cookiesInfo": "We do not track users in an intrusive manner. However, we use <link>Matomo</link>, an anonymous, GDPR-friendly analytics tool, to gather anonymized usage statistics. No personally identifiable information is collected by this tool, and its usage is strictly limited to improving user experience.",
"changesTitle": "Changes to This Privacy Policy", "changesTitle": "Changes to This Privacy Policy",
"changesInfo": "We may update this privacy policy from time to time. Any changes will be posted on this page, and we encourage you to review this policy periodically." "changesInfo": "We may update this privacy policy from time to time. Any changes will be posted on this page, and we encourage you to review this policy periodically."
} }
+7 -3
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": "Uniquement tournois à normes", "normsOnly": "Tournois à normes",
"noneFound": "Pas de tournois trouvé", "noneFound": "Pas de tournois trouvé",
"date": "Date", "date": "Date",
"town": "Ville", "town": "Ville",
@@ -90,7 +90,11 @@
"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": {
@@ -320,7 +324,7 @@
"shareTitle": "Partage de Données", "shareTitle": "Partage de Données",
"shareInfo": "Nous ne partageons, ne vendons ni ne fournissons l'accès à votre adresse email à des tiers. Vos informations sont strictement confidentielles et sont utilisées uniquement dans le cadre de notre projet.", "shareInfo": "Nous ne partageons, ne vendons ni ne fournissons l'accès à votre adresse email à des tiers. Vos informations sont strictement confidentielles et sont utilisées uniquement dans le cadre de notre projet.",
"cookiesTitle": "Cookies et Suivi", "cookiesTitle": "Cookies et Suivi",
"cookiesInfo": "Nous ne suivons pas les utilisateurs de manière intrusive. Toutefois, nous utilisons <link>TinyAnalytics.io</link>, un outil d'analyse anonyme et conforme au RGPD (Règlement Général sur la Protection des Données), pour obtenir des statistiques d'utilisation anonymisées. Aucune donnée personnelle identifiable n'est collectée par cet outil, et son utilisation est strictement limitée à des fins d'amélioration de l'expérience utilisateur.", "cookiesInfo": "Nous ne suivons pas les utilisateurs de manière intrusive. Toutefois, nous utilisons <link>Matomo</link>, un outil d'analyse anonyme et conforme au RGPD (Règlement Général sur la Protection des Données), pour obtenir des statistiques d'utilisation anonymisées. Aucune donnée personnelle identifiable n'est collectée par cet outil, et son utilisation est strictement limitée à des fins d'amélioration de l'expérience utilisateur.",
"changesTitle": "Modifications de Cette Politique de Confidentialité", "changesTitle": "Modifications de Cette Politique de Confidentialité",
"changesInfo": "Nous pouvons mettre à jour cette politique de confidentialité de temps à autre. Toutes les modifications seront publiées sur cette page, et nous vous encourageons à consulter régulièrement cette politique." "changesInfo": "Nous pouvons mettre à jour cette politique de confidentialité de temps à autre. Toutes les modifications seront publiées sur cette page, et nous vous encourageons à consulter régulièrement cette politique."
} }
+7 -7
View File
@@ -4,28 +4,28 @@ import { z } from "zod";
import { TimeControl } from "@/types"; import { TimeControl } from "@/types";
export const contactUsSchema = z.object({ export const contactUsSchema = z.object({
email: z.string().email(), email: z.email(),
subject: z.string().min(1, { message: "FormValidation.required" }), subject: z.string().min(1, { message: "FormValidation.required" }),
message: z.string().min(1, { message: "FormValidation.required" }), message: z.string().min(1, { message: "FormValidation.required" }),
}); });
export const addClubSchema = z.object({ export const addClubSchema = z.object({
name: z.string().min(1, { message: "FormValidation.required" }), name: z.string().min(1, { message: "FormValidation.required" }),
email: z.string().email(), email: z.email(),
message: z.string().optional(), message: z.string().optional(),
club: z.object({ club: z.object({
name: z.string().min(1, { message: "FormValidation.required" }), name: z.string().min(1, { message: "FormValidation.required" }),
email: z.string().email().optional(), email: z.email().optional(),
address: z.string().min(1, { message: "FormValidation.required" }), address: z.string().min(1, { message: "FormValidation.required" }),
website: z.string().url({ message: "FormValidation.url" }).optional(), website: z.url({ message: "FormValidation.url" }).optional(),
coordinates: z.array(z.number()).length(2), coordinates: z.array(z.number()).length(2),
}), }),
}); });
export const addTournamentSchema = z.object({ export const addTournamentSchema = z.object({
name: z.string().min(1, { message: "FormValidation.required" }), name: z.string().min(1, { message: "FormValidation.required" }),
email: z.string().email(), email: z.email(),
message: z.string().optional(), message: z.string().optional(),
tournament: z.object({ tournament: z.object({
@@ -33,8 +33,8 @@ export const addTournamentSchema = z.object({
town: z.string().min(1, { message: "FormValidation.required" }), town: z.string().min(1, { message: "FormValidation.required" }),
department: z.string().min(1, { message: "FormValidation.required" }), department: z.string().min(1, { message: "FormValidation.required" }),
tournament: z.string().min(1, { message: "FormValidation.required" }), tournament: z.string().min(1, { message: "FormValidation.required" }),
url: z.string().url({ message: "FormValidation.url" }), url: z.url({ message: "FormValidation.url" }),
time_control: z.nativeEnum(TimeControl), time_control: z.enum(TimeControl),
norm_tournament: z.boolean(), norm_tournament: z.boolean(),
date: z.date(), date: z.date(),
coordinates: z.array(z.number()).length(2), coordinates: z.array(z.number()).length(2),
+3
View File
@@ -25,6 +25,9 @@ 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> = {
+3 -3
View File
@@ -2,12 +2,12 @@ import path from "node:path";
import { defineConfig } from "vitest/config"; import { defineConfig } from "vitest/config";
export default defineConfig({ export default defineConfig({
test: {
exclude: ["**/node_modules/**", "**/dist/**"],
},
resolve: { resolve: {
alias: { alias: {
"@": path.resolve(__dirname, "./src"), "@": path.resolve(__dirname, "./src"),
}, },
}, },
test: {
exclude: ["**/node_modules/**", "**/dist/**"],
},
}); });
+466 -704
View File
File diff suppressed because it is too large Load Diff