Polish UX: auto-redirect on create, fix design consistency
- createModule now redirects to module page after creation - createLesson now redirects to lesson editor after creation - Regenerate Prisma client to fix missing types (category, accessLog, expiresAt) - Rewrite sortable-modules/lessons with Second Brain design tokens (remove amber/slate) - Rewrite lesson-editor toolbar and toggle with design tokens - Fix register page/form: replace amber theme with card-aubade design Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,13 +2,17 @@ import { RegisterForm } from "./register-form";
|
||||
|
||||
export default function RegisterPage() {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-amber-50">
|
||||
<div className="w-full max-w-md">
|
||||
<div className="min-h-screen flex items-center justify-center" style={{ backgroundColor: "var(--background)" }}>
|
||||
<div className="w-full max-w-sm">
|
||||
<div className="text-center mb-8">
|
||||
<h1 className="text-3xl font-bold text-amber-900">Second Brain</h1>
|
||||
<p className="text-amber-700 mt-2">Создайте аккаунт</p>
|
||||
<h1 className="text-2xl font-bold tracking-wide" style={{ color: "var(--foreground)" }}>
|
||||
Second Brain
|
||||
</h1>
|
||||
<p className="mt-1 text-sm uppercase tracking-widest" style={{ color: "var(--muted-foreground)", fontSize: "0.65rem" }}>
|
||||
Образовательная платформа
|
||||
</p>
|
||||
</div>
|
||||
<div className="bg-white rounded-2xl shadow-sm border border-amber-100 p-8">
|
||||
<div className="card-aubade p-8">
|
||||
<RegisterForm />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import Link from "next/link";
|
||||
import { signUp } from "@/lib/auth-client";
|
||||
|
||||
export function RegisterForm() {
|
||||
const router = useRouter();
|
||||
const [name, setName] = useState("");
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
@@ -14,6 +12,16 @@ export function RegisterForm() {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [success, setSuccess] = useState(false);
|
||||
|
||||
const inputStyle = {
|
||||
border: "2px solid var(--border)",
|
||||
background: "var(--background)",
|
||||
outline: "none",
|
||||
width: "100%",
|
||||
padding: "0.5rem 0.75rem",
|
||||
fontSize: "0.875rem",
|
||||
fontFamily: "inherit",
|
||||
} as React.CSSProperties;
|
||||
|
||||
async function handleSubmit(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
setError("");
|
||||
@@ -35,14 +43,11 @@ export function RegisterForm() {
|
||||
return (
|
||||
<div className="text-center space-y-4">
|
||||
<div className="text-4xl">✉️</div>
|
||||
<h2 className="text-xl font-semibold text-gray-800">
|
||||
Проверьте почту
|
||||
</h2>
|
||||
<p className="text-gray-500">
|
||||
Мы отправили письмо на <strong>{email}</strong> для подтверждения
|
||||
аккаунта.
|
||||
<p className="font-bold">Проверьте почту</p>
|
||||
<p className="text-sm" style={{ color: "var(--muted-foreground)" }}>
|
||||
Мы отправили письмо на <strong>{email}</strong> для подтверждения аккаунта.
|
||||
</p>
|
||||
<Link href="/login" className="text-amber-600 hover:underline text-sm">
|
||||
<Link href="/login" className="text-sm underline" style={{ color: "var(--foreground)" }}>
|
||||
Вернуться к входу
|
||||
</Link>
|
||||
</div>
|
||||
@@ -51,8 +56,8 @@ export function RegisterForm() {
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-bold uppercase tracking-widest" style={{ color: "var(--muted-foreground)" }}>
|
||||
Имя
|
||||
</label>
|
||||
<input
|
||||
@@ -60,12 +65,14 @@ export function RegisterForm() {
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
required
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-amber-400"
|
||||
style={inputStyle}
|
||||
onFocus={(e) => (e.currentTarget.style.borderColor = "var(--foreground)")}
|
||||
onBlur={(e) => (e.currentTarget.style.borderColor = "var(--border)")}
|
||||
placeholder="Иван Иванов"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-bold uppercase tracking-widest" style={{ color: "var(--muted-foreground)" }}>
|
||||
Email
|
||||
</label>
|
||||
<input
|
||||
@@ -73,12 +80,14 @@ export function RegisterForm() {
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
required
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-amber-400"
|
||||
style={inputStyle}
|
||||
onFocus={(e) => (e.currentTarget.style.borderColor = "var(--foreground)")}
|
||||
onBlur={(e) => (e.currentTarget.style.borderColor = "var(--border)")}
|
||||
placeholder="you@example.com"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-bold uppercase tracking-widest" style={{ color: "var(--muted-foreground)" }}>
|
||||
Пароль
|
||||
</label>
|
||||
<input
|
||||
@@ -87,21 +96,28 @@ export function RegisterForm() {
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
required
|
||||
minLength={8}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-amber-400"
|
||||
style={inputStyle}
|
||||
onFocus={(e) => (e.currentTarget.style.borderColor = "var(--foreground)")}
|
||||
onBlur={(e) => (e.currentTarget.style.borderColor = "var(--border)")}
|
||||
placeholder="Минимум 8 символов"
|
||||
/>
|
||||
</div>
|
||||
{error && <p className="text-red-500 text-sm">{error}</p>}
|
||||
{error && (
|
||||
<p className="text-xs py-2 px-3" style={{ border: "2px solid oklch(0.577 0.245 27.325)", color: "oklch(0.577 0.245 27.325)" }}>
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
<button
|
||||
type="submit"
|
||||
disabled={loading}
|
||||
className="w-full bg-amber-500 hover:bg-amber-600 text-white font-medium py-2 px-4 rounded-lg transition-colors disabled:opacity-50"
|
||||
className="btn-aubade btn-aubade-accent w-full py-2 text-sm"
|
||||
style={{ opacity: loading ? 0.6 : 1 }}
|
||||
>
|
||||
{loading ? "Регистрация..." : "Зарегистрироваться"}
|
||||
</button>
|
||||
<p className="text-center text-sm text-gray-500">
|
||||
<p className="text-center text-xs" style={{ color: "var(--muted-foreground)" }}>
|
||||
Уже есть аккаунт?{" "}
|
||||
<Link href="/login" className="text-amber-600 hover:underline">
|
||||
<Link href="/login" className="underline" style={{ color: "var(--foreground)" }}>
|
||||
Войти
|
||||
</Link>
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user