mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-22 20:16:57 +00:00
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { useRef, useState } from "react";
|
|
|
|
import { useAtomValue } from "jotai";
|
|
import { LatLngLiteral } from "leaflet";
|
|
|
|
import { franceCenterAtom } from "@/app/atoms";
|
|
import { TournamentFormProps } from "@/types";
|
|
|
|
export const useTournamentForm = (): TournamentFormProps => {
|
|
const center = useAtomValue(franceCenterAtom);
|
|
|
|
const tournamentNameRef = useRef(null);
|
|
const dateRef = useRef(null);
|
|
const urlRef = useRef(null);
|
|
const timeControlRef = useRef(null);
|
|
const normRef = useRef(null);
|
|
const addressRef = useRef(null);
|
|
const townRef = useRef(null);
|
|
const departmentRef = useRef(null);
|
|
const countryRef = useRef(null);
|
|
const yourNameRef = useRef(null);
|
|
const yourEmailRef = useRef(null);
|
|
const messageRef = useRef(null);
|
|
const [position, setPosition] = useState<LatLngLiteral>(center);
|
|
|
|
return {
|
|
tournamentNameRef,
|
|
dateRef,
|
|
urlRef,
|
|
timeControlRef,
|
|
normRef,
|
|
addressRef,
|
|
townRef,
|
|
departmentRef,
|
|
countryRef,
|
|
yourNameRef,
|
|
yourEmailRef,
|
|
messageRef,
|
|
position,
|
|
setPosition,
|
|
};
|
|
};
|
|
|
|
export default useTournamentForm;
|