Commit e7d5da6a authored by tom goriunov's avatar tom goriunov Committed by GitHub

Merge pull request #1485 from blockscout/fix-wallet-tooltip

Fix wallet tooltip
parents c0239eef 1143b411
...@@ -2,6 +2,8 @@ import { Tooltip, useBoolean, useOutsideClick } from '@chakra-ui/react'; ...@@ -2,6 +2,8 @@ import { Tooltip, useBoolean, useOutsideClick } from '@chakra-ui/react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
import { SECOND } from 'lib/consts';
type Props = { type Props = {
children: React.ReactNode; children: React.ReactNode;
isDisabled?: boolean; isDisabled?: boolean;
...@@ -26,12 +28,15 @@ const WalletTooltip = ({ children, isDisabled, isMobile }: Props) => { ...@@ -26,12 +28,15 @@ const WalletTooltip = ({ children, isDisabled, isMobile }: Props) => {
React.useEffect(() => { React.useEffect(() => {
const wasShown = window.localStorage.getItem(localStorageKey); const wasShown = window.localStorage.getItem(localStorageKey);
if (!isDisabled && !wasShown) { const isMarketplacePage = [ '/apps', '/apps/[id]' ].includes(router.pathname);
setIsTooltipShown.on(); if (!isDisabled && !wasShown && isMarketplacePage) {
window.localStorage.setItem(localStorageKey, 'true'); setTimeout(() => {
setTimeout(() => setIsTooltipShown.off(), 3000); setIsTooltipShown.on();
window.localStorage.setItem(localStorageKey, 'true');
setTimeout(() => setIsTooltipShown.off(), 5 * SECOND);
}, SECOND);
} }
}, [ setIsTooltipShown, localStorageKey, isDisabled ]); }, [ setIsTooltipShown, localStorageKey, isDisabled, router.pathname ]);
return ( return (
<Tooltip <Tooltip
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment