feat: add resilient cover previews and zoom
This commit is contained in:
@@ -17,6 +17,7 @@ type ApiCourse = {
|
||||
description: string;
|
||||
category: string;
|
||||
coverImageUrl: string | null;
|
||||
coverImageZoom: number;
|
||||
status: 'draft' | 'published' | 'archived';
|
||||
progress?: number;
|
||||
lastActivity?: string | null;
|
||||
@@ -67,6 +68,7 @@ const toCourse = (course: ApiCourse): Course => ({
|
||||
description: course.description,
|
||||
category: course.category,
|
||||
thumbnail: course.coverImageUrl || '/course-placeholder.svg',
|
||||
coverImageZoom: course.coverImageZoom || 1,
|
||||
instructor: course.instructor.name,
|
||||
status: course.status === 'draft' ? 'draft' : 'published',
|
||||
progress: course.progress,
|
||||
@@ -124,6 +126,7 @@ const toCoursePayload = (course: Course) => ({
|
||||
description: course.description,
|
||||
category: course.category,
|
||||
coverImageUrl: course.thumbnail && /^https?:\/\//.test(course.thumbnail) ? course.thumbnail : null,
|
||||
coverImageZoom: course.coverImageZoom || 1,
|
||||
status: course.status || 'published',
|
||||
assets: (course.attachments || []).filter((attachment) => attachment.url && attachment.url !== '#').map(toAssetPayload),
|
||||
lessons: course.lessons.map((lesson) => ({
|
||||
|
||||
Reference in New Issue
Block a user