33import React , { useState , useMemo , useCallback } from 'react' ;
44import { Progress } from '@/components/ui/progress' ;
55import { cn } from '@/lib/utils' ;
6+ import { InfoTooltip , DBC_TOOLTIPS } from '@/components/ui/info-tooltip' ;
67
78interface LiquidityProps {
89 onNext : ( data : LiquidityData ) => void ;
@@ -18,6 +19,13 @@ export interface LiquidityData {
1819 creatorLpPercentage : number ;
1920 partnerLockedLpPercentage : number ;
2021 creatorLockedLpPercentage : number ;
22+ creatorTradingFeePercentage : number ;
23+ leftover : number ;
24+ // Migration Fee (optional)
25+ migrationFee ?: {
26+ feePercentage : number ;
27+ creatorFeePercentage : number ;
28+ } ;
2129}
2230
2331export default function Liquidity ( {
@@ -33,6 +41,12 @@ export default function Liquidity({
3341 creatorLpPercentage : initialData ?. creatorLpPercentage || 50 ,
3442 partnerLockedLpPercentage : initialData ?. partnerLockedLpPercentage || 0 ,
3543 creatorLockedLpPercentage : initialData ?. creatorLockedLpPercentage || 0 ,
44+ creatorTradingFeePercentage : initialData ?. creatorTradingFeePercentage || 50 ,
45+ leftover : initialData ?. leftover || 0 ,
46+ migrationFee : initialData ?. migrationFee || {
47+ feePercentage : 0 ,
48+ creatorFeePercentage : 0 ,
49+ } ,
3650 } ) ;
3751
3852 const progressPercentage = useMemo ( ( ) =>
@@ -45,6 +59,17 @@ export default function Liquidity({
4559 setFormData ( prev => ( { ...prev , [ field ] : numValue } ) ) ;
4660 } , [ ] ) ;
4761
62+ const handleMigrationFeeChange = useCallback ( ( field : 'feePercentage' | 'creatorFeePercentage' , value : string ) => {
63+ const numValue = parseFloat ( value ) || 0 ;
64+ setFormData ( prev => ( {
65+ ...prev ,
66+ migrationFee : {
67+ ...prev . migrationFee ! ,
68+ [ field ] : numValue
69+ }
70+ } ) ) ;
71+ } , [ ] ) ;
72+
4873 const handleSubmit = useCallback ( ( e : React . FormEvent ) => {
4974 e . preventDefault ( ) ;
5075 onNext ( formData ) ;
@@ -106,11 +131,12 @@ export default function Liquidity({
106131 { /* LP Distribution */ }
107132 < div className = "mb-6 sm:mb-8" >
108133 < h3 className = "text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4" > LP Distribution</ h3 >
109-
134+
110135 < div className = "grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4" >
111136 < div >
112- < label className = "block text-sm font-medium text-gray-700 mb-2" >
137+ < label className = "block text-sm font-medium text-gray-700 mb-2 flex items-center " >
113138 Partner LP Percentage
139+ < InfoTooltip content = { DBC_TOOLTIPS . lpDistribution . partnerLpPercentage } />
114140 </ label >
115141 < input
116142 type = "number"
@@ -123,8 +149,9 @@ export default function Liquidity({
123149 />
124150 </ div >
125151 < div >
126- < label className = "block text-sm font-medium text-gray-700 mb-2" >
152+ < label className = "block text-sm font-medium text-gray-700 mb-2 flex items-center " >
127153 Creator LP Percentage
154+ < InfoTooltip content = { DBC_TOOLTIPS . lpDistribution . creatorLpPercentage } />
128155 </ label >
129156 < input
130157 type = "number"
@@ -163,11 +190,12 @@ export default function Liquidity({
163190 { /* LP Locking */ }
164191 < div className = "mb-6 sm:mb-8" >
165192 < h3 className = "text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4" > LP Locking</ h3 >
166-
193+
167194 < div className = "grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4" >
168195 < div >
169- < label className = "block text-sm font-medium text-gray-700 mb-2" >
196+ < label className = "block text-sm font-medium text-gray-700 mb-2 flex items-center " >
170197 Partner Locked LP Percentage
198+ < InfoTooltip content = { DBC_TOOLTIPS . lpDistribution . partnerLockedLpPercentage } />
171199 </ label >
172200 < input
173201 type = "number"
@@ -180,8 +208,9 @@ export default function Liquidity({
180208 />
181209 </ div >
182210 < div >
183- < label className = "block text-sm font-medium text-gray-700 mb-2" >
211+ < label className = "block text-sm font-medium text-gray-700 mb-2 flex items-center " >
184212 Creator Locked LP Percentage
213+ < InfoTooltip content = { DBC_TOOLTIPS . lpDistribution . creatorLockedLpPercentage } />
185214 </ label >
186215 < input
187216 type = "number"
@@ -196,6 +225,85 @@ export default function Liquidity({
196225 </ div >
197226 </ div >
198227
228+ { /* Trading Fee & Leftover */ }
229+ < div className = "mb-6 sm:mb-8" >
230+ < h3 className = "text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4" > Trading Fee & Leftover </ h3 >
231+
232+ < div className = "grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4" >
233+ < div >
234+ < label className = "block text-sm font-medium text-gray-700 mb-2 flex items-center" >
235+ Creator Trading Fee Percentage (%)
236+ < InfoTooltip content = { DBC_TOOLTIPS . lpDistribution . creatorTradingFeePercentage } />
237+ </ label >
238+ < input
239+ type = "number"
240+ placeholder = "50"
241+ value = { formData . creatorTradingFeePercentage }
242+ onChange = { ( e ) => handleInputChange ( 'creatorTradingFeePercentage' , e . target . value ) }
243+ className = "w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 text-sm sm:text-base"
244+ min = "0"
245+ max = "100"
246+ />
247+ < p className = "text-xs text-gray-500 mt-1" > 0% = all fees go to partner</ p >
248+ </ div >
249+ < div >
250+ < label className = "block text-sm font-medium text-gray-700 mb-2 flex items-center" >
251+ Leftover Amount
252+ < InfoTooltip content = { DBC_TOOLTIPS . lpDistribution . leftover } />
253+ </ label >
254+ < input
255+ type = "number"
256+ placeholder = "0"
257+ value = { formData . leftover }
258+ onChange = { ( e ) => handleInputChange ( 'leftover' , e . target . value ) }
259+ className = "w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 text-sm sm:text-base"
260+ min = "0"
261+ />
262+ < p className = "text-xs text-gray-500 mt-1" > Claimable after pool migrates</ p >
263+ </ div >
264+ </ div >
265+ </ div >
266+
267+ { /* Migration Fee */ }
268+ < div className = "mb-6 sm:mb-8" >
269+ < h3 className = "text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4" > Migration Fee (Optional)</ h3 >
270+
271+ < div className = "grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4" >
272+ < div >
273+ < label className = "block text-sm font-medium text-gray-700 mb-2 flex items-center" >
274+ Migration Fee Percentage (%)
275+ < InfoTooltip content = { DBC_TOOLTIPS . migrationFee . feePercentage } />
276+ </ label >
277+ < input
278+ type = "number"
279+ placeholder = "0"
280+ value = { formData . migrationFee ?. feePercentage || 0 }
281+ onChange = { ( e ) => handleMigrationFeeChange ( 'feePercentage' , e . target . value ) }
282+ className = "w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 text-sm sm:text-base"
283+ min = "0"
284+ max = "50"
285+ />
286+ < p className = "text-xs text-gray-500 mt-1" > Fee taken from migration threshold (0-50%)</ p >
287+ </ div >
288+ < div >
289+ < label className = "block text-sm font-medium text-gray-700 mb-2 flex items-center" >
290+ Creator Migration Fee Percentage (%)
291+ < InfoTooltip content = { DBC_TOOLTIPS . migrationFee . creatorFeePercentage } />
292+ </ label >
293+ < input
294+ type = "number"
295+ placeholder = "0"
296+ value = { formData . migrationFee ?. creatorFeePercentage || 0 }
297+ onChange = { ( e ) => handleMigrationFeeChange ( 'creatorFeePercentage' , e . target . value ) }
298+ className = "w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 text-sm sm:text-base"
299+ min = "0"
300+ max = "100"
301+ />
302+ < p className = "text-xs text-gray-500 mt-1" > Creator's share of migration fee (0-100%)</ p >
303+ </ div >
304+ </ div >
305+ </ div >
306+
199307 { /* LP Distribution Preview */ }
200308 < div className = "bg-blue-50 p-6 rounded-lg mb-8" >
201309 < h3 className = "font-semibold text-black mb-4" > LP Distribution Preview</ h3 >
0 commit comments