1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-29 16:07:40 +01:00

Dont show extension banner on mobile

This commit is contained in:
Cooper Ransom 2024-03-17 16:28:53 -04:00
parent 78451f8a0e
commit e9efe50ce0
2 changed files with 17 additions and 3 deletions

View file

@ -182,6 +182,7 @@ export function TopFlix() {
const type = isShowOrMovie(item.tmdbFullId);
// const poster = await getPoster(tmdbId, type === "movie" ? TMDBContentTypes.MOVIE : TMDBContentTypes.TV);
const poster = "";
console.log(poster);
const media: MediaItem = {
id: tmdbId,
title: item.title,

View file

@ -29,6 +29,7 @@ export function Layout(props: { children: ReactNode }) {
const [extensionState, setExtensionState] =
useState<ExtensionStatus>("unknown");
const [loading, setLoading] = useState(true);
const [isMobile, setIsMobile] = useState(false);
useEffect(() => {
let isMounted = true;
@ -40,8 +41,18 @@ export function Layout(props: { children: ReactNode }) {
}
});
const mediaQuery = window.matchMedia("(max-width: 768px)"); // Adjust the max-width as per your needs
setIsMobile(mediaQuery.matches);
const handleResize = () => {
setIsMobile(mediaQuery.matches);
};
mediaQuery.addListener(handleResize);
return () => {
isMounted = false;
mediaQuery.removeListener(handleResize);
};
}, []);
@ -53,9 +64,11 @@ export function Layout(props: { children: ReactNode }) {
return (
<div>
{!isMobile && (
<div className="fixed inset-x-0 z-[1000]">
<ExtensionBanner extensionState={extensionState} />
</div>
)}
<div
style={{
paddingTop: location === null ? `${bannerSize}px` : "0px",