From b0d282b131c59ae1bf94591789d0d4ac37ced8d0 Mon Sep 17 00:00:00 2001 From: Emanuel Palestino <75344407+Emanuel-Palestino@users.noreply.github.com> Date: Mon, 5 Aug 2024 10:47:45 -0600 Subject: [PATCH] feat(frontend): ux improvements to liquidity dialog component (#2839) * fixed(frontend) asset page now retains page scroll position. * feat(frontend) added autofocus to liquidity dialog input * feat(fronted) made eslint happy --- packages/frontend/app/components/LiquidityDialog.tsx | 10 +++++++++- packages/frontend/app/routes/assets.$assetId.tsx | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/frontend/app/components/LiquidityDialog.tsx b/packages/frontend/app/components/LiquidityDialog.tsx index 00757aea2f..917370ab1c 100644 --- a/packages/frontend/app/components/LiquidityDialog.tsx +++ b/packages/frontend/app/components/LiquidityDialog.tsx @@ -1,7 +1,7 @@ import { Dialog } from '@headlessui/react' import { Form } from '@remix-run/react' import type { ChangeEvent } from 'react' -import { useState } from 'react' +import { useEffect, useRef, useState } from 'react' import { XIcon } from '~/components/icons' import { Button, Input } from '~/components/ui' @@ -42,6 +42,13 @@ export const LiquidityDialog = ({ setActualAmount(integerScaledInput) } + const inputRef = useRef(null) + useEffect(() => { + if (inputRef.current) { + inputRef.current.focus() + } + }, []) + return (
@@ -67,6 +74,7 @@ export const LiquidityDialog = ({