feat: disable registration for FightForm and update UI accordingly
This commit is contained in:
@@ -141,7 +141,7 @@ function Events() {
|
|||||||
link="https://yukafest.ru/pilots/"
|
link="https://yukafest.ru/pilots/"
|
||||||
/>
|
/>
|
||||||
<EventCard
|
<EventCard
|
||||||
disabled={false}
|
disabled={true}
|
||||||
id="moscow_fight"
|
id="moscow_fight"
|
||||||
image="/events/moscow_fight.png"
|
image="/events/moscow_fight.png"
|
||||||
title="Дрифт «Битва за Москву»"
|
title="Дрифт «Битва за Москву»"
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ function FightFormPage() {
|
|||||||
});
|
});
|
||||||
const [carPhotos, setCarPhotos] = useState<File[]>([]);
|
const [carPhotos, setCarPhotos] = useState<File[]>([]);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
// Add a key to force re-render of Fileupload component
|
|
||||||
const [fileUploadKey, setFileUploadKey] = useState(0);
|
const [fileUploadKey, setFileUploadKey] = useState(0);
|
||||||
|
|
||||||
|
// Add registration disabled state
|
||||||
|
const isRegistrationDisabled = true;
|
||||||
|
|
||||||
const { value: phoneValue, handleChange: handlePhoneChange } = usePhoneMask();
|
const { value: phoneValue, handleChange: handlePhoneChange } = usePhoneMask();
|
||||||
|
|
||||||
@@ -47,6 +49,11 @@ function FightFormPage() {
|
|||||||
const handleSubmit = async (e: React.FormEvent) => {
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (isRegistrationDisabled) {
|
||||||
|
alert("Регистрация временно закрыта");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!checkboxValues.includes("terms")) {
|
if (!checkboxValues.includes("terms")) {
|
||||||
alert("Необходимо согласие на обработку персональных данных");
|
alert("Необходимо согласие на обработку персональных данных");
|
||||||
return;
|
return;
|
||||||
@@ -126,7 +133,15 @@ function FightFormPage() {
|
|||||||
Регистрация на Битву за Москву
|
Регистрация на Битву за Москву
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<form onSubmit={handleSubmit} className="space-y-6 max-w-2xl w-full">
|
{isRegistrationDisabled && (
|
||||||
|
<div className="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-6 max-w-2xl w-full">
|
||||||
|
<p className={`${gothampro.className} text-center`}>
|
||||||
|
Регистрация временно закрыта
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<form onSubmit={handleSubmit} className={`space-y-6 max-w-2xl w-full ${isRegistrationDisabled ? 'opacity-50 pointer-events-none' : ''}`}>
|
||||||
<Input
|
<Input
|
||||||
label="Фамилия"
|
label="Фамилия"
|
||||||
placeholder="Введите вашу фамилию"
|
placeholder="Введите вашу фамилию"
|
||||||
@@ -275,10 +290,10 @@ function FightFormPage() {
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting || isRegistrationDisabled}
|
||||||
className={`${fluxgore.className} bg-[#1068B0] hover:bg-[#0d5a96] text-white px-9 py-4 text-base font-medium uppercase tracking-wide disabled:opacity-50 w-full`}
|
className={`${fluxgore.className} bg-[#1068B0] hover:bg-[#0d5a96] text-white px-9 py-4 text-base font-medium uppercase tracking-wide disabled:opacity-50 w-full`}
|
||||||
>
|
>
|
||||||
{isSubmitting ? "Отправка..." : "Отправить"}
|
{isRegistrationDisabled ? "Регистрация закрыта" : isSubmitting ? "Отправка..." : "Отправить"}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user