1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

Polish for prod

This commit is contained in:
Cooper Ransom 2024-03-26 21:52:05 -04:00
parent 075ec651b0
commit c33ba14d63
2 changed files with 2 additions and 21 deletions

View file

@ -1,28 +1,9 @@
import { ReactNode, useEffect, useState } from "react"; import { ReactNode, useEffect, useState } from "react";
import { isAllowedExtensionVersion } from "@/backend/extension/compatibility";
import { extensionInfo } from "@/backend/extension/messaging";
import { useIsMobile } from "@/hooks/useIsMobile"; import { useIsMobile } from "@/hooks/useIsMobile";
import { useBannerSize, useBannerStore } from "@/stores/banner"; import { useBannerSize, useBannerStore } from "@/stores/banner";
import { ExtensionBanner } from "@/stores/banner/BannerLocation"; import { ExtensionBanner } from "@/stores/banner/BannerLocation";
import { ExtensionStatus, getExtensionState } from "@/utils/onboarding";
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
}
export function Layout(props: { children: ReactNode }) { export function Layout(props: { children: ReactNode }) {
const bannerSize = useBannerSize(); const bannerSize = useBannerSize();

View file

@ -3,8 +3,8 @@ import { Trans, useTranslation } from "react-i18next";
import { useLocation, useNavigate } from "react-router-dom"; import { useLocation, useNavigate } from "react-router-dom";
import { Icon, Icons } from "@/components/Icon"; import { Icon, Icons } from "@/components/Icon";
import { ExtensionStatus } from "@/setup/Layout";
import { useBannerStore, useRegisterBanner } from "@/stores/banner"; import { useBannerStore, useRegisterBanner } from "@/stores/banner";
import type { ExtensionStatus } from "@/utils/onboarding";
export function Banner(props: { export function Banner(props: {
children: React.ReactNode; children: React.ReactNode;