linguabot commited on
Commit
1d170e0
·
verified ·
1 Parent(s): 7cfba08

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/pages/TutorialTasks.tsx +31 -7
client/src/pages/TutorialTasks.tsx CHANGED
@@ -657,10 +657,29 @@ const TutorialTasks: React.FC = () => {
657
  };
658
 
659
  const toggleExpanded = (taskId: string) => {
660
- setExpandedSections(prev => ({
661
- ...prev,
662
- [taskId]: !prev[taskId]
663
- }));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
664
  };
665
 
666
  const fetchUserSubmissions = useCallback(async (tasks: TutorialTask[]) => {
@@ -892,12 +911,17 @@ const TutorialTasks: React.FC = () => {
892
  withPreservedCardOffset(taskId, () => {
893
  setSubmitting({ ...submitting, [taskId]: false });
894
  });
895
- // release after a couple frames to let DOM settle
896
- requestAnimationFrame(() => requestAnimationFrame(() => {
897
  unlockListHeight();
898
  unlockCardHeightById(taskId);
899
  unlockGridHeightById(taskId);
900
- }));
 
 
 
 
 
901
  setMutatingTaskId(null);
902
  }
903
  };
 
657
  };
658
 
659
  const toggleExpanded = (taskId: string) => {
660
+ if (isSafari) {
661
+ lockListHeight();
662
+ lockCardHeightById(taskId);
663
+ lockGridHeightById(taskId);
664
+ withPreservedCardOffset(taskId, () => {
665
+ setMutatingTaskId(taskId);
666
+ setExpandedSections(prev => ({
667
+ ...prev,
668
+ [taskId]: !prev[taskId]
669
+ }));
670
+ });
671
+ requestAnimationFrame(() => requestAnimationFrame(() => {
672
+ unlockListHeight();
673
+ unlockCardHeightById(taskId);
674
+ unlockGridHeightById(taskId);
675
+ setMutatingTaskId(null);
676
+ }));
677
+ } else {
678
+ setExpandedSections(prev => ({
679
+ ...prev,
680
+ [taskId]: !prev[taskId]
681
+ }));
682
+ }
683
  };
684
 
685
  const fetchUserSubmissions = useCallback(async (tasks: TutorialTask[]) => {
 
911
  withPreservedCardOffset(taskId, () => {
912
  setSubmitting({ ...submitting, [taskId]: false });
913
  });
914
+ // release after a couple frames to let DOM settle (extra frame on Safari)
915
+ const release = () => {
916
  unlockListHeight();
917
  unlockCardHeightById(taskId);
918
  unlockGridHeightById(taskId);
919
+ };
920
+ if (isSafari) {
921
+ requestAnimationFrame(() => requestAnimationFrame(() => requestAnimationFrame(release)));
922
+ } else {
923
+ requestAnimationFrame(() => requestAnimationFrame(release));
924
+ }
925
  setMutatingTaskId(null);
926
  }
927
  };