1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +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 type = isShowOrMovie(item.tmdbFullId);
// const poster = await getPoster(tmdbId, type === "movie" ? TMDBContentTypes.MOVIE : TMDBContentTypes.TV); // const poster = await getPoster(tmdbId, type === "movie" ? TMDBContentTypes.MOVIE : TMDBContentTypes.TV);
const poster = ""; const poster = "";
console.log(poster);
const media: MediaItem = { const media: MediaItem = {
id: tmdbId, id: tmdbId,
title: item.title, title: item.title,

View file

@ -29,6 +29,7 @@ export function Layout(props: { children: ReactNode }) {
const [extensionState, setExtensionState] = const [extensionState, setExtensionState] =
useState<ExtensionStatus>("unknown"); useState<ExtensionStatus>("unknown");
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [isMobile, setIsMobile] = useState(false);
useEffect(() => { useEffect(() => {
let isMounted = true; 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 () => { return () => {
isMounted = false; isMounted = false;
mediaQuery.removeListener(handleResize);
}; };
}, []); }, []);
@ -53,9 +64,11 @@ export function Layout(props: { children: ReactNode }) {
return ( return (
<div> <div>
<div className="fixed inset-x-0 z-[1000]"> {!isMobile && (
<ExtensionBanner extensionState={extensionState} /> <div className="fixed inset-x-0 z-[1000]">
</div> <ExtensionBanner extensionState={extensionState} />
</div>
)}
<div <div
style={{ style={{
paddingTop: location === null ? `${bannerSize}px` : "0px", paddingTop: location === null ? `${bannerSize}px` : "0px",