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";
|
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 {
|
function detectSavePlatform(): SavePlatform {
|
||||||
if (typeof navigator === "undefined") return "desktop";
|
if (typeof navigator === "undefined") return "desktop";
|
||||||
const ua = navigator.userAgent || "";
|
const ua = navigator.userAgent || "";
|
||||||
@@ -92,6 +99,7 @@ export function SaveToAlbumGuideProvider({
|
|||||||
const platform = useMemo(() => detectSavePlatform(), []);
|
const platform = useMemo(() => detectSavePlatform(), []);
|
||||||
|
|
||||||
const showSaveToAlbumGuide = useCallback((kind: SaveToAlbumMediaKind) => {
|
const showSaveToAlbumGuide = useCallback((kind: SaveToAlbumMediaKind) => {
|
||||||
|
if (!shouldShowSaveAlbumGuide()) return;
|
||||||
setMediaKind(kind);
|
setMediaKind(kind);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user