feat: add course cover positioning
All checks were successful
CI / Validate frontend and API (push) Successful in 37s
CI / Build and publish Docker images (push) Successful in 18s

This commit is contained in:
Cauê Faleiros
2026-09-04 14:42:04 -03:00
parent ad860074fd
commit 7a01be2b59
10 changed files with 120 additions and 18 deletions

View File

@@ -18,6 +18,8 @@ type ApiCourse = {
category: string;
coverImageUrl: string | null;
coverImageZoom: number;
coverImagePositionX: number;
coverImagePositionY: number;
status: 'draft' | 'published' | 'archived';
progress?: number;
lastActivity?: string | null;
@@ -69,6 +71,8 @@ const toCourse = (course: ApiCourse): Course => ({
category: course.category,
thumbnail: course.coverImageUrl || '/course-placeholder.svg',
coverImageZoom: course.coverImageZoom || 1,
coverImagePositionX: course.coverImagePositionX ?? 50,
coverImagePositionY: course.coverImagePositionY ?? 50,
instructor: course.instructor.name,
status: course.status === 'draft' ? 'draft' : 'published',
progress: course.progress,
@@ -127,6 +131,8 @@ const toCoursePayload = (course: Course) => ({
category: course.category,
coverImageUrl: course.thumbnail && /^https?:\/\//.test(course.thumbnail) ? course.thumbnail : null,
coverImageZoom: course.coverImageZoom || 1,
coverImagePositionX: course.coverImagePositionX ?? 50,
coverImagePositionY: course.coverImagePositionY ?? 50,
status: course.status || 'published',
assets: (course.attachments || []).filter((attachment) => attachment.url && attachment.url !== '#').map(toAssetPayload),
lessons: course.lessons.map((lesson) => ({