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 layout picker dropdown within viewport on mobile
Adam Eivy1cfeababb156
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex c4443f8a74..7bb6264934 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -57,6 +57,8 @@- **Image Gen preview no longer flickers between progress and "Waiting for first preview..."** — `useImageGenProgress()` now merges progress events instead of replacing the whole state, so the throttled `currentImage` (server emits a base64 frame every ~2s while polling every 500ms) and any progress event missing `step`/`totalSteps` (some SD API states omit them) no longer cause the preview pane to revert to the empty/waiting state between frames. The hook also seeds initial progress from the `started` event (`step: 0, totalSteps: N`) so the status row shows "Step 0/N" immediately, never "Waiting for first preview..." once a render has begun. Affects both the Image Gen page and the Settings → Image Gen Test Render card. File: `client/src/hooks/useImageGenProgress.js`.+- **Dashboard layout picker dropdown no longer clips off-screen on mobile** — the layout selector menu uses `absolute right-0` to anchor its right edge to the trigger button. On a narrow viewport where the picker sits mid-row (after Server status, before Arrange/Ambient), the 224px-wide menu would extend past the left edge of the screen and cut off layout names ("ything", "us", "ning Review"). `LayoutPicker` now measures the trigger's bounding rect on open: when right-aligning would clip, it switches to `position: fixed` anchored to the viewport's right edge with an 8px margin instead. Added `max-w-[calc(100vw-1rem)]` so the menu can never exceed the viewport regardless of placement, `min-h-[40px]` on every row for the project's 40px touch-target standard, and `shrink-0` on the leading icon + trailing "Built-in" badge so they never collapse when the layout name is long. The dashboard header button row also wraps now (`flex-wrap items-center justify-end gap-2 sm:gap-3`) so on very narrow screens the controls re-flow instead of crowding into a single overflowing row. Files: `client/src/components/dashboard/LayoutPicker.jsx`, `client/src/pages/Dashboard.jsx`.+## Changed- **Command palette cleanup pass** — post-review simplify: `normalizeLabel` is exported once from `navManifest.js` and imported by `voice/tools.js` (was duplicated verbatim); `getToolMetadata(id)` added to `voice/tools.js` so `routes/palette.js` no longer reaches through the OpenAI-shaped function spec; palette manifest frozen at module load (`buildActionManifest` no longer runs per request) with `Cache-Control: private, max-age=300`. Client scorer precomputes lowercased `_label`/`_aliases`/`_keywords`/`_section` so per-keystroke fuzzy matching does zero re-lowercasing over the 117-entry manifest. `CmdKSearch.jsx` trimmed ~80 lines: collapsed the triple `useMemo` chain, merged `renderCommandRow` + inline search-result row into a single `renderRow`/`renderGroup` pair, flattened `dispatchCommand` into a `DISPATCH` lookup table, dropped the dead `running` state, removed two `.catch()` error-swallows (errors now propagate to the central toast handler per CLAUDE.md), cleared `resultRefs` on close. `ALIAS_KEYS` cached once in `resolveNavCommand`. Decorative section-banner comments and narration comments removed across the new files.diff --git a/client/src/components/dashboard/LayoutPicker.jsx b/client/src/components/dashboard/LayoutPicker.jsxindex fd8161b1a4..d2f8a29339 100644--- a/client/src/components/dashboard/LayoutPicker.jsx+++ b/client/src/components/dashboard/LayoutPicker.jsx@@ -1,9 +1,15 @@-import { useState, useRef, useEffect } from 'react';+import { useState, useRef, useEffect, useLayoutEffect } from 'react';import { LayoutGrid, Check, Pencil } from 'lucide-react';export default function LayoutPicker({ layouts, activeLayoutId, onSelect, onEdit }) {const [open, setOpen] = useState(false);+ // Computed fixed-position style applied only when right-aligning to the+ // trigger button would push the dropdown off the left edge of the+ // viewport (typical on mobile, where the picker sits mid-row). Null →+ // use the default `absolute right-0` placement.+ const [menuPos, setMenuPos] = useState(null);const ref = useRef(null);+ const btnRef = useRef(null);const active = layouts.find((l) => l.id === activeLayoutId) || layouts[0];useEffect(() => {@@ -18,9 +24,39 @@ export default function LayoutPicker({ layouts, activeLayoutId, onSelect, onEdit};}, [open]);+ useLayoutEffect(() => {+ if (!open) {+ setMenuPos(null);+ return;+ }+ const compute = () => {+ if (!btnRef.current) return;+ const rect = btnRef.current.getBoundingClientRect();+ const padding = 8;+ const desiredWidth = 224; // matches w-56+ // If aligning the dropdown's right edge with the button's right edge+ // would clip the left side, anchor it to the viewport's right edge+ // instead via fixed positioning.+ if (rect.right - desiredWidth < padding) {+ setMenuPos({+ position: 'fixed',+ top: rect.bottom + 4,+ right: padding,+ left: 'auto',+ });+ } else {+ setMenuPos(null);+ }+ };+ compute();+ window.addEventListener('resize', compute);+ return () => window.removeEventListener('resize', compute);+ }, [open]);+return (<div ref={ref} className="relative"><button+ ref={btnRef}onClick={() => setOpen((v) => !v)}className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-port-card border border-port-border hover:border-gray-600 transition-colors text-sm text-gray-300 hover:text-white min-h-[40px] focus:outline-hidden focus:ring-2 focus:ring-port-accent focus:ring-offset-2 focus:ring-offset-port-bg"title="Switch dashboard layout"@@ -35,7 +71,8 @@ export default function LayoutPicker({ layouts, activeLayoutId, onSelect, onEdit{open && (<divaria-label="Dashboard layout menu"- className="absolute right-0 mt-1 w-56 bg-port-card border border-port-border rounded-lg shadow-2xl overflow-hidden z-50"+ className={`mt-1 w-56 max-w-[calc(100vw-1rem)] bg-port-card border border-port-border rounded-lg shadow-2xl overflow-hidden z-50 ${menuPos ? '' : 'absolute right-0'}`}+ style={menuPos || undefined}><div className="py-1">{layouts.map((l) => (@@ -48,20 +85,20 @@ export default function LayoutPicker({ layouts, activeLayoutId, onSelect, onEdit// failure, swallow here to avoid unhandled rejections.Promise.resolve(onSelect(l.id)).catch(() => {});}}- className={`w-full text-left flex items-center gap-2 px-3 py-2 text-sm hover:bg-white/5 ${+ className={`w-full text-left flex items-center gap-2 px-3 py-2 text-sm hover:bg-white/5 min-h-[40px] ${l.id === activeLayoutId ? 'text-white' : 'text-gray-300'}`}>- {l.id === activeLayoutId ? <Check size={14} className="text-port-success" aria-hidden="true" /> : <span className="w-3.5" aria-hidden="true" />}+ {l.id === activeLayoutId ? <Check size={14} className="text-port-success shrink-0" aria-hidden="true" /> : <span className="w-3.5 shrink-0" aria-hidden="true" />}<span className="flex-1 truncate">{l.name}</span>- {l.builtIn && <span className="text-[10px] text-gray-500 uppercase">Built-in</span>}+ {l.builtIn && <span className="text-[10px] text-gray-500 uppercase shrink-0">Built-in</span>}</button>))}</div><div className="border-t border-port-border"><buttononClick={() => { setOpen(false); onEdit(); }}- className="w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-300 hover:bg-white/5 hover:text-white"+ className="w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-300 hover:bg-white/5 hover:text-white min-h-[40px]"><Pencil size={14} aria-hidden="true" /><span>Edit layouts…</span>diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsxindex 5d2d36ff2c..456ea2ef85 100644--- a/client/src/pages/Dashboard.jsx+++ b/client/src/pages/Dashboard.jsx@@ -236,7 +236,7 @@ export default function Dashboard() {{activeApps.length} app{activeApps.length !== 1 ? 's' : ''} registered{apps.length !== activeApps.length ? ` (${apps.length - activeApps.length} archived)` : ''}</p></div>- <div className="flex items-center gap-3">+ <div className="flex flex-wrap items-center justify-end gap-2 sm:gap-3">{health && (<div className="text-sm text-gray-500">Server: <span className="text-port-success">Online</span>