diff --git a/packages/bruno-app/src/components/Sidebar/ImportCollection/FullscreenLoader/index.js b/packages/bruno-app/src/components/Sidebar/ImportCollection/FullscreenLoader/index.js new file mode 100644 index 000000000..d5a26ad22 --- /dev/null +++ b/packages/bruno-app/src/components/Sidebar/ImportCollection/FullscreenLoader/index.js @@ -0,0 +1,43 @@ +import { useState, useEffect } from 'react'; +import { IconLoader2 } from '@tabler/icons'; + +// Messages to cycle through while loading +const loadingMessages = [ + 'Processing collection...', + 'Analyzing requests...', + 'Translating scripts...', + 'Preparing collection...', + 'Almost done...' +]; + +const FullscreenLoader = ({ isLoading }) => { + const [loadingMessage, setLoadingMessage] = useState(''); + + useEffect(() => { + if (!isLoading) return; + + let messageIndex = 0; + const interval = setInterval(() => { + messageIndex = (messageIndex + 1) % loadingMessages.length; + setLoadingMessage(loadingMessages[messageIndex]); + }, 2000); + + setLoadingMessage(loadingMessages[0]); + + return () => clearInterval(interval); + }, [isLoading]); + + return ( +
+ This may take a moment depending on the collection size +
+- This may take a moment depending on the collection size -
-+ Select whether to create folders according to the spec's paths or tags. +
+