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:
@@ -22,6 +22,7 @@ import BootScreen from './BootScreen';
|
||||
import StatusBar from './StatusBar';
|
||||
import RouteTransition from './RouteTransition';
|
||||
import Sidebar, { type SidebarNavItem } from './Sidebar';
|
||||
import MobileNav from './MobileNav';
|
||||
import AppErrorBoundary from './ErrorBoundary';
|
||||
import { adapter } from '@/lib/adapter';
|
||||
import { pickUserName } from '@/lib/user-name';
|
||||
@@ -473,7 +474,9 @@ const ShellLayout = () => {
|
||||
unreadNotifications={unreadCount}
|
||||
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 +
|
||||
⌘K tile + user row; all remaining depth lives in ⌘K. */}
|
||||
<Sidebar
|
||||
@@ -502,6 +505,7 @@ const ShellLayout = () => {
|
||||
<RouteTransition />
|
||||
</main>
|
||||
</div>
|
||||
<MobileNav spine={spine} onOpenCommand={() => ov.setShowGlobalSearch(true)} />
|
||||
|
||||
{/* Overlays — Desktop.tsx:569-663 relocated; handlers retarget to
|
||||
navigate() per §1.2 / §2.2. */}
|
||||
|
||||
72
apps/web/src/components/os/MobileNav.tsx
Normal file
72
apps/web/src/components/os/MobileNav.tsx
Normal 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;
|
||||
@@ -3,6 +3,7 @@ import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { ChevronDown, Palette, Plus, Search } from "lucide-react";
|
||||
import { cmdKLabel } from "@/lib/platform";
|
||||
import { useDesignMode } from "@/lib/design-mode";
|
||||
import { isNavItemActive } from "@/lib/nav-items";
|
||||
import { HintTooltip } from "@/components/ui/hint-tooltip";
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
|
||||
@@ -74,10 +75,7 @@ const Sidebar = ({
|
||||
const [design, setDesign] = useDesignMode();
|
||||
const calm = design === "calm";
|
||||
|
||||
const isActive = (item: SidebarNavItem): boolean =>
|
||||
item.activeWhen
|
||||
? item.activeWhen(pathname)
|
||||
: item.match.some((p) => pathname === p || pathname.startsWith(`${p}/`));
|
||||
const isActive = (item: SidebarNavItem): boolean => isNavItemActive(item, pathname);
|
||||
|
||||
const renderNavItem = (item: SidebarNavItem) => {
|
||||
const active = isActive(item);
|
||||
@@ -131,7 +129,9 @@ const Sidebar = ({
|
||||
<nav
|
||||
role="navigation"
|
||||
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 */}
|
||||
<RailHint content={workspaceName ?? "Workspace"}>
|
||||
|
||||
@@ -248,7 +248,7 @@ function buildStartHereMove(briefing: HomeBriefing, wsById: Map<string, RecentWo
|
||||
// ── Loading skeleton ─────────────────────────────────────────────────────
|
||||
function CockpitSkeleton() {
|
||||
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-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)]" />
|
||||
@@ -264,7 +264,7 @@ function CockpitSkeleton() {
|
||||
// ── First-run empty state ────────────────────────────────────────────────
|
||||
function FirstRunEmpty({ greeting, onCreateWorkspace }: { greeting: string; onCreateWorkspace: () => void }) {
|
||||
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>
|
||||
<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>
|
||||
{SHOW_STREAK && <StreakChip days={STREAK_DAYS} />}
|
||||
</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}
|
||||
</h1>
|
||||
{/* 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.
|
||||
if (permissionDenied) {
|
||||
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">
|
||||
<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>
|
||||
@@ -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.
|
||||
if (loadError || !briefing) {
|
||||
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">
|
||||
{/* 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
|
||||
@@ -844,7 +844,7 @@ const HomeCockpit = ({ onContinue, onOpenWorkspaceDesktop, onCreateWorkspace, us
|
||||
const heroPendingTotal = recentWorkspaces.reduce((n, w) => n + (w.pendingCount || 0), 0);
|
||||
|
||||
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
|
||||
Home feels alive without competing with content. Home-only (gated here);
|
||||
reduced-motion holds a static faint radial. */}
|
||||
|
||||
Reference in New Issue
Block a user