Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix(dashboard): keep widget state when rotating between portrait and landscape
Adam Eivy3d0db694ceff
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 4a4311d9d6..aab2e88bb8 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -6,6 +6,7 @@## Fixed+- **Dashboard form input no longer wipes when rotating between portrait and landscape.** `DashboardGrid` was returning two structurally different render trees on either side of the 640px breakpoint — a flat `<div className="space-y-4">` on mobile and a relative-positioned absolute-grid wrapper on desktop. Crossing the breakpoint (which happens any time you rotate an iPhone, since portrait ~390px is below it and landscape ~844px is above) put the widget at a different DOM depth, so React unmounted every widget and remounted a new one — taking any in-progress `useState` value with it. The Quick Capture text field reset to empty mid-typing. The grid now uses a single render tree across both modes, toggling only `className`/`style` between flow and absolute layouts. Widget components keep their state across rotation.- **Toast notifications and the eye-exam form no longer overflow on mobile.** The agent-feedback toast had a hard `w-[480px]` when expanded that overflowed past the right edge of a 375px viewport, and the global toast container's `max-w-[520px]` could similarly extend past the screen on narrow viewports. Both now cap at `calc(100vw - 2rem)` on mobile and switch to their full width at the `sm:` breakpoint (640px+). The eye-exam editor on MeatSpace → Body was also unusable on mobile — its `grid-cols-7` layout squeezed seven number inputs into ~42px each at 375px wide; it now reflows to two columns on mobile (with the date field full-width), four on tablet, seven on desktop.- **Image preview lightbox readable in glass-style day themes.** The MediaLightbox panel (used by Image Gen and Video Gen) inherited `--port-card-alpha: 0.6` from glass themes like Lumen Glass Day, rendering as muddy translucent grey over the modal's `bg-black/90` overlay. Combined with the existing tinted action buttons (`bg-port-accent/20 text-port-accent`), the Remix and Send to Video buttons became nearly invisible. The panel now pins `--port-card-alpha` and `--port-border-alpha` to 1 within the lightbox scope so it renders solid in any theme, and the action buttons switched from translucent-tint to solid-fill (`bg-port-accent text-white`, `bg-port-success text-white`) for high contrast across all day and night themes.diff --git a/client/src/components/dashboard/DashboardGrid.jsx b/client/src/components/dashboard/DashboardGrid.jsxindex 88f836dbf7..cd52f9f97e 100644--- a/client/src/components/dashboard/DashboardGrid.jsx+++ b/client/src/components/dashboard/DashboardGrid.jsx@@ -250,45 +250,36 @@ export default function DashboardGrid({ items, editable, onChange, renderItem })// eslint-disable-next-line react-hooks/exhaustive-deps}, [dragGhost ? 'active' : 'idle', items, onChange, containerWidth]);- // Mobile fallback: stack widgets full-width in source order. Uses CSS flow- // (no absolute positioning) so the layout adapts to widget content height.- if (isMobile) {- return (- <div ref={containerRef} className="space-y-4">- {items.map((item) => (- <div key={item.id} className="w-full">- {renderItem(item)}- </div>- ))}- </div>- );- }-- const colWidth = getColWidth(containerWidth);+ // Single render tree across mobile and desktop — only the className/style+ // toggle. If we returned a different JSX shape per mode (separate mobile+ // branch with shallower wrappers), React would unmount every widget on the+ // breakpoint cross, wiping in-progress form input. Rotating an iPhone from+ // portrait (~390px) to landscape (~844px) crosses MOBILE_BREAKPOINT_PX, so+ // structural divergence here = "my Quick Capture text vanished when I+ // rotated." Keep the wrapper depth identical and let CSS handle the rest.+ const colWidth = isMobile ? 0 : getColWidth(containerWidth);+ const showDragHandles = editable && !isMobile && containerWidth > 0;return (<divref={containerRef}- className="relative w-full"- style={{ height: containerWidth ? containerHeight : 'auto', minHeight: '4rem' }}+ className={isMobile ? 'space-y-4' : 'relative w-full'}+ style={isMobile ? undefined : { height: containerWidth ? containerHeight : 'auto', minHeight: '4rem' }}>{items.map((item) => {- const isDragging = dragGhost?.id === item.id;- const renderRect = rectFor(item, colWidth);+ const isDragging = !isMobile && dragGhost?.id === item.id;+ const itemStyle = isMobile ? undefined : rectFor(item, colWidth);+ const itemClass = isMobile+ ? 'w-full'+ : `absolute ${isDragging ? 'opacity-40' : ''} ${dragGhost ? '' : 'transition-[left,top,width,height] duration-150'}`;+ const innerClass = isMobile+ ? 'relative'+ : `relative w-full h-full overflow-hidden rounded-xl ${editable ? 'ring-1 ring-port-border' : ''}`;return (- <div- key={item.id}- className={`absolute ${isDragging ? 'opacity-40' : ''} ${dragGhost ? '' : 'transition-[left,top,width,height] duration-150'}`}- style={{- left: renderRect.left,- top: renderRect.top,- width: renderRect.width,- height: renderRect.height,- }}- >- <div className={`relative w-full h-full overflow-hidden rounded-xl ${editable ? 'ring-1 ring-port-border' : ''}`}>+ <div key={item.id} className={itemClass} style={itemStyle}>+ <div className={innerClass}>{renderItem(item)}- {editable && containerWidth > 0 && (+ {showDragHandles && (<><DragHandlekind="move" item={item} icon={GripVertical} onStart={startDrag}@@ -308,7 +299,7 @@ export default function DashboardGrid({ items, editable, onChange, renderItem }){/* Drop preview during drag — outline showing where the item willland after snap. Pointer-events:none so it never intercepts thegesture. */}- {dragGhost && containerWidth > 0 && (+ {!isMobile && dragGhost && containerWidth > 0 && (<divclassName="absolute pointer-events-none border-2 border-dashed border-port-accent rounded-xl bg-port-accent/10 z-30"style={rectFor(dragGhost, colWidth)}