diff --git a/src/components/Settings/index.tsx b/src/components/Settings/index.tsx index 8229cac170..8b8b9f77aa 100644 --- a/src/components/Settings/index.tsx +++ b/src/components/Settings/index.tsx @@ -94,6 +94,8 @@ const MenuFlyout = styled.span` ${({ theme }) => theme.mediaWidth.upToMedium` min-width: 18.125rem; `}; + + user-select: none; ` const Break = styled.div` diff --git a/src/components/TransactionSettings/index.tsx b/src/components/TransactionSettings/index.tsx index fb796dbf6c..8d68a4226d 100644 --- a/src/components/TransactionSettings/index.tsx +++ b/src/components/TransactionSettings/index.tsx @@ -136,11 +136,16 @@ export default function TransactionSettings({ placeholderSlippage }: Transaction if (value.length === 0) { setDeadline(DEFAULT_DEADLINE_FROM_NOW) } else { - const parsed: number = Math.floor(Number.parseFloat(value) * 60) - if (!Number.isInteger(parsed) || parsed < 60) { + try { + const parsed: number = Math.floor(Number.parseFloat(value) * 60) + if (!Number.isInteger(parsed) || parsed < 60 || parsed > 180 * 60) { + setDeadlineError(DeadlineError.InvalidInput) + } else { + setDeadline(parsed) + } + } catch (error) { + console.error(error) setDeadlineError(DeadlineError.InvalidInput) - } else { - setDeadline(parsed) } } } diff --git a/src/state/user/reducer.ts b/src/state/user/reducer.ts index 02755cc982..dfe1c574e9 100644 --- a/src/state/user/reducer.ts +++ b/src/state/user/reducer.ts @@ -96,7 +96,12 @@ export default createReducer(initialState, (builder) => // deadline isnt being tracked in local storage, reset to default // noinspection SuspiciousTypeOfGuard - if (typeof state.userDeadline !== 'number' || !Number.isInteger(state.userDeadline) || state.userDeadline < 60) { + if ( + typeof state.userDeadline !== 'number' || + !Number.isInteger(state.userDeadline) || + state.userDeadline < 60 || + state.userDeadline > 180 * 60 + ) { state.userDeadline = DEFAULT_DEADLINE_FROM_NOW }