From ba5a4b6d363e1869c936a1d44227c947d94d65c3 Mon Sep 17 00:00:00 2001 From: evilpeach Date: Tue, 29 Aug 2023 08:48:03 +0700 Subject: [PATCH 1/3] feat: auto focus, can do enter --- .../SelectContractInstantiator.tsx | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) 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 ( <> From de915d499e2c1c57b14376c405df49be11edd556 Mon Sep 17 00:00:00 2001 From: evilpeach Date: Tue, 29 Aug 2023 08:50:08 +0700 Subject: [PATCH 2/3] docs: add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83a363368..6fc22fc13 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 +- [#507](https://github.com/alleslabs/celatone-frontend/pull/507) 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 From 713e61980db10ddfd4dfabd00fa44c831af482b6 Mon Sep 17 00:00:00 2001 From: evilpeach Date: Tue, 29 Aug 2023 08:53:57 +0700 Subject: [PATCH 3/3] docs: change PR number --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fc22fc13..04102d8d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Features -- [#507](https://github.com/alleslabs/celatone-frontend/pull/507) Add auto focus, enter key listener on contract selection +- [#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