dont disable token pool selector for delegations
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import { FormControl, InputLabel, ListItemText, MenuItem, Select, SelectChangeEvent, Typography } from '@mui/material';
|
||||
import { ClientContext } from '../context/main';
|
||||
import { useCheckOwnership } from '../hooks/useCheckOwnership';
|
||||
|
||||
type TPoolOption = 'balance' | 'locked';
|
||||
|
||||
export const TokenPoolSelector: React.FC<{ onSelect: (pool: TPoolOption) => void }> = ({ onSelect }) => {
|
||||
export const TokenPoolSelector: React.FC<{ disabled: boolean; onSelect: (pool: TPoolOption) => void }> = ({
|
||||
disabled,
|
||||
onSelect,
|
||||
}) => {
|
||||
const [value, setValue] = useState<TPoolOption>('balance');
|
||||
const {
|
||||
userBalance: { tokenAllocation, balance, fetchBalance, fetchTokenAllocation },
|
||||
currency,
|
||||
} = useContext(ClientContext);
|
||||
|
||||
const { ownership } = useCheckOwnership();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
await fetchBalance();
|
||||
@@ -34,8 +34,8 @@ export const TokenPoolSelector: React.FC<{ onSelect: (pool: TPoolOption) => void
|
||||
label="Token Pool"
|
||||
onChange={handleChange}
|
||||
value={value}
|
||||
disabled={ownership.hasOwnership}
|
||||
renderValue={(value) => <Typography sx={{ textTransform: 'capitalize' }}>{value}</Typography>}
|
||||
disabled={disabled}
|
||||
renderValue={(val) => <Typography sx={{ textTransform: 'capitalize' }}>{val}</Typography>}
|
||||
>
|
||||
<MenuItem value="balance">
|
||||
<ListItemText
|
||||
|
||||
@@ -185,7 +185,7 @@ export const BondForm = ({
|
||||
|
||||
{userBalance.originalVesting && (
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TokenPoolSelector onSelect={(pool) => setValue('tokenPool', pool)} />
|
||||
<TokenPoolSelector onSelect={(pool) => setValue('tokenPool', pool)} disabled={disabled} />
|
||||
</Grid>
|
||||
)}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ export const DelegateForm = ({
|
||||
|
||||
{userBalance.originalVesting && (
|
||||
<Grid item xs={6}>
|
||||
<TokenPoolSelector onSelect={(pool) => setValue('tokenPool', pool)} />
|
||||
<TokenPoolSelector onSelect={(pool) => setValue('tokenPool', pool)} disabled={false} />
|
||||
</Grid>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user