Skip to content

Commit 90860b6

Browse files
author
Rajat
committed
Merge branch 'main' of github.com:codelitdev/courselit into issue-793-2
2 parents 799b577 + b0422ff commit 90860b6

11 files changed

Lines changed: 199 additions & 2 deletions

File tree

apps/docs-new/content/docs/courses/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"introduction",
66
"create",
77
"publish",
8+
"preview",
89
"set-a-price-for-product",
910
"visibility",
1011
"add-content",
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Preview a course
3+
description: Preview a course before learners see it
4+
---
5+
6+
Course preview lets course managers open the learner-facing course viewer without enrolling in the course. Use it to review the course experience before publishing, while editing unpublished lessons, or while checking drip schedules and section order.
7+
8+
Preview mode is different from making a lesson available as a free preview. Lesson preview controls what learners can see before enrolling. Course preview is a private review mode for course managers.
9+
10+
## Who can preview a course?
11+
12+
Users who can manage the course can preview it. This includes school admins with permission to manage any course, and course creators who have course management permission.
13+
14+
## What happens in preview mode?
15+
16+
When you preview a course:
17+
18+
- All course content appears unlocked.
19+
- Unpublished lessons are visible.
20+
- Dripped sections and lessons are visible without waiting for the drip schedule.
21+
- A preview badge appears in the course viewer.
22+
- Lesson completion and learner progress are not recorded.
23+
- The exit button returns you to the product dashboard you opened the preview from.
24+
25+
## Steps to preview a course
26+
27+
1. From the `Products` section in the dashboard, select your course to open its product dashboard.
28+
29+
2. Open the `Actions` menu.
30+
31+
3. Click `Preview`.
32+
33+
![Preview course menu](/assets/courses/preview.png)
34+
35+
4. Review the course in the course viewer.
36+
37+
![Preview course](/assets/courses/course-preview.png)
38+
39+
5. Click the exit button when you are done. You will return to the course product dashboard.
40+
41+
## Notes
42+
43+
- Preview mode does not publish your course or lessons.
44+
- Preview mode does not enroll you in the course.
45+
- Preview mode does not change customer reports, progress, or completion data.
46+
- Quiz submissions and previewing SCORM content are not supported in preview mode.

apps/docs-new/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./.next/types/routes.d.ts";
3+
import "./.next/dev/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
69.4 KB
Loading
180 KB
Loading
69.4 KB
Loading
180 KB
Loading

apps/docs/src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export const SIDEBAR: Sidebar = {
5454
{ text: "Introduction", link: "en/courses/introduction" },
5555
{ text: "Create a course", link: "en/courses/create" },
5656
{ text: "Publish", link: "en/courses/publish" },
57+
{ text: "Preview a course", link: "en/courses/preview" },
5758
{ text: "Set a price", link: "en/courses/set-a-price-for-product" },
5859
{ text: "Control visibility", link: "en/courses/visibility" },
5960
{ text: "Add content", link: "en/courses/add-content" },
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: Preview a course
3+
description: Preview a course before learners see it
4+
layout: ../../../layouts/MainLayout.astro
5+
---
6+
7+
Course preview lets course managers open the learner-facing course viewer without enrolling in the course. Use it to review the course experience before publishing, while editing unpublished lessons, or while checking drip schedules and section order.
8+
9+
Preview mode is different from making a lesson available as a free preview. Lesson preview controls what learners can see before enrolling. Course preview is a private review mode for course managers.
10+
11+
## Who can preview a course?
12+
13+
Users who can manage the course can preview it. This includes school admins with permission to manage any course, and course creators who have course management permission.
14+
15+
## What happens in preview mode?
16+
17+
When you preview a course:
18+
19+
- All course content appears unlocked.
20+
- Unpublished lessons are visible.
21+
- Dripped sections and lessons are visible without waiting for the drip schedule.
22+
- A preview badge appears in the course viewer.
23+
- Lesson completion and learner progress are not recorded.
24+
- The exit button returns you to the product dashboard you opened the preview from.
25+
26+
## Steps to preview a course
27+
28+
1. From the `Products` section in the dashboard, select your course to open its product dashboard.
29+
30+
2. Open the `Actions` menu.
31+
32+
3. Click `Preview`.
33+
34+
![Preview course menu](/assets/courses/preview.png)
35+
36+
4. Review the course in the course viewer.
37+
38+
![Preview course](/assets/courses/course-preview.png)
39+
40+
5. Click the exit button when you are done. You will return to the course product dashboard.
41+
42+
## Notes
43+
44+
- Preview mode does not publish your course or lessons.
45+
- Preview mode does not enroll you in the course.
46+
- Preview mode does not change customer reports, progress, or completion data.
47+
- Quiz submissions and previewing SCORM content are not supported in preview mode.
48+
49+
## Stuck somewhere?
50+
51+
We are always here for you. Come chat with us in our <a href="https://discord.com/invite/GR4bQsN" target="_blank">Discord</a> channel or send a tweet at <a href="https://twitter.com/courselit" target="_blank">@CourseLit</a>.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { render, screen } from "@testing-library/react";
2+
3+
import { TextRenderer } from "../../../../../packages/page-blocks/src/components/text-renderer";
4+
5+
jest.mock("@courselit/text-editor", () => ({
6+
createExtensions: jest.fn(() => []),
7+
createId: jest.fn((text: string) =>
8+
text.toLowerCase().replace(/\s+/g, "-"),
9+
),
10+
emptyDoc: { type: "doc", content: [] },
11+
extractTextFromNode: jest.fn((node) =>
12+
node?.content?.map((child) => child.text ?? "").join(""),
13+
),
14+
}));
15+
16+
jest.mock("@tiptap/static-renderer", () => ({
17+
renderToReactElement: jest.fn(({ content }) => {
18+
const hasEmptyTextNode = (node: any): boolean => {
19+
if (node?.type === "text" && node.text === "") {
20+
return true;
21+
}
22+
23+
return Array.isArray(node?.content)
24+
? node.content.some(hasEmptyTextNode)
25+
: false;
26+
};
27+
28+
if (hasEmptyTextNode(content)) {
29+
throw new RangeError("Empty text nodes are not allowed");
30+
}
31+
32+
return <p>{content.content[0].content[0].text}</p>;
33+
}),
34+
}));
35+
36+
describe("TextRenderer", () => {
37+
it("renders content with empty text nodes", () => {
38+
expect(() =>
39+
render(
40+
<TextRenderer
41+
json={
42+
{
43+
type: "doc",
44+
content: [
45+
{
46+
type: "paragraph",
47+
content: [
48+
{
49+
type: "text",
50+
text: "Post body",
51+
},
52+
],
53+
},
54+
{
55+
type: "paragraph",
56+
content: [
57+
{
58+
type: "text",
59+
text: "",
60+
},
61+
],
62+
},
63+
],
64+
} as any
65+
}
66+
/>,
67+
),
68+
).not.toThrow();
69+
70+
expect(screen.getByText("Post body")).toBeInTheDocument();
71+
});
72+
});

0 commit comments

Comments
 (0)