fix(web): give phones a bottom navigation bar instead of the rail (UF-057)

At 375px the 64px icon rail took a fifth of the screen and Home's heading
wrapped over five lines. Below sm the rail hides, a bottom bar carries the
five places plus More (⌘K), and Home tightens its padding and heading.
This commit is contained in:
shumeiko.it
2026-10-27 14:36:35 +01:00
parent 5bf3dd9ea8
commit 3ae3cc81fc
7 changed files with 169 additions and 12 deletions

View File

@@ -22,6 +22,7 @@ import BootScreen from './BootScreen';
import StatusBar from './StatusBar'; import StatusBar from './StatusBar';
import RouteTransition from './RouteTransition'; import RouteTransition from './RouteTransition';
import Sidebar, { type SidebarNavItem } from './Sidebar'; import Sidebar, { type SidebarNavItem } from './Sidebar';
import MobileNav from './MobileNav';
import AppErrorBoundary from './ErrorBoundary'; import AppErrorBoundary from './ErrorBoundary';
import { adapter } from '@/lib/adapter'; import { adapter } from '@/lib/adapter';
import { pickUserName } from '@/lib/user-name'; import { pickUserName } from '@/lib/user-name';
@@ -473,7 +474,9 @@ const ShellLayout = () => {
unreadNotifications={unreadCount} unreadNotifications={unreadCount}
onSearchClick={() => ov.setShowGlobalSearch(true)} onNotificationClick={ov.toggleNotifications} /> onSearchClick={() => ov.setShowGlobalSearch(true)} onNotificationClick={ov.toggleNotifications} />
<div className="absolute inset-x-0 top-8 bottom-0 flex"> {/* Below sm the bottom bar (MobileNav, 56px plus the safe-area inset)
replaces the rail, so the canvas stops above it. */}
<div className="absolute inset-x-0 top-8 bottom-[calc(3.5rem+env(safe-area-inset-bottom))] flex sm:bottom-0">
{/* Warm-Hive calm spine (ia.html) — five places + workspace pill + {/* Warm-Hive calm spine (ia.html) — five places + workspace pill +
⌘K tile + user row; all remaining depth lives in ⌘K. */} ⌘K tile + user row; all remaining depth lives in ⌘K. */}
<Sidebar <Sidebar
@@ -502,6 +505,7 @@ const ShellLayout = () => {
<RouteTransition /> <RouteTransition />
</main> </main>
</div> </div>
<MobileNav spine={spine} onOpenCommand={() => ov.setShowGlobalSearch(true)} />
{/* Overlays — Desktop.tsx:569-663 relocated; handlers retarget to {/* Overlays — Desktop.tsx:569-663 relocated; handlers retarget to
navigate() per §1.2 / §2.2. */} navigate() per §1.2 / §2.2. */}

View File

@@ -0,0 +1,72 @@
import { useLocation, useNavigate } from "react-router-dom";
import { Search } from "lucide-react";
import { isNavItemActive } from "@/lib/nav-items";
import type { SidebarNavItem } from "./Sidebar";
interface MobileNavProps {
spine: SidebarNavItem[];
onOpenCommand: () => void;
}
/**
* Phone-width navigation (below sm). The sidebar rail would take a fifth of a
* 375px screen, so the five everyday places sit in a bottom bar instead and
* "More" opens ⌘K, which reaches everything else: workspaces, settings, a new
* agent. AppShell reserves the bar's height so it never covers content.
*/
const MobileNav = ({ spine, onOpenCommand }: MobileNavProps) => {
const navigate = useNavigate();
const { pathname } = useLocation();
const itemClass =
"relative flex min-h-[56px] min-w-0 flex-col items-center justify-center gap-1 px-1 text-[10.5px] transition-colors";
return (
<nav
aria-label="Primary"
data-testid="mobile-nav"
className="fixed inset-x-0 bottom-0 z-20 grid border-t border-[var(--line-soft)] bg-[var(--bg-2)] pb-[env(safe-area-inset-bottom)] sm:hidden"
style={{ gridTemplateColumns: `repeat(${spine.length + 1}, minmax(0, 1fr))` }}
>
{spine.map((item) => {
const active = isNavItemActive(item, pathname);
const Icon = item.icon;
return (
<button
key={item.key}
type="button"
data-testid={`mobile-nav-${item.key}`}
aria-current={active ? "page" : undefined}
onClick={() => (item.onClick ? item.onClick() : navigate(item.to))}
className={`${itemClass} ${
active ? "font-semibold text-[var(--text)]" : "font-medium text-[var(--text-2)]"
}`}
>
<Icon
className={`h-5 w-5 shrink-0 ${active ? "text-[var(--attention)]" : ""}`}
strokeWidth={1.7}
aria-hidden
/>
<span className="max-w-full truncate">{item.label}</span>
{!!item.badge && item.badge > 0 && (
<span className="absolute left-1/2 top-1.5 ml-2 rounded-full bg-[var(--honey-wash)] px-1.5 font-mono text-[10px] leading-4 text-[var(--attention)]">
{item.badge > 99 ? "99+" : item.badge}
</span>
)}
</button>
);
})}
<button
type="button"
data-testid="mobile-nav-more"
aria-label="More: search and commands"
onClick={onOpenCommand}
className={`${itemClass} font-medium text-[var(--text-2)]`}
>
<Search className="h-5 w-5 shrink-0" strokeWidth={1.7} aria-hidden />
<span className="max-w-full truncate">More</span>
</button>
</nav>
);
};
export default MobileNav;

View File

@@ -3,6 +3,7 @@ import { useLocation, useNavigate } from "react-router-dom";
import { ChevronDown, Palette, Plus, Search } from "lucide-react"; import { ChevronDown, Palette, Plus, Search } from "lucide-react";
import { cmdKLabel } from "@/lib/platform"; import { cmdKLabel } from "@/lib/platform";
import { useDesignMode } from "@/lib/design-mode"; import { useDesignMode } from "@/lib/design-mode";
import { isNavItemActive } from "@/lib/nav-items";
import { HintTooltip } from "@/components/ui/hint-tooltip"; import { HintTooltip } from "@/components/ui/hint-tooltip";
import { TooltipProvider } from "@/components/ui/tooltip"; import { TooltipProvider } from "@/components/ui/tooltip";
@@ -74,10 +75,7 @@ const Sidebar = ({
const [design, setDesign] = useDesignMode(); const [design, setDesign] = useDesignMode();
const calm = design === "calm"; const calm = design === "calm";
const isActive = (item: SidebarNavItem): boolean => const isActive = (item: SidebarNavItem): boolean => isNavItemActive(item, pathname);
item.activeWhen
? item.activeWhen(pathname)
: item.match.some((p) => pathname === p || pathname.startsWith(`${p}/`));
const renderNavItem = (item: SidebarNavItem) => { const renderNavItem = (item: SidebarNavItem) => {
const active = isActive(item); const active = isActive(item);
@@ -131,7 +129,9 @@ const Sidebar = ({
<nav <nav
role="navigation" role="navigation"
aria-label="Primary" aria-label="Primary"
className="waggle-sidebar relative z-10 flex w-16 lg:w-[248px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-[var(--line-soft)] bg-[var(--bg-2)] px-2 lg:px-3 py-3.5" // Below sm the rail would take a fifth of a phone screen; MobileNav
// carries the five places there instead.
className="waggle-sidebar relative z-10 hidden w-16 sm:flex lg:w-[248px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-[var(--line-soft)] bg-[var(--bg-2)] px-2 lg:px-3 py-3.5"
> >
{/* Workspace switcher pill */} {/* Workspace switcher pill */}
<RailHint content={workspaceName ?? "Workspace"}> <RailHint content={workspaceName ?? "Workspace"}>

View File

@@ -248,7 +248,7 @@ function buildStartHereMove(briefing: HomeBriefing, wsById: Map<string, RecentWo
// ── Loading skeleton ───────────────────────────────────────────────────── // ── Loading skeleton ─────────────────────────────────────────────────────
function CockpitSkeleton() { function CockpitSkeleton() {
return ( return (
<div className="mx-auto h-full max-w-[920px] animate-pulse overflow-auto px-8 pb-20 pt-[46px]" data-testid="home-cockpit-loading"> <div className="mx-auto h-full max-w-[920px] animate-pulse overflow-auto px-4 sm:px-8 pb-20 pt-6 sm:pt-[46px]" data-testid="home-cockpit-loading">
<div className="mb-2 h-4 w-44 rounded bg-[var(--surface-2)]" /> <div className="mb-2 h-4 w-44 rounded bg-[var(--surface-2)]" />
<div className="mb-8 h-12 w-80 rounded-lg bg-[var(--surface-2)]" /> <div className="mb-8 h-12 w-80 rounded-lg bg-[var(--surface-2)]" />
<div className="mb-8 h-40 rounded-[var(--r-xl)] border border-[var(--line-soft)] bg-[var(--surface)]" /> <div className="mb-8 h-40 rounded-[var(--r-xl)] border border-[var(--line-soft)] bg-[var(--surface)]" />
@@ -264,7 +264,7 @@ function CockpitSkeleton() {
// ── First-run empty state ──────────────────────────────────────────────── // ── First-run empty state ────────────────────────────────────────────────
function FirstRunEmpty({ greeting, onCreateWorkspace }: { greeting: string; onCreateWorkspace: () => void }) { function FirstRunEmpty({ greeting, onCreateWorkspace }: { greeting: string; onCreateWorkspace: () => void }) {
return ( return (
<div className="mx-auto h-full max-w-[920px] overflow-auto px-8 pb-20 pt-[46px]" data-testid="home-cockpit-empty"> <div className="mx-auto h-full max-w-[920px] overflow-auto px-4 sm:px-8 pb-20 pt-6 sm:pt-[46px]" data-testid="home-cockpit-empty">
<h1 className="mb-1 font-display text-[clamp(28px,4vw,40px)] font-semibold leading-tight text-[var(--text)]">{greeting}</h1> <h1 className="mb-1 font-display text-[clamp(28px,4vw,40px)] font-semibold leading-tight text-[var(--text)]">{greeting}</h1>
<p className="mb-8 text-[15px] text-[var(--text-muted)]">Your AI should know how you work. Let's set up your first workspace.</p> <p className="mb-8 text-[15px] text-[var(--text-muted)]">Your AI should know how you work. Let's set up your first workspace.</p>
@@ -321,7 +321,7 @@ function GreetingHeader({
</div> </div>
{SHOW_STREAK && <StreakChip days={STREAK_DAYS} />} {SHOW_STREAK && <StreakChip days={STREAK_DAYS} />}
</div> </div>
<h1 className="font-display text-[clamp(34px,5vw,52px)] font-semibold leading-[1.04] tracking-[-0.02em] text-[var(--text)]"> <h1 className="font-display text-[clamp(28px,5vw,52px)] font-semibold leading-[1.04] tracking-[-0.02em] text-[var(--text)]">
{greeting} {greeting}
</h1> </h1>
{/* Wave F (fix 2): a RETURNING user gets their real deltas, not marketing {/* Wave F (fix 2): a RETURNING user gets their real deltas, not marketing
@@ -739,7 +739,7 @@ const HomeCockpit = ({ onContinue, onOpenWorkspaceDesktop, onCreateWorkspace, us
// distinct, non-retry message so the user understands it's an access gate. // distinct, non-retry message so the user understands it's an access gate.
if (permissionDenied) { if (permissionDenied) {
return ( return (
<div className="mx-auto h-full max-w-[920px] overflow-auto px-8 pt-[46px]" data-testid="home-cockpit-permission-denied"> <div className="mx-auto h-full max-w-[920px] overflow-auto px-4 sm:px-8 pt-6 sm:pt-[46px]" data-testid="home-cockpit-permission-denied">
<div className="flex flex-col items-center justify-center py-20 text-center"> <div className="flex flex-col items-center justify-center py-20 text-center">
<AlertTriangle className="mb-3 h-10 w-10 text-[var(--attention)]" /> <AlertTriangle className="mb-3 h-10 w-10 text-[var(--attention)]" />
<p className="mb-1 text-[15px] font-semibold text-[var(--text)]">Access not permitted</p> <p className="mb-1 text-[15px] font-semibold text-[var(--text)]">Access not permitted</p>
@@ -756,7 +756,7 @@ const HomeCockpit = ({ onContinue, onOpenWorkspaceDesktop, onCreateWorkspace, us
// than a blank screen. Offline-aware copy so local-only isn't read as a crash. // than a blank screen. Offline-aware copy so local-only isn't read as a crash.
if (loadError || !briefing) { if (loadError || !briefing) {
return ( return (
<div className="mx-auto h-full max-w-[920px] overflow-auto px-8 pt-[46px]" data-testid="home-cockpit-error"> <div className="mx-auto h-full max-w-[920px] overflow-auto px-4 sm:px-8 pt-6 sm:pt-[46px]" data-testid="home-cockpit-error">
<div className="flex flex-col items-center justify-center py-20 text-center"> <div className="flex flex-col items-center justify-center py-20 text-center">
{/* Wave Q Lane A (item 4): a calm honey-family glyph, not a red {/* Wave Q Lane A (item 4): a calm honey-family glyph, not a red
triangle — a transient briefing miss is an attention moment, not a triangle — a transient briefing miss is an attention moment, not a
@@ -844,7 +844,7 @@ const HomeCockpit = ({ onContinue, onOpenWorkspaceDesktop, onCreateWorkspace, us
const heroPendingTotal = recentWorkspaces.reduce((n, w) => n + (w.pendingCount || 0), 0); const heroPendingTotal = recentWorkspaces.reduce((n, w) => n + (w.pendingCount || 0), 0);
return ( return (
<div className="relative mx-auto h-full max-w-[920px] overflow-auto px-8 pb-20 pt-[46px]" data-testid="home-cockpit"> <div className="relative mx-auto h-full max-w-[920px] overflow-auto px-4 sm:px-8 pb-20 pt-6 sm:pt-[46px]" data-testid="home-cockpit">
{/* Pillar 3.4 — a below-attention honey "breath" behind the hero zone so {/* Pillar 3.4 — a below-attention honey "breath" behind the hero zone so
Home feels alive without competing with content. Home-only (gated here); Home feels alive without competing with content. Home-only (gated here);
reduced-motion holds a static faint radial. */} reduced-motion holds a static faint radial. */}

View File

@@ -0,0 +1,8 @@
import type { SidebarNavItem } from '@/components/os/Sidebar';
/** Whether a spine item matches the current route (Sidebar and MobileNav). */
export function isNavItemActive(item: SidebarNavItem, pathname: string): boolean {
return item.activeWhen
? item.activeWhen(pathname)
: item.match.some((p) => pathname === p || pathname.startsWith(`${p}/`));
}

View File

@@ -0,0 +1,63 @@
/**
* Below sm the sidebar rail is hidden and MobileNav carries the five places
* plus "More" (⌘K) in a bottom bar (anti-slop audit R-03).
*/
import { describe, it, expect, vi, afterEach } from 'vitest';
import { render, screen, cleanup, fireEvent } from '@testing-library/react';
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
import { Brain, Home } from 'lucide-react';
import MobileNav from '@/components/os/MobileNav';
import type { SidebarNavItem } from '@/components/os/Sidebar';
afterEach(cleanup);
const spine: SidebarNavItem[] = [
{ key: 'home', label: 'Home', icon: Home, to: '/home', match: ['/home'] },
{ key: 'memory', label: 'Memory', icon: Brain, to: '/memory', match: ['/memory'], badge: 3 },
];
function Path() {
return <span data-testid="path">{useLocation().pathname}</span>;
}
function renderNav(onOpenCommand = vi.fn()) {
render(
<MemoryRouter initialEntries={['/home']}>
<MobileNav spine={spine} onOpenCommand={onOpenCommand} />
<Routes><Route path="*" element={<Path />} /></Routes>
</MemoryRouter>,
);
return onOpenCommand;
}
describe('MobileNav', () => {
it('shows every place and More, hidden from sm up', () => {
renderNav();
const nav = screen.getByTestId('mobile-nav');
expect(nav.className).toContain('sm:hidden');
expect(screen.getByTestId('mobile-nav-home')).toHaveTextContent('Home');
expect(screen.getByTestId('mobile-nav-memory')).toHaveTextContent('Memory');
expect(screen.getByTestId('mobile-nav-more')).toHaveTextContent('More');
});
it('marks the current place and navigates to another', () => {
renderNav();
expect(screen.getByTestId('mobile-nav-home')).toHaveAttribute('aria-current', 'page');
fireEvent.click(screen.getByTestId('mobile-nav-memory'));
expect(screen.getByTestId('path')).toHaveTextContent('/memory');
expect(screen.getByTestId('mobile-nav-memory')).toHaveAttribute('aria-current', 'page');
});
it('opens the command center from More', () => {
const onOpenCommand = renderNav();
fireEvent.click(screen.getByTestId('mobile-nav-more'));
expect(onOpenCommand).toHaveBeenCalledTimes(1);
});
it('keeps every target at least 56px tall', () => {
renderNav();
for (const id of ['mobile-nav-home', 'mobile-nav-memory', 'mobile-nav-more']) {
expect(screen.getByTestId(id).className).toContain('min-h-[56px]');
}
});
});

View File

@@ -85,6 +85,7 @@ Baseline: commit `b20b138` of `git.os-dev.tech/oleg.m/waggle-os`.
| UF-054 | Settings and the status bar name different default models | Fixed | Web UI, models | | UF-054 | Settings and the status bar name different default models | Fixed | Web UI, models |
| UF-055 | Home greets the user by the assistant's name | Fixed | Sidecar, Web UI | | UF-055 | Home greets the user by the assistant's name | Fixed | Sidecar, Web UI |
| UF-056 | Home calls the last 24 hours "While you slept" | Fixed | Web UI | | UF-056 | Home calls the last 24 hours "While you slept" | Fixed | Web UI |
| UF-057 | At phone width the sidebar rail takes a fifth of the screen | Fixed | Web UI |
## Entries ## Entries
@@ -565,3 +566,12 @@ Entries UF-010 to UF-019 come from the UI audit `anti-slop/audit-001-2026-10-14.
- Cause: the summary always covers the last 24 hours, whatever the time of day, but the copy describes a night. - Cause: the summary always covers the last 24 hours, whatever the time of day, but the copy describes a night.
- What we did: the block is labelled "Last 24 hours", the story starts "In the last 24 hours, Waggle …" and the empty state reads "Nothing ran in the last 24 hours." The Dream Diary card keeps "While you slept": it shows the nightly memory run. - What we did: the block is labelled "Last 24 hours", the story starts "In the last 24 hours, Waggle …" and the empty state reads "Nothing ran in the last 24 hours." The Dream Diary card keeps "While you slept": it shows the nightly memory run.
- Recommendation: apply the same change in the main project, or pass the time of the user's last visit as `since` and word the copy for that window. - Recommendation: apply the same change in the main project, or pass the time of the user's last visit as `since` and word the copy for that window.
### UF-057. At phone width the sidebar rail takes a fifth of the screen
- Status: Fixed
- Found: 2026-10-14
- Where: at commit `b20b138`, `apps/web/src/components/os/Sidebar.tsx:126` (the rail, `w-16` at every width) and `apps/web/src/components/os/apps/HomeCockpit.tsx:324` (the Home heading, 34px minimum) with the page's `px-8` padding
- Symptom: at 375px the 64px icon rail stays on the left, there is no bottom navigation, and the Home heading wraps over five lines.
- Cause: the layout has two states, the icon rail and the full sidebar; nothing replaces the rail on a phone, and the Home heading and padding keep their desktop minimums.
- What we did: below 640px the rail is hidden and a bottom bar carries the five places plus "More", which opens ⌘K for everything else. Every target is at least 56px tall, the bar respects the safe-area inset, and the canvas stops above it. Home uses 16px side padding and a 28px minimum heading on phones. A test covers the bar.
- Recommendation: apply the same change in the main project.