Skip to content

Commit

Permalink
bugfix/defaultInputValue
Browse files Browse the repository at this point in the history
  • Loading branch information
brucedonovan committed Dec 8, 2022
1 parent 806c719 commit 4472780
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app-v2",
"version": "2.4.25",
"version": "2.4.26",
"private": true,
"dependencies": {
"@ethersproject/providers": "^5.6.8",
Expand Down
2 changes: 1 addition & 1 deletion src/components/selectors/SeriesSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const AprText = ({
actionType,
color,
}: {
inputValue: string | undefined;
inputValue: string;
series: ISeries;
actionType: ActionType;
color: string;
Expand Down
9 changes: 5 additions & 4 deletions src/components/views/Borrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ const Borrow = () => {
const [stepPosition, setStepPosition] = useState<number>(0);

// renderId for user flow traking (analytics)
const [renderId, setRenderId] = useState<string>();
// const [renderId, setRenderId] = useState<string>();
// useEffect(() => {
// setRenderId(new Date().getTime().toString(36));
// }, []);

const [borrowInput, setBorrowInput] = useState<string>('');
const [collatInput, setCollatInput] = useState<string>('');
Expand Down Expand Up @@ -146,9 +149,7 @@ const Borrow = () => {
} as GA_Properties.transaction_initiated);
};

useEffect(() => {
setRenderId(new Date().getTime().toString(36));
}, []);


/** Interaction handlers */
const handleNavAction = (_stepPosition: number) => {
Expand Down
8 changes: 4 additions & 4 deletions src/components/views/Lend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AssetSelector from '../selectors/AssetSelector';
import InputWrap from '../wraps/InputWrap';
import MainViewWrap from '../wraps/MainViewWrap';
import SeriesSelector from '../selectors/SeriesSelector';
import { cleanValue, getTxCode, nFormatter } from '../../utils/appUtils';
import { cleanValue, nFormatter } from '../../utils/appUtils';
import SectionWrap from '../wraps/SectionWrap';

import { UserContext } from '../../contexts/UserContext';
Expand Down Expand Up @@ -53,7 +53,7 @@ const Lend = () => {

/* LOCAL STATE */
const [modalOpen, toggleModal] = useState<boolean>(false);
const [lendInput, setLendInput] = useState<string | undefined>(undefined);
const [lendInput, setLendInput] = useState<string>('');
// const [maxLend, setMaxLend] = useState<string | undefined>();
const [lendDisabled, setLendDisabled] = useState<boolean>(true);
const [stepPosition, setStepPosition] = useState<number>(0);
Expand Down Expand Up @@ -100,7 +100,7 @@ const Lend = () => {
};

const resetInputs = useCallback(() => {
setLendInput(undefined);
setLendInput('');
setStepPosition(0);
resetLendProcess();
}, [resetLendProcess]);
Expand Down Expand Up @@ -156,7 +156,7 @@ const Lend = () => {
type="number"
inputMode="decimal"
placeholder="Enter amount"
value={lendInput || ''}
value={lendInput}
onChange={(event: any) =>
setLendInput(cleanValue(event.target.value, selectedSeries?.decimals))
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/LendPosition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FiArrowRight, FiChevronDown, FiClock, FiTool, FiTrendingUp } from 'reac
import ActionButtonGroup from '../wraps/ActionButtonWrap';
import InputWrap from '../wraps/InputWrap';
import SeriesSelector from '../selectors/SeriesSelector';
import { abbreviateHash, cleanValue, getTxCode, nFormatter } from '../../utils/appUtils';
import { abbreviateHash, cleanValue, nFormatter } from '../../utils/appUtils';
import SectionWrap from '../wraps/SectionWrap';

import { UserContext } from '../../contexts/UserContext';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useApr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const useApr = (input: string | undefined, actionType: ActionType, series

const _selectedSeries = series || selectedSeries;
/* Make sure there won't be an underflow */
const _fallbackInput = ETH_BASED_ASSETS.includes(series?.baseId!) ? '.001' : '1';
const _fallbackInput = ETH_BASED_ASSETS.includes(series?.baseId!) ? '0.01' : '1';
const _input = Number(input) === 0 ? _fallbackInput : cleanValue(input, _selectedSeries?.decimals);

/* LOCAL STATE */
Expand Down

0 comments on commit 4472780

Please sign in to comment.