From e43e57932968f36947a9b4e017bc472d1304da96 Mon Sep 17 00:00:00 2001 From: Oronemu Date: Wed, 17 Dec 2025 22:13:39 +0700 Subject: [PATCH] Finish --- auth-pages-backup.tsx | 434 ------------------------------------------ 1 file changed, 434 deletions(-) delete mode 100644 auth-pages-backup.tsx diff --git a/auth-pages-backup.tsx b/auth-pages-backup.tsx deleted file mode 100644 index 97b4e4d..0000000 --- a/auth-pages-backup.tsx +++ /dev/null @@ -1,434 +0,0 @@ -// ============================================ -// AUTH PAGES BACKUP - Bento Style -// ============================================ - -// ============================================ -// LOGIN PAGE (LoginPage.tsx) -// ============================================ - -import { useState } from 'react' -import { Link, useNavigate } from 'react-router-dom' -import { useForm } from 'react-hook-form' -import { zodResolver } from '@hookform/resolvers/zod' -import { z } from 'zod' -import { useAuthStore } from '@/store/auth' -import { marathonsApi } from '@/api' -import { NeonButton, Input, GlassCard } from '@/components/ui' -import { Gamepad2, LogIn, AlertCircle, Trophy, Users, Zap, Target } from 'lucide-react' - -const loginSchema = z.object({ - login: z.string().min(3, 'Логин должен быть не менее 3 символов'), - password: z.string().min(6, 'Пароль должен быть не менее 6 символов'), -}) - -type LoginForm = z.infer - -export function LoginPage() { - const navigate = useNavigate() - const { login, isLoading, error, clearError, consumePendingInviteCode } = useAuthStore() - const [submitError, setSubmitError] = useState(null) - - const { - register, - handleSubmit, - formState: { errors }, - } = useForm({ - resolver: zodResolver(loginSchema), - }) - - const onSubmit = async (data: LoginForm) => { - setSubmitError(null) - clearError() - try { - await login(data) - - // Check for pending invite code - const pendingCode = consumePendingInviteCode() - if (pendingCode) { - try { - const marathon = await marathonsApi.join(pendingCode) - navigate(`/marathons/${marathon.id}`) - return - } catch { - // If join fails (already member, etc), just go to marathons - } - } - - navigate('/marathons') - } catch { - setSubmitError(error || 'Ошибка входа') - } - } - - const features = [ - { icon: , text: 'Соревнуйтесь с друзьями' }, - { icon: , text: 'Выполняйте челленджи' }, - { icon: , text: 'Зарабатывайте очки' }, - { icon: , text: 'Создавайте марафоны' }, - ] - - return ( -
- {/* Background effects */} -
-
-
-
- - {/* Bento Grid */} -
-
- {/* Branding Block (left) */} - - {/* Background decoration */} -
-
-
-
- -
- {/* Logo */} -
-
- -
-
- - {/* Title */} -

- Game Marathon -

-

- Платформа для игровых соревнований -

- - {/* Features */} -
- {features.map((feature, index) => ( -
-
- {feature.icon} -
- {feature.text} -
- ))} -
-
- - - {/* Form Block (right) */} - - {/* Header */} -
-

Добро пожаловать!

-

Войдите, чтобы продолжить

-
- - {/* Form */} -
- {(submitError || error) && ( -
- - {submitError || error} -
- )} - - - - - - } - > - Войти - -
- - {/* Footer */} -
-

- Нет аккаунта?{' '} - - Зарегистрироваться - -

-
-
-
- - {/* Decorative elements */} -
-
-
-
- ) -} - - -// ============================================ -// REGISTER PAGE (RegisterPage.tsx) -// ============================================ - -import { useState } from 'react' -import { Link, useNavigate } from 'react-router-dom' -import { useForm } from 'react-hook-form' -import { zodResolver } from '@hookform/resolvers/zod' -import { z } from 'zod' -import { useAuthStore } from '@/store/auth' -import { marathonsApi } from '@/api' -import { NeonButton, Input, GlassCard } from '@/components/ui' -import { Gamepad2, UserPlus, AlertCircle, Trophy, Users, Zap, Target, Sparkles } from 'lucide-react' - -const registerSchema = z.object({ - login: z - .string() - .min(3, 'Логин должен быть не менее 3 символов') - .max(50, 'Логин должен быть не более 50 символов') - .regex(/^[a-zA-Z0-9_]+$/, 'Логин может содержать только буквы, цифры и подчёркивания'), - nickname: z - .string() - .min(2, 'Никнейм должен быть не менее 2 символов') - .max(50, 'Никнейм должен быть не более 50 символов'), - password: z.string().min(6, 'Пароль должен быть не менее 6 символов'), - confirmPassword: z.string(), -}).refine((data) => data.password === data.confirmPassword, { - message: 'Пароли не совпадают', - path: ['confirmPassword'], -}) - -type RegisterForm = z.infer - -export function RegisterPage() { - const navigate = useNavigate() - const { register: registerUser, isLoading, error, clearError, consumePendingInviteCode } = useAuthStore() - const [submitError, setSubmitError] = useState(null) - - const { - register, - handleSubmit, - formState: { errors }, - } = useForm({ - resolver: zodResolver(registerSchema), - }) - - const onSubmit = async (data: RegisterForm) => { - setSubmitError(null) - clearError() - try { - await registerUser({ - login: data.login, - password: data.password, - nickname: data.nickname, - }) - - // Check for pending invite code - const pendingCode = consumePendingInviteCode() - if (pendingCode) { - try { - const marathon = await marathonsApi.join(pendingCode) - navigate(`/marathons/${marathon.id}`) - return - } catch { - // If join fails, just go to marathons - } - } - - navigate('/marathons') - } catch { - setSubmitError(error || 'Ошибка регистрации') - } - } - - const features = [ - { icon: , text: 'Соревнуйтесь с друзьями' }, - { icon: , text: 'Выполняйте челленджи' }, - { icon: , text: 'Зарабатывайте очки' }, - { icon: , text: 'Создавайте марафоны' }, - ] - - return ( -
- {/* Background effects */} -
-
-
-
- - {/* Bento Grid */} -
-
- {/* Branding Block (left) */} - - {/* Background decoration */} -
-
-
-
- -
- {/* Logo */} -
-
- -
-
- - {/* Title */} -

- Game Marathon -

-

- Присоединяйтесь к игровому сообществу -

- - {/* Benefits */} -
-
- - Что вас ждет: -
-
    -
  • - - Создавайте игровые марафоны -
  • -
  • - - Выполняйте уникальные челленджи -
  • -
  • - - Соревнуйтесь за первое место -
  • -
-
- - {/* Features */} -
- {features.map((feature, index) => ( -
-
- {feature.icon} -
- {feature.text} -
- ))} -
-
- - - {/* Form Block (right) */} - - {/* Header */} -
-
-
- -
-
-

Создать аккаунт

-

Начните играть уже сегодня

-
- - {/* Form */} -
- {(submitError || error) && ( -
- - {submitError || error} -
- )} - - - - - - - - - - } - > - Зарегистрироваться - -
- - {/* Footer */} -
-

- Уже есть аккаунт?{' '} - - Войти - -

-
-
-
- - {/* Decorative elements */} -
-
-
-
- ) -}