linguabot commited on
Commit
a603f48
·
verified ·
1 Parent(s): 769216b

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/pages/TutorialTasks.tsx +8 -2
client/src/pages/TutorialTasks.tsx CHANGED
@@ -66,6 +66,7 @@ const TutorialTasks: React.FC = () => {
66
  const [submitting, setSubmitting] = useState<{[key: string]: boolean}>({});
67
  const [isWeekHidden, setIsWeekHidden] = useState<boolean>(false);
68
  const [translationText, setTranslationText] = useState<{[key: string]: string}>({});
 
69
 
70
  const [expandedSections, setExpandedSections] = useState<{[key: string]: boolean}>({});
71
  const cardRefs = useRef<{[key: string]: HTMLDivElement | null}>({});
@@ -766,6 +767,7 @@ const TutorialTasks: React.FC = () => {
766
  }
767
 
768
  try {
 
769
  lockListHeight();
770
  lockCardHeightById(taskId);
771
  withPreservedCardOffset(taskId, () => {
@@ -807,6 +809,7 @@ const TutorialTasks: React.FC = () => {
807
  unlockListHeight();
808
  unlockCardHeightById(taskId);
809
  }));
 
810
  }
811
  };
812
 
@@ -852,6 +855,7 @@ const TutorialTasks: React.FC = () => {
852
 
853
 
854
  try {
 
855
  lockListHeight();
856
  const response = await api.delete(`/api/submissions/${submissionId}`);
857
 
@@ -875,6 +879,7 @@ const TutorialTasks: React.FC = () => {
875
  requestAnimationFrame(() => requestAnimationFrame(() => {
876
  unlockListHeight();
877
  if (taskId) unlockCardHeightById(taskId);
 
878
  }));
879
  };
880
 
@@ -1833,7 +1838,8 @@ const TutorialTasks: React.FC = () => {
1833
  ref={(el) => { (cardRefs.current[task._id] = el); }}
1834
  className="bg-white rounded-xl shadow-lg border border-gray-100 p-8 hover:shadow-xl transition-shadow duration-300 mb-8"
1835
  style={{
1836
- minHeight: '700px'
 
1837
  }}
1838
  >
1839
  <div className="mb-6">
@@ -2162,7 +2168,7 @@ const TutorialTasks: React.FC = () => {
2162
  </svg>
2163
  </button>
2164
  </div>
2165
- <div className={`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 transition-all duration-300 ${
2166
  expandedSections[task._id]
2167
  ? 'max-h-none overflow-visible'
2168
  : 'max-h-0 overflow-hidden'
 
66
  const [submitting, setSubmitting] = useState<{[key: string]: boolean}>({});
67
  const [isWeekHidden, setIsWeekHidden] = useState<boolean>(false);
68
  const [translationText, setTranslationText] = useState<{[key: string]: string}>({});
69
+ const [mutatingTaskId, setMutatingTaskId] = useState<string | null>(null);
70
 
71
  const [expandedSections, setExpandedSections] = useState<{[key: string]: boolean}>({});
72
  const cardRefs = useRef<{[key: string]: HTMLDivElement | null}>({});
 
767
  }
768
 
769
  try {
770
+ setMutatingTaskId(taskId);
771
  lockListHeight();
772
  lockCardHeightById(taskId);
773
  withPreservedCardOffset(taskId, () => {
 
809
  unlockListHeight();
810
  unlockCardHeightById(taskId);
811
  }));
812
+ setMutatingTaskId(null);
813
  }
814
  };
815
 
 
855
 
856
 
857
  try {
858
+ if (taskId) setMutatingTaskId(taskId);
859
  lockListHeight();
860
  const response = await api.delete(`/api/submissions/${submissionId}`);
861
 
 
879
  requestAnimationFrame(() => requestAnimationFrame(() => {
880
  unlockListHeight();
881
  if (taskId) unlockCardHeightById(taskId);
882
+ setMutatingTaskId(null);
883
  }));
884
  };
885
 
 
1838
  ref={(el) => { (cardRefs.current[task._id] = el); }}
1839
  className="bg-white rounded-xl shadow-lg border border-gray-100 p-8 hover:shadow-xl transition-shadow duration-300 mb-8"
1840
  style={{
1841
+ minHeight: '700px',
1842
+ overflowAnchor: mutatingTaskId === task._id ? 'none' as any : undefined
1843
  }}
1844
  >
1845
  <div className="mb-6">
 
2168
  </svg>
2169
  </button>
2170
  </div>
2171
+ <div className={`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 ${mutatingTaskId === task._id ? 'transition-none' : 'transition-all duration-300'} ${
2172
  expandedSections[task._id]
2173
  ? 'max-h-none overflow-visible'
2174
  : 'max-h-0 overflow-hidden'