@@ -7,6 +7,8 @@ import Details from './Details';
77import Milestones from './Milestones' ;
88import Team from './Team' ;
99import Contact from './Contact' ;
10+ import LoadingScreen from './LoadingScreen' ;
11+ import SuccessScreen from './SuccessScreen' ;
1012
1113const CreateProjectModal = ( {
1214 open,
@@ -16,6 +18,8 @@ const CreateProjectModal = ({
1618 setOpen : ( open : boolean ) => void ;
1719} ) => {
1820 const [ currentStep , setCurrentStep ] = useState ( 1 ) ;
21+ const [ isLoading , setIsLoading ] = useState ( false ) ;
22+ const [ showSuccess , setShowSuccess ] = useState ( false ) ;
1923
2024 const handleBack = ( ) => {
2125 if ( currentStep > 1 ) {
@@ -24,19 +28,37 @@ const CreateProjectModal = ({
2428 } ;
2529
2630 const handleContinue = ( ) => {
31+ if ( showSuccess ) return ; // prevent clicks when success is showing
32+
2733 if ( currentStep < 5 ) {
28- setCurrentStep ( currentStep + 1 ) ;
34+ setIsLoading ( true ) ;
35+ setTimeout ( ( ) => {
36+ setCurrentStep ( prev => prev + 1 ) ;
37+ setIsLoading ( false ) ;
38+ } , 1000 ) ;
2939 } else {
30- // Handle final submission
31- // TODO: Implement project submission logic
32- // This could include API calls, form validation, etc.
40+ // ✅ After final step, show success screen
41+ setShowSuccess ( true ) ;
3342 }
3443 } ;
3544
36- // Placeholder for step validation - you can implement actual validation logic here
45+ const handleReset = ( ) => {
46+ // reset all states to start fresh
47+ setShowSuccess ( false ) ;
48+ setCurrentStep ( 1 ) ;
49+ setIsLoading ( false ) ;
50+ } ;
51+
3752 const isStepValid = true ;
3853
3954 const renderStepContent = ( ) => {
55+ if ( isLoading ) {
56+ return < LoadingScreen /> ;
57+ }
58+ if ( showSuccess ) {
59+ return < SuccessScreen onContinue = { handleReset } /> ;
60+ }
61+
4062 switch ( currentStep ) {
4163 case 1 :
4264 return < Basic /> ;
@@ -59,15 +81,19 @@ const CreateProjectModal = ({
5981 open = { open }
6082 setOpen = { setOpen }
6183 >
62- < Header currentStep = { currentStep } onBack = { handleBack } />
84+ { ! showSuccess && < Header currentStep = { currentStep } onBack = { handleBack } /> }
85+
6386 < div className = 'min-h-[calc(55vh)] px-4 md:px-[50px] lg:px-[75px] xl:px-[150px]' >
6487 { renderStepContent ( ) }
6588 </ div >
66- < Footer
67- currentStep = { currentStep }
68- onContinue = { handleContinue }
69- isStepValid = { isStepValid }
70- />
89+
90+ { ! showSuccess && (
91+ < Footer
92+ currentStep = { currentStep }
93+ onContinue = { handleContinue }
94+ isStepValid = { isStepValid }
95+ />
96+ ) }
7197 </ BoundlessSheet >
7298 ) ;
7399} ;
0 commit comments