diff --git a/src/components/Input/numeric.tsx b/src/components/Input/numeric.tsx index a270357..abfdbc5 100644 --- a/src/components/Input/numeric.tsx +++ b/src/components/Input/numeric.tsx @@ -21,7 +21,7 @@ export class NumericInput extends React.Component { if (value.startsWith && (value.startsWith('.') || value.startsWith('-.'))) { valueTemp = valueTemp.replace('.', '0.'); } - onChange?.(valueTemp.replace(/0*(\d+)/, '$1')); + if (valueTemp.replace) onChange?.(valueTemp.replace(/0*(\d+)/, '$1')); if (onBlur) { onBlur(); } diff --git a/src/constants/labels.ts b/src/constants/labels.ts index 8566999..8b9faff 100644 --- a/src/constants/labels.ts +++ b/src/constants/labels.ts @@ -61,7 +61,8 @@ export const LABELS = { TRADING_TABLE_TITLE_ACTIONS: 'Action', TRADING_ADD_POSITION: 'Add Position', MARGIN_TRADE_ACTION: 'Margin Trade', - MARGIN_TRADE_QUESTION: 'How much of this asset would you like?', + MARGIN_TRADE_CHOOSE_COLLATERAL_AND_LEVERAGE: 'Please choose your collateral and leverage.', + MARGIN_TRADE_QUESTION: 'Please choose how much of this asset you wish to purchase.', TABLE_TITLE_BUYING_POWER: 'Total Buying Power', NOT_ENOUGH_MARGIN_MESSAGE: 'Not enough buying power in oyster to make this trade at this leverage.', LEVERAGE_LIMIT_MESSAGE: diff --git a/src/views/marginTrading/newPosition/NewPositionForm.tsx b/src/views/marginTrading/newPosition/NewPositionForm.tsx index dc1a709..47a0f2b 100644 --- a/src/views/marginTrading/newPosition/NewPositionForm.tsx +++ b/src/views/marginTrading/newPosition/NewPositionForm.tsx @@ -42,72 +42,73 @@ export default function NewPositionForm({ lendingReserve, newPosition, setNewPos justifyContent: 'space-around', }} > -
{LABELS.SELECT_COLLATERAL}
- { - const id: string = cache.byParser(LendingReserveParser).find((acc) => acc === key) || ''; - const parser = cache.get(id) as ParsedAccount; - setNewPosition({ ...newPosition, collateral: parser }); - }} - /> +

{newPosition.error}

-
{LABELS.MARGIN_TRADE_QUESTION}
-
- - {LABELS.MARGIN_TRADE_CHOOSE_COLLATERAL_AND_LEVERAGE}

+
+ { + const id: string = cache.byParser(LendingReserveParser).find((acc) => acc === key) || ''; + const parser = cache.get(id) as ParsedAccount; + setNewPosition({ ...newPosition, collateral: parser }); }} - onChange={(v: string) => { - setNewPosition({ - ...newPosition, - asset: { ...newPosition.asset, value: v }, - }); - }} - placeholder='0.00' /> -
- { - tokens.find((t) => t.mintAddress === newPosition.asset.type?.info?.liquidityMint?.toBase58()) - ?.tokenSymbol - } +
+ { + setNewPosition({ ...newPosition, leverage: e.target.value }); + }} + > + 1x + 2x + 3x + 4x + 5x + + { + setNewPosition({ ...newPosition, leverage }); + }} + />
+
+

{LABELS.MARGIN_TRADE_QUESTION}

+ +
+
+ + { + setNewPosition({ + ...newPosition, + asset: { ...newPosition.asset, value: v }, + }); + }} + placeholder='0.00' + /> +
+ { + tokens.find((t) => t.mintAddress === newPosition.asset.type?.info?.liquidityMint?.toBase58()) + ?.tokenSymbol + } +
+
-
- { - setNewPosition({ ...newPosition, leverage: e.target.value }); - }} - > - 1x - 2x - 3x - 4x - 5x - - { - setNewPosition({ ...newPosition, leverage }); - }} - /> -

{newPosition.error}

-
-