@@ -35,6 +35,7 @@ import { formatDate } from "../../../../utils/date"
3535import { calculatePercenteage } from "../../../../utils/percentage"
3636import { StakingAppForm } from "../../../../components/StakingApplicationForms"
3737import { AuthorizationStatus } from "../../../../types"
38+ import { StakingProviderInfo } from "../../../../threshold-ts/applications"
3839
3940interface CommonProps {
4041 stakingAppId : StakingAppName
@@ -58,6 +59,7 @@ type StakingAppAuthDataBaseProps = {
5859 remainingAuthorizationDecreaseDelay : string
5960 isOperatorInPool : boolean | undefined
6061 operator : string
62+ stakingProviderInfo ?: StakingProviderInfo | undefined
6163}
6264
6365type AppAuthDataConditionalProps =
@@ -255,8 +257,26 @@ export const AuthorizeApplicationsCardCheckboxBase: FC<
255257 }
256258
257259 const onSubmitForm = ( tokenAmount : string ) => {
258- if ( isIncreaseAction ) onAuthorizeApp ( tokenAmount )
259- else onInitiateDeauthorization ( tokenAmount )
260+ if ( isIncreaseAction ) {
261+ onAuthorizeApp ( tokenAmount )
262+ } else {
263+ if ( appAuthData . stakingAppId === "taco" ) {
264+ // const endCommitment = appAuthData.stakingProviderInfo?.endCommitment
265+ const endCommitment = appAuthData . stakingProviderInfo ?. endCommitment
266+ const currentTime = Math . floor ( Date . now ( ) / 1000 )
267+ const isCommited = ( Number ( endCommitment ) ?? 0 ) > currentTime
268+ const endCommitmentDate = new Date (
269+ ( Number ( endCommitment ) ?? 0 ) * 1000
270+ ) . toLocaleDateString ( )
271+ if ( isCommited ) {
272+ alert ( `You are still committed until ${ endCommitmentDate } .` )
273+ } else {
274+ onInitiateDeauthorization ( tokenAmount )
275+ }
276+ } else {
277+ onInitiateDeauthorization ( tokenAmount )
278+ }
279+ }
260280 }
261281
262282 const onConfirmDeauthorization = ( ) => {
0 commit comments