mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Try fixing jank extensionBanner flow
This commit is contained in:
parent
366251e143
commit
6e478fd37e
2 changed files with 5 additions and 3 deletions
|
@ -29,11 +29,11 @@ export function Layout(props: { children: ReactNode }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{extensionState !== "success" && !isMobile && (
|
{extensionState !== "success" ? (
|
||||||
<div className="fixed inset-x-0 z-[1000]">
|
<div className="fixed inset-x-0 z-[1000]">
|
||||||
<ExtensionBanner extensionState={extensionState} />
|
<ExtensionBanner extensionState={extensionState} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
) : null}
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
paddingTop: location === null ? `${bannerSize}px` : "0px",
|
paddingTop: location === null ? `${bannerSize}px` : "0px",
|
||||||
|
|
|
@ -3,6 +3,7 @@ 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 { useIsMobile } from "@/hooks/useIsMobile";
|
||||||
import { useBannerStore, useRegisterBanner } from "@/stores/banner";
|
import { useBannerStore, useRegisterBanner } from "@/stores/banner";
|
||||||
import type { ExtensionStatus } from "@/utils/extension";
|
import type { ExtensionStatus } from "@/utils/extension";
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ export function ExtensionBanner(props: {
|
||||||
/CrOS/.test(navigator.userAgent) ||
|
/CrOS/.test(navigator.userAgent) ||
|
||||||
/TV/.test(navigator.userAgent) ||
|
/TV/.test(navigator.userAgent) ||
|
||||||
/iPhone|iPad|iPod/i.test(navigator.userAgent);
|
/iPhone|iPad|iPod/i.test(navigator.userAgent);
|
||||||
|
const { isMobile } = useIsMobile();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loc) {
|
if (loc) {
|
||||||
|
@ -88,7 +90,7 @@ export function ExtensionBanner(props: {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Show the banner with a 36.5% chance or not if users dont meet requirements
|
// Show the banner with a 36.5% chance or not if users dont meet requirements
|
||||||
if (!isEligible && Math.random() < 0.365) {
|
if (!isEligible && !isMobile && Math.random() < 0.365) {
|
||||||
let bannerText = "";
|
let bannerText = "";
|
||||||
switch (props.extensionState) {
|
switch (props.extensionState) {
|
||||||
case "noperms":
|
case "noperms":
|
||||||
|
|
Loading…
Reference in a new issue