dont disable token pool selector for delegations

This commit is contained in:
fmtabbara
2022-03-17 17:14:41 +00:00
parent 8b635a44b8
commit 07155b4fe5
3 changed files with 8 additions and 8 deletions
@@ -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
+1 -1
View File
@@ -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>
)}