@anantagnanam/lms 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +77 -2
- package/astro/client.ts +433 -0
- package/astro/components/CertificateCard.astro +83 -0
- package/astro/components/CourseCard.astro +61 -0
- package/astro/components/CourseCatalog.astro +96 -0
- package/astro/components/CourseOverview.astro +286 -0
- package/astro/components/LearnerDashboard.astro +121 -0
- package/astro/components/LearningShell.astro +28 -0
- package/astro/components/LessonPlayer.astro +323 -0
- package/astro/components/MediaPlayer.astro +60 -0
- package/astro/components/index.ts +7 -0
- package/astro/layouts/AcademyLayout.astro +84 -0
- package/astro/pages/certificate.astro +57 -0
- package/astro/pages/cohort.astro +102 -0
- package/astro/pages/course.astro +80 -0
- package/astro/pages/dashboard.astro +34 -0
- package/astro/pages/index.astro +40 -0
- package/astro/pages/lesson.astro +100 -0
- package/astro/pages/teach.astro +15 -0
- package/astro/styles.css +1288 -0
- package/dist/admin.d.ts +32 -0
- package/dist/admin.js +2762 -0
- package/dist/admin.js.map +1 -0
- package/dist/astro.d.ts +11 -0
- package/dist/astro.js +49 -0
- package/dist/astro.js.map +1 -0
- package/dist/commerce.d.ts +72 -0
- package/dist/commerce.js +0 -0
- package/dist/config-BX3beTpM.js +15 -0
- package/dist/config-BX3beTpM.js.map +1 -0
- package/dist/constants-C0kT94tc.js +139 -0
- package/dist/constants-C0kT94tc.js.map +1 -0
- package/dist/csv-DKq_4OWU.js +55 -0
- package/dist/csv-DKq_4OWU.js.map +1 -0
- package/dist/errors-ChzJS9al.js +16 -0
- package/dist/errors-ChzJS9al.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.d.ts +681 -0
- package/dist/runtime.js +2060 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schemas.d.ts +584 -0
- package/dist/schemas.js +315 -0
- package/dist/schemas.js.map +1 -0
- package/dist/server.d.ts +30 -0
- package/dist/server.js +54 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +284 -0
- package/dist/types.js +0 -0
- package/package.json +83 -4
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Layout from "virtual:anantagnanam-lms/layout";
|
|
3
|
+
import LearningShell from "../components/LearningShell.astro";
|
|
4
|
+
import CourseOverview from "../components/CourseOverview.astro";
|
|
5
|
+
import { lmsPublic, lmsLearner, LmsError } from "@anantagnanam/lms/server";
|
|
6
|
+
import { basePath } from "virtual:anantagnanam-lms/config";
|
|
7
|
+
import type {
|
|
8
|
+
CourseDetail,
|
|
9
|
+
PublicEnrollment,
|
|
10
|
+
ProgressSummary,
|
|
11
|
+
Review,
|
|
12
|
+
Page,
|
|
13
|
+
CohortMembership,
|
|
14
|
+
} from "@anantagnanam/lms/types";
|
|
15
|
+
export const prerender = false;
|
|
16
|
+
Astro.response.headers.set("Cache-Control", "private, no-store");
|
|
17
|
+
const slug = Astro.params.slug ?? "";
|
|
18
|
+
let course: CourseDetail | undefined;
|
|
19
|
+
let enrollment: PublicEnrollment | null = null;
|
|
20
|
+
let progress: ProgressSummary | undefined;
|
|
21
|
+
let reviews: Page<Review> | undefined;
|
|
22
|
+
let cohortMembership: CohortMembership | null = null;
|
|
23
|
+
const cohortId = Astro.url.searchParams.get("cohort") ?? undefined;
|
|
24
|
+
let error = "";
|
|
25
|
+
try {
|
|
26
|
+
if (Astro.locals.user) {
|
|
27
|
+
const result = await lmsLearner<{
|
|
28
|
+
course: CourseDetail;
|
|
29
|
+
enrollment: PublicEnrollment | null;
|
|
30
|
+
progress: ProgressSummary;
|
|
31
|
+
}>(Astro.locals, "learner/course-by-slug", { slug }, Astro.url.origin);
|
|
32
|
+
course = result.course;
|
|
33
|
+
enrollment = result.enrollment;
|
|
34
|
+
progress = result.progress;
|
|
35
|
+
if (cohortId)
|
|
36
|
+
cohortMembership = await lmsLearner<CohortMembership | null>(
|
|
37
|
+
Astro.locals,
|
|
38
|
+
"learner/cohort",
|
|
39
|
+
{ cohortId },
|
|
40
|
+
Astro.url.origin,
|
|
41
|
+
);
|
|
42
|
+
} else course = await lmsPublic<CourseDetail>(Astro.locals, "course", { slug }, Astro.url.origin);
|
|
43
|
+
try {
|
|
44
|
+
reviews = await lmsPublic<Page<Review>>(
|
|
45
|
+
Astro.locals,
|
|
46
|
+
"reviews",
|
|
47
|
+
{ courseId: course.id },
|
|
48
|
+
Astro.url.origin,
|
|
49
|
+
);
|
|
50
|
+
} catch {}
|
|
51
|
+
} catch (cause) {
|
|
52
|
+
Astro.response.status = cause instanceof LmsError ? cause.status : 503;
|
|
53
|
+
error = cause instanceof Error ? cause.message : "Course unavailable.";
|
|
54
|
+
}
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
<Layout
|
|
58
|
+
title={course?.title ?? "Course unavailable"}
|
|
59
|
+
description={course?.summary}
|
|
60
|
+
robots={course ? undefined : "noindex, follow"}
|
|
61
|
+
>
|
|
62
|
+
<LearningShell>
|
|
63
|
+
{course ? (
|
|
64
|
+
<CourseOverview
|
|
65
|
+
course={course}
|
|
66
|
+
enrollment={enrollment}
|
|
67
|
+
progress={progress}
|
|
68
|
+
reviews={reviews}
|
|
69
|
+
cohortId={cohortId}
|
|
70
|
+
cohortMembership={cohortMembership}
|
|
71
|
+
/>
|
|
72
|
+
) : (
|
|
73
|
+
<section class="lms-gate">
|
|
74
|
+
<h1>Course unavailable</h1>
|
|
75
|
+
<p>{error}</p>
|
|
76
|
+
<a href={basePath}>Explore courses →</a>
|
|
77
|
+
</section>
|
|
78
|
+
)}
|
|
79
|
+
</LearningShell>
|
|
80
|
+
</Layout>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Layout from "virtual:anantagnanam-lms/layout";
|
|
3
|
+
import LearningShell from "../components/LearningShell.astro";
|
|
4
|
+
import LearnerDashboard from "../components/LearnerDashboard.astro";
|
|
5
|
+
import { lmsLearner, loginUrl } from "@anantagnanam/lms/server";
|
|
6
|
+
import { loginPath } from "virtual:anantagnanam-lms/config";
|
|
7
|
+
import type { CourseCard, PublicEnrollment, ProgressSummary, Page } from "@anantagnanam/lms/types";
|
|
8
|
+
export const prerender = false;
|
|
9
|
+
Astro.response.headers.set("Cache-Control", "private, no-store");
|
|
10
|
+
if (!Astro.locals.user)
|
|
11
|
+
return Astro.redirect(loginUrl(loginPath, Astro.url.pathname + Astro.url.search));
|
|
12
|
+
let page: Page<{ course: CourseCard; enrollment: PublicEnrollment; progress: ProgressSummary }> = {
|
|
13
|
+
items: [],
|
|
14
|
+
hasMore: false,
|
|
15
|
+
};
|
|
16
|
+
let error = "";
|
|
17
|
+
try {
|
|
18
|
+
page = await lmsLearner<typeof page>(
|
|
19
|
+
Astro.locals,
|
|
20
|
+
"learner/dashboard",
|
|
21
|
+
{ cursor: Astro.url.searchParams.get("cursor") ?? undefined },
|
|
22
|
+
Astro.url.origin,
|
|
23
|
+
);
|
|
24
|
+
} catch (cause) {
|
|
25
|
+
Astro.response.status = 503;
|
|
26
|
+
error = cause instanceof Error ? cause.message : "Could not load your learning records.";
|
|
27
|
+
}
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<Layout title="My learning" robots="noindex, follow">
|
|
31
|
+
<LearningShell>
|
|
32
|
+
<LearnerDashboard page={page} error={error} />
|
|
33
|
+
</LearningShell>
|
|
34
|
+
</Layout>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Layout from "virtual:anantagnanam-lms/layout";
|
|
3
|
+
import LearningShell from "../components/LearningShell.astro";
|
|
4
|
+
import CourseCatalog from "../components/CourseCatalog.astro";
|
|
5
|
+
import { lmsPublic, LmsError } from "@anantagnanam/lms/server";
|
|
6
|
+
import type { Page, CourseCard } from "@anantagnanam/lms/types";
|
|
7
|
+
export const prerender = false;
|
|
8
|
+
Astro.response.headers.set("Cache-Control", "private, no-store");
|
|
9
|
+
let page: Page<CourseCard> = { items: [], hasMore: false };
|
|
10
|
+
let academy = {
|
|
11
|
+
title: "Ananta Gnanam Academy",
|
|
12
|
+
description: "Build knowledge, one lesson at a time.",
|
|
13
|
+
};
|
|
14
|
+
let error = "";
|
|
15
|
+
try {
|
|
16
|
+
[page, academy] = await Promise.all([
|
|
17
|
+
lmsPublic<Page<CourseCard>>(
|
|
18
|
+
Astro.locals,
|
|
19
|
+
"catalog",
|
|
20
|
+
Object.fromEntries(Astro.url.searchParams),
|
|
21
|
+
Astro.url.origin,
|
|
22
|
+
),
|
|
23
|
+
lmsPublic<typeof academy>(Astro.locals, "academy", {}, Astro.url.origin),
|
|
24
|
+
]);
|
|
25
|
+
} catch (cause) {
|
|
26
|
+
Astro.response.status = cause instanceof LmsError ? cause.status : 503;
|
|
27
|
+
error = cause instanceof Error ? cause.message : "The academy is temporarily unavailable.";
|
|
28
|
+
}
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<Layout title={academy.title} description={academy.description}>
|
|
32
|
+
<LearningShell>
|
|
33
|
+
<CourseCatalog
|
|
34
|
+
page={page}
|
|
35
|
+
title={academy.title}
|
|
36
|
+
description={academy.description}
|
|
37
|
+
error={error}
|
|
38
|
+
/>
|
|
39
|
+
</LearningShell>
|
|
40
|
+
</Layout>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Layout from "virtual:anantagnanam-lms/layout";
|
|
3
|
+
import LearningShell from "../components/LearningShell.astro";
|
|
4
|
+
import LessonPlayer from "../components/LessonPlayer.astro";
|
|
5
|
+
import { lmsPublic, lmsLearner, courseUrl, loginUrl, LmsError } from "@anantagnanam/lms/server";
|
|
6
|
+
import { basePath, loginPath } from "virtual:anantagnanam-lms/config";
|
|
7
|
+
import type {
|
|
8
|
+
CourseDetail,
|
|
9
|
+
PublicLesson,
|
|
10
|
+
PublicEnrollment,
|
|
11
|
+
ProgressSummary,
|
|
12
|
+
} from "@anantagnanam/lms/types";
|
|
13
|
+
export const prerender = false;
|
|
14
|
+
Astro.response.headers.set("Cache-Control", "private, no-store");
|
|
15
|
+
let course: CourseDetail | undefined;
|
|
16
|
+
let lesson: PublicLesson | undefined;
|
|
17
|
+
let enrollment: PublicEnrollment | null = null;
|
|
18
|
+
let progress: ProgressSummary | undefined;
|
|
19
|
+
let error = "";
|
|
20
|
+
let preview = false;
|
|
21
|
+
try {
|
|
22
|
+
if (Astro.locals.user) {
|
|
23
|
+
const result = await lmsLearner<{
|
|
24
|
+
course: CourseDetail;
|
|
25
|
+
enrollment: PublicEnrollment | null;
|
|
26
|
+
progress: ProgressSummary;
|
|
27
|
+
}>(Astro.locals, "learner/course-by-slug", { slug: Astro.params.slug }, Astro.url.origin);
|
|
28
|
+
course = result.course;
|
|
29
|
+
enrollment = result.enrollment;
|
|
30
|
+
} else
|
|
31
|
+
course = await lmsPublic<CourseDetail>(
|
|
32
|
+
Astro.locals,
|
|
33
|
+
"course",
|
|
34
|
+
{ slug: Astro.params.slug },
|
|
35
|
+
Astro.url.origin,
|
|
36
|
+
);
|
|
37
|
+
if (enrollment && ["active", "completed"].includes(enrollment.status)) {
|
|
38
|
+
const result = await lmsLearner<{
|
|
39
|
+
course: CourseDetail;
|
|
40
|
+
lesson: PublicLesson;
|
|
41
|
+
enrollment: PublicEnrollment;
|
|
42
|
+
progress: ProgressSummary;
|
|
43
|
+
}>(
|
|
44
|
+
Astro.locals,
|
|
45
|
+
"learner/lesson",
|
|
46
|
+
{ courseId: course.id, lessonId: Astro.params.lessonId },
|
|
47
|
+
Astro.url.origin,
|
|
48
|
+
);
|
|
49
|
+
lesson = result.lesson;
|
|
50
|
+
enrollment = result.enrollment;
|
|
51
|
+
progress = result.progress;
|
|
52
|
+
} else {
|
|
53
|
+
const result = await lmsPublic<{ course: CourseDetail; lesson: PublicLesson }>(
|
|
54
|
+
Astro.locals,
|
|
55
|
+
"preview",
|
|
56
|
+
{ courseId: course.id, lessonId: Astro.params.lessonId },
|
|
57
|
+
Astro.url.origin,
|
|
58
|
+
);
|
|
59
|
+
lesson = result.lesson;
|
|
60
|
+
preview = true;
|
|
61
|
+
}
|
|
62
|
+
} catch (cause) {
|
|
63
|
+
Astro.response.status = cause instanceof LmsError ? cause.status : 503;
|
|
64
|
+
error = cause instanceof Error ? cause.message : "This lesson is unavailable.";
|
|
65
|
+
}
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
<Layout
|
|
69
|
+
title={lesson?.title ?? "Continue your learning"}
|
|
70
|
+
description={lesson?.summary}
|
|
71
|
+
robots="noindex, follow"
|
|
72
|
+
>
|
|
73
|
+
<LearningShell>
|
|
74
|
+
{course && lesson ? (
|
|
75
|
+
<LessonPlayer
|
|
76
|
+
course={course}
|
|
77
|
+
lesson={lesson}
|
|
78
|
+
enrollment={enrollment}
|
|
79
|
+
progress={progress}
|
|
80
|
+
preview={preview}
|
|
81
|
+
/>
|
|
82
|
+
) : (
|
|
83
|
+
<section class="lms-gate">
|
|
84
|
+
<p class="lms-eyebrow">ONE STEP AT A TIME</p>
|
|
85
|
+
<h1>Continue your learning</h1>
|
|
86
|
+
<p>{error}</p>
|
|
87
|
+
{!Astro.locals.user && (
|
|
88
|
+
<a class="lms-btn" href={loginUrl(loginPath, Astro.url.pathname)}>
|
|
89
|
+
Sign in →
|
|
90
|
+
</a>
|
|
91
|
+
)}
|
|
92
|
+
{course && (
|
|
93
|
+
<p>
|
|
94
|
+
<a href={courseUrl(basePath, course.slug)}>Return to course overview →</a>
|
|
95
|
+
</p>
|
|
96
|
+
)}
|
|
97
|
+
</section>
|
|
98
|
+
)}
|
|
99
|
+
</LearningShell>
|
|
100
|
+
</Layout>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Layout from "virtual:anantagnanam-lms/layout";
|
|
3
|
+
import { CoursesPage } from "@anantagnanam/lms/admin";
|
|
4
|
+
import { loginUrl } from "@anantagnanam/lms/server";
|
|
5
|
+
import { loginPath } from "virtual:anantagnanam-lms/config";
|
|
6
|
+
export const prerender = false;
|
|
7
|
+
Astro.response.headers.set("Cache-Control", "private, no-store");
|
|
8
|
+
if (!Astro.locals.user) return Astro.redirect(loginUrl(loginPath, Astro.url.pathname));
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<Layout title="Course studio" robots="noindex, follow">
|
|
12
|
+
<div class="lms-container" id="lms-main">
|
|
13
|
+
<CoursesPage client:load />
|
|
14
|
+
</div>
|
|
15
|
+
</Layout>
|