From 482cef33ea097ea7a74ddc8fa5f2fb831e789118 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Thu, 21 Dec 2023 16:40:13 +0700 Subject: [PATCH 1/2] fix: reroute cosmwasm pool back to pool detail page --- CHANGELOG.md | 1 + src/lib/components/LabelText.tsx | 2 +- .../components/supportedSection/PoolCard.tsx | 23 ++++--------------- src/lib/types/pool.ts | 6 +++-- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3c05ee7b..520bfec25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -634,6 +634,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes +- [#694](https://github.com/alleslabs/celatone-frontend/pull/694) Reroute cosmwasm pool back to pool detail page - [#211](https://github.com/alleslabs/celatone-frontend/pull/211) Fix contract count not display for code table in public project - [#208](https://github.com/alleslabs/celatone-frontend/pull/208) Fix messages shown in past tx page (should show only wasm and send messages) - [#200](https://github.com/alleslabs/celatone-frontend/pull/200) Fix add attached assets property diff --git a/src/lib/components/LabelText.tsx b/src/lib/components/LabelText.tsx index 06ed721bf..4817f71cd 100644 --- a/src/lib/components/LabelText.tsx +++ b/src/lib/components/LabelText.tsx @@ -9,7 +9,7 @@ interface LabelTextProps extends FlexProps { labelColor?: string; isSmall?: boolean; tooltipText?: string; - children: string | JSX.Element; + children?: string | JSX.Element; helperText1?: string; helperText2?: string; } diff --git a/src/lib/pages/pools/components/supportedSection/PoolCard.tsx b/src/lib/pages/pools/components/supportedSection/PoolCard.tsx index 35c855848..25f42eae5 100644 --- a/src/lib/pages/pools/components/supportedSection/PoolCard.tsx +++ b/src/lib/pages/pools/components/supportedSection/PoolCard.tsx @@ -10,7 +10,6 @@ import { CustomIcon } from "lib/components/icon"; import { LabelText } from "lib/components/LabelText"; import { Tooltip } from "lib/components/Tooltip"; import type { USD, Pool, Token, U } from "lib/types"; -import { PoolType } from "lib/types"; import { formatPrice } from "lib/utils"; import { AllocationBadge } from "./AllocationBadge"; @@ -23,23 +22,11 @@ interface PoolCardProps { } export const PoolCard = ({ item, mode = "percent-value" }: PoolCardProps) => { + const navigate = useInternalNavigate(); const poolConfig = usePoolConfig({ shouldRedirect: true }); // Remark: the empty string has never been used when poolConfig is disabled const poolUrl = poolConfig.enabled ? poolConfig.url : ""; - const navigate = useInternalNavigate(); - const handleOnClick = () => { - // First version, navigate to contract details page if pool type is CosmWasm - if (item?.type === PoolType.COSMWASM && item.contractAddress) - navigate({ - pathname: `/contracts/[contractAddress]`, - query: { contractAddress: item.contractAddress }, - }); - else { - navigate({ pathname: `/pools/[poolId]`, query: { poolId: item.id } }); - } - }; - const liquidity = item.poolLiquidity.reduce( (total, asset) => total.add(asset.value ?? big(0)) as USD, big(0) as USD @@ -52,7 +39,9 @@ export const PoolCard = ({ item, mode = "percent-value" }: PoolCardProps) => { justifyContent="space-between" gap={4} flexDirection="column" - onClick={handleOnClick} + onClick={() => + navigate({ pathname: `/pools/[poolId]`, query: { poolId: item.id } }) + } bg="gray.900" borderRadius="8px" p={4} @@ -100,9 +89,7 @@ export const PoolCard = ({ item, mode = "percent-value" }: PoolCardProps) => { - {" "} - + /> {item.poolLiquidity.some((coin) => !coin.amount) diff --git a/src/lib/types/pool.ts b/src/lib/types/pool.ts index 69697b0ed..aa82f7477 100644 --- a/src/lib/types/pool.ts +++ b/src/lib/types/pool.ts @@ -5,6 +5,7 @@ import type { Addr, ContractAddr, Nullable, + Nullish, Option, Token, TokenWithValue, @@ -34,7 +35,8 @@ export interface Pool< type: PoolType; isSuperfluid: boolean; poolLiquidity: TLiquidity[]; - contractAddress: Option>; + // NOTE: not used any more + contractAddress: Nullish; } export interface PoolDetail< @@ -54,7 +56,7 @@ export interface PoolDetail< scalingFactorController: Nullable; spreadFactor: Nullable; tickSpacing: Nullable; - contractAddress: Nullable; + contractAddress: Nullish; } export interface PoolInfo { From f1c2278bdb4633e82db1ba6712b3f34b2e5b241c Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Thu, 21 Dec 2023 17:46:29 +0700 Subject: [PATCH 2/2] fix: changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 520bfec25..3f1821603 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes +- [#694](https://github.com/alleslabs/celatone-frontend/pull/694) Reroute cosmwasm pool back to pool detail page - [#693](https://github.com/alleslabs/celatone-frontend/pull/693) Fix ui styling for contract card and states - [#687](https://github.com/alleslabs/celatone-frontend/pull/687) Fix resource and module related bugs - [#690](https://github.com/alleslabs/celatone-frontend/pull/690) Fix query msg regex for Sylvia contract @@ -634,7 +635,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes -- [#694](https://github.com/alleslabs/celatone-frontend/pull/694) Reroute cosmwasm pool back to pool detail page - [#211](https://github.com/alleslabs/celatone-frontend/pull/211) Fix contract count not display for code table in public project - [#208](https://github.com/alleslabs/celatone-frontend/pull/208) Fix messages shown in past tx page (should show only wasm and send messages) - [#200](https://github.com/alleslabs/celatone-frontend/pull/200) Fix add attached assets property