mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-11-18 07:22:06 +00:00
Update packages
This commit is contained in:
@@ -39,7 +39,7 @@ export const InputDatePicker = forwardRef<HTMLInputElement, AllProps>(
|
||||
className={twMerge(
|
||||
"flex w-full content-center rounded-lg border p-3",
|
||||
"border-gray-300 bg-gray-50 text-gray-900 shadow-sm",
|
||||
"dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 ",
|
||||
"dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400",
|
||||
!error &&
|
||||
"focus-within:border-primary-500 focus-within:ring-primary-500 dark:focus-within:border-primary-500 dark:focus-within:ring-primary-500",
|
||||
error && "!border-orange-700 focus:!border-orange-700",
|
||||
|
||||
@@ -78,11 +78,7 @@ export const DateField = <
|
||||
portalId="calendar-portal"
|
||||
dateFormat={dateFormat}
|
||||
disabledKeyboardNavigation={true}
|
||||
formatWeekDay={(day: string) => (
|
||||
<div className="flex h-8 flex-col items-center justify-center">
|
||||
{day.slice(0, 3)}
|
||||
</div>
|
||||
)}
|
||||
formatWeekDay={(day: string) => day.slice(0, 3)}
|
||||
weekDayClassName={() =>
|
||||
"text-xs h-8 w-8 flex-1 bg-gray-50 text-gray-900 dark:bg-gray-700 dark:text-white"
|
||||
}
|
||||
@@ -95,9 +91,13 @@ export const DateField = <
|
||||
onChange={field.onChange}
|
||||
onChangeRaw={(e) => {
|
||||
// Called when the user types in the input
|
||||
if (e.currentTarget.value) {
|
||||
if (e?.currentTarget && "value" in e.currentTarget) {
|
||||
const value = e.currentTarget.value;
|
||||
const date = parse(value, at("dateParseFormat"), new Date());
|
||||
const date = parse(
|
||||
value as string,
|
||||
at("dateParseFormat"),
|
||||
new Date(),
|
||||
);
|
||||
if (
|
||||
isValid(date) &&
|
||||
date.getFullYear() >= min &&
|
||||
|
||||
@@ -92,7 +92,7 @@ export const RadioGroupField = <
|
||||
value={option.value}
|
||||
className={({ checked }) =>
|
||||
twMerge(
|
||||
"flex flex-1 cursor-pointer items-center justify-center rounded-lg border px-5 py-3 text-center font-medium focus:outline-none",
|
||||
"flex flex-1 cursor-pointer items-center justify-center rounded-lg border px-5 py-3 text-center font-medium focus:outline-none",
|
||||
"border-gray-300 bg-gray-50 text-gray-900",
|
||||
"dark:border-gray-600 dark:bg-gray-700 dark:text-white",
|
||||
checked &&
|
||||
|
||||
@@ -42,7 +42,7 @@ export const classNames = <Option, IsMulti extends boolean = false>(
|
||||
menu: () =>
|
||||
twMerge(
|
||||
"!z-30 mt-2 rounded-lg border border-gray-200 bg-white p-1",
|
||||
"border-gray-300 bg-gray-50 text-gray-900",
|
||||
"border-gray-300 bg-gray-50 text-gray-900",
|
||||
"dark:border-gray-600 dark:bg-gray-700 dark:text-white",
|
||||
),
|
||||
groupHeading: () => "mx-3 mt-2 mb-1 text-textGray text-sm uppercase",
|
||||
|
||||
@@ -87,7 +87,7 @@ export const TextAreaField = <
|
||||
disabled={disabled}
|
||||
className={twMerge(
|
||||
"flex w-full content-center rounded-lg border p-3",
|
||||
"border-gray-300 bg-gray-50 text-gray-900 shadow-sm focus:border-primary-500 focus:ring-primary-500",
|
||||
"border-gray-300 bg-gray-50 text-gray-900 shadow-sm focus:border-primary-500 focus:ring-primary-500",
|
||||
"dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-primary-500 dark:focus:ring-primary-500",
|
||||
hasError && "!border-orange-700 focus:!border-orange-700",
|
||||
disabled && "dark:bg-gray-50",
|
||||
|
||||
@@ -60,7 +60,7 @@ export const TextField = <
|
||||
? isNaN(value)
|
||||
? ""
|
||||
: value.toString()
|
||||
: value ?? "";
|
||||
: (value ?? "");
|
||||
};
|
||||
|
||||
const output =
|
||||
|
||||
@@ -40,7 +40,8 @@ export const TournamentSelectField = <
|
||||
useState<SearchedTournament | null>(null);
|
||||
|
||||
const loadOption = async (ffeId: string) => {
|
||||
const { data: tournament } = await getTournamentDetails({ ffeId });
|
||||
const result = await getTournamentDetails({ ffeId });
|
||||
const tournament = result?.data;
|
||||
|
||||
return !tournament
|
||||
? undefined
|
||||
@@ -52,10 +53,12 @@ export const TournamentSelectField = <
|
||||
};
|
||||
|
||||
const loadOptions = async (searchValue?: string) => {
|
||||
const { data: tournaments } = await searchTournaments({
|
||||
const result = await searchTournaments({
|
||||
searchValue: searchValue ?? "",
|
||||
});
|
||||
|
||||
const tournaments = result?.data ?? [];
|
||||
|
||||
return (tournaments ?? []).map((tournament) => ({
|
||||
value: tournament.ffeId,
|
||||
label: tournament.tournament,
|
||||
@@ -73,7 +76,7 @@ export const TournamentSelectField = <
|
||||
loadOptions={loadOptions}
|
||||
isClearable={true}
|
||||
onInformChange={(data) => {
|
||||
setSelectedTournament(data ? data[0].data ?? null : null);
|
||||
setSelectedTournament(data ? (data[0].data ?? null) : null);
|
||||
onInformChange?.(data);
|
||||
}}
|
||||
formatOptionLabel={(option, context) => {
|
||||
@@ -83,7 +86,7 @@ export const TournamentSelectField = <
|
||||
<div className="flex items-center gap-2 text-xs uppercase">
|
||||
<div className="flex-1">{option.data?.town}</div>
|
||||
<div
|
||||
className="ml-2 rounded-sm px-1 py-0.5 align-middle text-[9px]/[11px] uppercase text-white"
|
||||
className="ml-2 rounded-sm px-1 py-0.5 align-middle text-[9px]/[11px] uppercase text-white"
|
||||
style={{
|
||||
background: `${TimeControlColours[option.data!.timeControl]}`,
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user