Skip to content

Commit

Permalink
fix: quick fixes (#1733)
Browse files Browse the repository at this point in the history
* fix: include non-rounded amount in data-amount attribute of <Tokens />

* fix: use `relay?.name` instead of `relay?.chainName` in network info rows
  • Loading branch information
alecdwm authored Dec 10, 2024
1 parent cbf7497 commit 9880d9f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
15 changes: 7 additions & 8 deletions apps/extension/src/ui/domains/Asset/Tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ export const Tokens: FC<TokensProps> = ({
const { refReveal, isRevealable, isRevealed, isHidden, effectiveNoCountUp } =
useRevealableBalance(isBalance, noCountUp)

const tooltip = useMemo(
const tooltipAmount = useMemo(
() =>
noTooltip
? null
: `${formatDecimals(amount, decimals ?? MAX_DECIMALS_FORMAT, { notation: "standard" })} ${
symbol ?? ""
}`.trim(),
[amount, decimals, noTooltip, symbol],
`${formatDecimals(amount, decimals ?? MAX_DECIMALS_FORMAT, { notation: "standard" })} ${
symbol ?? ""
}`.trim(),
[amount, decimals, symbol],
)
const tooltip = useMemo(() => (noTooltip ? null : tooltipAmount), [noTooltip, tooltipAmount])

const render = amount !== null && amount !== undefined

Expand All @@ -92,7 +91,7 @@ export const Tokens: FC<TokensProps> = ({
{render && (
<Tooltip placement="bottom-end">
<TooltipTrigger asChild>
<span>
<span data-amount={tooltipAmount}>
<DisplayValue
amount={isHidden ? 0 : amount}
symbol={symbol}
Expand Down
30 changes: 14 additions & 16 deletions apps/extension/src/ui/hooks/useNetworkInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: "" }
Expand Down

0 comments on commit 9880d9f

Please sign in to comment.