diff --git a/app/components/LoadingDots.tsx b/app/components/LoadingDots.tsx
index b12b84e869..b4aa233350 100644
--- a/app/components/LoadingDots.tsx
+++ b/app/components/LoadingDots.tsx
@@ -1,11 +1,67 @@
-export const LoadingDotsTyping = ()=>{
- return(
-
- );
+import { useState, useEffect } from 'react';
+
+interface LoadingDotsProps {
+ show?: boolean;
+ transition?: boolean;
+ transitionDuration?: number;
+};
+
+interface LoadingDotsInnerProps {
+ show?: boolean;
+ transition?: boolean;
+ transitionDuration?: number;
+ children: React.ReactNode;
+};
+
+export const LoadingDotsTyping = (props: LoadingDotsProps)=>{
+ return (
+
+
+
+ )
+}
+export const LoadingDotsBricks = (props: LoadingDotsProps)=>{
+ return (
+
+
+
+ )
}
-export const LoadingDotsBricks = ()=>{
- return(
-
- );
-}
\ No newline at end of file
+function LoadingDots({
+ show=true,
+ transition = false,
+ transitionDuration = 1000,
+ children,
+}: LoadingDotsInnerProps){
+ const [state, setState] = useState<'loading'|'loaded'|'completed'>('loading');
+ const transitionClasses =
+ (transition ? `transition-opacity duration-${transitionDuration} `: "")
+ + (state === 'loading' ? 'opacity-100' : 'opacity-0');
+
+ const classNames = "w-full h-full flex justify-center items-center bg-ui-background " + transitionClasses;
+ useEffect(()=>{
+ if(!show){
+ if(transition){
+ setState((curr)=>{
+ if (curr === 'loading') return 'loaded'
+ else return curr;
+ });
+ setTimeout(()=>setState('completed'), 2000);
+ } else {
+ setState('completed');
+ }
+ }
+ }, [show, transition]);
+
+ if(state!== 'completed'){
+ return(
+
+ {children}
+
+ );
+ }else{
+ return null;
+ }
+};
+
diff --git a/app/modules/LoadingScreen/LoadingScreen.tsx b/app/modules/LoadingScreen/LoadingScreen.tsx
deleted file mode 100644
index 0ccfe83a1f..0000000000
--- a/app/modules/LoadingScreen/LoadingScreen.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { LoadingDotsBricks } from "~/components";
-
-export const LoadingScreen = ()=>{
- return(
-
-
-
- );
-};
\ No newline at end of file
diff --git a/app/modules/LoadingScreen/index.tsx b/app/modules/LoadingScreen/index.tsx
deleted file mode 100644
index edb7c50caf..0000000000
--- a/app/modules/LoadingScreen/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { LoadingScreen } from './LoadingScreen';
\ No newline at end of file
diff --git a/app/pages/PageEnigma/comps/PreviewWindow/index.tsx b/app/pages/PageEnigma/comps/PreviewWindow/index.tsx
index 92accbd2d2..7704c68ecd 100644
--- a/app/pages/PageEnigma/comps/PreviewWindow/index.tsx
+++ b/app/pages/PageEnigma/comps/PreviewWindow/index.tsx
@@ -1,10 +1,15 @@
-import { useContext } from "react"
+import { useContext, useEffect, useState } from "react"
import { EngineContext } from "~/contexts/EngineContext"
+import { LoadingDotsTyping } from "~/components";
export const PreviewWindow = ()=>{
const editorEngine = useContext(EngineContext);
//take data from egine context
+ const [showLoader, setShowLoader] = useState(true);
+ useEffect(()=>{
+ setTimeout(()=>setShowLoader(false), 5000);
+ },[]);
return (
-
+
+

+
+
+