Phones: a bar under the thumb, and one-tap and swipe acknowledge and snooze
Below tablet width a bottom bar holds Dashboard, Alerts (with its count), Servers and Menu. On the Alerts page an operator can acknowledge with one tap or snooze for an hour, or swipe a row right to acknowledge and left to snooze; each has an Undo, a scroll never triggers a swipe, and every swipe is also a button. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a69d0a611d
commit
939ebf8d83
8 files changed
+425
-4
No files matched your search
@@ -1,9 +1,9 @@
|
||||
import { useEffect, useRef, useState, type ReactNode } from "react";
|
||||
import { Link, NavLink, useLocation } from "react-router-dom";
|
||||
import { IconPlaneDeparture, IconKey, IconMenu2, IconSun, IconMoon, IconShieldLock, IconTool, IconChevronUp, IconLogout, IconDeviceDesktop, IconChevronsLeft, IconChevronsRight } from "@tabler/icons-react";
|
||||
import { IconLayoutDashboard, IconAlertTriangle, IconServer2, IconPlaneDeparture, IconKey, IconMenu2, IconSun, IconMoon, IconShieldLock, IconTool, IconChevronUp, IconLogout, IconDeviceDesktop, IconChevronsLeft, IconChevronsRight } from "@tabler/icons-react";
|
||||
import { api, type AwayView, type CurrentUser, type MaintenanceWindow } from "../api/client";
|
||||
import { formatDateTime } from "../utils/date";
|
||||
import { isCurrent, isGroup, visibleNav, type NavGroup } from "./nav";
|
||||
import { isCurrent, isGroup, visibleNav, type NavEntry, type NavGroup } from "./nav";
|
||||
import SidebarNav, { type NavBadge } from "./SidebarNav";
|
||||
import { initFavorites } from "../utils/favorites";
|
||||
import { initDashboardLayout } from "../utils/dashboardLayout";
|
||||
@@ -450,6 +450,37 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
{/* On a phone: the three places used most, and the menu, under the thumb (hidden from tablet width up, where the sidebar is always there). */}
|
||||
<nav className="thumb-bar" aria-label={t("Quick links")}>
|
||||
{([
|
||||
{ to: "/", label: t("Dashboard"), icon: <IconLayoutDashboard size={22} />, end: true, badge: null as string | null, level: "" },
|
||||
{ to: "/alerts", label: t("Alerts"), icon: <IconAlertTriangle size={22} />, end: false, badge: alerts ? String(alerts.count) : null, level: alerts?.level ?? "" },
|
||||
{ to: "/servers", label: t("Servers"), icon: <IconServer2 size={22} />, end: false, badge: null as string | null, level: "" },
|
||||
] as const)
|
||||
.filter((item) => item.to === "/" || item.to === "/alerts" || navHas(nav, item.to))
|
||||
.map((item) => (
|
||||
<NavLink key={item.to} to={item.to} end={item.end} className="thumb-item" onClick={() => setSidebarOpen(false)}>
|
||||
<span className="thumb-icon" aria-hidden="true">
|
||||
{item.icon}
|
||||
{item.badge && <span className={`thumb-badge ${item.level === "critical" ? "thumb-badge-critical" : ""}`}>{item.badge}</span>}
|
||||
</span>
|
||||
<span className="thumb-label">{item.label}</span>
|
||||
{item.badge && <span className="visually-hidden">{tn(Number(item.badge), "{n} active alert", "{n} active alerts")}</span>}
|
||||
</NavLink>
|
||||
))}
|
||||
<button type="button" className="thumb-item" aria-expanded={sidebarOpen} onClick={() => setSidebarOpen((open) => !open)}>
|
||||
<span className="thumb-icon" aria-hidden="true">
|
||||
<IconMenu2 size={22} />
|
||||
</span>
|
||||
<span className="thumb-label">{t("Menu")}</span>
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Whether the menu has this page for this person (a page they hid, or whose role they lack, is not there). */
|
||||
function navHas(nav: NavEntry[], path: string): boolean {
|
||||
return nav.some((entry) => (isGroup(entry) ? entry.items.some((i) => i.to === path) : entry.to === path));
|
||||
}
|
||||
Reference in new issue
Block a user