Init front

This commit is contained in:
fullofempt
2025-12-12 20:22:50 +05:00
parent a79c26085b
commit 55c42a115d
26 changed files with 8222 additions and 0 deletions

141
app/AuthPage.jsx Normal file
View File

@@ -0,0 +1,141 @@
"use client";
import React, { useState } from "react";
import { useRouter } from "next/navigation";
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
const AuthPage = () => {
const router = useRouter();
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [rememberMe, setRememberMe] = useState(false);
const [checkboxError, setCheckboxError] = useState(false);
const isEmailValid = emailRegex.test(email);
const isFormValid = isEmailValid && password.length > 0;
const handleSubmit = (e) => {
e.preventDefault();
// проверка чекбокса
if (!rememberMe) {
setCheckboxError(true);
return;
}
setCheckboxError(false);
if (!isFormValid) return;
console.log("Email:", email, "Password:", password, "Remember:", rememberMe);
router.push('./home');
};
return (
<div className="min-h-screen w-full bg-[#90D2F9] flex items-center justify-center px-4">
<div className="w-full max-w-md bg-white/10 rounded-2xl p-6 sm:p-8 shadow-lg relative">
{/* Красный баннер ошибки по чекбоксу */}
{checkboxError && (
<div
className="absolute -top-10 left-0 w-full bg-red-500 text-white text-xs sm:text-sm font-montserrat px-3 py-2 rounded-t-2xl flex items-center justify-center shadow-md"
role="alert"
>
Вы не согласны с условиями использования
</div>
)}
<h1 className="font-montserrat text-white font-extrabold text-2xl text-center">
Авторизация
</h1>
{/* <p className="font-montserrat text-white text-sm text-center mt-1">
как пользователь
</p> */}
<form onSubmit={handleSubmit} className="mt-6 space-y-4">
{/* Почта */}
<div className="space-y-1">
<label className="block font-montserrat font-extrabold text-xs text-[#ffffff]">
Почта
</label>
<input
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
className="w-full rounded-full bg-white px-4 py-2 text-sm font-montserrat text-black outline-none focus:ring-2 focus:ring-blue-200"
/>
{!isEmailValid && email.length > 0 && (
<p className="text-[11px] text-red-600 font-montserrat">
Введите корректный email
</p>
)}
</div>
{/* Пароль */}
<div className="space-y-1">
<label className="block font-montserrat font-extrabold text-xs text-[#ffffff]">
Пароль
</label>
<input
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
className="w-full rounded-full bg-white px-4 py-2 text-sm font-montserrat text-black outline-none focus:ring-2 focus:ring-blue-200"
/>
</div>
{/* Чекбокс */}
<div className="flex items-start space-x-2">
<button
type="button"
onClick={() => {
setRememberMe((prev) => !prev);
if (!rememberMe) setCheckboxError(false);
}}
className={`w-5 h-5 rounded-full border border-white flex items-center justify-center ${rememberMe ? "bg-white" : "bg-transparent"
}`}
>
{rememberMe && (
<span className="h-2 w-2 rounded-full bg-[#90D2F9]" />
)}
</button>
<p className="font-montserrat text-[10px] leading-[12px] text-white">
Подтверждаю, что я прочитал условия использования данного приложения
</p>
</div>
{/* Ссылки */}
<div className="flex justify-between text-[11px] font-montserrat font-bold text-[#FF6363] mt-1">
<button type="button" className="hover:underline" onClick={() => router.push("/recPassword")}>
Забыли пароль?
</button>
<button
type="button"
className="hover:underline"
onClick={() => router.push("/reg")}
>
Регистрация
</button>
</div>
{/* Кнопка Войти */}
<button
type="submit"
disabled={!isFormValid}
className={`mt-4 w-full rounded-full py-2 text-center font-montserrat font-extrabold text-sm transition-colors
${isFormValid
? "bg-green-500 text-white hover:bg-green-600"
: "bg-white text-[#C4C4C4] cursor-not-allowed"
}`}
>
Войти
</button>
</form>
</div>
</div>
);
};
export default AuthPage;

View File

@@ -0,0 +1,161 @@
import React, { useState } from "react";
import { FaStar } from "react-icons/fa";
const RequestDetailsModal = ({ request, onClose }) => {
const isDone = request.status === "Выполнена";
const isRejected = request.status === "Отклонена";
const [rating, setRating] = useState(0);
const [review, setReview] = useState("");
const [rejectFeedback, setRejectFeedback] = useState("");
const handleStarClick = (value) => {
setRating(value);
};
const handleSubmit = () => {
console.log("Оставить отзыв:", {
id: request.id,
status: request.status,
rating,
review,
rejectFeedback,
});
onClose();
};
return (
<div className="fixed inset-0 z-40 flex flex-col bg-[#90D2F9] px-4 pt-4 pb-20">
{/* Заголовок */}
<div className="flex items-center gap-2 mb-3">
<button
type="button"
onClick={onClose}
className="text-white w-7 h-7 rounded-full flex items-center justify-center text-lg"
>
</button>
<p className="flex-1 text-center font-montserrat font-extrabold text-[20px] leading-[24px] text-white">
Заявка от {request.createdAt}
</p>
<span className="w-7" />
</div>
{/* Белая карточка как на макете */}
<div className="flex-1 flex items-start justify-center">
<div className="w-full max-w-[360px] bg-white rounded-3xl p-4 flex flex-col gap-4 shadow-lg">
{/* Статус + срок (берём цвет и текст из заявки) */}
<div className="flex items-start justify-between">
<span
className="inline-flex items-center justify-center px-3 py-1 rounded-full font-montserrat text-[10px] font-semibold text-white"
style={{ backgroundColor: request.statusColor }}
>
{request.status}
</span>
<div className="text-right leading-tight">
<p className="font-montserrat text-[10px] text-black">
{request.date}
</p>
<p className="font-montserrat text-[10px] text-black">
{request.time}
</p>
</div>
</div>
{/* Название задачи */}
<p className="font-montserrat font-semibold text-[16px] leading-[20px] text.black">
{request.title}
</p>
{/* ВЫПОЛНЕНА: голубой блок с отзывом как было */}
{isDone && (
<div className="bg-[#72B8E2] rounded-3xl p-3 flex flex-col gap-2">
<p className="font-montserrat font-bold text-[12px] text-white">
Отзыв
</p>
<textarea
value={review}
onChange={(e) => setReview(e.target.value)}
rows={4}
className="w-full bg-[#72B8E2] rounded-2xl px-3 py-2 text-sm font-montserrat text-white placeholder:text-white/70 outline-none resize-none border border-white/20"
placeholder="Напишите, как прошла помощь"
/>
</div>
)}
{/* ОТКЛОНЕНА: причина отказа + комментарий, без изменения размеров */}
{isRejected && (
<>
{request.rejectReason && (
<div className="bg-[#FF8282] rounded-3xl p-3">
<p className="font-montserrat font-bold text-[12px] text-white mb-1">
Причина отказа
</p>
<p className="font-montserrat text-[12px] text-white">
{request.rejectReason}
</p>
</div>
)}
<div className="flex flex-col gap-1">
<p className="font-montserrat font-bold text-[12px] text-black">
Ваш комментарий
</p>
<textarea
value={rejectFeedback}
onChange={(e) => setRejectFeedback(e.target.value)}
rows={4}
className="w-full rounded-2xl px-3 py-2 text-sm font-montserrat text-black placeholder:text-black/40 outline-none resize-none border border-[#FF8282]"
placeholder="Расскажите, что можно улучшить"
/>
</div>
</>
)}
{/* Оценка волонтёра — только для выполненной */}
{/* Оценка волонтера */}
{isDone && (
<div className="mt-1 flex flex-col items-center gap-2">
<p className="font-montserrat font-semibold text-[14px] text-black">
Оценить волонтера
</p>
<div className="flex gap-2">
{[1, 2, 3, 4, 5].map((star) => (
<button
key={star}
type="button"
onClick={() => handleStarClick(star)}
className="text-[#F6E168]"
>
<FaStar
size={26}
className={
star <= rating ? "fill-[#F6E168]" : "fill-[#F6E168]/40"
}
/>
</button>
))}
</div>
</div>
)}
</div>
</div>
{/* Кнопка внизу */}
{(isDone || isRejected) && (
<button
type="button"
onClick={handleSubmit}
className="mt-4 w-full max-w-[360px] mx-auto bg-[#94E067] rounded-full py-3 flex items-center justify-center"
>
<span className="font-montserrat font-extrabold text-[16px] text-white">
{isRejected ? "Отправить комментарий" : "Оставить отзыв"}
</span>
</button>
)}
</div>
);
};
export default RequestDetailsModal;

44
app/components/TabBar.jsx Normal file
View File

@@ -0,0 +1,44 @@
"use client";
import React from "react";
import { FaClock, FaNewspaper, FaHome, FaCog } from "react-icons/fa";
import { useRouter } from "next/navigation";
const TabBar = () => {
const router = useRouter();
return (
<nav className="fixed bottom-0 left-0 right-0 flex justify-center">
<div className="w-full max-w-md bg-white rounded-t-xl flex items-center justify-around py-4 shadow-inner">
<button
type="button"
onClick={() => router.push("/createRequest")}
className="flex flex-col items-center gap-1 text-[#90D2F9]"
>
<FaHome size={20} />
</button>
<button
type="button"
onClick={() => router.push("/historyRequest")}
className="flex flex-col items-center gap-1 text-[#90D2F9]"
>
<FaClock size={20} />
</button>
<button
type="button"
className="flex flex-col items-center gap-1 text-[#90D2F9]"
>
<FaNewspaper size={20} />
</button>
<button
type="button"
className="flex flex-col items-center gap-1 text-[#90D2F9]"
>
<FaCog size={20} />
</button>
</div>
</nav>
);
};
export default TabBar;

171
app/createRequest/page.jsx Normal file
View File

@@ -0,0 +1,171 @@
"use client";
import React, { useState } from "react";
import { useRouter } from "next/navigation";
import { FaClock, FaNewspaper, FaHome, FaCog, FaBell, FaUser } from "react-icons/fa";
import TabBar from "../components/TabBar";
const CreateRequestPage = () => {
const router = useRouter();
const [title, setTitle] = useState("");
const [date, setDate] = useState("");
const [time, setTime] = useState("");
const [description, setDescription] = useState("");
const [note, setNote] = useState("");
const isFormValid = title && date && time && description;
const handleSubmit = (e) => {
e.preventDefault();
if (!isFormValid) return;
console.log({
title,
date,
time,
description,
note,
});
// TODO: запрос на бэк
};
return (
<div className="min-h-screen w-full bg-[#90D2F9] flex justify-center px-4">
<div className="relative w-full max-w-md flex.flex-col pb-20 pt-4">
{/* Header */}
<header className="flex items-center justify-between mb-4">
<div className="flex items-center gap-2">
<div className="w-8 h-8 rounded-full border border-white flex items-center justify-center">
<FaUser className="text-white text-sm" />
</div>
<div>
<p className="font-montserrat font-extrabold text-[20px] leading-[11px] text-white">
Александр
</p>
</div>
</div>
<button
type="button"
className="w-8 h-8 rounded-full border border-white flex items-center justify-center"
>
<FaBell className="text-white text-sm" />
</button>
</header>
<h1 className="font-montserrat font-extrabold text-[20px] leading-[22px] text-white mb-3">
Создать заявку
</h1>
{/* Карточка с формой */}
<main className="bg-white rounded-xl p-4 flex flex-col gap-3">
<form onSubmit={handleSubmit} className="flex flex-col">
{/* Что сделать */}
<div className="flex flex-col gap-1">
<label className="font-montserrat font-bold text-[10px] text-white/90">
Что сделать
</label>
<input
type="text"
value={title}
onChange={(e) => setTitle(e.target.value)}
className="w-full bg-[#72B8E2] rounded-lg px-3 py-3 text-sm font-montserrat text-white placeholder:text-white/70 outline-none focus:ring-2 focus:ring-blue-200"
placeholder="Опишите основную задачу"
/>
</div>
{/* Дата и Время */}
<div className="flex gap-3">
<div className="flex-1 flex flex-col gap-1">
<label className="font-montserrat font-bold text-[10px] text-white/90">
Дата
</label>
<input
type="date"
value={date}
onChange={(e) => setDate(e.target.value)}
className="w-full bg-[#72B8E2] rounded-lg px-3 py-3 text-sm font-montserrat text-white outline-none focus:ring-2 focus:ring-blue-200"
/>
</div>
<div className="flex-1 flex flex-col gap-1">
<label className="font-montserrat font-bold text-[10px] text-white/90">
Время
</label>
<input
type="time"
value={time}
onChange={(e) => setTime(e.target.value)}
className="w-full bg-[#72B8E2] rounded-lg px-3 py-3 text-sm font-montserrat text-white outline-none focus:ring-2 focus:ring-blue-200"
/>
</div>
</div>
{/* Описание */}
<div className="flex flex-col gap-1">
<label className="font-montserrat font-bold text-[10px] text-white/90">
Описание
</label>
<textarea
value={description}
onChange={(e) => setDescription(e.target.value)}
rows={3}
className="w-full bg-[#72B8E2] rounded-lg px-3 py-3 text-sm font-montserrat text-white placeholder:text-white/70 outline-none focus:ring-2 focus:ring-blue-200 resize-none"
placeholder="Подробно опишите, что нужно сделать"
/>
</div>
{/* Дополнительная информация */}
<div className="flex flex-col gap-1">
<label className="font-montserrat font-bold text-[10px] text-white/90">
Дополнительно
</label>
<textarea
value={note}
onChange={(e) => setNote(e.target.value)}
rows={2}
className="w-full bg-[#72B8E2] rounded-lg px-3 py-3 text-sm font-montserrat text-white placeholder:text-white/70 outline-none focus:ring-2 focus:ring-blue-200 resize-none"
placeholder="Комментарий (необязательно)"
/>
</div>
{/* Добавить фото */}
<div className="flex items-center gap-3 mt-5">
<button
type="button"
className="w-15 h-15 bg-[#f3f3f3] rounded-lg flex items-center justify-center"
>
<span className="text-2xl text-[#E2E2E2] leading-none">+</span>
</button>
<div className="flex gap-2">
<div className="w-15 h-15 bg-[#E2E2E2] rounded-lg" />
<div className="w-15 h-15 bg-[#E2E2E2] rounded-lg" />
</div>
<span className="font-montserrat font-bold text-[14px] text-[#72B8E2] ml-2">
Добавить фото
</span>
</div>
{/* Кнопка Отправить */}
<button
type="submit"
disabled={!isFormValid}
className={`mt-5 w-full rounded-lg py-3 text-center font-montserrat font-bold text-sm transition-colors
${
isFormValid
? "bg-[#94E067] text-white hover:bg-green-600"
: "bg-[#94E067]/60 text-white/70 cursor-not-allowed"
}`}
>
Отправить
</button>
</form>
</main>
{/* TabBar снизу, во всю ширину */}
<TabBar />
</div>
</div>
);
};
export default CreateRequestPage;

26
app/globals.css Normal file
View File

@@ -0,0 +1,26 @@
@import "tailwindcss";
:root {
/* --background: #ffffff;
--foreground: #171717; */
}
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
}
@media (prefers-color-scheme: dark) {
:root {
/* --background: #0a0a0a;
--foreground: #ededed; */
}
}
body {
background: var(--background);
color: var(--foreground);
font-family: Arial, Helvetica, sans-serif;
}

259
app/historyRequest/page.jsx Normal file
View File

@@ -0,0 +1,259 @@
"use client";
import React, { useState } from "react";
import { FaBell, FaUser, FaStar } from "react-icons/fa";
import TabBar from "../components/TabBar";
import RequestDetailsModal from "../components/RequestDetailsModal";
const requests = [
{
id: 1,
title: "Приобрести продукты пенсионерке",
status: "Отклонена",
statusColor: "#FF8282",
date: "До 28.11.2025",
time: "13:00",
createdAt: "28.11.2025",
rejectReason: "Адрес вне зоны обслуживания",
description: "Купить продукты и принести по адресу.",
},
{
id: 2,
title: "Приобрести продукты пенсионерке",
status: "Принята",
statusColor: "#94E067",
date: "До 28.11.2025",
time: "13:00",
createdAt: "28.11.2025",
description: "Купить продукты и принести по адресу.",
},
{
id: 3,
title: "Приобрести продукты пенсионерке",
status: "На модерации",
statusColor: "#E9D171",
date: "До 28.11.2025",
time: "13:00",
createdAt: "28.11.2025",
description: "Купить продукты и принести по адресу.",
},
{
id: 4,
title: "Приобрести продукты пенсионерке",
status: "Выполнена",
statusColor: "#71A5E9",
date: "До 28.11.2025",
time: "13:00",
createdAt: "28.11.2025",
description: "Купить продукты и принести по адресу.",
},
{
id: 5,
title: "Приобрести продукты пенсионерке",
status: "В процессе",
statusColor: "#E971E1",
date: "До 28.11.2025",
time: "13:00",
createdAt: "28.11.2025",
description: "Купить продукты и принести по адресу.",
},
{
id: 6,
title: "Приобрести продукты пенсионерке",
status: "В процессе",
statusColor: "#E971E1",
date: "До 28.11.2025",
time: "13:00",
createdAt: "28.11.2025",
description: "Купить продукты и принести по адресу.",
},
{
id: 7,
title: "Приобрести продукты пенсионерке",
status: "В процессе",
statusColor: "#E971E1",
date: "До 28.11.2025",
time: "13:00",
createdAt: "28.11.2025",
description: "Купить продукты и принести по адресу.",
},
];
const HistoryRequestPage = () => {
const [selectedRequest, setSelectedRequest] = useState(null);
const handleOpen = (req) => {
setSelectedRequest(req);
};
const handleClose = () => {
setSelectedRequest(null);
};
return (
<div className="min-h-screen w-full bg-[#90D2F9] flex justify-center px-4">
<div className="relative w-full max-w-md flex flex-col pb-20 pt-4">
{/* Header */}
<header className="flex items-center justify-between mb-4">
<div className="flex items-center gap-2">
<div className="w-8 h-8 rounded-full border border-white flex items-center justify-center">
<FaUser className="text-white text-sm" />
</div>
<p className="font-montserrat font-extrabold text-[11px] leading-[11px] text-white">
Александр
</p>
</div>
<button
type="button"
className="w-8 h-8 rounded-full border border-white flex items-center justify-center"
>
<FaBell className="text-white text-sm" />
</button>
</header>
<h1 className="font-montserrat font-extrabold text-[18px] leading-[22px] text-white mb-3">
История заявок
</h1>
{/* Список заявок */}
<main className="space-y-3 overflow-y-auto pr-1 max-h-[80vh]">
{requests.map((req) => (
<button
key={req.id}
type="button"
onClick={() => handleOpen(req)}
className="w-full text-left bg-white rounded-xl px-3 py-2 flex flex-col gap-1"
>
{/* верхняя строка: статус + дата/время */}
<div className="flex items-center justify-between gap-2">
<span
className="inline-flex items-center justify-center px-2 py-0.5 rounded-full font-montserrat text-[12px] font-light text-black"
style={{ backgroundColor: req.statusColor }}
>
{req.status}
</span>
<div className="text-right leading-tight">
<p className="font-montserrat text-[10px] text-black">
{req.date}
</p>
<p className="font-montserrat text-[10px] text-black">
{req.time}
</p>
</div>
</div>
{/* Заголовок заявки */}
<p className="font-montserrat font-semibold text-[15px] leading-[18px] text-black mt-1">
{req.title}
</p>
{/* Кнопка "Развернуть" */}
<div className="mt-2 w-full bg-[#94E067] rounded-lg py-3 flex items-center justify-center">
<span className="font-montserrat font-bold text-[15px] leading-[18px] text-white">
Развернуть
</span>
</div>
</button>
))}
</main>
{/* Попап */}
{selectedRequest && (
<RequestDetailsModal request={selectedRequest} onClose={handleClose} />
)}
<TabBar />
</div>
</div>
);
};
export default HistoryRequestPage;
// const RequestDetailsModal = ({ request, onClose }) => {
// const isDone = request.status === "Выполнена";
// return (
// <div className="fixed inset-0 z-40 flex items-center justify-center bg-black/40 px-4">
// <div className="w-full max-w-sm bg-[#90D2F9] rounded-2xl p-3 relative">
// {/* Белая карточка */}
// <div className="bg-white rounded-xl p-3 flex flex-col gap-3">
// {/* Шапка попапа */}
// <div className="flex items-center justify-between mb-1">
// <button
// type="button"
// onClick={onClose}
// className="text-white bg-[#90D2F9] w-7 h-7 rounded-full flex items-center justify-center text-sm"
// >
// ←
// </button>
// <p className="flex-1 text-center font-montserrat font-extrabold text-[15px] text-white">
// Заявка от {request.createdAt}
// </p>
// <span className="w-7" />
// </div>
// {/* Статус + срок */}
// <div className="flex items-center justify-between">
// <span
// className="inline-flex items-center justify-center px-2 py-0.5 rounded-full font-montserrat text-[8px] font-light text-black"
// style={{ backgroundColor: "#71A5E9" }}
// >
// Выполнена
// </span>
// <div className="text-right leading-tight">
// <p className="font-montserrat text-[8px] text-black">
// До {request.date.replace("До ", "")}
// </p>
// <p className="font-montserrat text-[8px] text-black">
// {request.time}
// </p>
// </div>
// </div>
// {/* Название задачи */}
// <p className="font-montserrat font-semibold text-[12px] leading-[15px] text-black">
// {request.title}
// </p>
// {/* Блок отзыва */}
// {isDone && (
// <div className="bg-[#72B8E2] rounded-lg p-2 flex flex-col gap-2">
// <p className="font-montserrat font-bold text-[10px] text-white">
// Отзыв
// </p>
// <p className="font-montserrat text-[10px] text-white">
// Здесь будет текст отзыва с бэка.
// </p>
// </div>
// )}
// {/* Оценка волонтера */}
// <div className="mt-1">
// <p className="font-montserrat font-semibold text-[12px] text-black mb-1">
// Оценить волонтера
// </p>
// <div className="flex gap-1">
// {[1, 2, 3, 4, 5].map((star) => (
// <FaStar key={star} className="text-[#F6E168]" size={20} />
// ))}
// </div>
// </div>
// {/* Кнопка оставить отзыв */}
// {isDone && (
// <button
// type="button"
// className="mt-3 w-full bg-[#94E067] rounded-lg py-2 flex items-center justify-center"
// >
// <span className="font-montserrat font-bold text-[14px] text-white">
// Оставить отзыв
// </span>
// </button>
// )}
// </div>
// </div>
// </div>
// );
// };

72
app/home/page.jsx Normal file
View File

@@ -0,0 +1,72 @@
"use client";
import React from "react";
import { useRouter } from "next/navigation";
import { FaClock, FaNewspaper, FaHome, FaCog } from "react-icons/fa";
import TabBar from "../components/TabBar";
const HomePage = () => {
const router = useRouter();
return (
<div className="min-h-screen w-full bg-[#90D2F9] flex justify-center px-4">
<div className="relative w-full max-w-md flex flex-col pb-20">
{/* Основной контент: текст сверху, "Продолжить" внизу */}
<main className="flex flex-col justify-between h-full pt-6">
{/* Верх: текст + две второстепенные кнопки */}
<div className="flex flex-col gap-4">
<div className="space-y-3">
<h1 className="font-montserrat font-extrabold text-2xl text-white">
Добро Пожаловать!
</h1>
<p className="font-montserrat font-medium text-base text-white">
Приложение предназначено для помощи мало-подвижным людям.
</p>
<p className="font-montserrat font-medium text-base text-white">
Мы уже помогли более 200 людям с особенностями.
</p>
</div>
<div className="mt-4 flex flex-col gap-3">
<button
type="button"
className="w-full bg-[#E0B267] rounded-xl flex items-center justify-center py-3"
>
<span className="font-montserrat font-extrabold text-base text-white">
Инструкция
</span>
</button>
<button
type="button"
className="w-full bg-[#E07567] rounded-xl flex items-center justify-center py-3"
>
<span className="font-montserrat font-extrabold text-base text-white">
Новые обновления
</span>
</button>
</div>
</div>
{/* Низ: основная кнопка "Продолжить" */}
<div className="mt-6">
<button
type="button"
onClick={() => router.push("/createRequest")}
className="w-full bg-[#94E067] rounded-xl flex items-center justify-center py-3"
>
<span className="font-montserrat font-extrabold text-base text-white">
Создать заявку
</span>
</button>
</div>
</main>
{/* TabBar фиксирован снизу, во всю ширину */}
<TabBar />
</div>
</div>
);
};
export default HomePage;

21
app/layout.tsx Normal file
View File

@@ -0,0 +1,21 @@
import type { Metadata } from "next";
import "./globals.css";
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className="antialiased">
{children}
</body>
</html>
);
}

10
app/page.tsx Normal file
View File

@@ -0,0 +1,10 @@
import AuthPage from "./AuthPage";
export default function Home() {
return (
<div className="flex min-h-screen items-center justify-center">
<AuthPage />
</div>
);
}

98
app/recPassword/page.jsx Normal file
View File

@@ -0,0 +1,98 @@
"use client";
import React, { useState } from "react";
import { useRouter } from "next/navigation";
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
const RecPasswordPage = () => {
const router = useRouter();
const [email, setEmail] = useState("");
const [emailSent, setEmailSent] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const isEmailValid = emailRegex.test(email);
const handleSubmit = async (e) => {
e.preventDefault();
if (!isEmailValid) return;
// имитация запроса на бэк
try {
setIsLoading(true);
await new Promise((resolve) => setTimeout(resolve, 1000)); // фейковый запрос [web:254][web:264]
setEmailSent(true);
// навигация на ввод кода
router.push("/recPasswordCode");
} finally {
setIsLoading(false);
}
};
return (
<div className="min-h-screen w-full bg-[#90D2F9] flex items-center justify-center px-4">
<div className="w-full max-w-md bg-white/10 rounded-2xl p-6 sm:p-8 shadow-lg relative">
<div className="flex items-center mb-4">
<button
type="button"
onClick={() => router.back()}
className="text-white text-sm font-montserrat hover:underline"
>
Назад
</button>
<span className="flex-1 text-center font-montserrat text-white font-extrabold text-xl sm:text-2xl">
Восстановление пароля
</span>
{/* Пустой блок для симметрии по ширине с кнопкой Назад */}
<span className="w-[60px]" />
</div>
{emailSent && (
<div
className="mb-4 w-full bg-green-500 text-white text-xs sm:text-sm font-montserrat px-3 py-2 rounded-xl flex items-center justify-center shadow-md"
role="status"
>
Если почта существует, ссылка для восстановления отправлена
</div>
)}
<form onSubmit={handleSubmit} className="mt-2 space-y-4">
{/* Почта */}
<div className="space-y-1">
<label className="block font-montserrat font-extrabold text-xs text-white">
Почта
</label>
<input
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
className="w-full rounded-full bg-white px-4 py-2 text-sm font-montserrat text-black outline-none focus:ring-2 focus:ring-blue-200"
/>
{!isEmailValid && email.length > 0 && (
<p className="text-[11px] text-red-600 font-montserrat">
Введите корректный email
</p>
)}
</div>
{/* Кнопка Восстановить */}
<button
type="submit"
disabled={!isEmailValid || isLoading}
className={`mt-4 w-full rounded-full py-2 text-center font-montserrat font-extrabold text-sm transition-colors
${isEmailValid && !isLoading
? "bg-green-500 text-white hover:bg-green-600"
: "bg-white text-[#C4C4C4] cursor-not-allowed"
}`}
>
{isLoading ? "Отправка..." : "Восстановить"}
</button>
</form>
</div>
</div>
);
};
export default RecPasswordPage;

View File

@@ -0,0 +1,148 @@
"use client";
import React, { useState, useEffect } from "react";
import { useRouter } from "next/navigation";
const RecPasswordCodePage = () => {
const router = useRouter();
const [code, setCode] = useState("");
const [error, setError] = useState("");
const [secondsLeft, setSecondsLeft] = useState(60);
const [isResending, setIsResending] = useState(false);
const isCodeValid = code.length === 6;
const canResend = secondsLeft === 0 && !isResending;
// таймер на минуту
useEffect(() => {
if (secondsLeft <= 0) return;
const timer = setInterval(() => {
setSecondsLeft((prev) => prev - 1);
}, 1000);
return () => clearInterval(timer);
}, [secondsLeft]);
const handleSubmit = (e) => {
e.preventDefault();
if (!isCodeValid) {
setError("Код должен содержать 6 символов");
return;
}
setError("");
console.log("Подтверждение кода:", code);
router.push("/recPasswordNew");
// TODO: запрос на бэк и переход на страницу смены пароля
};
const handleChange = (e) => {
const value = e.target.value.replace(/\D/g, "").slice(0, 6);
setCode(value);
if (error && value.length === 6) setError("");
};
const handleResend = async () => {
if (!canResend) return;
try {
setIsResending(true);
// фейковый запрос на повторную отправку кода
await new Promise((resolve) => setTimeout(resolve, 1000));
console.log("Повторная отправка кода на почту");
setSecondsLeft(60);
} finally {
setIsResending(false);
}
};
const formatTime = (sec) => {
const m = Math.floor(sec / 60)
.toString()
.padStart(2, "0");
const s = (sec % 60).toString().padStart(2, "0");
return `${m}:${s}`;
};
return (
<div className="min-h-screen w-full bg-[#90D2F9] flex items-center justify-center px-4">
<div className="w-full max-w-md bg-white/10 rounded-2xl p-6 sm:p-8 shadow-lg relative">
<div className="flex items-center justify-between mb-4">
<button
type="button"
onClick={() => router.back()}
className="text-white text-sm font-montserrat hover:underline"
>
Назад
</button>
<span className="flex-1 ml-9 text-center font-montserrat text-white font-extrabold text-xl sm:text-2xl">
Код подтверждения
</span>
<span className="w-[80px]" />
</div>
<form onSubmit={handleSubmit} className="mt-4 space-y-4">
<p className="font-montserrat text-white text-sm text-center">
Введите код из письма, отправленного на вашу почту
</p>
<div className="space-y-1">
<label className="block font-montserrat font-extrabold text-xs text-[#ffffff] text-center">
Код
</label>
<input
type="text"
inputMode="numeric"
value={code}
onChange={handleChange}
className="w-full rounded-full bg-white px-4 py-2 text-center tracking-[0.4em] text-sm font-montserrat text-black outline-none focus:ring-2 focus:ring-blue-200"
placeholder="••••••"
/>
{error && (
<p className="text-[11px] text-red-200 font-montserrat text-center">
{error}
</p>
)}
</div>
<button
type="submit"
disabled={!isCodeValid}
className={`mt-4 w-full rounded-full py-2 text-center font-montserrat font-extrabold text-sm transition-colors
${isCodeValid
? "bg-green-500 text-white hover:bg-green-600"
: "bg-white text-[#C4C4C4] cursor-not-allowed"
}`}
>
Подтвердить
</button>
{/* Кнопка повторной отправки кода с таймером */}
<div className="mt-2 flex flex-col items-center space-y-1">
<button
type="button"
onClick={handleResend}
disabled={!canResend}
className={`text-[12px] font-montserrat font-bold underline-offset-2 ${canResend
? "text-white hover:underline"
: "text-white/50 cursor-not-allowed"
}`}
>
Отправить код ещё раз
</button>
<span className="text-[12px] font-montserrat text-white/80">
{secondsLeft > 0
? `Повторная отправка через ${formatTime(secondsLeft)}`
: "Можно отправить код ещё раз"}
</span>
</div>
</form>
</div>
</div>
);
};
export default RecPasswordCodePage;

102
app/recPasswordNew/page.jsx Normal file
View File

@@ -0,0 +1,102 @@
"use client";
import React, { useState } from "react";
import { useRouter } from "next/navigation";
const RecPasswordNewPage = () => {
const router = useRouter();
const [password, setPassword] = useState("");
const [repeatPassword, setRepeatPassword] = useState("");
const [error, setError] = useState("");
const isFormValid =
password.length >= 6 && repeatPassword.length >= 6 && password === repeatPassword;
const handleSubmit = (e) => {
e.preventDefault();
if (!isFormValid) {
if (password !== repeatPassword) {
setError("Пароли не совпадают");
} else {
setError("Пароль должен быть не короче 6 символов");
}
return;
}
setError("");
console.log("Новый пароль установлен:", password);
// TODO: запрос на бэк и редирект на страницу логина
router.push("/"); // например, на авторизацию
};
return (
<div className="min-h-screen w-full bg-[#90D2F9] flex items-center justify-center px-4">
<div className="w-full max-w-md bg-white/10 rounded-2xl p-6 sm:p-8 shadow-lg relative">
<div className="flex items-center mb-4">
<button
type="button"
onClick={() => router.back()}
className="text-white text-sm font-montserrat hover:underline"
>
Назад
</button>
<span className="flex-1 ml-5 text-center font-montserrat text-white font-extrabold text-xl sm:text-2xl">
Восстановление пароля
</span>
<span className="w-[60px]" />
</div>
<form onSubmit={handleSubmit} className="mt-2 space-y-4">
{/* Новый пароль */}
<div className="space-y-1">
<label className="block font-montserrat font-extrabold text-xs text-[#DFDFDF]">
Новый пароль
</label>
<input
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
className="w-full rounded-full bg-white px-4 py-2 text-sm font-montserrat text-black outline-none focus:ring-2 focus:ring-blue-200"
/>
</div>
{/* Повторите пароль */}
<div className="space-y-1">
<label className="block.font-montserrat font-extrabold text-xs text-[#DFDFDF]">
Повторите пароль
</label>
<input
type="password"
value={repeatPassword}
onChange={(e) => setRepeatPassword(e.target.value)}
className="w-full rounded-full bg-white px-4 py-2 text-sm font-montserrat text-black outline-none focus:ring-2 focus:ring-blue-200"
/>
</div>
{error && (
<p className="text-[11px] text-red-200 font-montserrat text-center">
{error}
</p>
)}
{/* Кнопка Войти */}
<button
type="submit"
disabled={!isFormValid}
className={`mt-4 w-full rounded-full py-2 text-center font-montserrat font-extrabold text-sm transition-colors
${
isFormValid
? "bg-green-500 text-white hover:bg-green-600"
: "bg-white text-[#C4C4C4] cursor-not-allowed"
}`}
>
Войти
</button>
</form>
</div>
</div>
);
};
export default RecPasswordNewPage;

134
app/reg/page.jsx Normal file
View File

@@ -0,0 +1,134 @@
"use client";
import React, { useState } from "react";
import { useRouter } from "next/navigation";
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
const RegPage = () => {
const router = useRouter();
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [rememberMe, setRememberMe] = useState(false);
const [checkboxError, setCheckboxError] = useState(false);
const isEmailValid = emailRegex.test(email);
const isFormValid = isEmailValid && password.length > 0;
const handleSubmit = (e) => {
e.preventDefault();
if (!rememberMe) {
setCheckboxError(true);
return;
}
setCheckboxError(false);
if (!isFormValid) return;
console.log("Email:", email, "Password:", password, "Remember:", rememberMe);
router.push("/regCode");
};
return (
<div className="min-h-screen w-full bg-[#90D2F9] flex items-center justify-center px-4">
<div className="w-full max-w-md bg-white/10 rounded-2xl p-6 sm:p-8 shadow-lg relative">
{/* Красный баннер ошибки по чекбоксу */}
{checkboxError && (
<div
className="absolute -top-10 left-0 w-full bg-red-500 text-white text-xs sm:text-sm font-montserrat px-3 py-2 rounded-t-2xl flex items-center justify-center shadow-md"
role="alert"
>
Вы не согласны с условиями использования
</div>
)}
{/* Кнопка Назад */}
<div className="flex items-center justify-between mb-4">
<button
type="button"
onClick={() => router.back()}
className="text-[#ebebeb] text-sm font-montserrat hover:underline"
>
Назад
</button>
<span className="flex-1 text-center font-montserrat text-white font-extrabold text-2xl">
Регистрация
</span>
{/* Пустой блок для выравнивания по центру заголовка */}
<span className="w-[48px]" />
</div>
<form onSubmit={handleSubmit} className="mt-2 space-y-4">
{/* Почта */}
<div className="space-y-1">
<label className="block font-montserrat font-extrabold text-xs text-white">
Почта
</label>
<input
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
className="w-full rounded-full bg-white px-4 py-2 text-sm font-montserrat text-black outline-none focus:ring-2 focus:ring-blue-200"
/>
{!isEmailValid && email.length > 0 && (
<p className="text-[11px] text-red-600 font-montserrat">
Введите корректный email
</p>
)}
</div>
{/* Пароль */}
<div className="space-y-1">
<label className="block font-montserrat font-extrabold text-xs text-white">
Пароль
</label>
<input
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
className="w-full rounded-full bg-white px-4 py-2 text-sm font-montserrat text-black outline-none focus:ring-2 focus:ring-blue-200"
/>
</div>
{/* Чекбокс */}
<div className="flex items-start space-x-2">
<button
type="button"
onClick={() => {
setRememberMe((prev) => !prev);
if (!rememberMe) setCheckboxError(false);
}}
className={`w-5 h-5 rounded-full border border-white flex items-center justify-center ${rememberMe ? "bg-white" : "bg-transparent"
}`}
>
{rememberMe && (
<span className="h-2 w-2 rounded-full bg-[#90D2F9]" />
)}
</button>
<p className="font-montserrat text-[10px] leading-[12px] text-white">
Подтверждаю, что я прочитал условия использования данного приложения
</p>
</div>
{/* Кнопка Войти */}
<button
type="submit"
disabled={!isFormValid}
className={`mt-4 w-full rounded-full py-2 text-center font-montserrat font-extrabold text-sm transition-colors
${isFormValid
? "bg-green-500 text-white hover:bg-green-600"
: "bg-white text-[#C4C4C4] cursor-not-allowed"
}`}
>
Регистрация
</button>
</form>
</div>
</div>
);
};
export default RegPage;

148
app/regCode/page.jsx Normal file
View File

@@ -0,0 +1,148 @@
"use client";
import React, { useState, useEffect } from "react";
import { useRouter } from "next/navigation";
const RecPasswordCodePage = () => {
const router = useRouter();
const [code, setCode] = useState("");
const [error, setError] = useState("");
const [secondsLeft, setSecondsLeft] = useState(60);
const [isResending, setIsResending] = useState(false);
const isCodeValid = code.length === 6;
const canResend = secondsLeft === 0 && !isResending;
// таймер на минуту
useEffect(() => {
if (secondsLeft <= 0) return;
const timer = setInterval(() => {
setSecondsLeft((prev) => prev - 1);
}, 1000);
return () => clearInterval(timer);
}, [secondsLeft]);
const handleSubmit = (e) => {
e.preventDefault();
if (!isCodeValid) {
setError("Код должен содержать 6 символов");
return;
}
setError("");
console.log("Подтверждение кода:", code);
router.push("/home");
// TODO: запрос на бэк и переход на страницу смены пароля
};
const handleChange = (e) => {
const value = e.target.value.replace(/\D/g, "").slice(0, 6);
setCode(value);
if (error && value.length === 6) setError("");
};
const handleResend = async () => {
if (!canResend) return;
try {
setIsResending(true);
// фейковый запрос на повторную отправку кода
await new Promise((resolve) => setTimeout(resolve, 1000));
console.log("Повторная отправка кода на почту");
setSecondsLeft(60);
} finally {
setIsResending(false);
}
};
const formatTime = (sec) => {
const m = Math.floor(sec / 60)
.toString()
.padStart(2, "0");
const s = (sec % 60).toString().padStart(2, "0");
return `${m}:${s}`;
};
return (
<div className="min-h-screen w-full bg-[#90D2F9] flex items-center justify-center px-4">
<div className="w-full max-w-md bg-white/10 rounded-2xl p-6 sm:p-8 shadow-lg relative">
<div className="flex items-center justify-between mb-4">
<button
type="button"
onClick={() => router.back()}
className="text-white text-sm font-montserrat hover:underline"
>
Назад
</button>
<span className="flex-1 ml-9 text-center font-montserrat text-white font-extrabold text-xl sm:text-2xl">
Код подтверждения
</span>
<span className="w-[80px]" />
</div>
<form onSubmit={handleSubmit} className="mt-4 space-y-4">
<p className="font-montserrat text-white text-sm text-center">
Введите код из письма, отправленного на вашу почту
</p>
<div className="space-y-1">
<label className="block font-montserrat font-extrabold text-xs text-[#ffffff] text-center">
Код
</label>
<input
type="text"
inputMode="numeric"
value={code}
onChange={handleChange}
className="w-full rounded-full bg-white px-4 py-2 text-center tracking-[0.4em] text-sm font-montserrat text-black outline-none focus:ring-2 focus:ring-blue-200"
placeholder="••••••"
/>
{error && (
<p className="text-[11px] text-red-200 font-montserrat text-center">
{error}
</p>
)}
</div>
<button
type="submit"
disabled={!isCodeValid}
className={`mt-4 w-full rounded-full py-2 text-center font-montserrat font-extrabold text-sm transition-colors
${isCodeValid
? "bg-green-500 text-white hover:bg-green-600"
: "bg-white text-[#C4C4C4] cursor-not-allowed"
}`}
>
Подтвердить
</button>
{/* Кнопка повторной отправки кода с таймером */}
<div className="mt-2 flex flex-col items-center space-y-1">
<button
type="button"
onClick={handleResend}
disabled={!canResend}
className={`text-[12px] font-montserrat font-bold underline-offset-2 ${canResend
? "text-white hover:underline"
: "text-white/50 cursor-not-allowed"
}`}
>
Отправить код ещё раз
</button>
<span className="text-[12px] font-montserrat text-white/80">
{secondsLeft > 0
? `Повторная отправка через ${formatTime(secondsLeft)}`
: "Можно отправить код ещё раз"}
</span>
</div>
</form>
</div>
</div>
);
};
export default RecPasswordCodePage;