Compare commits

...
36 changed files with 2682 additions and 5446 deletions
-6
View File
@@ -1,6 +0,0 @@
{
"extends": ["next", "next/core-web-vitals", "prettier"],
"globals": {
"React": "readonly"
}
}
+2
View File
@@ -12,6 +12,8 @@
# pwa
sw.*
workbox*.*
swe-worker*.*
!src/app/sw.ts
# testing
/coverage
+4
View File
@@ -0,0 +1,4 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"ignorePatterns": ["leaflet.d.ts"]
}
+15
View File
@@ -0,0 +1,15 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": [
"typescript",
"unicorn",
"oxc"
],
"categories": {
"correctness": "error"
},
"rules": {},
"env": {
"builtin": true
}
}
-9
View File
@@ -1,9 +0,0 @@
{
"trailingComma": "all",
"bracketSpacing": true,
"plugins": ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
"importOrder": ["^react$", "^@?\\w", "^@\\\\", "<THIRD_PARTY_MODULES>", "^\\.\\.", "^\\."],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"tailwindFunctions": ["twMerge"]
}
+6
View File
@@ -0,0 +1,6 @@
{
"$schema": "https://unpkg.com/knip@6/schema.json",
"ignore": [],
"ignoreDependencies": [],
"tags": ["-lintignore"]
}
+18 -7
View File
@@ -1,5 +1,10 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
// react-leaflet v4 creates maps in a render-phase ref callback, which breaks
// under React dev StrictMode's double-mount ("Map container is already
// initialized"). StrictMode only runs in dev, so production is unaffected.
reactStrictMode: false,
};
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
@@ -7,10 +12,16 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
const withNextIntl = require("next-intl/plugin")("./src/i18n.ts");
const withPWA = require("next-pwa")({
dest: "public",
disable: process.env.NODE_ENV === "development",
});
// PWA service worker, generated with Serwist. It hooks into webpack, so it is
// only enabled for production builds (`next build --webpack`) and disabled for
// development, letting `next dev` keep running on Turbopack.
const withSerwist =
process.env.NODE_ENV === "production"
? require("@serwist/next").default({
swSrc: "src/app/sw.ts",
swDest: "public/sw.js",
disable: process.env.NODE_ENV !== "production",
})
: (config) => config;
module.exports = nextConfig;
module.exports = withBundleAnalyzer(withNextIntl(withPWA({})));
module.exports = withBundleAnalyzer(withNextIntl(withSerwist(nextConfig)));
+22 -21
View File
@@ -5,24 +5,27 @@
"scripts": {
"test": "vitest --config vitetest.config.ts",
"dev": "next dev",
"build": "next build",
"build": "next build --webpack",
"start": "next start",
"lint": "next lint",
"lint": "oxlint",
"typeCheck": "tsc -p ./tsconfig.json",
"format": "prettier --check \"**/*.{js,jsx,ts,tsx}\"",
"format:fix": "prettier --write \"**/*.{js,jsx,ts,tsx}\""
"postinstall": "patch-package",
"format": "oxfmt --check",
"format:fix": "oxfmt",
"knip": "knip",
"knip:prod": "knip --production",
"knip:ci": "knip --production --cache"
},
"dependencies": {
"@auth/mongodb-adapter": "^3.5.2",
"@headlessui-float/react": "^0.15.0",
"@headlessui/react": "^2.1.8",
"@headlessui/tailwindcss": "^0.2.1",
"@hookform/resolvers": "^3.9.0",
"@infra-blocks/zod-utils": "^0.4.2",
"@next/bundle-analyzer": "^14.0.4",
"@next/bundle-analyzer": "^16.3.6",
"@serwist/next": "^9.5.12",
"@socialgouv/matomo-next": "^1.10.0",
"@tanstack/react-query": "^5.29.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.114",
"@types/node": "^22.7.2",
"autoprefixer": "^10.4.16",
@@ -30,6 +33,7 @@
"date-fns": "^4.1.0",
"geojson": "^0.5.0",
"jotai": "^2.6.1",
"knip": "^6.38.0",
"leaflet": "^1.9.4",
"leaflet-defaulticon-compatibility": "^0.1.2",
"leaflet-draw": "^1.0.4",
@@ -38,17 +42,18 @@
"leaflet.smooth_marker_bouncing": "3.0.3",
"lodash": "^4.17.21",
"mongodb": "^7.0.0",
"next": "^14.2.3",
"next-auth": "^5.0.0-beta.16",
"next-intl": "^3.3.2",
"next-pwa": "^5.6.0",
"next": "^16.3.6",
"next-auth": "^5.0.0-beta.32",
"next-intl": "^4.14.7",
"next-safe-action": "^7.9.3",
"nodemailer": "^6.9.12",
"oxfmt": "^0.71.0",
"oxlint": "^1.86.0",
"postcss": "^8.4.47",
"react": "^18.2.0",
"react": "^19.3.0",
"react-date-range": "^2.0.1",
"react-datepicker": "^7.4.0",
"react-dom": "^18.2.0",
"react-dom": "^19.3.0",
"react-hook-form": "^7.46.1",
"react-icons": "^5.3.0",
"react-input-mask": "^2.0.4",
@@ -57,6 +62,7 @@
"react-leaflet-draw": "^0.20.4",
"react-select": "^5.7.4",
"react-tooltip": "^5.18.0",
"serwist": "^9.5.12",
"sharp": "^0.33.0",
"superjson": "^2.2.1",
"tailwind-merge": "^2.0.0",
@@ -73,16 +79,11 @@
"@types/leaflet": "^1.9.12",
"@types/lodash": "^4.14.195",
"@types/nodemailer": "^6.4.8",
"@types/react": "^18.2.27",
"@types/react": "^19.3.0",
"@types/react-date-range": "^1.4.9",
"@types/react-dom": "^18.2.18",
"@types/react-dom": "^19.3.0",
"@types/react-input-mask": "^3.0.2",
"eslint": "8",
"eslint-config-next": "^14.0.4",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-react-hooks": "^5.0.0-canary-7118f5dd7-20230705",
"prettier": "^3.1.1",
"prettier-plugin-tailwindcss": "^0.6.8"
"patch-package": "^8.0.1"
},
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
}
+19
View File
@@ -0,0 +1,19 @@
diff --git a/node_modules/react-leaflet-cluster/lib/index.js b/node_modules/react-leaflet-cluster/lib/index.js
index 36ab0c1..ba2ae92 100644
--- a/node_modules/react-leaflet-cluster/lib/index.js
+++ b/node_modules/react-leaflet-cluster/lib/index.js
@@ -28,14 +28,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@react-leaflet/core");
var leaflet_1 = __importDefault(require("leaflet"));
require("leaflet.markercluster");
-require("./assets/MarkerCluster.css");
-require("./assets/MarkerCluster.Default.css");
-delete leaflet_1.default.Icon.Default.prototype._getIconUrl;
-leaflet_1.default.Icon.Default.mergeOptions({
- iconRetinaUrl: require('./assets/marker-icon-2x.png').default,
- iconUrl: require('./assets/marker-icon.png').default,
- shadowUrl: require('./assets/marker-shadow.png').default,
-});
function getPropsAndEvents(props) {
var clusterProps = {};
var clusterEvents = {};
-1
View File
@@ -1 +0,0 @@
self.__WB_DISABLE_DEV_LOGS=!0;
@@ -4,10 +4,11 @@ import SignInClient from "@/app/[locale]/(main)/auth/sign-in/SignInClient";
import { baseUrl } from "@/constants";
export async function generateMetadata({
params: { locale },
params,
}: {
params: { locale?: string };
params: Promise<{ locale?: string }>;
}): Promise<Metadata> {
const { locale } = await params;
return {
alternates: {
canonical:
+3 -2
View File
@@ -12,10 +12,11 @@ import ClubsDisplay from "./ClubsDisplay";
export const revalidate = 3600; // Revalidate cache every 6 hours
export async function generateMetadata({
params: { locale },
params,
}: {
params: { locale?: string };
params: Promise<{ locale?: string }>;
}): Promise<Metadata> {
const { locale } = await params;
return {
alternates: {
canonical:
+3 -2
View File
@@ -4,10 +4,11 @@ import EloClient from "@/app/[locale]/(main)/elo/EloClient";
import { baseUrl } from "@/constants";
export async function generateMetadata({
params: { locale },
params,
}: {
params: { locale?: string };
params: Promise<{ locale?: string }>;
}): Promise<Metadata> {
const { locale } = await params;
return {
alternates: {
canonical:
@@ -3,7 +3,7 @@
import { useCallback, useMemo } from "react";
import { useAtomValue } from "jotai";
import L, { LatLngLiteral } from "leaflet";
import L from "leaflet";
import "leaflet-defaulticon-compatibility";
import "leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css";
import "leaflet.smooth_marker_bouncing";
+3 -2
View File
@@ -20,10 +20,11 @@ import TournamentsDisplay from "./TournamentsDisplay";
setDefaultOptions({ locale: fr });
export async function generateMetadata({
params: { locale },
params,
}: {
params: { locale?: string };
params: Promise<{ locale?: string }>;
}): Promise<Metadata> {
const { locale } = await params;
return {
alternates: {
canonical:

Before

Width:  |  Height:  |  Size: 197 KiB

After

Width:  |  Height:  |  Size: 197 KiB

+6 -4
View File
@@ -21,12 +21,13 @@ const title = Julius_Sans_One({
});
export async function generateMetadata({
params: { locale },
params,
}: {
params: { locale?: string };
params: Promise<{ locale?: string }>;
}) {
// While the `locale` is required, the namespace is optional and
// identical to the parameter that `useTranslations` accepts.
const { locale } = await params;
const t = await getTranslations({
locale: locale ?? "fr",
namespace: "Metadata",
@@ -48,11 +49,12 @@ export async function generateMetadata({
export default async function RootLayout({
children,
params: { locale },
params,
}: {
children: ReactNode;
params: { locale?: string };
params: Promise<{ locale?: string }>;
}) {
const { locale } = await params;
let messages;
try {
messages = (await import(`@/messages/${locale}.json`)).default;
+1 -1
View File
@@ -5,7 +5,7 @@ import { GrLineChart } from "react-icons/gr";
import { HiUserGroup } from "react-icons/hi2";
import { twMerge } from "tailwind-merge";
import bannerImage from "/public/banner.jpeg";
import bannerImage from "./banner.jpeg";
import { Link } from "@/utils/routing";
export default function Home() {
+21
View File
@@ -0,0 +1,21 @@
import { defaultCache } from "@serwist/next/worker";
import type { PrecacheEntry } from "serwist";
import { Serwist } from "serwist";
declare global {
interface WorkerGlobalScope {
__SW_MANIFEST: (PrecacheEntry | string)[] | undefined;
}
}
declare const self: WorkerGlobalScope;
const serwist = new Serwist({
precacheEntries: self.__SW_MANIFEST,
skipWaiting: true,
clientsClaim: true,
navigationPreload: true,
runtimeCaching: defaultCache,
});
serwist.addEventListeners();
+33 -41
View File
@@ -1,6 +1,5 @@
import React from "react";
import { Float } from "@headlessui-float/react";
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
import { IoMdMore } from "react-icons/io";
import { twMerge } from "tailwind-merge";
@@ -25,47 +24,40 @@ export const DropdownMenu = ({
}: DropdownMenuProps) => {
return (
<Menu as="div" className={twMerge("relative", containerClassName)}>
<Float
portal
placement="bottom-end"
offset={15}
enter="transition ease-out duration-100"
enterFrom="transform opacity-0 scale-95"
enterTo="transform opacity-100 scale-100"
leave="transition ease-in duration-75"
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
{buttonComponent ?? (
<MenuButton>
<IoMdMore />
</MenuButton>
)}
{buttonComponent ?? (
<MenuButton>
<IoMdMore />
</MenuButton>
)}
<MenuItems className="z-20 flex w-auto items-start overflow-hidden rounded-md bg-neutral-200 focus:outline-none dark:bg-neutral-600">
<div className="flex flex-col px-1 py-1">
{items.map(({ title, onClick, className, disabled }, i) => (
<MenuItem key={i}>
<button
type="button"
className={twMerge(
"w-full whitespace-nowrap rounded-md px-2.5 py-2 text-left text-sm text-black dark:text-white",
!disabled && "hover:bg-white dark:hover:bg-neutral-700",
disabled && "text-neutral-500 dark:text-neutral-500",
className,
)}
disabled={disabled ?? false}
onClick={() => {
if (!disabled) onClick();
}}
>
{title}
</button>
</MenuItem>
))}
</div>
</MenuItems>
</Float>
<MenuItems
anchor={{ to: "bottom end", gap: 15 }}
portal
transition
className="z-20 flex w-auto items-start overflow-hidden rounded-md bg-neutral-200 transition ease-out data-[closed]:scale-95 data-[closed]:opacity-0 focus:outline-none dark:bg-neutral-600"
>
<div className="flex flex-col px-1 py-1">
{items.map(({ title, onClick, className, disabled }, i) => (
<MenuItem key={i}>
<button
type="button"
className={twMerge(
"w-full whitespace-nowrap rounded-md px-2.5 py-2 text-left text-sm text-black dark:text-white",
!disabled && "hover:bg-white dark:hover:bg-neutral-700",
disabled && "text-neutral-500 dark:text-neutral-500",
className,
)}
disabled={disabled ?? false}
onClick={() => {
if (!disabled) onClick();
}}
>
{title}
</button>
</MenuItem>
))}
</div>
</MenuItems>
</Menu>
);
};
+12 -5
View File
@@ -12,6 +12,8 @@ import "leaflet/dist/leaflet.css";
import { FaAngleDoubleDown } from "react-icons/fa";
import { LayerGroup, MapContainer, TileLayer } from "react-leaflet";
import MarkerClusterGroup from "react-leaflet-cluster";
import "react-leaflet-cluster/lib/assets/MarkerCluster.css";
import "react-leaflet-cluster/lib/assets/MarkerCluster.Default.css";
import { debouncedHoveredListIdAtom, mapBoundsAtom } from "@/atoms";
import { MapEvents } from "@/components/MapEvents";
@@ -60,7 +62,7 @@ type MapProps = {
export const Map = ({
filters,
legend,
markers: markers,
markers,
iconCreateFunction,
}: MapProps) => {
const setMapBounds = useSetAtom(mapBoundsAtom);
@@ -193,11 +195,16 @@ export const Map = ({
const referencedMarkers = useMemo(
() =>
markers.map((marker) =>
React.cloneElement(marker.component, {
ref: (ref: MarkerRef) => {
markerRefs.current[marker.markerId] = ref;
React.cloneElement(
marker.component as React.ReactElement<{
ref?: (ref: MarkerRef) => void;
}>,
{
ref: (ref: MarkerRef) => {
markerRefs.current[marker.markerId] = ref;
},
},
}),
),
),
[markers],
);
+8 -5
View File
@@ -1,23 +1,26 @@
"use client";
import { useEffect } from "react";
import { trackAppRouter } from "@socialgouv/matomo-next";
import { usePathname, useSearchParams } from "next/navigation";
import { useEffect } from "react";
const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL;
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID;
const isMatomoEnabled = Boolean(MATOMO_URL && MATOMO_SITE_ID);
export function MatomoAnalytics() {
const pathname = usePathname();
const searchParams = useSearchParams();
useEffect(() => {
if (!isMatomoEnabled) return;
trackAppRouter({
url: MATOMO_URL || "",
siteId: MATOMO_SITE_ID || "",
url: MATOMO_URL as string,
siteId: MATOMO_SITE_ID as string,
pathname,
searchParams, // Pass URLSearchParams object directly
// Optional: Enable additional features
searchParams,
enableHeatmapSessionRecording: false,
enableHeartBeatTimer: true,
cleanUrl: true,
+1 -1
View File
@@ -17,7 +17,7 @@ import { Field, GenericFieldProps } from "./Field";
export type BaseOption<T = string, D = unknown> = {
value: T;
label: string | JSX.Element;
label: string | React.JSX.Element;
disabled?: boolean;
data?: D;
};
+1 -1
View File
@@ -8,7 +8,7 @@ import { Prettify } from "@/types";
export type BaseOption<T = string, D = unknown> = {
value: T;
label: string | JSX.Element;
label: string | React.JSX.Element;
disabled?: boolean;
data?: D;
};
@@ -91,7 +91,7 @@ export const TournamentSelectField = <
background: `${TimeControlColours[option.data!.timeControl]}`,
}}
>
{at("timeControlEnum", { tc: option.data?.timeControl })}
{at("timeControlEnum", { tc: option.data!.timeControl })}
</div>
<div className="text-xs">{option.data?.date}</div>
</div>
+1 -1
View File
@@ -20,7 +20,7 @@ export type ZoneEditorProps = {
export const ZoneEditor = ({ value, onChange }: ZoneEditorProps) => {
const initialFeatures = React.useRef(value?.features);
const featureGroup = React.useRef<L.FeatureGroup>();
const featureGroup = React.useRef<L.FeatureGroup | null>(null);
const setFeatureCollectionRef = (element: L.FeatureGroup) => {
featureGroup.current = element;
+1 -1
View File
@@ -6,7 +6,7 @@ const useDatePickerWidth = ({
datePickerRef,
setDateDirectionState,
}: {
datePickerRef: RefObject<HTMLDivElement>;
datePickerRef: RefObject<HTMLDivElement | null>;
setDateDirectionState: Dispatch<SetStateAction<DatePickerDirection>>;
}) => {
useEffect(() => {
+4 -2
View File
@@ -3,11 +3,13 @@ import { notFound } from "next/navigation";
import { routing } from "./utils/routing";
export default getRequestConfig(async ({ locale }) => {
export default getRequestConfig(async ({ requestLocale }) => {
// Validate that the incoming `locale` parameter is valid
if (!routing.locales.includes(locale as any)) notFound();
const locale = await requestLocale;
if (!locale || !routing.locales.includes(locale as any)) notFound();
return {
locale,
messages: (
await (locale === "en"
? // When using Turbopack, this will enable HMR for `en`
View File
-2
View File
@@ -1,7 +1,5 @@
"use server";
import { z } from "zod";
import { contactUsSchema } from "@/schemas";
import { errorLog } from "@/utils/logger";
-1
View File
@@ -1,7 +1,6 @@
"use server";
import { ObjectId } from "mongodb";
import { z } from "zod";
import { adapter, auth } from "@/auth";
import { collections, dbConnect } from "@/server/mongodb";
+1 -1
View File
@@ -80,5 +80,5 @@ export function generatePieSVG(
return [...prev, [to, path(getDAttribute(radius, from, to), value.colour)]];
}, []);
return svg(className, radius * 2, paths.map(([to, path]) => path).join(""));
return svg(className, radius * 2, paths.map(([_to, path]) => path).join(""));
}
+2 -2
View File
@@ -1,4 +1,4 @@
import { createLocalizedPathnamesNavigation } from "next-intl/navigation";
import { createNavigation } from "next-intl/navigation";
import { defineRouting } from "next-intl/routing";
export const routing = defineRouting({
@@ -62,4 +62,4 @@ export type Pathnames = keyof typeof routing.pathnames;
export type Locale = (typeof routing.locales)[number];
export const { Link, redirect, usePathname, useRouter, getPathname } =
createLocalizedPathnamesNavigation(routing);
createNavigation(routing);
+14 -5
View File
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@@ -12,7 +16,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
@@ -20,7 +24,9 @@
}
],
"paths": {
"@/*": ["./src/*"]
"@/*": [
"./src/*"
]
}
},
"include": [
@@ -30,7 +36,10 @@
".next/types/**/*.ts",
"global.d.ts",
"leaflet.d.ts",
"next-auth.d.ts"
"next-auth.d.ts",
".next/dev/types/**/*.ts"
],
"exclude": ["node_modules"]
"exclude": [
"node_modules"
]
}
-5
View File
@@ -1,5 +0,0 @@
// To disable all workbox logging during development, you can set self.__WB_DISABLE_DEV_LOGS to true
// https://developers.google.com/web/tools/workbox/guides/configure-workbox#disable_logging
// eslint-disable-next-line no-underscore-dangle,no-restricted-globals
self.__WB_DISABLE_DEV_LOGS = true;
+2407 -5245
View File
File diff suppressed because it is too large Load Diff