feat(dashboard): add view course site actions and publish flow (#690)

Add View course site and Publish course options to org course context menus.
Replace the course header View as student button with View Course Site and
a companion overflow menu that includes View as student plus list actions.
Show a publish prompt modal for unpublished courses and support #publish
deep links in course settings.
This commit is contained in:
Rotimi Best
2026-06-25 22:39:30 +01:00
committed by GitHub
parent 6d594b4296
commit 1305e2e454
17 changed files with 449 additions and 164 deletions
@@ -0,0 +1,32 @@
import { generateSlug } from '@cio/utils/functions';
import { isObject } from '$lib/utils/functions/isObject';
import { courseApi } from '$features/course/api';
import type { Course } from '$features/course/utils/types';
export async function publishCourse(course: Course): Promise<boolean> {
if (!course?.id) {
return false;
}
let slug = course.slug?.trim() ? course.slug : undefined;
if (!slug) {
slug = generateSlug(course.title, { appendTimestamp: true });
}
const metadataPayload = {
...(isObject(course.metadata) ? course.metadata : {}),
allowNewStudent: true
};
const result = await courseApi.update(
course.id,
{
isPublished: true,
slug,
metadata: metadataPayload
},
{ showSuccessToast: true }
);
return !!result;
}