2026-04-29 14:16:30 +02:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { useState, type ReactNode } from 'react';
|
|
|
|
|
|
2026-05-01 16:34:28 +02:00
|
|
|
import { cn } from '@/lib/utils';
|
2026-04-29 14:16:30 +02:00
|
|
|
import { MobileLayoutProvider } from './mobile-layout-provider';
|
|
|
|
|
import { MobileTopbar } from './mobile-topbar';
|
|
|
|
|
import { MobileBottomTabs } from './mobile-bottom-tabs';
|
|
|
|
|
import { MoreSheet } from './more-sheet';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Mobile shell: fixed compact topbar + scrollable content + fixed bottom tab
|
2026-05-04 22:57:01 +02:00
|
|
|
* bar. Renders only when CSS reveals it (data-shell="mobile") - both shells
|
2026-04-29 14:16:30 +02:00
|
|
|
* are in the DOM, see src/app/globals.css. The bottom tabs and More sheet
|
|
|
|
|
* derive the active port slug from the URL themselves, so this layout takes
|
|
|
|
|
* no portSlug prop.
|
|
|
|
|
*/
|
|
|
|
|
export function MobileLayout({ children }: { children: ReactNode }) {
|
|
|
|
|
const [moreOpen, setMoreOpen] = useState(false);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div data-shell="mobile" className="min-h-screen bg-background">
|
|
|
|
|
<MobileLayoutProvider>
|
|
|
|
|
<MobileTopbar />
|
2026-05-01 16:34:28 +02:00
|
|
|
<main
|
|
|
|
|
className={cn(
|
|
|
|
|
'px-4 min-h-screen',
|
|
|
|
|
// 56px topbar + safe-area + 16px breathing room
|
|
|
|
|
'pt-[calc(56px+env(safe-area-inset-top)+1rem)]',
|
|
|
|
|
// 56px tab bar + safe-area + 32px breathing room
|
|
|
|
|
'pb-[calc(56px+env(safe-area-inset-bottom)+2rem)]',
|
|
|
|
|
)}
|
|
|
|
|
>
|
2026-04-29 14:16:30 +02:00
|
|
|
{children}
|
|
|
|
|
</main>
|
|
|
|
|
<MobileBottomTabs onMoreClick={() => setMoreOpen(true)} />
|
|
|
|
|
<MoreSheet open={moreOpen} onOpenChange={setMoreOpen} />
|
|
|
|
|
</MobileLayoutProvider>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|