File tree Expand file tree Collapse file tree 3 files changed +36
-5
lines changed
src/components/statementWizard Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,14 @@ interface PrivacySelectorProps {
66 isPublic : boolean ;
77 onChange : ( isPublic : boolean ) => void ;
88 onComplete : ( ) => void ;
9+ isSubmitting ?: boolean ;
910}
1011
1112export const PrivacySelector : React . FC < PrivacySelectorProps > = ( {
1213 isPublic,
1314 onChange,
1415 onComplete,
16+ isSubmitting = false ,
1517} ) => {
1618 return (
1719 < div className = 'space-y-6' >
@@ -53,8 +55,13 @@ export const PrivacySelector: React.FC<PrivacySelectorProps> = ({
5355 </ div >
5456 </ Button >
5557 </ div >
56- < Button variant = 'pink' className = 'mx-auto' onClick = { onComplete } >
57- Create Statement
58+ < Button
59+ variant = 'pink'
60+ className = 'mx-auto'
61+ onClick = { onComplete }
62+ disabled = { isSubmitting }
63+ >
64+ { isSubmitting ? 'Submitting...' : 'Create Statement' }
5865 </ Button >
5966 </ div >
6067 ) ;
Original file line number Diff line number Diff line change @@ -191,7 +191,8 @@ const StatementWizard: React.FC<StatementWizardProps> = ({
191191 />
192192 ) ;
193193 case 'privacy' :
194- return (
194+ return isPreset ? (
195+ // In preset flow, privacy isn't final (next goes to complement)
195196 < PrivacyStep
196197 isPublic = { selection . isPublic }
197198 onUpdate = { ( val ) =>
@@ -202,10 +203,31 @@ const StatementWizard: React.FC<StatementWizardProps> = ({
202203 }
203204 onNext = { goNext }
204205 onBack = { goBack }
206+ isSubmitting = { isSubmitting }
207+ />
208+ ) : (
209+ // In custom flow, privacy is the final step so we call handleComplete
210+ < PrivacyStep
211+ isPublic = { selection . isPublic }
212+ onUpdate = { ( val ) =>
213+ setSelection ( ( prev ) => ( {
214+ ...prev ,
215+ isPublic : val ,
216+ } ) )
217+ }
218+ onNext = { handleComplete }
219+ onBack = { goBack }
220+ isSubmitting = { isSubmitting }
205221 />
206222 ) ;
207223 case 'complement' :
208- return < ComplementStep onComplete = { handleComplete } onBack = { goBack } /> ;
224+ return (
225+ < ComplementStep
226+ onComplete = { handleComplete }
227+ onBack = { goBack }
228+ isSubmitting = { isSubmitting }
229+ />
230+ ) ;
209231 default :
210232 return null ;
211233 }
Original file line number Diff line number Diff line change 1- // src/components/statementWizard/steps/PrivacyStep.tsx
21import React from 'react' ;
32import StepContainer from '../StepContainer' ;
43import { PrivacySelector } from '../PrivacySelector' ;
@@ -8,13 +7,15 @@ interface PrivacyStepProps {
87 onUpdate : ( isPublic : boolean ) => void ;
98 onNext : ( ) => void ;
109 onBack : ( ) => void ;
10+ isSubmitting ?: boolean ;
1111}
1212
1313export const PrivacyStep : React . FC < PrivacyStepProps > = ( {
1414 isPublic,
1515 onUpdate,
1616 onNext,
1717 onBack,
18+ isSubmitting = false ,
1819} ) => {
1920 const subQuestion = `Who can see this statement?` ;
2021 return (
@@ -23,6 +24,7 @@ export const PrivacyStep: React.FC<PrivacyStepProps> = ({
2324 isPublic = { isPublic }
2425 onChange = { onUpdate }
2526 onComplete = { ( ) => onNext ( ) }
27+ isSubmitting = { isSubmitting } // Pass along the submission state
2628 />
2729 </ StepContainer >
2830 ) ;
You can’t perform that action at this time.
0 commit comments