Skip to content

Commit

Permalink
Merge branch 'master' into feat/dark-mode-enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
brucedonovan authored Mar 15, 2023
2 parents 53b9300 + ad9afa5 commit 02aa8e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/components/views/Borrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ const Borrow = () => {

/* STATE FROM CONTEXT */
const { userState, userActions } = useContext(UserContext);
const { assetMap, vaultMap, seriesMap, selectedSeries, selectedIlk, selectedBase, selectedVault } = userState;
const { assetMap, vaultMap, vaultsLoading, seriesMap, selectedSeries, selectedIlk, selectedBase, selectedVault } =
userState;
const { setSelectedIlk } = userActions;

const { address: activeAccount } = useAccountPlus();
Expand Down Expand Up @@ -549,7 +550,9 @@ const Borrow = () => {
borrowProcess?.tx.status === TxState.SUCCESSFUL && (
<Box pad="large" gap="small">
<Text size="small"> View Vault: </Text>
{vaultToUse && <VaultItem vault={vaultMap?.get(vaultToUse.id)!} condensed index={1} />}
{vaultToUse && !vaultsLoading && (
<VaultItem vault={vaultMap?.get(vaultToUse.id)!} condensed index={1} />
)}
{!vaultToUse && newVaultId && (
<DummyVaultItem series={selectedSeries!} vaultId={newVaultId!} condensed />
)}
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/useInputValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const useInputValidation = (
const _inputAsFloat = parseFloat(input);
const aboveMax: boolean = !!limits[1] && _inputAsFloat > parseFloat(limits[1].toString());
const belowMin: boolean = !!limits[0] && _inputAsFloat < parseFloat(limits[0].toString());
const aboveUserBalance: boolean = aboveMax && !protocolLimited
const aboveUserBalance: boolean = aboveMax && !protocolLimited;
const aboveProtocolLendLimit: boolean = aboveMax && protocolLimited;

// General input validation here:
if (parseFloat(input) < 0 && actionCode !== ActionCodes.TRANSFER_VAULT) {
Expand Down Expand Up @@ -90,7 +91,7 @@ export const useInputValidation = (

case ActionCodes.LEND:
aboveUserBalance && setInputError('Amount exceeds available balance');
protocolLimited && setInputError('Amount exceeds the maximum you can lend');
aboveProtocolLendLimit && setInputError('Amount exceeds the maximum you can lend');
belowMin && setInputError('Amount should be expressed as a positive value');
break;

Expand Down

0 comments on commit 02aa8e4

Please sign in to comment.