From 0e59812bb631ecd69435715a58e9fcf23ca2252d Mon Sep 17 00:00:00 2001 From: evilpeach Date: Wed, 19 Jun 2024 17:13:02 +0700 Subject: [PATCH 1/4] fix: searching block --- src/lib/services/searchService.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/services/searchService.ts b/src/lib/services/searchService.ts index 1e1246f45..f9f1af23e 100644 --- a/src/lib/services/searchService.ts +++ b/src/lib/services/searchService.ts @@ -165,9 +165,10 @@ export const useSearchHandler = ( isPosDecimal(debouncedKeyword) && isFullTier ); const { foundBlock, isFetching: blockFetching } = useMemo(() => { - if (!isFullTier) return { foundBlock: true, isFetching: false }; + if (isPosDecimal(debouncedKeyword) && !isFullTier) + return { foundBlock: true, isFetching: false }; return { foundBlock: blockApi.data, isFetching: blockApi.isFetching }; - }, [blockApi, isFullTier]); + }, [blockApi.data, blockApi.isFetching, debouncedKeyword, isFullTier]); // Proposal const { data: proposalApiData, isFetching: proposalApiIsFetching } = From 3adb48e182e65ce4b59b6c3bb4f50cc3f655545d Mon Sep 17 00:00:00 2001 From: evilpeach Date: Wed, 19 Jun 2024 17:32:47 +0700 Subject: [PATCH 2/4] docs: add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed7babfb0..b00298145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes +- [#984](https://github.com/alleslabs/celatone-frontend/pull/984) Exclude non block number from searching block in lite - [#974](https://github.com/alleslabs/celatone-frontend/pull/974) Fix tx by account addr lcd to support new cosmos sdk - [#976](https://github.com/alleslabs/celatone-frontend/pull/976) Support save accounts in lite version - [#944](https://github.com/alleslabs/celatone-frontend/pull/944) Fix asset input selector From d2dfe32940485cfbf9102fd104ae5e97fcd53299 Mon Sep 17 00:00:00 2001 From: evilpeach Date: Wed, 19 Jun 2024 17:51:15 +0700 Subject: [PATCH 3/4] fix: handle account address type --- src/lib/layout/Searchbar.tsx | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/lib/layout/Searchbar.tsx b/src/lib/layout/Searchbar.tsx index 1f1533803..f2eb55874 100644 --- a/src/lib/layout/Searchbar.tsx +++ b/src/lib/layout/Searchbar.tsx @@ -1,3 +1,4 @@ +/* eslint-disable sonarjs/no-duplicate-string */ import { Button, chakra, @@ -16,7 +17,7 @@ import { useDisclosure, useOutsideClick, } from "@chakra-ui/react"; -import { useCallback, useRef, useState } from "react"; +import { useCallback, useMemo, useRef, useState } from "react"; import type { ChangeEvent, KeyboardEvent } from "react"; import { trackUseMainSearch } from "lib/amplitude"; @@ -131,6 +132,18 @@ const ResultItem = ({ onClose, }: ResultItemProps) => { const route = getRouteOptions(type)?.pathname; + const isAccountAddress = type === "Account Address"; + const displayValue = useMemo(() => { + if (isAccountAddress) { + return metadata.icns.address || metadata.initiaUsername.address || value; + } + return value; + }, [ + isAccountAddress, + metadata.icns.address, + metadata.initiaUsername.address, + value, + ]); const normalizedIcnsValue = value.endsWith(`.${metadata.icns.bech32Prefix}`) ? value : `${value}.${metadata.icns.bech32Prefix}`; @@ -155,9 +168,7 @@ const ResultItem = ({ onClose?.(); }} > - - {metadata.icns.address || metadata.initiaUsername.address || value} - + {displayValue} {metadata.icns.icnsNames?.primaryName && ( @@ -184,7 +195,7 @@ const ResultItem = ({ )} )} - {metadata.initiaUsername?.username && ( + {isAccountAddress && metadata.initiaUsername?.username && ( )} @@ -314,9 +325,12 @@ const Searchbar = () => { if (type === "Module Path") { return splitModule(keyword) as [Addr, string]; } - return ( - metadata.icns.address || metadata.initiaUsername.address || keyword - ); + if (type === "Account Address") + return ( + metadata.icns.address || metadata.initiaUsername.address || keyword + ); + + return keyword; }; trackUseMainSearch(isClick, type); From 50da66c9afe0109970339075c35ba706b37f5dc7 Mon Sep 17 00:00:00 2001 From: evilpeach Date: Thu, 20 Jun 2024 11:37:05 +0700 Subject: [PATCH 4/4] fix: handle contract address --- src/lib/layout/Searchbar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/layout/Searchbar.tsx b/src/lib/layout/Searchbar.tsx index f2eb55874..4dc77fbdb 100644 --- a/src/lib/layout/Searchbar.tsx +++ b/src/lib/layout/Searchbar.tsx @@ -132,7 +132,8 @@ const ResultItem = ({ onClose, }: ResultItemProps) => { const route = getRouteOptions(type)?.pathname; - const isAccountAddress = type === "Account Address"; + const isAccountAddress = + type === "Account Address" || type === "Contract Address"; const displayValue = useMemo(() => { if (isAccountAddress) { return metadata.icns.address || metadata.initiaUsername.address || value; @@ -169,7 +170,7 @@ const ResultItem = ({ }} > {displayValue} - {metadata.icns.icnsNames?.primaryName && ( + {isAccountAddress && metadata.icns.icnsNames?.primaryName && (