Tristan Yu commited on
Commit
6144f38
·
1 Parent(s): 58595c2

Add spinner loading to TutorialTasks week switches and increase Week 2 transition duration to 2000ms

Browse files
client/src/components/Layout.tsx CHANGED
@@ -60,7 +60,7 @@ const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
60
  // Check if navigating to Week 2 (use localStorage since URL might not be updated yet)
61
  const tutorialWeek = localStorage.getItem('selectedTutorialWeek');
62
  if (tutorialWeek === '2') {
63
- transitionDuration = 1500; // Extended duration for Week 2
64
  }
65
  }
66
 
 
60
  // Check if navigating to Week 2 (use localStorage since URL might not be updated yet)
61
  const tutorialWeek = localStorage.getItem('selectedTutorialWeek');
62
  if (tutorialWeek === '2') {
63
+ transitionDuration = 2000; // Extended duration for Week 2
64
  }
65
  }
66
 
client/src/pages/TutorialTasks.tsx CHANGED
@@ -740,43 +740,17 @@ const TutorialTasks: React.FC = () => {
740
  </div>
741
  </div>
742
 
743
- {/* Content with Week Transition Skeleton */}
744
- {isWeekTransitioning ? (
745
- <div className="space-y-6 animate-pulse" style={{ animationDuration: '600ms' }}>
746
- {/* Skeleton for Translation Brief */}
747
- <div className="bg-white rounded-lg p-6 mb-8 border border-gray-200 shadow-sm animate-pulse">
748
- <div className="flex items-center justify-between mb-4">
749
- <div className="flex items-center space-x-3">
750
- <div className="bg-gray-300 rounded-lg p-2 h-9 w-9"></div>
751
- <div className="h-6 bg-gray-300 rounded w-32"></div>
752
- </div>
753
- </div>
754
- <div className="space-y-3">
755
- <div className="h-4 bg-gray-300 rounded w-full"></div>
756
- <div className="h-4 bg-gray-300 rounded w-3/4"></div>
757
- <div className="h-4 bg-gray-300 rounded w-1/2"></div>
758
- </div>
759
  </div>
760
-
761
- {/* Skeleton for Tasks */}
762
- {[1, 2, 3].map((i) => (
763
- <div key={i} className="bg-white rounded-xl shadow-lg border border-gray-100 p-8 animate-pulse">
764
- <div className="flex items-center justify-between mb-6">
765
- <div className="flex items-center space-x-3">
766
- <div className="bg-gray-300 rounded-full p-2 h-9 w-9"></div>
767
- <div className="h-5 bg-gray-300 rounded w-24"></div>
768
- </div>
769
- </div>
770
- <div className="space-y-4">
771
- <div className="h-4 bg-gray-300 rounded w-full"></div>
772
- <div className="h-4 bg-gray-300 rounded w-5/6"></div>
773
- <div className="h-4 bg-gray-300 rounded w-4/5"></div>
774
- <div className="h-4 bg-gray-300 rounded w-3/4"></div>
775
- </div>
776
- </div>
777
- ))}
778
  </div>
779
- ) : (
 
 
780
  <>
781
  {/* Translation Brief - Shown once at the top */}
782
  {tutorialWeek && tutorialWeek.translationBrief ? (
 
740
  </div>
741
  </div>
742
 
743
+ {/* Week Transition Loading Spinner */}
744
+ {isWeekTransitioning && (
745
+ <div className="fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-50">
746
+ <div className="bg-white rounded-lg shadow-lg p-4 flex items-center space-x-3">
747
+ <div className="animate-spin rounded-full h-6 w-6 border-b-2 border-indigo-600"></div>
748
+ <span className="text-gray-700 font-medium">Loading...</span>
 
 
 
 
 
 
 
 
 
 
749
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
750
  </div>
751
+ )}
752
+
753
+ {!isWeekTransitioning && (
754
  <>
755
  {/* Translation Brief - Shown once at the top */}
756
  {tutorialWeek && tutorialWeek.translationBrief ? (