Skip to content

Commit

Permalink
fix(suite): discovery buttons tooltip (trezor#11283)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvaclavik authored Feb 22, 2024
1 parent 444b665 commit 1fecb58
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/suite/src/components/suite/CoinList/CoinList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getFirmwareVersion, isDeviceInBootloaderMode } from '@trezor/device-uti
import { versionUtils } from '@trezor/utils';

import { Translation } from 'src/components/suite';
import { useDevice, useSelector } from 'src/hooks/suite';
import { useDevice, useDiscovery, useSelector } from 'src/hooks/suite';
import type { Network } from 'src/types/wallet';

import { Coin } from './Coin';
Expand Down Expand Up @@ -35,9 +35,11 @@ export const CoinList = ({
}: CoinListProps) => {
const { device, isLocked } = useDevice();
const blockchain = useSelector(state => state.wallet.blockchain);

const isDeviceLocked = !!device && isLocked();
const lockedTooltip = isDeviceLocked && 'TR_DISABLED_SWITCH_TOOLTIP';
const { isDiscoveryRunning } = useDiscovery();
const lockedTooltip = isDeviceLocked ? 'TR_DISABLED_SWITCH_TOOLTIP' : null;
const discoveryTooltip = isDiscoveryRunning ? 'TR_LOADING_ACCOUNTS' : null;

const deviceModelInternal = device?.features?.internal_model;
const isBootloaderMode = isDeviceInBootloaderMode(device);
const firmwareVersion = getFirmwareVersion(device);
Expand Down Expand Up @@ -70,7 +72,8 @@ export const CoinList = ({
!!unavailableReason &&
!isBootloaderMode &&
getCoinUnavailabilityMessage(unavailableReason);
const tooltipString = lockedTooltip || unavailabilityTooltip || tooltip;
const tooltipString =
discoveryTooltip || lockedTooltip || unavailabilityTooltip || tooltip;

const coinLabel = blockchain[symbol].backends.selected
? 'TR_CUSTOM_BACKEND'
Expand Down

0 comments on commit 1fecb58

Please sign in to comment.