Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: quick fixes #1733

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading