From e1e53aefd60ebaae06f47299e082cf94b4d26063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Sun, 23 Aug 2026 22:39:34 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=93=B1=20bottom=20sheet=20menu=20?= =?UTF-8?q?on=20phones,=20and=20keep=20the=20tab=20bar=20on=20messages=20-?= =?UTF-8?q?=20the=20side=20drawer=20is=20replaced=20by=20a=20sheet=20that?= =?UTF-8?q?=20rises=20from=20the=20bottom=20of=20the=20=20=20screen,=20whe?= =?UTF-8?q?re=20a=20thumb=20already=20is:=20grab=20handle,=20title=20row,?= =?UTF-8?q?=20grouped=20links=20=20=20with=20icon=20tiles,=20max-h-[75vh]?= =?UTF-8?q?=20scroll=20area,=20account=20block=20pinned=20below=20it=20-?= =?UTF-8?q?=20the=20sheet=20stays=20mounted=20and=20translates=20off-scree?= =?UTF-8?q?n=20when=20closed,=20so=20both=20=20=20opening=20and=20closing?= =?UTF-8?q?=20animate=20instead=20of=20snapping=20in=20one=20frame=20-=20t?= =?UTF-8?q?he=20tab=20bar=20hid=20on=20every=20wide()=20route,=20which=20s?= =?UTF-8?q?ilently=20took=20the=20bottom=20=20=20navigation=20away=20on=20?= =?UTF-8?q?/messages;=20only=20the=20exam=20room=20goes=20chrome-free=20no?= =?UTF-8?q?w=20-=20the=20content's=20bottom=20padding=20grew=20with=20the?= =?UTF-8?q?=20tab=20bar:=20it=20reserves=20the=20=20=20gesture-bar=20inset?= =?UTF-8?q?=20too,=20so=20the=20last=20card=20is=20no=20longer=20cut=20off?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/layout/app-shell.tsx | 44 ++----- src/components/layout/mobile-nav-sheet.tsx | 130 +++++++++++++++++++++ 2 files changed, 140 insertions(+), 34 deletions(-) create mode 100644 src/components/layout/mobile-nav-sheet.tsx diff --git a/src/components/layout/app-shell.tsx b/src/components/layout/app-shell.tsx index 34e131c..a5cd5dc 100644 --- a/src/components/layout/app-shell.tsx +++ b/src/components/layout/app-shell.tsx @@ -8,10 +8,11 @@ import { NavBar } from "@/components/layout/nav-bar"; import { NotificationCenter } from "@/components/layout/notification-center"; import { routeLabelKey } from "@/components/layout/nav-items"; import { ShellMessagesButton } from "@/components/layout/shell-messages-button"; +import { MobileNavSheet } from "@/components/layout/mobile-nav-sheet"; import { SideNav } from "@/components/layout/side-nav"; import { SidebarAccount } from "@/components/layout/sidebar-account"; import { Button } from "@/components/ui/button"; -import { IconChevronLeft, IconPanelLeft, IconSearch, IconSparkles, IconX } from "@/components/ui/icons"; +import { IconChevronLeft, IconPanelLeft, IconSearch, IconSparkles } from "@/components/ui/icons"; import { Toaster } from "@/components/ui/toast"; import { useAuth } from "@/stores/auth-context"; import { ShellFeedProvider } from "@/stores/shell-feed-context"; @@ -96,37 +97,12 @@ export function AppShell(props: ParentProps) { - -
- -
-
- setMobileOpen(false)} /> -
- - - + + setMobileOpen(false)} + onLogout={logout} + />
@@ -183,7 +159,7 @@ export function AppShell(props: ParentProps) {
@@ -193,7 +169,7 @@ export function AppShell(props: ParentProps) {
{/* MobileTabBar stays inside the provider — it is a shell surface, so a useShellFeed() badge there must not throw. */} - + setMobileOpen(true)} /> diff --git a/src/components/layout/mobile-nav-sheet.tsx b/src/components/layout/mobile-nav-sheet.tsx new file mode 100644 index 0000000..7b8347c --- /dev/null +++ b/src/components/layout/mobile-nav-sheet.tsx @@ -0,0 +1,130 @@ +import { For, Show } from "solid-js"; +import { Link, useRouterState } from "@tanstack/solid-router"; +import { routeNavItem, sidebarNavGroups, type NavItem } from "@/components/layout/nav-items"; +import { SidebarAccount } from "@/components/layout/sidebar-account"; +import { IconX } from "@/components/ui/icons"; +import { cn } from "@/lib/cn"; +import { useAuth } from "@/stores/auth-context"; +import { useShellFeed } from "@/stores/shell-feed-context"; +import { useT } from "@/stores/preferences-context"; + +/** + * The phone-sized navigation menu: a sheet that rises from the bottom of the + * screen, where a thumb already is, instead of the side drawer this replaces. + * + * It stays mounted and is moved off-screen when closed, so opening and closing + * both animate; a `` around it would make it appear and disappear in one + * frame. + */ +export function MobileNavSheet(props: { + open: boolean; + onClose: () => void; + onLogout: () => void | Promise; +}) { + const auth = useAuth(); + const t = useT(); + const feed = useShellFeed(); + const pathname = useRouterState({ select: (state) => state.location.pathname }); + + // The primary destinations are already one tap away in the tab bar, so the + // sheet lists everything else. + const groups = () => sidebarNavGroups(auth.user()?.role); + const current = () => routeNavItem(pathname(), auth.user()?.role); + const badgeFor = (item: NavItem) => (item.id === "messages" ? feed.unreadMessages().total : 0); + + return ( +
+ +
+ +
+ + {(group) => ( +
+

+ {t(group.labelKey)} +

+
+ + {(item) => { + const active = () => current()?.id === item.id; + return ( + + + + + + {t(item.labelKey)} + + 0}> + + {badgeFor(item) > 99 ? "99+" : badgeFor(item)} + + + + ); + }} + +
+
+ )} +
+
+ + + + + ); +}