diff --git a/CHANGELOG.md b/CHANGELOG.md index d05aa5c0d..8df0ec51a 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 - [#691](https://github.com/alleslabs/celatone-frontend/pull/691) Fix unsupported token card - [#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 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 {