linguabot commited on
Commit
fc30ad4
·
verified ·
1 Parent(s): 58a7c18

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/pages/TutorialTasks.tsx +10 -15
client/src/pages/TutorialTasks.tsx CHANGED
@@ -827,8 +827,6 @@ const TutorialTasks: React.FC = () => {
827
 
828
  try {
829
  setMutatingTaskId(taskId);
830
- setGlobalAnchorDisabled(true);
831
- freezeScroll();
832
  lockListHeight();
833
  lockCardHeightById(taskId);
834
  lockGridHeightById(taskId);
@@ -836,13 +834,16 @@ const TutorialTasks: React.FC = () => {
836
  setSubmitting({ ...submitting, [taskId]: true });
837
  });
838
  const user = JSON.parse(localStorage.getItem('user') || '{}');
839
- const response = await api.post('/api/submissions', {
840
- sourceTextId: taskId,
841
- transcreation: text,
842
- groupNumber: group,
843
- culturalAdaptations: [],
844
- username: user.name || 'Unknown'
845
- });
 
 
 
846
 
847
  if (response.status >= 200 && response.status < 300) {
848
  const created = response.data;
@@ -885,8 +886,6 @@ const TutorialTasks: React.FC = () => {
885
  unlockGridHeightById(taskId);
886
  }));
887
  setMutatingTaskId(null);
888
- setGlobalAnchorDisabled(false);
889
- unfreezeScroll();
890
  }
891
  };
892
 
@@ -933,8 +932,6 @@ const TutorialTasks: React.FC = () => {
933
 
934
  try {
935
  if (taskId) setMutatingTaskId(taskId);
936
- setGlobalAnchorDisabled(true);
937
- freezeScroll();
938
  lockListHeight();
939
  const response = await api.delete(`/api/submissions/${submissionId}`);
940
 
@@ -980,8 +977,6 @@ const TutorialTasks: React.FC = () => {
980
  unlockGridHeightById(taskId);
981
  }
982
  setMutatingTaskId(null);
983
- setGlobalAnchorDisabled(false);
984
- unfreezeScroll();
985
  }));
986
  };
987
 
 
827
 
828
  try {
829
  setMutatingTaskId(taskId);
 
 
830
  lockListHeight();
831
  lockCardHeightById(taskId);
832
  lockGridHeightById(taskId);
 
834
  setSubmitting({ ...submitting, [taskId]: true });
835
  });
836
  const user = JSON.parse(localStorage.getItem('user') || '{}');
837
+ const response = await new Promise((resolve) => requestAnimationFrame(async () => {
838
+ const res = await api.post('/api/submissions', {
839
+ sourceTextId: taskId,
840
+ transcreation: text,
841
+ groupNumber: group,
842
+ culturalAdaptations: [],
843
+ username: user.name || 'Unknown'
844
+ });
845
+ resolve(res);
846
+ })) as any;
847
 
848
  if (response.status >= 200 && response.status < 300) {
849
  const created = response.data;
 
886
  unlockGridHeightById(taskId);
887
  }));
888
  setMutatingTaskId(null);
 
 
889
  }
890
  };
891
 
 
932
 
933
  try {
934
  if (taskId) setMutatingTaskId(taskId);
 
 
935
  lockListHeight();
936
  const response = await api.delete(`/api/submissions/${submissionId}`);
937
 
 
977
  unlockGridHeightById(taskId);
978
  }
979
  setMutatingTaskId(null);
 
 
980
  }));
981
  };
982