Skip to content

Commit 62ced3e

Browse files
committed
Add top and bottom margin for mobile
1 parent 31718f1 commit 62ced3e

File tree

8 files changed

+54
-30
lines changed

8 files changed

+54
-30
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
android:roundIcon="@mipmap/ic_launcher_round"
99
android:supportsRtl="true"
1010
android:usesCleartextTraffic="true"
11+
android:fitsSystemWindows="true"
1112
android:theme="@style/AppTheme">
1213

1314
<activity

web/components/nav/bottom-nav-bar.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ export function BottomNavBar(props: {
3939

4040
return (
4141
<nav
42-
className="border-ink-200 dark:border-ink-300 text-ink-700 bg-canvas-50 fixed inset-x-0 bottom-0 z-50 flex select-none items-center justify-between border-t-2 text-xs lg:hidden sidebar-nav">
42+
className={clsx(
43+
"border-ink-200 dark:border-ink-300 text-ink-700 bg-canvas-50 fixed inset-x-0 bottom-0 z-50 flex select-none items-center justify-between border-t-2 text-xs lg:hidden sidebar-nav",
44+
'safe-bottom',
45+
)}
46+
>
4347
{navigationOptions.map((item) => (
4448
<NavBarItem
4549
key={item.name}

web/components/page-base.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import Sidebar from './nav/sidebar'
2424
import {useProfile} from 'web/hooks/use-profile'
2525
import {Profile} from 'common/profiles/profile'
2626
import {NotificationsIcon, SolidNotificationsIcon} from './notifications-icon'
27-
import {IS_MAINTENANCE} from "common/constants";
28-
import {MdThumbUp} from "react-icons/md";
29-
import {FaEnvelope} from "react-icons/fa";
27+
import {IS_MAINTENANCE} from "common/constants"
28+
import {MdThumbUp} from "react-icons/md"
29+
import {FaEnvelope} from "react-icons/fa"
3030

3131
export function PageBase(props: {
3232
trackPageView: string | false
@@ -106,20 +106,20 @@ export function PageBase(props: {
106106
)
107107
}
108108

109-
const Profiles = {name: 'Profiles', href: '/', icon: SolidHomeIcon};
110-
const ProfilesHome = {name: 'Profiles', href: '/', icon: HomeIcon};
111-
const faq = {name: 'FAQ', href: '/faq', icon: SolidQuestionIcon};
112-
const About = {name: 'About', href: '/about', icon: QuestionMarkCircleIcon};
113-
const Signin = {name: 'Sign in', href: '/signin', icon: UserCircleIcon};
114-
const Notifs = {name: 'Notifs', href: `/notifications`, icon: NotificationsIcon};
115-
const NotifsSolid = {name: 'Notifs', href: `/notifications`, icon: SolidNotificationsIcon};
116-
const Messages = {name: 'Messages', href: '/messages', icon: PrivateMessagesIcon};
117-
const Social = {name: 'Social', href: '/social', icon: LinkIcon};
118-
const Organization = {name: 'Organization', href: '/organization', icon: GlobeAltIcon};
119-
const Vote = {name: 'Vote', href: '/vote', icon: MdThumbUp};
120-
const Contact = {name: 'Contact', href: '/contact', icon: FaEnvelope};
121-
const News = {name: "What's new", href: '/news', icon: NewspaperIcon};
122-
const Settings = {name: "Settings", href: '/settings', icon: CogIcon};
109+
const Profiles = {name: 'Profiles', href: '/', icon: SolidHomeIcon}
110+
const ProfilesHome = {name: 'Profiles', href: '/', icon: HomeIcon}
111+
const faq = {name: 'FAQ', href: '/faq', icon: SolidQuestionIcon}
112+
const About = {name: 'About', href: '/about', icon: QuestionMarkCircleIcon}
113+
const Signin = {name: 'Sign in', href: '/signin', icon: UserCircleIcon}
114+
const Notifs = {name: 'Notifs', href: `/notifications`, icon: NotificationsIcon}
115+
const NotifsSolid = {name: 'Notifs', href: `/notifications`, icon: SolidNotificationsIcon}
116+
const Messages = {name: 'Messages', href: '/messages', icon: PrivateMessagesIcon}
117+
const Social = {name: 'Social', href: '/social', icon: LinkIcon}
118+
const Organization = {name: 'Organization', href: '/organization', icon: GlobeAltIcon}
119+
const Vote = {name: 'Vote', href: '/vote', icon: MdThumbUp}
120+
const Contact = {name: 'Contact', href: '/contact', icon: FaEnvelope}
121+
const News = {name: "What's new", href: '/news', icon: NewspaperIcon}
122+
const Settings = {name: "Settings", href: '/settings', icon: CogIcon}
123123

124124
const base = [
125125
About,

web/lib/firebase/users.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {safeLocalStorage} from '../util/local'
77
import {app} from './init'
88
import {GOOGLE_CLIENT_ID} from "common/constants";
99
import {REDIRECT_URI} from "common/envs/constants";
10+
import {isAndroidWebView} from "web/lib/util/webview";
1011

1112
dayjs.extend(utc)
1213

@@ -45,15 +46,6 @@ export function writeReferralInfo(
4546
}
4647
}
4748

48-
export function isAndroidWebView() {
49-
try {
50-
// Detect if Android bridge exists
51-
return typeof (window as any).AndroidBridge?.isNativeApp === 'function';
52-
} catch {
53-
return false;
54-
}
55-
}
56-
5749
async function generatePKCE() {
5850
const array = new Uint8Array(32);
5951
crypto.getRandomValues(array);

web/lib/util/webview.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export function isAndroidWebView() {
2+
try {
3+
// Detect if Android bridge exists
4+
return typeof (window as any).AndroidBridge?.isNativeApp === 'function';
5+
} catch {
6+
return false;
7+
}
8+
}

web/pages/_app.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import AndroidPush from "web/lib/service/android-push";
1515
import {unauthedApi} from "common/util/api";
1616
import {GoogleAuthProvider, signInWithCredential} from "firebase/auth";
1717
import {auth} from "web/lib/firebase/users";
18+
import {isAndroidWebView} from "web/lib/util/webview";
19+
1820

1921
// See https://nextjs.org/docs/basic-features/font-optimization#google-fonts
2022
// and if you add a font, you must add it to tailwind config as well for it to work.
@@ -52,6 +54,7 @@ function printBuildInfo() {
5254
type PageProps = { auth?: AuthUser }
5355

5456
function MyApp({Component, pageProps}: AppProps<PageProps>) {
57+
console.log('isAndroidWebView app:', isAndroidWebView())
5558
useEffect(printBuildInfo, [])
5659
useHasLoaded()
5760

@@ -147,7 +150,7 @@ function MyApp({Component, pageProps}: AppProps<PageProps>) {
147150
/>
148151
<meta
149152
name="viewport"
150-
content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no"
153+
content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no, viewport-fit=cover"
151154
/>
152155
</Head>
153156
<PostHogProvider client={posthog}>

web/pages/_document.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Head, Html, Main, NextScript} from 'next/document'
22
import {ENV_CONFIG, IS_DEPLOYED} from 'common/envs/constants'
33
import Script from 'next/script'
4+
import clsx from "clsx";
45

56
export default function Document() {
67
return (
@@ -40,7 +41,10 @@ export default function Document() {
4041
} catch(e){} })();`
4142
}}/>}
4243
</Head>
43-
<body className="body-bg text-ink-1000">
44+
<body className={clsx(
45+
"body-bg text-ink-1000",
46+
'app-content',
47+
)}>
4448
<Main/>
4549
<NextScript/>
4650
</body>

web/styles/globals.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,4 +448,16 @@ ol > li::marker {
448448
font-weight: 600;
449449
font-size: 1em;
450450
color: #374151; /* pick a visible color */
451-
}
451+
}
452+
453+
.app-content {
454+
padding-top: calc(env(safe-area-inset-top) + 30px);
455+
/*padding-bottom: env(safe-area-inset-bottom);*/
456+
box-sizing: border-box; /* ensure padding doesn’t break layout */
457+
}
458+
459+
.safe-bottom {
460+
/*bottom: env(safe-area-inset-bottom);*/
461+
bottom: calc(env(safe-area-inset-bottom) + 30px);
462+
}
463+

0 commit comments

Comments
 (0)