44import { useState } from 'react'
55
66import { DropdownMenu } from '@status-im/components'
7- import { AddSmallIcon , DropdownIcon , UnlockedIcon } from '@status-im/icons/20'
7+ import {
8+ AddSmallIcon ,
9+ DropdownIcon ,
10+ LockedIcon ,
11+ UnlockedIcon ,
12+ } from '@status-im/icons/20'
813
914import { formatSNT } from '../../utils/currency'
1015
@@ -95,6 +100,10 @@ export function VaultSelect({
95100 const selectedVault = vaults . find ( vault => vault . address === value )
96101 const selectedIndex = vaults . findIndex ( vault => vault . address === value )
97102
103+ const now = Math . floor ( Date . now ( ) / 1000 )
104+ const lockUntilTimestamp = Number ( selectedVault ?. data ?. lockUntil )
105+ const isLocked = lockUntilTimestamp > now
106+
98107 const displayLabel =
99108 selectedVault && selectedIndex !== - 1
100109 ? getVaultLabel ( selectedVault , selectedIndex )
@@ -107,15 +116,21 @@ export function VaultSelect({
107116 < button
108117 type = "button"
109118 disabled = { disabled }
110- className = "flex w-full items-center justify-between rounded-16 border border-neutral-20 bg-white-100 py-[9px] pl-4 pr-3 text-left text-15 font-medium text-neutral-80 transition data-[state=open]:border-neutral-30 hover:border-neutral-30"
119+ className = "flex w-full items-center justify-between rounded-12 border border-neutral-20 bg-white-100 px-3 py-[9px] text-left text-15 text-neutral-100 transition data-[state=open]:border-neutral-30 hover:border-neutral-30"
111120 >
112121 < div className = "flex min-w-0 items-center gap-2" >
113122 { selectedVault ? (
114- < UnlockedIcon className = "size-5 shrink-0 text-purple" />
123+ isLocked ? (
124+ < LockedIcon className = "size-5 shrink-0 text-purple" />
125+ ) : (
126+ < UnlockedIcon className = "size-5 shrink-0 text-purple" />
127+ )
115128 ) : (
116129 < AddSmallIcon className = "size-5 shrink-0 text-neutral-100" />
117130 ) }
118- < span className = "truncate" > { displayLabel } </ span >
131+ < span className = "truncate font-regular leading-[2.15] tracking-[-0.135px]" >
132+ { displayLabel }
133+ </ span >
119134 </ div >
120135 < DropdownIcon
121136 className = { `shrink-0 text-neutral-40 transition-transform ${ open ? 'rotate-180' : '' } ` }
@@ -126,7 +141,7 @@ export function VaultSelect({
126141 const content = (
127142 < DropdownMenu . Content
128143 align = "start"
129- className = "z-50 w-[var(--radix-dropdown-menu-trigger-width)]"
144+ className = "z-50 max-h-[400px] w-[var(--radix-dropdown-menu-trigger-width)] overflow-y-auto "
130145 >
131146 < DropdownMenu . Item
132147 icon = { < AddSmallIcon className = "text-neutral-100" /> }
@@ -139,18 +154,30 @@ export function VaultSelect({
139154 />
140155 { hasVaults ? (
141156 < >
142- { vaults . map ( ( vault , index ) => (
143- < DropdownMenu . Item
144- key = { vault . address }
145- icon = { < UnlockedIcon className = "text-purple" /> }
146- label = { getVaultLabel ( vault , index ) }
147- selected = { vault . address === value }
148- onSelect = { ( ) => {
149- onChange ( vault . address )
150- setOpen ( false )
151- } }
152- />
153- ) ) }
157+ { vaults . map ( ( vault , index ) => {
158+ const now = Math . floor ( Date . now ( ) / 1000 )
159+ const lockUntilTimestamp = Number ( vault . data ?. lockUntil )
160+ const isVaultLocked = lockUntilTimestamp > now
161+
162+ return (
163+ < DropdownMenu . Item
164+ key = { vault . address }
165+ icon = {
166+ isVaultLocked ? (
167+ < LockedIcon className = "text-purple" />
168+ ) : (
169+ < UnlockedIcon className = "text-purple" />
170+ )
171+ }
172+ label = { getVaultLabel ( vault , index ) }
173+ selected = { vault . address === value }
174+ onSelect = { ( ) => {
175+ onChange ( vault . address )
176+ setOpen ( false )
177+ } }
178+ />
179+ )
180+ } ) }
154181 </ >
155182 ) : null }
156183 </ DropdownMenu . Content >
0 commit comments