@@ -57,7 +57,6 @@ document.addEventListener('DOMContentLoaded', () => {
5757 const loadingTextElement = onboardWrapper . querySelector ( '.tutor-onboard-loading-text' ) ;
5858 const loadingText = loadingTextElement ?. dataset . text || loadingTextElement ?. textContent ?. trim ( ) || '' ;
5959 let loadingTextTimer = null ;
60- let isLoadingTextLooping = false ;
6160 let isSubmitting = false ;
6261
6362 const handleReloadHotkeys = ( event ) => {
@@ -87,8 +86,6 @@ document.addEventListener('DOMContentLoaded', () => {
8786 } ;
8887
8988 const stopLoadingTextAnimation = ( ) => {
90- isLoadingTextLooping = false ;
91-
9289 if ( loadingTextTimer ) {
9390 clearTimeout ( loadingTextTimer ) ;
9491 loadingTextTimer = null ;
@@ -105,10 +102,9 @@ document.addEventListener('DOMContentLoaded', () => {
105102 }
106103
107104 let dotsCount = 0 ;
108- isLoadingTextLooping = true ;
109105
110106 const animateDots = ( ) => {
111- if ( ! loadingTextElement || ! isLoadingTextLooping ) {
107+ if ( ! loadingTextElement ) {
112108 return ;
113109 }
114110
@@ -201,6 +197,8 @@ document.addEventListener('DOMContentLoaded', () => {
201197
202198 activateScreen ( loadingScreen ) ;
203199 const loadingTextAnimation = startLoadingTextAnimation ( ) ;
200+ const minimumLoadingDuration = 6000 ;
201+ const onboardStartTime = performance . now ( ) ;
204202
205203 try {
206204 if ( formData . get ( 'tutor_onboard_load_sample_course' ) ) {
@@ -228,6 +226,9 @@ document.addEventListener('DOMContentLoaded', () => {
228226 submitButton . disabled = false ;
229227 }
230228 await loadingTextAnimation ;
229+ const onboardingDuration = performance . now ( ) - onboardStartTime ;
230+ const remainingLoadingDuration = Math . max ( 0 , minimumLoadingDuration - onboardingDuration ) ;
231+ await wait ( remainingLoadingDuration ) ;
231232 await fadeOutLoadingScreen ( ) ;
232233 toggleReloadProtection ( false ) ;
233234 location . href = _tutorOnboardObject . tutor_welcome_page ;
0 commit comments