mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-06 17:08:10 +00:00
6cc66faa8c
* feat(security): reflow the node Security page for mobile Below the md breakpoint the Security page now reads as a phone surface instead of a squeezed desktop, with no change to the desktop layout. - Masthead stat cluster moves into a full-width 3-cell strip (critical / high / last scan) below the tab strip, since the masthead hides its inline cluster on a phone. - The eight-section tab strip becomes a horizontally scrollable mono row with an edge mask-fade and a cyan underline on the active tab; every section stays reachable by scroll. - The six totals render as a 3x2 hairline-divided grid instead of the 640px-wide rail that forced a horizontal scroll. - The Images tab becomes a filterable, scrollable list (severity dot, truncated ref, freshness, critical/high count tags) with a chip row, in place of the desktop table. - A freshness footer band states scan recency and scanner version. All mobile treatment is gated by useIsMobile() or max-md: utilities, so the desktop view is byte-identical. Charts are reused full-width. * feat(security): make the mobile Security page a bespoke masthead-led screen On a phone the Security page now drops the global top bar and leads with its masthead (the notifications + more-menu cluster moves into the masthead's right slot), matching Home and Fleet so the mobile shell is continuous across pages. The view is reclassified bespoke and rendered through the masthead-led path; the desktop layout is unchanged. The mobile "more" menu now lists every destination instead of omitting the bottom-tab views, so the same menu opens the same set on every screen rather than changing contents from page to page. * refactor(mobile): extract shared PageHead, sub-tabs, and chip-row primitives Add PageHead (the header for a pushed full-screen secondary view), MobileSubTabs (the mono tab scroller with the cyan active underline), and MobileChipRow (the cyan-filled filter chips) to the shared mobile-ui kit, and rewire the Security page's tab strip and Images filter to consume them. No visual change; this is the shared chrome the remaining mobile pages reuse. * feat(updates): make the mobile Updates page a bespoke masthead-led screen Below the md breakpoint the Auto-Update Readiness page becomes a pushed full-screen view: a PageHead (back chip, the rehomed notifications + more-menu, a "fleet readiness" crumb, and a Recheck action) leads, then a brand-tinted readiness hero, per-node sections, and one-up readiness cards that reuse the same risk badge, version delta, and apply/disabled logic as the desktop board. The desktop layout is unchanged. Reclassifies auto-updates as bespoke and renders it through renderMobileBespoke behind the same hub-only + capability gates as the desktop content path. Also lifts the PageHead, sub-tabs, and chip-row primitives' right-slot to host the rehomed global chrome. * feat(app-store): make the mobile App Store a bespoke masthead-led screen Below the md breakpoint the App Store becomes a pushed full-screen view: a PageHead (back chip, the rehomed notifications + more-menu, and an app-count crumb) leads, the category sidebar collapses into a horizontal chip scroller, and the featured hero plus the tile grid (already single-column on a phone) stack below. The featured hero, tile grid, and deploy sheet are shared with the desktop layout, which is unchanged. Reclassifies templates as bespoke and renders it through renderMobileBespoke. Adds tests for the shared chip row and sub-tabs. * feat(audit): make the mobile Audit Log a bespoke masthead-led screen Below the md breakpoint the Audit Log becomes a pushed full-screen view: a PageHead (back chip, the rehomed notifications + more-menu, an entry-count crumb, and Refresh) leads, then the Stream/Table sub-tabs and the stream view, where the signal-rail tiles fold to a 2x2 grid and the day-banded activity stream reflows. The columnar table reads best on a larger screen, so the Table tab points there on a phone. Desktop is unchanged. Reclassifies audit-log as bespoke behind the same hub-only + capability gates as the desktop content path. * feat(app-store): drop the featured hero and category chips on mobile On a phone the App Store is now search plus a single-column list of every matching app. The featured hero and the category chip row are removed; the would-be-featured app is folded into the list so nothing is dropped. Desktop keeps the featured hero, category sidebar, and grid. * feat(resources): make the mobile Resources page a bespoke masthead-led screen Below the md breakpoint Resources becomes a pushed full-screen view: a PageHead (back chip, the rehomed notifications + more-menu, a docker crumb) leads, then the reclaim hero, the disk-footprint segments, the 2x2 quick-clean grid, and the resource tabs. The raw resource tables scroll horizontally to fit; the detail sheets stay full-screen. The main content and the dialog/sheet overlays are shared with the desktop layout, which is unchanged. * chore(mobile): correct shared-primitive comments and dedupe the lazy fallback Fix the "shared by" consumer lists on the mobile-ui primitives, point the headerActions doc comments at the PageHead (not a masthead), drop the stale "all eight sections" count on the Security tab strip, rename a readiness-card test to match what it asserts, and extract a single Suspense fallback for the four bespoke phone-screen lazy imports. No behavior change. * feat(mobile): codify the fade+arrow tab scroller and fix the Resources tab clip Extract the horizontal tab scroller (edge fade + clickable chevron + wheel-to-horizontal) out of the stack anatomy panel into a shared ScrollableTabRow primitive, and adopt it in the stack anatomy tabs, the mobile sub-tabs (Security / Audit), and the Resources resource tabs. On a phone the Resources tabs now scroll horizontally, so the "Unmanaged" tab and its count no longer clip out of the frame. Desktop is unchanged. * feat(logs): make the mobile Logs page a bespoke masthead-led screen Below the md breakpoint the global Logs view drops the TopBar for a PageHead, hides the metrics rail, collapses the stream and level filters into a single Filters dropdown, turns the search into an icon that expands to an input, and folds the pause / clear / download controls into an expanding floating action button that retracts after each action. Desktop is unchanged. Reclassifies global-observability as bespoke behind the same hub-only gate as the desktop content path. * feat(mobile): standardize secondary pages on the status masthead Adopt the Home/Fleet/Security status masthead (cyan rail, kicker, serif- italic state word + tone dot, meta line, notifications + more-menu in the right slot) on every bespoke secondary page (Resources, App Store, Updates, Audit, Logs), replacing the title-led PageHead, which is removed. Each page derives a status word: Updates "Up to date" / "N pending", Logs Streaming / Idle / Offline, Audit Healthy / Review / Alerts, Resources Reclaimable / Tidy, App Store the app count. The "< Stacks" back chip is dropped (the bottom tab bar and more-menu own navigation), the page actions (Recheck, Refresh) move into the body, and the Updates readiness hero folds into the masthead. Also make the Resources tab tables scroll horizontally instead of clipping on the right. Desktop is unchanged. * feat(stacks): lead the mobile stack list with the status masthead On phones the stack list now opens with the shared status masthead instead of the global top bar plus an in-sidebar node row. The node switcher renders as a compact kicker chip in the masthead, the serif word summarizes stack health (down, updates, or all running), and notifications plus the more-menu sit in the right slot. This matches the Home, Fleet, and Security pages. The dropped top bar hosted global search, so the more-menu gains a Search item that opens the command palette. The masthead kicker now accepts either a styled kicker or a raw slot, enforced as a discriminated union so exactly one source is supplied. Desktop is unchanged: the new chrome is gated to the mobile shell and the sidebar rows hide via max-md only. * fix(stacks): only call the list "All running" when every stack is up The mobile stack masthead derived its health word from filterCounts, where up counts running stacks and down counts exited ones. Any other status, and the window before statuses load, counts as neither, so a list with no exited stacks but some not yet running fell through to "All running" even though it was not. Gate that label on up equal to all, and otherwise show the running count out of the total so the headline stays honest while statuses settle.
76 lines
3.1 KiB
TypeScript
76 lines
3.1 KiB
TypeScript
import { describe, it, expect, vi } from 'vitest';
|
|
import { render, screen, fireEvent } from '@testing-library/react';
|
|
import { Home, Radar, Boxes, ShieldCheck } from 'lucide-react';
|
|
import { MobileMoreMenu } from './MobileMoreMenu';
|
|
import { GlobalCommandPaletteProvider, usePaletteState } from './GlobalCommandPalette';
|
|
import type { NavItem } from './EditorLayout/hooks/useViewNavigationState';
|
|
|
|
// Includes a bottom-tab primary (dashboard) and secondary destinations; the
|
|
// menu must list every one so navigation is identical on every screen.
|
|
const navItems: NavItem[] = [
|
|
{ value: 'dashboard', label: 'Home', icon: Home },
|
|
{ value: 'fleet', label: 'Fleet', icon: Radar },
|
|
{ value: 'resources', label: 'Resources', icon: Boxes },
|
|
{ value: 'security', label: 'Security', icon: ShieldCheck },
|
|
];
|
|
|
|
function open(over: Partial<React.ComponentProps<typeof MobileMoreMenu>> = {}) {
|
|
const props: React.ComponentProps<typeof MobileMoreMenu> = {
|
|
navItems,
|
|
activeView: 'security',
|
|
onNavigate: vi.fn(),
|
|
...over,
|
|
};
|
|
// The Search item reaches the command palette via usePaletteState, so the
|
|
// menu must render inside the palette provider.
|
|
render(
|
|
<GlobalCommandPaletteProvider>
|
|
<MobileMoreMenu {...props} />
|
|
</GlobalCommandPaletteProvider>,
|
|
);
|
|
// The destination list lives inside a Sheet that is closed until the trigger
|
|
// is clicked, so open it before querying the nav buttons.
|
|
fireEvent.click(screen.getByRole('button', { name: 'More destinations' }));
|
|
return props;
|
|
}
|
|
|
|
describe('MobileMoreMenu', () => {
|
|
it('lists every nav item, including the bottom-tab primaries', () => {
|
|
open();
|
|
for (const item of navItems) {
|
|
expect(screen.getByRole('button', { name: item.label })).toBeInTheDocument();
|
|
}
|
|
});
|
|
|
|
it('navigates to the chosen destination on click', () => {
|
|
const { onNavigate } = open();
|
|
fireEvent.click(screen.getByRole('button', { name: 'Resources' }));
|
|
expect(onNavigate).toHaveBeenCalledWith('resources');
|
|
});
|
|
|
|
it('marks the active destination', () => {
|
|
open({ activeView: 'security' });
|
|
expect(screen.getByRole('button', { name: 'Security' }).className).toContain('bg-glass-highlight');
|
|
expect(screen.getByRole('button', { name: 'Resources' }).className).not.toContain('font-medium');
|
|
});
|
|
|
|
it('opens the command palette from the Search item', () => {
|
|
// The Stacks list drops the TopBar's search, so the menu's Search item is
|
|
// the way back to the palette: clicking it flips the shared palette state.
|
|
function PaletteProbe() {
|
|
const { open: paletteOpen } = usePaletteState();
|
|
return <span data-testid="palette-open">{String(paletteOpen)}</span>;
|
|
}
|
|
render(
|
|
<GlobalCommandPaletteProvider>
|
|
<PaletteProbe />
|
|
<MobileMoreMenu navItems={navItems} activeView="security" onNavigate={vi.fn()} />
|
|
</GlobalCommandPaletteProvider>,
|
|
);
|
|
fireEvent.click(screen.getByRole('button', { name: 'More destinations' }));
|
|
expect(screen.getByTestId('palette-open').textContent).toBe('false');
|
|
fireEvent.click(screen.getByRole('button', { name: 'Search' }));
|
|
expect(screen.getByTestId('palette-open').textContent).toBe('true');
|
|
});
|
|
});
|