mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Polish for prod
This commit is contained in:
parent
075ec651b0
commit
c33ba14d63
2 changed files with 2 additions and 21 deletions
|
@ -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<ExtensionStatus> {
|
||||
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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue