Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Improve PWA look and feel on ios

fzaninottoe89ffd81cede
diff --git a/index.html b/index.html
index 9f8405ed..bfcff56b 100644
--- a/index.html
+++ b/index.html
@@ -4,9 +4,12 @@
<meta charset="utf-8" />
<meta
name="viewport"
- content="minimum-scale=1, initial-scale=1, width=device-width"
+ content="minimum-scale=1, initial-scale=1, width=device-width, viewport-fit=cover"
/>
<meta name="theme-color" content="#000000" />
+ <meta name="mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link rel="manifest" href="./manifest.json" />
<link rel="shortcut icon" href="./favicon.ico" />
<title>Atomic CRM</title>
diff --git a/src/components/atomic-crm/layout/MobileNavigation.tsx b/src/components/atomic-crm/layout/MobileNavigation.tsx
index bcc4ab54..ac558e94 100644
--- a/src/components/atomic-crm/layout/MobileNavigation.tsx
+++ b/src/components/atomic-crm/layout/MobileNavigation.tsx
@@ -46,10 +46,24 @@ export const MobileNavigation = () => {
currentPath = false;
}
+ // Check if the app is running as a PWA (standalone mode)
+ const isPwa = window.matchMedia("(display-mode: standalone)").matches;
+ // Check if it's iOS on the web
+ const isWebiOS = /iPad|iPod|iPhone/.test(window.navigator.userAgent);
+
return (
<nav
aria-label="CRM navigation"
className="fixed bottom-0 left-0 right-0 z-50 bg-secondary h-14"
+ style={{
+ // iOS bug: even though viewport is set correctly, the bottom safe area inset is not accounted for
+ // So we manually add some padding to avoid the navigation being too close to the home bar
+ paddingBottom: isPwa && isWebiOS ? 15 : undefined,
+ // We use box-sizing: border-box, so the height contains the padding.
+ // To actually increase the padding, we need to increase the height as well
+ height:
+ "calc(var(--spacing)) * 6" + (isPwa && isWebiOS ? " + 15px" : ""),
+ }}
>
<div className="flex justify-center">
<>