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:
2026-04-27 15:31:10 +05:00
parent ba0a630fd9
commit c64f393a7b
8 changed files with 223 additions and 24 deletions
+13 -8
View File
@@ -5,6 +5,7 @@ import { auth } from "@/lib/auth";
import { headers } from "next/headers";
import { revalidatePath } from "next/cache";
import { sendHomeworkSubmittedEmail } from "@/lib/email";
import { getSettings, parseNotificationEmails, asBool } from "@/lib/settings";
// ── Lesson Progress ───────────────────────────────────────────────────────────
@@ -72,20 +73,24 @@ export async function submitHomework(
});
submissionId = created.id;
const [lesson, admins] = await Promise.all([
const [lesson, settings] = await Promise.all([
prisma.homework.findUnique({
where: { id: homeworkId },
include: { lesson: { select: { title: true } } },
}),
prisma.user.findMany({
where: { role: { in: ["admin", "curator"] } },
select: { email: true, name: true },
}),
getSettings(),
]);
if (lesson) {
if (lesson && asBool(settings.notifyOnHomework)) {
const configuredEmails = parseNotificationEmails(settings.notificationEmails);
const recipients = configuredEmails.length > 0
? configuredEmails.map((email) => ({ email, name: "" }))
: await prisma.user.findMany({
where: { role: { in: ["admin", "curator"] } },
select: { email: true, name: true },
});
await Promise.all(
admins.map((a) =>
sendHomeworkSubmittedEmail(a.email, a.name, session.user.name, lesson.lesson.title, submissionId)
recipients.map((r) =>
sendHomeworkSubmittedEmail(r.email, r.name, session.user.name, lesson.lesson.title, submissionId)
)
);
}
+9
View File
@@ -33,6 +33,15 @@ export const SETTINGS_DEFAULTS = {
curatorCanAnswerQuestions: "true",
curatorCanSeeStudents: "true",
// Logo
logoUrl: "",
showLogo: "true",
// Social networks
socialYoutube: "",
socialVk: "",
socialTelegram: "",
// Code injection
headCode: "",
bodyCode: "",