mars-v2-frontend/src/components/Earn/vault/VaultRow.tsx
Linkie Link cd8fa35b76
Mp 2821 unlocked positions (#284)
* feat: added unlock flow to the deposited farm row

* feat: added first itteration of unlocking/unlocked logic

* feat: introduce getVaultPositionStatus

* feat: added animated unlock label

* fix: size fix

* MP-2821: created the VaultUnlockBanner

* MP-2821: finished single vault withdraw

* MP-2821: finished vault unlock integration

* fix: implemented feedback

* tidy: refactor isWaiting > isConfirming

* fix: updated according to feedback

* fix: updated according to feedback

* fix: added useMemo for multiple values

* tidy: fixed some format issues

* tidy: updated svg icon implementation

* fix: fixed Bob’s glas-border issues

* fix: refactor modal max-widths

* MP-3031: moved deposit button into the table row
:

* fix: cleanup and adjustment to the button (according to layout)

* fix: added nested groups and finalized the label animation

* tidy: cleanup
2023-07-05 14:28:39 +02:00

37 lines
1.0 KiB
TypeScript

import { flexRender, Row } from '@tanstack/react-table'
import classNames from 'classnames'
type AssetRowProps = {
row: Row<Vault>
resetExpanded: (defaultState?: boolean | undefined) => void
}
export const VaultRow = (props: AssetRowProps) => {
const vault = props.row.original as DepositedVault
return (
<tr
key={props.row.id}
className={classNames(
'bg-white/3 group/row border-b border-t border-white/5 transition-colors hover:bg-white/5',
vault.status && 'cursor-pointer',
props.row.getIsExpanded() && 'is-expanded',
)}
onClick={(e) => {
e.preventDefault()
if (!vault.status) return
const isExpanded = props.row.getIsExpanded()
props.resetExpanded()
!isExpanded && props.row.toggleExpanded()
}}
>
{props.row.getVisibleCells().map((cell) => {
return (
<td key={cell.id} className={'p-4 text-right'}>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</td>
)
})}
</tr>
)
}