diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index a08f91d2..06c348b8 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -201,7 +201,8 @@ "logout": "Log out", "register": "Sync to sudo-cloud", "settings": "Settings", - "support": "Support" + "support": "Support", + "discover": "Discover" } }, "notFound": { diff --git a/src/components/LinksDropdown.tsx b/src/components/LinksDropdown.tsx index a40f5083..0fb0957e 100644 --- a/src/components/LinksDropdown.tsx +++ b/src/components/LinksDropdown.tsx @@ -142,6 +142,9 @@ export function LinksDropdown(props: { children: React.ReactNode }) { {t("navigation.menu.about")} + + {t("navigation.menu.discover")} + {deviceName ? ( + diff --git a/src/pages/Discover.tsx b/src/pages/Discover.tsx index c4233241..f6f9fcf5 100644 --- a/src/pages/Discover.tsx +++ b/src/pages/Discover.tsx @@ -275,34 +275,32 @@ export function Discover() { }`, ) } - className="text-center relative mt-3 ml-[0.285em] mb-3 mr-[0.2em]" + className="text-center relative mt-3 ml-[0.285em] mb-3 mr-[0.2em] transition-transform hover:scale-105 duration-[0.45s]" style={{ flex: `0 0 ${movieWidth}` }} // Set a fixed width for each movie > -
- - - failed to fetch :( -

- {isTVShow - ? (media.name?.length ?? 0) > 32 - ? `${media.name?.slice(0, 32)}...` - : media.name - : (media.title?.length ?? 0) > 32 - ? `${media.title?.slice(0, 32)}...` - : media.title} -

-
-
+ + + failed to fetch :( +

+ {isTVShow + ? (media.name?.length ?? 0) > 32 + ? `${media.name?.slice(0, 32)}...` + : media.name + : (media.title?.length ?? 0) > 32 + ? `${media.title?.slice(0, 32)}...` + : media.title} +

+
))} diff --git a/src/setup/Layout.tsx b/src/setup/Layout.tsx index 82c4ae8f..3c0d404b 100644 --- a/src/setup/Layout.tsx +++ b/src/setup/Layout.tsx @@ -1,39 +1,13 @@ -import { ReactNode, useEffect, useState } from "react"; +import { ReactNode } from "react"; import { useBannerSize, useBannerStore } from "@/stores/banner"; -import { ExtensionBanner } from "@/stores/banner/BannerLocation"; -import { getExtensionState } from "@/utils/extension"; -import type { ExtensionStatus } from "@/utils/extension"; export function Layout(props: { children: ReactNode }) { const bannerSize = useBannerSize(); const location = useBannerStore((s) => s.location); - const [extensionState, setExtensionState] = - useState("unknown"); - const [storeLoaded, setStoreLoaded] = useState(false); - - useEffect(() => { - let isMounted = true; - - getExtensionState().then((state) => { - if (isMounted) { - setExtensionState(state); - setStoreLoaded(true); - } - }); - - return () => { - isMounted = false; - }; - }, []); return (
- {storeLoaded && extensionState !== "success" ? ( -
- -
- ) : null}
s.setLocation); - const currentLocation = useBannerStore((s) => s.location); - const loc = props.location ?? null; - const { pathname } = useLocation(); - const isEligible = !( - /CrOS/.test(navigator.userAgent) || - /TV/.test(navigator.userAgent) || - /iPhone|iPad|iPod/i.test(navigator.userAgent) - ); - - useEffect(() => { - if (loc) { - setLocation(loc); - return () => { - setLocation(null); - }; - } - }, [setLocation, loc]); - - const hideBannerFlag = sessionStorage.getItem("hideBanner"); - if (hideBannerFlag) { - return null; - } - - if (currentLocation !== loc || pathname === "/onboarding/extension") - return null; - - // Show the banner with a 36.5% chance or not if users don't meet requirements - if (isEligible && Math.random() < 0.365) { - let bannerText = ""; - switch (props.extensionState) { - case "noperms": - bannerText = "The extension does'nt have the necessary permissions."; - break; - case "outdated": - bannerText = - "Your extension is outdated. Please update it here."; - break; - case "disallowed": - bannerText = - "The extension is not enabled, click here to fix it."; - break; - case "failed": - bannerText = - "The extension is broken... Please click here."; - break; - default: - bannerText = - "You don't have the extension! Download it here for better quality."; - break; - } - - return ( - -
navigate("/onboarding/extension")} - style={{ cursor: "pointer" }} - > - , - }} - /> -
-
- ); - } - return null; -} - export function BannerLocation(props: { location?: string }) { const { t } = useTranslation(); const isOnline = useBannerStore((s) => s.isOnline);