From 4391114dc3525acc0b44d7f583fd6840218a1f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D1=82=D0=B0=D0=BB=D0=B8=D0=B9=20=D0=9B=D0=B0?= =?UTF-8?q?=D0=B2=D1=88=D0=BE=D0=BD=D0=BE=D0=BA?= <114582703+valavshonok@users.noreply.github.com> Date: Tue, 9 Dec 2025 16:24:40 +0300 Subject: [PATCH] formate --- src/components/input/DateInput.tsx | 53 ++++---- src/pages/ContestEditor.tsx | 16 +-- src/views/home/contest/Contest.tsx | 5 +- src/views/home/contests/Filter.tsx | 5 +- src/views/home/contests/ModalCreate.tsx | 162 +++++++++++------------- 5 files changed, 114 insertions(+), 127 deletions(-) diff --git a/src/components/input/DateInput.tsx b/src/components/input/DateInput.tsx index fea3053..9d3473e 100644 --- a/src/components/input/DateInput.tsx +++ b/src/components/input/DateInput.tsx @@ -1,38 +1,35 @@ // DateInput.tsx import React from 'react'; - interface DateInputProps { -label?: string; -value?: string; -defaultValue?: string; -onChange: (value: string) => void; -className?: string; + label?: string; + value?: string; + defaultValue?: string; + onChange: (value: string) => void; + className?: string; } - const DateInput: React.FC = ({ -label = 'Дата', -value, -defaultValue, -onChange, -className = '', + label = 'Дата', + value, + defaultValue, + onChange, + className = '', }) => { -return ( -
- - onChange(e.target.value)} -className="mt-1 block w-full rounded-md border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" -/> -
-); + return ( +
+ + onChange(e.target.value)} + className="mt-1 block w-full rounded-md border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + /> +
+ ); }; - -export default DateInput; \ No newline at end of file +export default DateInput; diff --git a/src/pages/ContestEditor.tsx b/src/pages/ContestEditor.tsx index 72b7c4b..e1537c2 100644 --- a/src/pages/ContestEditor.tsx +++ b/src/pages/ContestEditor.tsx @@ -43,17 +43,15 @@ const ContestEditor = () => { const [missionIdInput, setMissionIdInput] = useState(''); - const now = new Date(); -const plus60 = new Date(now.getTime() + 60 * 60 * 1000); + const now = new Date(); + const plus60 = new Date(now.getTime() + 60 * 60 * 1000); + const toLocal = (d: Date) => { + const off = d.getTimezoneOffset(); + const local = new Date(d.getTime() - off * 60000); + return local.toISOString().slice(0, 16); + }; -const toLocal = (d: Date) => { -const off = d.getTimezoneOffset(); -const local = new Date(d.getTime() - off * 60000); -return local.toISOString().slice(0, 16); -}; - - const [contest, setContest] = useState({ name: '', description: '', diff --git a/src/views/home/contest/Contest.tsx b/src/views/home/contest/Contest.tsx index 8f06880..b780437 100644 --- a/src/views/home/contest/Contest.tsx +++ b/src/views/home/contest/Contest.tsx @@ -2,7 +2,10 @@ import { useEffect } from 'react'; import { useAppDispatch, useAppSelector } from '../../../redux/hooks'; import { setMenuActivePage } from '../../../redux/slices/store'; import { Navigate, Route, Routes, useParams } from 'react-router-dom'; -import { fetchContestById, fetchMyAttemptsInContest } from '../../../redux/slices/contests'; +import { + fetchContestById, + fetchMyAttemptsInContest, +} from '../../../redux/slices/contests'; import ContestMissions from './Missions'; import Submissions from './Submissions'; diff --git a/src/views/home/contests/Filter.tsx b/src/views/home/contests/Filter.tsx index efc1181..0ff9845 100644 --- a/src/views/home/contests/Filter.tsx +++ b/src/views/home/contests/Filter.tsx @@ -1,7 +1,4 @@ -import { - FilterDropDown, - FilterItem, -} from '../../../components/filters/Filter'; +import { FilterDropDown, FilterItem } from '../../../components/filters/Filter'; import { SorterDropDown } from '../../../components/filters/Sorter'; import { SearchInput } from '../../../components/input/SearchInput'; diff --git a/src/views/home/contests/ModalCreate.tsx b/src/views/home/contests/ModalCreate.tsx index 0552123..7009f50 100644 --- a/src/views/home/contests/ModalCreate.tsx +++ b/src/views/home/contests/ModalCreate.tsx @@ -9,10 +9,12 @@ import { setContestStatus, } from '../../../redux/slices/contests'; import { CreateContestBody } from '../../../redux/slices/contests'; -import DateRangeInput from '../../../components/input/DateRangeInput'; import { useNavigate } from 'react-router-dom'; import { NumberInput } from '../../../components/input/NumberInput'; -import { DropDownList, DropDownListItem } from '../../../components/filters/DropDownList'; +import { + DropDownList, + DropDownListItem, +} from '../../../components/filters/DropDownList'; import DateInput from '../../../components/input/DateInput'; import { cn } from '../../../lib/cn'; @@ -42,25 +44,24 @@ const ModalCreateContest: FC = ({ ); const visibilityItems: DropDownListItem[] = [ - { value: "Public", text: "Публичный"}, - { value: "GroupPrivate", text: "Для группы"}, - ] - + { value: 'Public', text: 'Публичный' }, + { value: 'GroupPrivate', text: 'Для группы' }, + ]; + const scheduleTypeItems: DropDownListItem[] = [ - {value: "AlwaysOpen", text: "Всегда открыт"}, - {value: "FixedWindow", text: "Фиксированое окно"}, - {value: "RollingWindow", text: "Скользящее окно"}, - ] + { value: 'AlwaysOpen', text: 'Всегда открыт' }, + { value: 'FixedWindow', text: 'Фиксированое окно' }, + { value: 'RollingWindow', text: 'Скользящее окно' }, + ]; const now = new Date(); -const plus60 = new Date(now.getTime() + 60 * 60 * 1000); + const plus60 = new Date(now.getTime() + 60 * 60 * 1000); - -const toLocal = (d: Date) => { -const off = d.getTimezoneOffset(); -const local = new Date(d.getTime() - off * 60000); -return local.toISOString().slice(0, 16); -}; + const toLocal = (d: Date) => { + const off = d.getTimezoneOffset(); + const local = new Date(d.getTime() - off * 60000); + return local.toISOString().slice(0, 16); + }; const [form, setForm] = useState({ name: '', @@ -105,7 +106,6 @@ return local.toISOString().slice(0, 16); ); }; - return ( handleChange('description', v)} /> - -
- { - handleChange("scheduleType", v); - }} - weight='w-full' - /> - - + items={scheduleTypeItems} + onChange={(v) => { + handleChange('scheduleType', v); + }} + weight="w-full" + /> {/*
*/} -
- -
-
- handleChange('groupId', Number(v))} - /> - -
- +
+
+
+ + handleChange('groupId', Number(v)) + } + /> +
+
-{/* Даты */} -
- -
-
- handleChange('startsAt', v)} -/> - - - handleChange('endsAt', v)} -/> -
-
+ {/* Даты */} +
+
+
+ handleChange('startsAt', v)} + /> + handleChange('endsAt', v)} + /> +
+
{/* Продолжительность и лимиты */}
handleChange('endsAt', v)} } /> handleChange('endsAt', v)} />
- - {/* Разрешить раннее завершение */} {/*