From b82d0a49026e3485ed7d9bdcb720f249d5ead848 Mon Sep 17 00:00:00 2001 From: joker Date: Mon, 3 Apr 2023 10:35:10 +0300 Subject: [PATCH] modified: competition/regulations.mdx --- competition/regulations.mdx | 2 +- components/RegistrationForm copy.tsx | 137 ++++++++++++++++++++++ components/RegistrationForm.tsx | 60 +++------- components/UX/InputPass.tsx | 28 +++++ components/UX/index.ts | 3 +- components/UserForm.tsx | 113 ++++++++++++++++++ package-lock.json | 167 +++++++++++++++++++++++++-- package.json | 1 + pages/competition/registration.tsx | 6 +- tailwind.config.js | 2 +- yarn.lock | 65 +++++++++-- 11 files changed, 521 insertions(+), 63 deletions(-) create mode 100644 components/RegistrationForm copy.tsx create mode 100644 components/UX/InputPass.tsx create mode 100644 components/UserForm.tsx diff --git a/competition/regulations.mdx b/competition/regulations.mdx index 0c79bc5..b8628de 100644 --- a/competition/regulations.mdx +++ b/competition/regulations.mdx @@ -80,7 +80,7 @@ image: '/images/robottop.png' #### Задача #### Построить робота, который: * Которые может передвигаться по игровому полигону и разгрузить 8 шариков по 8 колодцам. -* На роботе должно быть место где можно разместить 8 шариков диаметром 20 мм. +* На роботе должно быть место где можно разместить 8 шариков диаметром от 20 до 45 мм. * Робот должен управляться при помощи пульта управления. #### Примечание: diff --git a/components/RegistrationForm copy.tsx b/components/RegistrationForm copy.tsx new file mode 100644 index 0000000..99d67f4 --- /dev/null +++ b/components/RegistrationForm copy.tsx @@ -0,0 +1,137 @@ +import React,{useRef} from 'react'; +import { useForm, SubmitHandler, FormProvider } from "react-hook-form"; +import { Select, Input, Link_str, SelectNominations } from "./UX"; +import Link from 'next/link'; + +interface IFormInputs { + name_team_coach: string, + coach_telefon_number: string, + nominations: string, + city_team: string, + training_institution_team: string, + team_name: string, + name_first_participant: string, + first_partial_class: number, + name_second_participant: string, + second_class: number, + name_third_party: string, + third_part_class: number, + body?: string[] | number[] +} + +const defaultValues = { + name_team_coach: '', + coach_telefon_number: '', + nominations: '0', + city_team: '', + training_institution_team: '', + team_name: '', + name_first_participant: '', + first_partial_class: 0, + name_second_participant: '', + second_class: 0, + name_third_party: 'нет', + third_part_class: 0, +}; + +export const RegistrationForm = (props): JSX.Element => { + const form = useRef(null); + const methods = useForm({ defaultValues }); + + const onSubmit: SubmitHandler = data => { + fetch('/api/registration', { method: 'POST', body: Object.values(data) as any}) + .then((data) => { + props.updateData(data); + }) + methods.reset(defaultValues); + } + return ( + <> +
+
+
+
+

Регистрация команды

+

Регистрация команд идет до 22.05.2023

+

Введите актуальные данные команды

+

От каждого учебного заведения может быть зарегистрировано неограниченное количество команд

+

Подписывайтесь на наш + Telegram канал + , чтобы быть в курсе новостей про соревнование

+
+
+
+ +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
@@ -79,50 +81,20 @@ export const RegistrationForm = (props): JSX.Element => {
-
+
- -
- -
- -
- -
- -
- -
- -
- -
- -
- + + ) +} \ No newline at end of file diff --git a/components/UX/index.ts b/components/UX/index.ts index 1d15b29..4bb59ec 100644 --- a/components/UX/index.ts +++ b/components/UX/index.ts @@ -3,4 +3,5 @@ export * from './Alert' export * from './Input' export * from './Link' export * from './SelectNominations' -export * from './Block' \ No newline at end of file +export * from './Block' +export * from './InputPass' \ No newline at end of file diff --git a/components/UserForm.tsx b/components/UserForm.tsx new file mode 100644 index 0000000..0dc1dcc --- /dev/null +++ b/components/UserForm.tsx @@ -0,0 +1,113 @@ +import React,{useRef} from 'react'; +import { useForm, SubmitHandler, FormProvider } from "react-hook-form"; +import { Select, Input, Link_str, SelectNominations } from "./UX"; + +interface IFormInputs { + name_team_coach: string, + coach_telefon_number: string, + nominations: string, + city_team: string, + training_institution_team: string, + team_name: string, + name_first_participant: string, + first_partial_class: number, + name_second_participant: string, + second_class: number, + name_third_party: string, + third_part_class: number, + body?: string[] | number[] +} + +const defaultValues = { + name_team_coach: '', + coach_telefon_number: '', + nominations: '0', + city_team: '', + training_institution_team: '', + team_name: '', + name_first_participant: '', + first_partial_class: 0, + name_second_participant: '', + second_class: 0, + name_third_party: 'нет', + third_part_class: 0, +}; + +export const UserForm = (props): JSX.Element => { + const form = useRef(null); + const methods = useForm({ defaultValues }); + + const onSubmit: SubmitHandler = data => { + fetch('/api/registration', { method: 'POST', body: Object.values(data) as any}) + .then((data) => { + props.updateData(data); + }) + methods.reset(defaultValues); + } + return ( + <> +
+

Личный кабинет

+ +
+ +
+ + +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+