fix: show save guide on mobile only
All checks were successful
Deploy to Frontend Servers / deploy (push) Successful in 27s
All checks were successful
Deploy to Frontend Servers / deploy (push) Successful in 27s
This commit is contained in:
@@ -53,6 +53,13 @@ export function mediaSaveKindFromType(
|
||||
|
||||
type SavePlatform = "ios" | "android" | "desktop";
|
||||
|
||||
const saveAlbumGuideMobileMediaQuery = "(max-width: 760px)";
|
||||
|
||||
function shouldShowSaveAlbumGuide(): boolean {
|
||||
if (typeof window === "undefined" || !window.matchMedia) return false;
|
||||
return window.matchMedia(saveAlbumGuideMobileMediaQuery).matches;
|
||||
}
|
||||
|
||||
function detectSavePlatform(): SavePlatform {
|
||||
if (typeof navigator === "undefined") return "desktop";
|
||||
const ua = navigator.userAgent || "";
|
||||
@@ -92,6 +99,7 @@ export function SaveToAlbumGuideProvider({
|
||||
const platform = useMemo(() => detectSavePlatform(), []);
|
||||
|
||||
const showSaveToAlbumGuide = useCallback((kind: SaveToAlbumMediaKind) => {
|
||||
if (!shouldShowSaveAlbumGuide()) return;
|
||||
setMediaKind(kind);
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user