Skip to content

Commit acda84d

Browse files
committed
feat: enhance vault selection UI with lock status indicators and improve table overflow handling for better user experience
1 parent bc6bc54 commit acda84d

File tree

3 files changed

+65
-32
lines changed

3 files changed

+65
-32
lines changed

apps/hub/src/app/_components/vault-select.tsx

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
import { useState } from 'react'
55

66
import { 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

914
import { 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>

apps/hub/src/app/_components/vaults/table.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,15 @@ export function VaultsTable() {
174174
)}
175175
</div>
176176

177-
<div className="relative w-full overflow-x-auto overflow-y-visible rounded-16 border border-solid border-neutral-10 bg-white-100">
178-
<div className="min-w-[800px]">
179-
<table className="w-full border-collapse">
180-
<TableHeader table={table} />
181-
<TableBody table={table} />
182-
<TableFooter table={table} />
183-
</table>
177+
<div className="relative w-full overflow-hidden rounded-16 border border-solid border-neutral-10 bg-white-100">
178+
<div className="max-h-[600px] overflow-auto">
179+
<div className="min-w-[800px]">
180+
<table className="w-full border-collapse">
181+
<TableHeader table={table} />
182+
<TableBody table={table} />
183+
<TableFooter table={table} />
184+
</table>
185+
</div>
184186
</div>
185187
</div>
186188
</div>

apps/hub/src/app/stake/page.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,19 +460,23 @@ const InfoTooltip = () => (
460460
<Tooltip
461461
delayDuration={150}
462462
side="top"
463-
className="border border-neutral-100"
463+
className="border-0"
464464
content={
465-
<div className="max-w-[286px] space-y-4 p-4">
466-
<p className="text-13 font-500">
465+
<div className="flex w-[286px] flex-col gap-4 rounded-8 bg-white-100 p-4">
466+
<span className="text-13 leading-[1.4] tracking-[-0.039px] text-neutral-100">
467467
The longer SNT is staked or locked in vaults, the higher this
468468
multiplier goes. This rewards long term believers. The maximum
469469
multiplier is x9.
470-
</p>
471-
472-
{/* TODO: change link */}
473-
<ButtonLink href="https://status.app/" variant="outline" size="24">
470+
</span>
471+
472+
<ButtonLink
473+
href="https://status.app/"
474+
variant="outline"
475+
className="rounded-8 px-2 py-1"
476+
size="24"
477+
>
474478
Learn more
475-
<ExternalIcon className="size-4 text-neutral-50" />
479+
<ExternalIcon className="size-3 text-neutral-50" />
476480
</ButtonLink>
477481
</div>
478482
}

0 commit comments

Comments
 (0)