Upload folder using huggingface_hub
Browse files
client/src/pages/TutorialTasks.tsx
CHANGED
|
@@ -170,27 +170,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 170 |
el.style.minHeight = '';
|
| 171 |
};
|
| 172 |
|
| 173 |
-
//
|
| 174 |
-
// vertical position changes of the task card across a burst of resizes.
|
| 175 |
-
const startCardScrollCompensator = (id: string): (() => void) => {
|
| 176 |
-
try {
|
| 177 |
-
const el = cardRefs.current[id];
|
| 178 |
-
if (!el || typeof ResizeObserver === 'undefined') return () => {};
|
| 179 |
-
let lastTop = el.getBoundingClientRect().top;
|
| 180 |
-
const observer = new ResizeObserver(() => {
|
| 181 |
-
try {
|
| 182 |
-
const currentTop = el.getBoundingClientRect().top;
|
| 183 |
-
const delta = currentTop - lastTop;
|
| 184 |
-
if (delta !== 0) {
|
| 185 |
-
window.scrollBy(0, delta);
|
| 186 |
-
lastTop = currentTop; // keep tracking relative to last applied position
|
| 187 |
-
}
|
| 188 |
-
} catch {}
|
| 189 |
-
});
|
| 190 |
-
observer.observe(el);
|
| 191 |
-
return () => { try { observer.disconnect(); } catch {} };
|
| 192 |
-
} catch { return () => {}; }
|
| 193 |
-
};
|
| 194 |
|
| 195 |
const withPreservedCardOffset = (taskId: string, fn: () => void) => {
|
| 196 |
// If scroll is frozen, avoid additional scroll adjustments that can fight WebKit
|
|
@@ -874,13 +854,11 @@ const TutorialTasks: React.FC = () => {
|
|
| 874 |
return;
|
| 875 |
}
|
| 876 |
|
| 877 |
-
let stopCompLocal: (() => void) | null = null;
|
| 878 |
try {
|
| 879 |
setMutatingTaskId(taskId);
|
| 880 |
if (isSafari) {
|
| 881 |
try { (document.activeElement as HTMLElement | null)?.blur?.(); } catch {}
|
| 882 |
freezeScroll();
|
| 883 |
-
stopCompLocal = startCardScrollCompensator(taskId);
|
| 884 |
}
|
| 885 |
lockListHeight();
|
| 886 |
lockCardHeightById(taskId);
|
|
@@ -947,7 +925,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 947 |
unlockListHeight();
|
| 948 |
unlockCardHeightById(taskId);
|
| 949 |
unlockGridHeightById(taskId);
|
| 950 |
-
if (isSafari) {
|
| 951 |
};
|
| 952 |
if (isSafari) {
|
| 953 |
requestAnimationFrame(() => requestAnimationFrame(() => requestAnimationFrame(release)));
|
|
@@ -999,10 +977,9 @@ const TutorialTasks: React.FC = () => {
|
|
| 999 |
const handleDeleteSubmission = async (submissionId: string, taskId?: string) => {
|
| 1000 |
|
| 1001 |
|
| 1002 |
-
let stopCompLocal: (() => void) | null = null;
|
| 1003 |
try {
|
| 1004 |
if (taskId) setMutatingTaskId(taskId);
|
| 1005 |
-
if (isSafari) { freezeScroll();
|
| 1006 |
lockListHeight();
|
| 1007 |
const response = await api.delete(`/api/submissions/${submissionId}`);
|
| 1008 |
|
|
@@ -1053,7 +1030,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 1053 |
unlockCardHeightById(taskId);
|
| 1054 |
unlockGridHeightById(taskId);
|
| 1055 |
}
|
| 1056 |
-
if (isSafari) {
|
| 1057 |
setMutatingTaskId(null);
|
| 1058 |
}));
|
| 1059 |
};
|
|
@@ -2320,7 +2297,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 2320 |
|
| 2321 |
{/* All Submissions for this Task */}
|
| 2322 |
{userSubmissions[task._id] && userSubmissions[task._id].length > 0 && (
|
| 2323 |
-
<div ref={(el) => { submissionsContainerRefs.current[task._id] = el; }} className="bg-gradient-to-r from-white to-indigo-50 rounded-xl p-6 mb-6 border border-stone-200" style={{ overflowAnchor: 'none'
|
| 2324 |
<div className="flex items-center justify-between mb-4">
|
| 2325 |
<div className="flex items-center space-x-2">
|
| 2326 |
<div className="bg-indigo-100 rounded-full p-1">
|
|
@@ -2347,7 +2324,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 2347 |
expandedSections[task._id]
|
| 2348 |
? 'max-h-none overflow-visible'
|
| 2349 |
: 'max-h-0 overflow-hidden'
|
| 2350 |
-
}`}
|
| 2351 |
{userSubmissions[task._id].map((submission, index) => (
|
| 2352 |
<div key={submission._id} className="bg-white rounded-lg p-3 border border-stone-200 flex flex-col justify-between h-full">
|
| 2353 |
<div className="flex items-center justify-between mb-2">
|
|
|
|
| 170 |
el.style.minHeight = '';
|
| 171 |
};
|
| 172 |
|
| 173 |
+
// (removed) ResizeObserver scroll compensator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
const withPreservedCardOffset = (taskId: string, fn: () => void) => {
|
| 176 |
// If scroll is frozen, avoid additional scroll adjustments that can fight WebKit
|
|
|
|
| 854 |
return;
|
| 855 |
}
|
| 856 |
|
|
|
|
| 857 |
try {
|
| 858 |
setMutatingTaskId(taskId);
|
| 859 |
if (isSafari) {
|
| 860 |
try { (document.activeElement as HTMLElement | null)?.blur?.(); } catch {}
|
| 861 |
freezeScroll();
|
|
|
|
| 862 |
}
|
| 863 |
lockListHeight();
|
| 864 |
lockCardHeightById(taskId);
|
|
|
|
| 925 |
unlockListHeight();
|
| 926 |
unlockCardHeightById(taskId);
|
| 927 |
unlockGridHeightById(taskId);
|
| 928 |
+
if (isSafari) { unfreezeScroll(); }
|
| 929 |
};
|
| 930 |
if (isSafari) {
|
| 931 |
requestAnimationFrame(() => requestAnimationFrame(() => requestAnimationFrame(release)));
|
|
|
|
| 977 |
const handleDeleteSubmission = async (submissionId: string, taskId?: string) => {
|
| 978 |
|
| 979 |
|
|
|
|
| 980 |
try {
|
| 981 |
if (taskId) setMutatingTaskId(taskId);
|
| 982 |
+
if (isSafari) { freezeScroll(); }
|
| 983 |
lockListHeight();
|
| 984 |
const response = await api.delete(`/api/submissions/${submissionId}`);
|
| 985 |
|
|
|
|
| 1030 |
unlockCardHeightById(taskId);
|
| 1031 |
unlockGridHeightById(taskId);
|
| 1032 |
}
|
| 1033 |
+
if (isSafari) { unfreezeScroll(); }
|
| 1034 |
setMutatingTaskId(null);
|
| 1035 |
}));
|
| 1036 |
};
|
|
|
|
| 2297 |
|
| 2298 |
{/* All Submissions for this Task */}
|
| 2299 |
{userSubmissions[task._id] && userSubmissions[task._id].length > 0 && (
|
| 2300 |
+
<div ref={(el) => { submissionsContainerRefs.current[task._id] = el; }} className="bg-gradient-to-r from-white to-indigo-50 rounded-xl p-6 mb-6 border border-stone-200" style={{ overflowAnchor: 'none' }}>
|
| 2301 |
<div className="flex items-center justify-between mb-4">
|
| 2302 |
<div className="flex items-center space-x-2">
|
| 2303 |
<div className="bg-indigo-100 rounded-full p-1">
|
|
|
|
| 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">
|