diff --git a/CHANGELOG.md b/CHANGELOG.md index 83a363368..04102d8d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Features +- [#508](https://github.com/alleslabs/celatone-frontend/pull/508) Add auto focus, enter key listener on contract selection - [#492](https://github.com/alleslabs/celatone-frontend/pull/492) Add jsonschema actions on contract detail page - [#486](https://github.com/alleslabs/celatone-frontend/pull/486) Switch to schema tab when available and prefill,expand,and scroll to the prefill msg - [#483](https://github.com/alleslabs/celatone-frontend/pull/483) Add json schema functionality to execute page diff --git a/src/lib/components/select-contract/SelectContractInstantiator.tsx b/src/lib/components/select-contract/SelectContractInstantiator.tsx index a849643e4..87d1bd051 100644 --- a/src/lib/components/select-contract/SelectContractInstantiator.tsx +++ b/src/lib/components/select-contract/SelectContractInstantiator.tsx @@ -16,6 +16,7 @@ import { import { useQuery } from "@tanstack/react-query"; import type { AxiosError } from "axios"; import { useState } from "react"; +import type { KeyboardEvent } from "react"; import { CustomIcon } from "../icon"; import { @@ -56,6 +57,8 @@ export const SelectContractInstantiator = ({ const { getContractLists } = useContractStore(); + const isMobile = useMobile(); + // TODO - Revisit false case const { instantiatedListInfo, isLoading } = useInstantiatedByMe(true); const contractLists = [instantiatedListInfo, ...getContractLists()]; @@ -98,7 +101,21 @@ export const SelectContractInstantiator = ({ setListSlug(slug); }; - const isMobile = useMobile(); + const handleSubmit = () => { + const err = validateContractAddress(searchContract); + if (err !== null) setInvalid(err); + else { + AmpTrack(AmpEvent.USE_CONTRACT_MODAL_SEARCH); + refetch(); + } + }; + + const handleKeydown = (event: KeyboardEvent) => { + if (event.key === "Enter") { + handleSubmit(); + } + }; + return ( <>