diff --git a/src/setup/Layout.tsx b/src/setup/Layout.tsx index 66372346..3c6c22ea 100644 --- a/src/setup/Layout.tsx +++ b/src/setup/Layout.tsx @@ -1,28 +1,9 @@ import { ReactNode, useEffect, useState } from "react"; -import { isAllowedExtensionVersion } from "@/backend/extension/compatibility"; -import { extensionInfo } from "@/backend/extension/messaging"; import { useIsMobile } from "@/hooks/useIsMobile"; import { useBannerSize, useBannerStore } from "@/stores/banner"; import { ExtensionBanner } from "@/stores/banner/BannerLocation"; - -export type ExtensionStatus = - | "unknown" - | "failed" - | "disallowed" - | "noperms" - | "outdated" - | "success"; - -async function getExtensionState(): Promise { - const info = await extensionInfo(); - if (!info) return "unknown"; // cant talk to extension - if (!info.success) return "failed"; // extension failed to respond - if (!info.allowed) return "disallowed"; // extension is not enabled on this page - if (!info.hasPermission) return "noperms"; // extension has no perms to do it's tasks - if (!isAllowedExtensionVersion(info.version)) return "outdated"; // extension is too old - return "success"; // no problems -} +import { ExtensionStatus, getExtensionState } from "@/utils/onboarding"; export function Layout(props: { children: ReactNode }) { const bannerSize = useBannerSize(); diff --git a/src/stores/banner/BannerLocation.tsx b/src/stores/banner/BannerLocation.tsx index e4549ca8..0c784dba 100644 --- a/src/stores/banner/BannerLocation.tsx +++ b/src/stores/banner/BannerLocation.tsx @@ -3,8 +3,8 @@ import { Trans, useTranslation } from "react-i18next"; import { useLocation, useNavigate } from "react-router-dom"; import { Icon, Icons } from "@/components/Icon"; -import { ExtensionStatus } from "@/setup/Layout"; import { useBannerStore, useRegisterBanner } from "@/stores/banner"; +import type { ExtensionStatus } from "@/utils/onboarding"; export function Banner(props: { children: React.ReactNode;