mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-11-18 07:22:06 +00:00
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
61 lines
1.4 KiB
TypeScript
61 lines
1.4 KiB
TypeScript
import { LatLngLiteral } from "leaflet";
|
|
|
|
import { TournamentModel } from "./server/models/tournamentModel";
|
|
|
|
type Status = "scheduled" | "ongoing" | "finished" | "in-play";
|
|
|
|
export enum TimeControl {
|
|
Classic = "Classic",
|
|
Rapid = "Rapid",
|
|
Blitz = "Blitz",
|
|
Other = "Other",
|
|
}
|
|
|
|
export type Tournament = {
|
|
id: string;
|
|
ffeId: string;
|
|
groupId: string;
|
|
town: string;
|
|
department: string;
|
|
tournament: string;
|
|
url: string;
|
|
timeControl: TimeControl;
|
|
date: string;
|
|
latLng: LatLngLiteral;
|
|
norm: boolean;
|
|
pending: boolean;
|
|
status: Status;
|
|
};
|
|
|
|
export const tcMap: Record<TournamentModel["time_control"], TimeControl> = {
|
|
"Cadence Lente": TimeControl.Classic,
|
|
Rapide: TimeControl.Rapid,
|
|
Blitz: TimeControl.Blitz,
|
|
};
|
|
|
|
export type Club = {
|
|
id: string;
|
|
name: string;
|
|
url?: string;
|
|
address?: string;
|
|
email?: string;
|
|
website?: string;
|
|
latLng: LatLngLiteral;
|
|
};
|
|
|
|
export type DatePickerDirection = "horizontal" | "vertical";
|
|
|
|
// Prettify takes a type as its argument and returns a new type that has the same properties as the original type,
|
|
// but the properties are not intersected. This means that the new type is easier to read and understand.
|
|
// https://gist.github.com/palashmon/db68706d4f26d2dbf187e76409905399
|
|
|
|
export type Prettify<T> = {
|
|
[K in keyof T]: T[K];
|
|
} & {};
|
|
|
|
export type Path<T, K extends keyof T = keyof T> = K extends string
|
|
? T[K] extends Record<string, unknown>
|
|
? `${K}.${Path<T[K], keyof T[K]>}`
|
|
: K
|
|
: never;
|