Implement platform settings (Stage 9)
- Wire settings to actual platform behavior: maintenance mode, registration toggle, notification emails, curator feedback emails, email verification flag - Add logo (logoUrl, showLogo) and social network links (YouTube, VK, Telegram) settings - Show logo + school name dynamically in student layout header - Add footer to student layout with org requisites and social links - Register page: read settings server-side, validate terms checkbox with legal links - Login page: show notice when redirected from closed registration - Settings form: add Logo and Social Networks sections Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,10 +4,18 @@ import { useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { signUp } from "@/lib/auth-client";
|
||||
|
||||
export function RegisterForm() {
|
||||
interface Props {
|
||||
showTermsCheckbox: boolean;
|
||||
privacyPolicyUrl: string;
|
||||
termsUrl: string;
|
||||
offerUrl: string;
|
||||
}
|
||||
|
||||
export function RegisterForm({ showTermsCheckbox, privacyPolicyUrl, termsUrl, offerUrl }: Props) {
|
||||
const [name, setName] = useState("");
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [termsAccepted, setTermsAccepted] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [success, setSuccess] = useState(false);
|
||||
@@ -22,8 +30,18 @@ export function RegisterForm() {
|
||||
fontFamily: "inherit",
|
||||
} as React.CSSProperties;
|
||||
|
||||
const legalLinks = [
|
||||
{ url: privacyPolicyUrl, label: "Политику конфиденциальности" },
|
||||
{ url: termsUrl, label: "Согласие на обработку данных" },
|
||||
{ url: offerUrl, label: "Договор-оферту" },
|
||||
].filter((l) => l.url);
|
||||
|
||||
async function handleSubmit(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
if (showTermsCheckbox && !termsAccepted) {
|
||||
setError("Необходимо принять условия для продолжения");
|
||||
return;
|
||||
}
|
||||
setError("");
|
||||
setLoading(true);
|
||||
|
||||
@@ -102,6 +120,38 @@ export function RegisterForm() {
|
||||
placeholder="Минимум 8 символов"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{showTermsCheckbox && (
|
||||
<label className="flex items-start gap-2 cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={termsAccepted}
|
||||
onChange={(e) => setTermsAccepted(e.target.checked)}
|
||||
className="mt-0.5 flex-shrink-0"
|
||||
style={{ width: "16px", height: "16px", accentColor: "var(--foreground)" }}
|
||||
/>
|
||||
<span className="text-xs" style={{ color: "var(--muted-foreground)" }}>
|
||||
Я принимаю{" "}
|
||||
{legalLinks.length > 0
|
||||
? legalLinks.map((l, i) => (
|
||||
<span key={l.url}>
|
||||
<a
|
||||
href={l.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline"
|
||||
style={{ color: "var(--foreground)" }}
|
||||
>
|
||||
{l.label}
|
||||
</a>
|
||||
{i < legalLinks.length - 1 ? ", " : ""}
|
||||
</span>
|
||||
))
|
||||
: "условия использования платформы"}
|
||||
</span>
|
||||
</label>
|
||||
)}
|
||||
|
||||
{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}
|
||||
|
||||
Reference in New Issue
Block a user