@package-uploader/ui 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Package Uploader</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-BS61yFPt.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-DHoRoGws.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -150,38 +150,32 @@ export default function UploadModal({
|
|
|
150
150
|
setParsingStructure(true);
|
|
151
151
|
setPreviewLoading(true);
|
|
152
152
|
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
// Run parse + preview in parallel — preview shows immediately with loading spinner
|
|
154
|
+
const previewOptions: { skin?: string; classMappings?: CourseClassMappings } = {};
|
|
155
|
+
if (skinName.trim()) previewOptions.skin = skinName.trim();
|
|
156
|
+
if (Object.keys(classMappings).length > 0) previewOptions.classMappings = classMappings;
|
|
157
|
+
|
|
158
|
+
const [structure, preview] = await Promise.all([
|
|
159
|
+
api.parseCourseStructure(files[0].file).catch(() => null),
|
|
160
|
+
api.startPreview(files[0].file, previewOptions).catch(() => null),
|
|
161
|
+
]);
|
|
162
|
+
|
|
163
|
+
setParsingStructure(false);
|
|
162
164
|
|
|
163
165
|
if (!structure) {
|
|
164
166
|
setParseFailed(true);
|
|
165
|
-
setParsingStructure(false);
|
|
166
167
|
setPreviewLoading(false);
|
|
168
|
+
// Clean up preview if it succeeded but parse didn't
|
|
169
|
+
if (preview?.token) api.stopPreview(preview.token).catch(() => {});
|
|
167
170
|
return;
|
|
168
171
|
}
|
|
169
172
|
|
|
170
173
|
setCourseStructure(structure);
|
|
171
174
|
setParseFailed(false);
|
|
172
|
-
setParsingStructure(false);
|
|
173
175
|
|
|
174
|
-
|
|
175
|
-
try {
|
|
176
|
-
const previewOptions: { skin?: string; classMappings?: CourseClassMappings } = {};
|
|
177
|
-
if (skinName.trim()) previewOptions.skin = skinName.trim();
|
|
178
|
-
if (Object.keys(classMappings).length > 0) previewOptions.classMappings = classMappings;
|
|
179
|
-
const preview = await api.startPreview(files[0].file, previewOptions);
|
|
176
|
+
if (preview) {
|
|
180
177
|
setPreviewToken(preview.token);
|
|
181
178
|
setPreviewUrl(preview.url);
|
|
182
|
-
} catch (err) {
|
|
183
|
-
console.warn('Preview not available:', err);
|
|
184
|
-
// Preview failed but structure is valid — stay in non-preview mode
|
|
185
179
|
}
|
|
186
180
|
|
|
187
181
|
setPreviewLoading(false);
|
|
@@ -351,8 +345,8 @@ export default function UploadModal({
|
|
|
351
345
|
: isPreviewMode
|
|
352
346
|
? 'Close Preview'
|
|
353
347
|
: courseStructure
|
|
354
|
-
? `Customize
|
|
355
|
-
: 'Customize
|
|
348
|
+
? `Customize Course (${courseStructure.lessons.length} lessons)`
|
|
349
|
+
: 'Customize Course';
|
|
356
350
|
|
|
357
351
|
// Build the preview URL — needs the API base path prepended
|
|
358
352
|
const fullPreviewUrl = previewUrl
|