From 6b5bbd7645e23ba6a5ff945740033d87bb8daeb3 Mon Sep 17 00:00:00 2001 From: alecdwm Date: Mon, 9 Dec 2024 03:33:50 +0000 Subject: [PATCH] fix: use `relay?.name` instead of `relay?.chainName` in network info rows --- apps/extension/src/ui/hooks/useNetworkInfo.ts | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/apps/extension/src/ui/hooks/useNetworkInfo.ts b/apps/extension/src/ui/hooks/useNetworkInfo.ts index 44edcb0c29..d7440a3116 100644 --- a/apps/extension/src/ui/hooks/useNetworkInfo.ts +++ b/apps/extension/src/ui/hooks/useNetworkInfo.ts @@ -11,25 +11,23 @@ export type NetworkInfoProps = { } export const getNetworkInfo = (t: TFunction, { chain, evmNetwork, relay }: NetworkInfoProps) => { - if (evmNetwork) - return { - label: evmNetwork.name, - type: evmNetwork.isTestnet ? t("EVM Testnet") : t("EVM Blockchain"), - } + if (evmNetwork) { + const label = evmNetwork.name + return { label, type: evmNetwork.isTestnet ? t("EVM Testnet") : t("EVM Blockchain") } + } if (chain) { - if (chain.isTestnet) return { label: chain.name, type: t("Testnet") } - if (chain.paraId) - return { - label: chain.name, - type: relay?.chainName - ? t("{{name}} Parachain", { name: relay?.chainName }) - : t("Parachain"), + const label = chain.name + const type = (() => { + if (chain.isTestnet) return t("Testnet") + if (chain.paraId) { + if (relay?.name) return t("{{name}} Parachain", { name: relay?.name }) + return t("Parachain") } - return { - label: chain.name, - type: (chain.parathreads || []).length > 0 ? t("Relay Chain") : t("Blockchain"), - } + return (chain.parathreads || []).length > 0 ? t("Relay Chain") : t("Blockchain") + })() + + return { label, type } } return { label: "", type: "" }