11"use client" ;
2- import { useState , useEffect , Suspense } from "react" ;
32import { useState , useEffect , useRef , Suspense } from "react" ;
43import { useRouter , useSearchParams } from "next/navigation" ;
54import DurationPicker from "@/components/DurationPicker" ;
@@ -144,9 +143,6 @@ function NewStreamWizard() {
144143 if ( ! isNaN ( num ) && num > 0 ) return Math . round ( num ) ;
145144 }
146145 return draft ?. duration ?? 0 ;
147- if ( ! durationParam ) return settings . defaultDurationSeconds ;
148- const num = parseFloat ( durationParam ) ;
149- return ! isNaN ( num ) && num > 0 ? Math . round ( num ) : settings . defaultDurationSeconds ;
150146 } ) ( ) ;
151147
152148 const [ recipient , setRecipient ] = useState ( initialRecipient ) ;
@@ -157,13 +153,7 @@ function NewStreamWizard() {
157153 const [ selectedToken , setSelectedToken ] = useState < string > (
158154 SUPPORTED_TOKENS . find ( ( t ) => t . symbol === defaultToken ) ?. symbol ?? SUPPORTED_TOKENS [ 0 ] . symbol ,
159155 ) ;
160- const [ duration , setDuration ] = useState ( initialDuration ) ;
161- const [ selectedToken , setSelectedToken ] = useState < string > (
162- draft ?. selectedToken ?? SUPPORTED_TOKENS [ 0 ] . symbol ,
163- ) ;
164156 const [ customTokenAddress , setCustomTokenAddress ] = useState ( draft ?. customTokenAddress ?? "" ) ;
165- const [ selectedToken , setSelectedToken ] = useState < string > ( settings . defaultToken || SUPPORTED_TOKENS [ 0 ] . symbol ) ;
166- const [ customTokenAddress , setCustomTokenAddress ] = useState ( "" ) ;
167157 const [ customTokenError , setCustomTokenError ] = useState ( "" ) ;
168158 const [ loading , setLoading ] = useState ( false ) ;
169159 const [ errors , setErrors ] = useState ( { recipient : "" , amount : "" , duration : "" , endDate : "" , cliffDate : "" , scheduledStart : "" } ) ;
@@ -200,14 +190,6 @@ function NewStreamWizard() {
200190 ...overrides ,
201191 } ) ;
202192 }
203- const [ endDate , setEndDate ] = useState ( "" ) ;
204- // Pre-fill cliff from preference (convert seconds offset to a future datetime-local string)
205- const [ cliffDate , setCliffDate ] = useState ( ( ) => {
206- if ( ! defaultCliffDuration || defaultCliffDuration <= 0 ) return "" ;
207- const dt = new Date ( Date . now ( ) + defaultCliffDuration * 1000 ) ;
208- // datetime-local format: "YYYY-MM-DDTHH:MM"
209- return dt . toISOString ( ) . slice ( 0 , 16 ) ;
210- } ) ;
211193
212194 // Scheduling
213195 const [ schedulingEnabled , setSchedulingEnabled ] = useState ( false ) ;
@@ -233,13 +215,6 @@ function NewStreamWizard() {
233215 const [ txFailedStage , setTxFailedStage ] = useState < TxStage | undefined > ( undefined ) ;
234216 const [ txError , setTxError ] = useState < string | undefined > ( undefined ) ;
235217
236- function handleTemplateSelect (
237- seconds : number ,
238- suggestedAmount ?: string ,
239- recipientOverride ?: string ,
240- tokenOverride ?: string ,
241- cliffDateOverride ?: string ,
242- ) {
243218 // Protocol fee state for review step
244219 const [ feeBasisPoints , setFeeBasisPoints ] = useState < number > ( 0 ) ;
245220 const [ feeLoading , setFeeLoading ] = useState ( false ) ;
@@ -412,7 +387,7 @@ function NewStreamWizard() {
412387 return ( ) => { cancelled = true ; } ;
413388 } , [ step , address ] ) ;
414389
415- function handleTemplateSelect ( seconds : number , suggestedAmount ?: string , recipientOverride ?: string ) {
390+ function handleTemplateSelect ( seconds : number , suggestedAmount ?: string , recipientOverride ?: string , tokenOverride ?: string , cliffDateOverride ?: string ) {
416391 setDuration ( seconds ) ;
417392 setErrors ( ( prev ) => ( { ...prev , duration : "" } ) ) ;
418393 const newAmount = suggestedAmount ?? amount ;
@@ -1198,7 +1173,7 @@ function NewStreamWizard() {
11981173 { step === "preview" && (
11991174 < div className = "space-y-6" >
12001175 < div className = "bg-gray-800 rounded-xl p-6 space-y-4 border border-gray-700" >
1201- < p className = "text-gray-400 text-sm mb-4" > Here' s what your stream will look like on-chain:</ p >
1176+ < p className = "text-gray-400 text-sm mb-4" > Here' s what your stream will look like on-chain:</ p >
12021177
12031178 { /* Flow rate per day */ }
12041179 < div >
@@ -1259,7 +1234,7 @@ function NewStreamWizard() {
12591234 { /* Info box */ }
12601235 < div className = "bg-blue-900/20 border border-blue-700/50 rounded-lg p-4" >
12611236 < p className = "text-blue-300 text-sm" >
1262- Review the details above. Click " Confirm" to proceed to sign this transaction with your wallet, or " Back" to edit the stream parameters.
1237+ Review the details above. Click " Confirm" to proceed to sign this transaction with your wallet, or " Back" to edit the stream parameters.
12631238 </ p >
12641239 </ div >
12651240 </ div >
0 commit comments