Spaces:
Sleeping
Sleeping
Tristan Yu commited on
Commit ·
83ee6d3
1
Parent(s): 96093a9
Fix image-only content payload to send empty content and include imageSize/imageAlignment for all image functions
Browse files
client/src/pages/TutorialTasks.tsx
CHANGED
|
@@ -682,7 +682,10 @@ const TutorialTasks: React.FC = () => {
|
|
| 682 |
weekNumber: selectedWeek,
|
| 683 |
category: 'tutorial',
|
| 684 |
imageUrl: editForm.imageUrl || null,
|
| 685 |
-
imageAlt: editForm.imageAlt || null
|
|
|
|
|
|
|
|
|
|
| 686 |
};
|
| 687 |
|
| 688 |
console.log('Task data being sent:', JSON.stringify(taskData, null, 2));
|
|
@@ -729,7 +732,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 729 |
|
| 730 |
const payload = {
|
| 731 |
title: `Week ${selectedWeek} Image Task`,
|
| 732 |
-
content: '
|
| 733 |
sourceLanguage: 'English',
|
| 734 |
weekNumber: selectedWeek,
|
| 735 |
category: 'tutorial',
|
|
|
|
| 682 |
weekNumber: selectedWeek,
|
| 683 |
category: 'tutorial',
|
| 684 |
imageUrl: editForm.imageUrl || null,
|
| 685 |
+
imageAlt: editForm.imageAlt || null,
|
| 686 |
+
// Add imageSize and imageAlignment for image-only content
|
| 687 |
+
...(editForm.imageUrl && !editForm.content.trim() && { imageSize: 200 }),
|
| 688 |
+
...(editForm.imageUrl && !editForm.content.trim() && { imageAlignment: 'center' })
|
| 689 |
};
|
| 690 |
|
| 691 |
console.log('Task data being sent:', JSON.stringify(taskData, null, 2));
|
|
|
|
| 732 |
|
| 733 |
const payload = {
|
| 734 |
title: `Week ${selectedWeek} Image Task`,
|
| 735 |
+
content: '', // Empty content for image-only task
|
| 736 |
sourceLanguage: 'English',
|
| 737 |
weekNumber: selectedWeek,
|
| 738 |
category: 'tutorial',
|
client/src/pages/WeeklyPractice.tsx
CHANGED
|
@@ -1112,7 +1112,10 @@ const WeeklyPractice: React.FC = () => {
|
|
| 1112 |
weekNumber: selectedWeek,
|
| 1113 |
category: 'weekly-practice',
|
| 1114 |
imageUrl: editForm.imageUrl.trim() || null,
|
| 1115 |
-
imageAlt: editForm.imageAlt.trim() || null
|
|
|
|
|
|
|
|
|
|
| 1116 |
};
|
| 1117 |
|
| 1118 |
console.log('🔧 Saving new practice with payload:', payload);
|
|
@@ -1151,7 +1154,7 @@ const WeeklyPractice: React.FC = () => {
|
|
| 1151 |
|
| 1152 |
const payload = {
|
| 1153 |
title: `Week ${selectedWeek} Image Practice`,
|
| 1154 |
-
content: '
|
| 1155 |
sourceLanguage: 'English',
|
| 1156 |
weekNumber: selectedWeek,
|
| 1157 |
category: 'weekly-practice',
|
|
|
|
| 1112 |
weekNumber: selectedWeek,
|
| 1113 |
category: 'weekly-practice',
|
| 1114 |
imageUrl: editForm.imageUrl.trim() || null,
|
| 1115 |
+
imageAlt: editForm.imageAlt.trim() || null,
|
| 1116 |
+
// Add imageSize and imageAlignment for image-only content
|
| 1117 |
+
...(editForm.imageUrl.trim() && !editForm.content.trim() && { imageSize: 200 }),
|
| 1118 |
+
...(editForm.imageUrl.trim() && !editForm.content.trim() && { imageAlignment: 'center' })
|
| 1119 |
};
|
| 1120 |
|
| 1121 |
console.log('🔧 Saving new practice with payload:', payload);
|
|
|
|
| 1154 |
|
| 1155 |
const payload = {
|
| 1156 |
title: `Week ${selectedWeek} Image Practice`,
|
| 1157 |
+
content: '', // Empty content for image-only practice
|
| 1158 |
sourceLanguage: 'English',
|
| 1159 |
weekNumber: selectedWeek,
|
| 1160 |
category: 'weekly-practice',
|