mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-07 01:14:14 +00:00
e8f271f5f6
* 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).
55 lines
1.9 KiB
TypeScript
55 lines
1.9 KiB
TypeScript
import { memo, useCallback } from 'react';
|
|
import { cn } from '@/lib/utils';
|
|
import { useDeployFeedback, VERB_LABELS } from '@/context/DeployFeedbackContext';
|
|
|
|
interface DeployFeedbackPillProps {
|
|
isVisible: boolean;
|
|
onExpand: () => void;
|
|
}
|
|
|
|
function DeployFeedbackPillBase({ isVisible, onExpand }: DeployFeedbackPillProps) {
|
|
const { panelState } = useDeployFeedback();
|
|
const { stackName, action, status } = panelState;
|
|
|
|
const handleKeyDown = useCallback((e: React.KeyboardEvent) => {
|
|
if (e.key === 'Enter' || e.key === ' ') onExpand();
|
|
}, [onExpand]);
|
|
|
|
if (!isVisible) return null;
|
|
|
|
const verbLabel = VERB_LABELS[action];
|
|
|
|
const dotClass = cn(
|
|
'h-2 w-2 rounded-full shrink-0',
|
|
(status === 'preparing' || status === 'streaming') && 'bg-brand animate-pulse',
|
|
status === 'succeeded' && 'bg-success',
|
|
status === 'failed' && 'bg-destructive',
|
|
);
|
|
|
|
const textClass = cn(
|
|
'text-xs',
|
|
(status === 'preparing' || status === 'streaming') && 'text-foreground',
|
|
status === 'succeeded' && 'text-success',
|
|
status === 'failed' && 'text-destructive',
|
|
);
|
|
|
|
return (
|
|
<div
|
|
role="button"
|
|
tabIndex={0}
|
|
data-testid="deploy-feedback-pill"
|
|
onClick={onExpand}
|
|
onKeyDown={handleKeyDown}
|
|
className="fixed bottom-6 left-1/2 -translate-x-1/2 z-50 w-[280px] bg-popover/95 backdrop-blur-[10px] backdrop-saturate-[1.15] border border-glass-border rounded-full px-3 py-1.5 shadow-lg cursor-pointer flex items-center gap-2 max-md:bottom-[calc(var(--sn-mobile-tabbar-h)_+_env(safe-area-inset-bottom)_+_0.75rem)]"
|
|
>
|
|
<span className={dotClass} />
|
|
<span className={cn(textClass, 'flex items-center gap-1 min-w-0 flex-1 overflow-hidden')}>
|
|
<span className="shrink-0">{verbLabel.present}</span>
|
|
<span className="font-mono truncate">{stackName}</span>
|
|
</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export const DeployFeedbackPill = memo(DeployFeedbackPillBase);
|