Upload folder using huggingface_hub
Browse files
client/src/pages/TutorialTasks.tsx
CHANGED
|
@@ -186,7 +186,10 @@ const TutorialTasks: React.FC = () => {
|
|
| 186 |
const topAfter = el ? el.getBoundingClientRect().top : null;
|
| 187 |
if (topBefore !== null && topAfter !== null) {
|
| 188 |
const delta = topAfter - topBefore;
|
| 189 |
-
if (delta !== 0)
|
|
|
|
|
|
|
|
|
|
| 190 |
} else {
|
| 191 |
window.scrollTo(0, scrollYBefore);
|
| 192 |
}
|
|
@@ -867,6 +870,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 867 |
setSubmitting({ ...submitting, [taskId]: true });
|
| 868 |
});
|
| 869 |
const user = JSON.parse(localStorage.getItem('user') || '{}');
|
|
|
|
| 870 |
const response = await new Promise((resolve) => requestAnimationFrame(async () => {
|
| 871 |
const res = await api.post('/api/submissions', {
|
| 872 |
sourceTextId: taskId,
|
|
@@ -877,6 +881,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 877 |
});
|
| 878 |
resolve(res);
|
| 879 |
})) as any;
|
|
|
|
| 880 |
|
| 881 |
if (response.status >= 200 && response.status < 300) {
|
| 882 |
const created = response.data;
|
|
@@ -911,10 +916,10 @@ const TutorialTasks: React.FC = () => {
|
|
| 911 |
});
|
| 912 |
});
|
| 913 |
} else {
|
| 914 |
-
console.error('
|
| 915 |
}
|
| 916 |
} catch (error) {
|
| 917 |
-
console.error('
|
| 918 |
|
| 919 |
} finally {
|
| 920 |
withPreservedCardOffset(taskId, () => {
|
|
@@ -981,9 +986,11 @@ const TutorialTasks: React.FC = () => {
|
|
| 981 |
if (taskId) setMutatingTaskId(taskId);
|
| 982 |
if (isSafari) { freezeScroll(); }
|
| 983 |
lockListHeight();
|
|
|
|
| 984 |
const response = await api.delete(`/api/submissions/${submissionId}`);
|
| 985 |
|
| 986 |
if (response.status === 200) {
|
|
|
|
| 987 |
|
| 988 |
// Optimistic removal (disabled on Safari to prevent multi-phase jumps)
|
| 989 |
if (taskId && !isSafari) {
|
|
@@ -1020,7 +1027,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 1020 |
|
| 1021 |
}
|
| 1022 |
} catch (error) {
|
| 1023 |
-
console.error('
|
| 1024 |
|
| 1025 |
}
|
| 1026 |
// let DOM settle then unlock (both list and card if id known)
|
|
@@ -2324,7 +2331,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 2324 |
expandedSections[task._id]
|
| 2325 |
? 'max-h-none overflow-visible'
|
| 2326 |
: 'max-h-0 overflow-hidden'
|
| 2327 |
-
}`}>
|
| 2328 |
{userSubmissions[task._id].map((submission, index) => (
|
| 2329 |
<div key={submission._id} className="bg-white rounded-lg p-3 border border-stone-200 flex flex-col justify-between h-full">
|
| 2330 |
<div className="flex items-center justify-between mb-2">
|
|
|
|
| 186 |
const topAfter = el ? el.getBoundingClientRect().top : null;
|
| 187 |
if (topBefore !== null && topAfter !== null) {
|
| 188 |
const delta = topAfter - topBefore;
|
| 189 |
+
if (delta !== 0) {
|
| 190 |
+
try { console.debug('[ScrollPreserve]', { taskId, delta, topBefore, topAfter, scrollYBefore }); } catch {}
|
| 191 |
+
window.scrollBy(0, delta);
|
| 192 |
+
}
|
| 193 |
} else {
|
| 194 |
window.scrollTo(0, scrollYBefore);
|
| 195 |
}
|
|
|
|
| 870 |
setSubmitting({ ...submitting, [taskId]: true });
|
| 871 |
});
|
| 872 |
const user = JSON.parse(localStorage.getItem('user') || '{}');
|
| 873 |
+
const t0 = performance.now();
|
| 874 |
const response = await new Promise((resolve) => requestAnimationFrame(async () => {
|
| 875 |
const res = await api.post('/api/submissions', {
|
| 876 |
sourceTextId: taskId,
|
|
|
|
| 881 |
});
|
| 882 |
resolve(res);
|
| 883 |
})) as any;
|
| 884 |
+
try { console.debug('[Submit]', { taskId, dt: Math.round(performance.now() - t0) }); } catch {}
|
| 885 |
|
| 886 |
if (response.status >= 200 && response.status < 300) {
|
| 887 |
const created = response.data;
|
|
|
|
| 916 |
});
|
| 917 |
});
|
| 918 |
} else {
|
| 919 |
+
console.error('[Submit][Error]', response.data);
|
| 920 |
}
|
| 921 |
} catch (error) {
|
| 922 |
+
console.error('[Submit][Exception]', error);
|
| 923 |
|
| 924 |
} finally {
|
| 925 |
withPreservedCardOffset(taskId, () => {
|
|
|
|
| 986 |
if (taskId) setMutatingTaskId(taskId);
|
| 987 |
if (isSafari) { freezeScroll(); }
|
| 988 |
lockListHeight();
|
| 989 |
+
const t0 = performance.now();
|
| 990 |
const response = await api.delete(`/api/submissions/${submissionId}`);
|
| 991 |
|
| 992 |
if (response.status === 200) {
|
| 993 |
+
try { console.debug('[Delete]', { taskId, submissionId, dt: Math.round(performance.now() - t0) }); } catch {}
|
| 994 |
|
| 995 |
// Optimistic removal (disabled on Safari to prevent multi-phase jumps)
|
| 996 |
if (taskId && !isSafari) {
|
|
|
|
| 1027 |
|
| 1028 |
}
|
| 1029 |
} catch (error) {
|
| 1030 |
+
console.error('[Delete][Exception]', error);
|
| 1031 |
|
| 1032 |
}
|
| 1033 |
// let DOM settle then unlock (both list and card if id known)
|
|
|
|
| 2331 |
expandedSections[task._id]
|
| 2332 |
? 'max-h-none overflow-visible'
|
| 2333 |
: 'max-h-0 overflow-hidden'
|
| 2334 |
+
}`} data-grid-id={task._id}>
|
| 2335 |
{userSubmissions[task._id].map((submission, index) => (
|
| 2336 |
<div key={submission._id} className="bg-white rounded-lg p-3 border border-stone-200 flex flex-col justify-between h-full">
|
| 2337 |
<div className="flex items-center justify-between mb-2">
|