mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-12 19:57:37 +00:00
feat(ui): make the core stack flow usable on mobile (#1327)
* feat(ui): make the core stack flow usable on mobile Below the md breakpoint the app collapses to a single full-width column: the stack list is full-screen, tapping a stack opens a full-screen detail with a Health / Logs / Compose segmented control (Logs first) and a back button, and a bottom tab bar switches Stacks, Fleet, Schedules, and Settings. Compose is read-only on a phone with a prompt to edit on desktop. Desktop (md and up) is unchanged: the mobile shell is gated behind a useIsMobile hook plus max-md/md variants, and the stack-detail blocks are shared with the desktop two-pane view so it renders identically. Also generalizes the unsaved-changes guard so leaving a dirty editor (back, tab bar, hamburger) prompts before discarding; adds 44px touch targets on list rows, filter chips, and actions; makes log and shell modals full-screen on mobile; and offsets toasts and the deploy pill above the bottom tab bar. * fix(ui): keep mobile nav in sync when opening views from outside the bottom bar On a phone the sidebar activity actions, the node switcher's Manage Nodes, the profile Settings entry, and the dashboard configuration links set the active view without flipping the mobile surface to content, so the user stayed on the stack list and never saw the destination. Route these through the mobile-aware navigation and settings helpers (a no-op on desktop).
This commit is contained in:
@@ -34,11 +34,14 @@ interface ModalProps {
|
||||
children: React.ReactNode;
|
||||
size?: ModalSize;
|
||||
className?: string;
|
||||
/** Pass through to DialogContent — set to false when the modal renders its own close affordance. */
|
||||
/** Pass through to DialogContent. Set to false when the modal renders its own close affordance. */
|
||||
showClose?: boolean;
|
||||
/** Fill the viewport below md (for large overlays like logs / shell). Opt-in so
|
||||
* small confirm dialogs keep their compact centered size on a phone. */
|
||||
mobileFullScreen?: boolean;
|
||||
}
|
||||
|
||||
export function Modal({ open, onOpenChange, children, size = 'md', className, showClose }: ModalProps) {
|
||||
export function Modal({ open, onOpenChange, children, size = 'md', className, showClose, mobileFullScreen }: ModalProps) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent
|
||||
@@ -47,6 +50,7 @@ export function Modal({ open, onOpenChange, children, size = 'md', className, sh
|
||||
'p-0 gap-0 overflow-hidden grid-cols-1',
|
||||
SIZE_CLASS[size],
|
||||
className,
|
||||
mobileFullScreen && 'max-md:h-[100dvh] max-md:w-screen max-md:max-w-none max-md:rounded-none max-md:border-0',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -38,9 +38,9 @@ const sheetVariants = cva(
|
||||
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
||||
bottom:
|
||||
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
||||
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
||||
left: "inset-y-0 left-0 h-full w-3/4 max-md:w-full max-md:max-w-none border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
||||
right:
|
||||
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
||||
"inset-y-0 right-0 h-full w-3/4 max-md:w-full max-md:max-w-none border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
|
||||
@@ -204,7 +204,7 @@ export function ToastContainer() {
|
||||
const visible = toasts.slice(-MAX_VISIBLE);
|
||||
|
||||
return createPortal(
|
||||
<div className="pointer-events-none fixed bottom-4 right-4 z-[200] flex w-full max-w-sm flex-col gap-2 p-4">
|
||||
<div className="pointer-events-none fixed bottom-4 right-4 z-[200] flex w-full max-w-sm flex-col gap-2 p-4 max-md:bottom-[calc(var(--sn-mobile-tabbar-h)_+_env(safe-area-inset-bottom)_+_0.75rem)]">
|
||||
<AnimatePresence mode="popLayout">
|
||||
{visible.map((t) => (
|
||||
<ToastItem key={t.id} {...t} />
|
||||
|
||||
Reference in New Issue
Block a user