mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
Sort players alphabetically
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { isEmpty } from "lodash";
|
import { isEmpty, sortBy } from "lodash";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
@@ -54,10 +54,13 @@ export default function Elo() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const playerOptions = (allResults ?? []).map((player) => ({
|
const playerOptions = sortBy(
|
||||||
value: player.id,
|
(allResults ?? []).map((player) => ({
|
||||||
label: player.name,
|
value: player.id,
|
||||||
}));
|
label: player.name,
|
||||||
|
})),
|
||||||
|
"label",
|
||||||
|
);
|
||||||
|
|
||||||
const form = useForm<FetchResultsFormValues>({
|
const form = useForm<FetchResultsFormValues>({
|
||||||
resolver: zodResolver(fetchTournamentResultsSchema),
|
resolver: zodResolver(fetchTournamentResultsSchema),
|
||||||
|
|||||||
Reference in New Issue
Block a user