Skip to content

Commit 6a19dea

Browse files
Merge pull request #19 from Juliusolsson05/fix/mobile-ui
fix: improve mobile shell sizing and signal embeds
2 parents b3fa4c7 + 1b8893a commit 6a19dea

5 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/app/(dashboard)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function DashboardShellLayout({ children }: { children: React.Rea
55
return (
66
<>
77
<ViewportHeightSync />
8-
<div className="flex flex-col min-h-0 overflow-hidden" style={{ height: 'var(--app-height)' }}>
8+
<div className="flex flex-col min-h-0 overflow-hidden" style={{ height: 'var(--app-shell-height)' }}>
99
<Header />
1010
<div className="flex flex-1 min-h-0 overflow-hidden pb-[var(--safe-bottom)]">
1111
{children}

src/app/browse/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function BrowseLayout({ children }: { children: React.ReactNode }
88
<div
99
data-theme="auto"
1010
className="flex flex-col min-h-0 overflow-hidden bg-[var(--bg-app)]"
11-
style={{ height: 'var(--app-height)' }}
11+
style={{ height: 'var(--app-shell-height)' }}
1212
>
1313
<BrowseShell>{children}</BrowseShell>
1414
</div>

src/app/globals.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
:root {
88
--app-height: 100vh;
9+
--app-height-mobile: 100vh;
10+
--app-shell-height: var(--app-height);
911
--safe-top: env(safe-area-inset-top, 0px);
1012
--safe-right: env(safe-area-inset-right, 0px);
1113
--safe-bottom: env(safe-area-inset-bottom, 0px);
@@ -142,7 +144,11 @@
142144
html, body { height: 100%; }
143145

144146
@supports (height: 100dvh) {
145-
:root { --app-height: 100dvh; }
147+
:root {
148+
--app-height: 100dvh;
149+
--app-height-mobile: 100dvh;
150+
--app-shell-height: 100dvh;
151+
}
146152
}
147153

148154
body {

src/shared/components/layout/ViewportHeightSync.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ import { useEffect } from 'react';
55
function updateAppHeightVar() {
66
if (typeof document === 'undefined' || typeof window === 'undefined') return;
77
const vv = window.visualViewport;
8+
const isCoarsePointer = window.matchMedia('(pointer: coarse)').matches;
89
// When pinch-zoomed (scale > 1), visualViewport.height shrinks — use innerHeight instead
910
const vh = vv && vv.scale <= 1 ? vv.height : window.innerHeight;
11+
const mobileVh = vv?.height ?? window.innerHeight;
12+
const shellVh = isCoarsePointer ? mobileVh : vh;
1013
document.documentElement.style.setProperty('--app-height', `${Math.round(vh)}px`);
14+
document.documentElement.style.setProperty('--app-height-mobile', `${Math.round(mobileVh)}px`);
15+
document.documentElement.style.setProperty('--app-shell-height', `${Math.round(shellVh)}px`);
1116
}
1217

1318
export function ViewportHeightSync() {
@@ -30,4 +35,3 @@ export function ViewportHeightSync() {
3035

3136
return null;
3237
}
33-

src/shared/components/shared/XPostCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ export function XPostCard({ post, compact }: Props) {
2020
<div className="card mb-2" style={{ borderLeft: `3px solid ${border}` }}>
2121

2222
{hasEmbed ? (
23-
<div className="grid grid-cols-[1fr_1fr] min-h-0 min-w-0 overflow-hidden">
23+
<div className="grid h-[min(78vh,760px)] min-h-[640px] min-w-0 grid-cols-1 grid-rows-[minmax(0,1fr)_minmax(0,1fr)] overflow-hidden lg:h-auto lg:min-h-0 lg:grid-cols-[1fr_1fr] lg:grid-rows-1">
2424
<div
2525
data-theme="dark"
26-
className="border-r border-[var(--bd-s)] px-1 py-2 [&_>_div]:!my-0 overflow-hidden"
26+
className="min-h-0 overflow-y-auto border-b border-[var(--bd-s)] px-1 py-2 [&_>_div]:!my-0 lg:border-r lg:border-b-0"
2727
>
2828
<div className="flex items-center gap-1 px-2 pb-1.5">
2929
<span className="mono text-[8px] text-[var(--t4)] tracking-[0.08em]">ORIGINAL</span>
@@ -33,7 +33,7 @@ export function XPostCard({ post, compact }: Props) {
3333
</Suspense>
3434
</div>
3535

36-
<div className="flex min-w-0 flex-col overflow-hidden">
36+
<div className="flex min-h-0 min-w-0 flex-col overflow-y-auto">
3737
<div className="flex items-center gap-1 px-3 py-1.5">
3838
<span className="mono text-[8px] text-[var(--blue-l)] tracking-[0.08em]">PHAROS INTEL</span>
3939
</div>

0 commit comments

Comments
 (0)