Enroll modal: days input instead of date; hide bundle if base course owned

- Quick-enroll modal now takes access duration in days (0/empty = unlimited)
  and shows the computed expiry date, instead of a manual date picker.
- Dashboard upsell no longer shows the "Всё включено" bundle of a course
  the student already owns in its base edition (obsidian/zotero).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-08 16:13:15 +05:00
parent 8c9f1e0a55
commit a290b9495c
2 changed files with 33 additions and 12 deletions
+10 -1
View File
@@ -57,11 +57,20 @@ export default async function StudentDashboard() {
// Витрина: продаваемые курсы, которых у студента нет → заблюренные карточки
const enrolledSlugs = new Set(enrollments.map((e) => e.course.slug));
// Не показываем «Всё включено», если у студента уже есть обычная версия того же курса
const SUPPRESS_IF_OWNED: Record<string, string> = {
"obsidian-full": "obsidian", // ВВ Obsidian 2025 ← обычный Obsidian 2025
"zotero-full": "zotero", // ВВ Zotero ← обычный Zotero
};
const storeCourses = await prisma.course.findMany({
where: { slug: { in: Object.keys(STORE_LINKS) }, published: true },
select: { id: true, slug: true, title: true, description: true, coverImage: true },
});
const locked = storeCourses.filter((c) => !enrolledSlugs.has(c.slug));
const locked = storeCourses.filter(
(c) =>
!enrolledSlugs.has(c.slug) &&
!(SUPPRESS_IF_OWNED[c.slug] && enrolledSlugs.has(SUPPRESS_IF_OWNED[c.slug]))
);
return (
<main className="max-w-5xl mx-auto px-6 py-10 w-full">