diff --git a/packages/app/src/systems/Account/components/QuickAccountConnect/QuickAccountConnect.tsx b/packages/app/src/systems/Account/components/QuickAccountConnect/QuickAccountConnect.tsx index 7adffda6c..60be71067 100644 --- a/packages/app/src/systems/Account/components/QuickAccountConnect/QuickAccountConnect.tsx +++ b/packages/app/src/systems/Account/components/QuickAccountConnect/QuickAccountConnect.tsx @@ -1,5 +1,5 @@ import { cssObj } from '@fuel-ui/css'; -import { Avatar, Box, ContentLoader, Tooltip } from '@fuel-ui/react'; +import { Box, ContentLoader, Tooltip } from '@fuel-ui/react'; import { useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; import { useCurrentTab } from '~/systems/CRX/hooks/useCurrentTab'; @@ -18,8 +18,8 @@ export const QuickAccountConnect = () => { const navigate = useNavigate(); const { account } = useCurrentAccount(); - const { url } = useCurrentTab(); - const { connection } = useConnection({ url }); + const { currentTab } = useCurrentTab(); + const { connection } = useConnection({ url: currentTab?.url }); const status = useMemo(() => { if (!account || !connection) { @@ -57,7 +57,9 @@ export const QuickAccountConnect = () => { { + if (!connection) return; navigate( Pages.settingsConnectedApps(undefined, { origin: connection?.origin, @@ -68,8 +70,8 @@ export const QuickAccountConnect = () => { > @@ -85,9 +87,15 @@ const styles = { root: cssObj({ position: 'relative', display: 'inline-block', - cursor: 'pointer', width: 24, height: 24, + + '&[data-has-connection="true"]': { + cursor: 'pointer', + }, + '&[data-has-connection="false"]': { + cursor: 'default', + }, }), favicon: cssObj({ display: 'flex', diff --git a/packages/app/src/systems/CRX/hooks/useCurrentTab.ts b/packages/app/src/systems/CRX/hooks/useCurrentTab.ts index 2989be8c6..c5959e224 100644 --- a/packages/app/src/systems/CRX/hooks/useCurrentTab.ts +++ b/packages/app/src/systems/CRX/hooks/useCurrentTab.ts @@ -1,18 +1,28 @@ import { useEffect, useState } from 'react'; +interface CurrentTab { + url: string | undefined; + title: string | undefined; + faviconUrl: string | undefined; +} + export function useCurrentTab() { - const [url, setUrl] = useState(); + const [currentTab, setCurrentTab] = useState(); useEffect(() => { if (!chrome?.tabs) return; chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { const currentTab = tabs[0]; - setUrl(currentTab?.url); + setCurrentTab({ + url: currentTab?.url, + title: currentTab?.title, + faviconUrl: currentTab?.favIconUrl, + }); }); }, []); return { - url, + currentTab, }; }