feat: add resilient cover previews and zoom
All checks were successful
CI / Validate frontend and API (push) Successful in 1m10s
CI / Build and publish Docker images (push) Successful in 50s

This commit is contained in:
Cauê Faleiros
2026-09-04 14:29:07 -03:00
parent 1d5eafbbd0
commit ad860074fd
10 changed files with 86 additions and 17 deletions

View File

@@ -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) => ({