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: align timeline focus order with responsive layout (#5424)
[._.]/ Adam Eivy82324e310368
diff --git a/client/src/pages/VideoTimelineEditor.jsx b/client/src/pages/VideoTimelineEditor.jsxindex e1b643f632..c91f7bbbc5 100644--- a/client/src/pages/VideoTimelineEditor.jsx+++ b/client/src/pages/VideoTimelineEditor.jsx@@ -109,6 +109,9 @@ export default function VideoTimelineEditor() {const [playing, setPlaying] = useState(false);const [muted, setMuted] = useState(false);const [renderJobId, setRenderJobId] = useState(null);+ const [isDesktop, setIsDesktop] = useState(() => (+ typeof window === 'undefined' || window.innerWidth >= 1024+ ));const [showLibrary, setShowLibrary] = useState(() => (typeof window === 'undefined' || window.innerWidth >= 1024));@@ -117,6 +120,12 @@ export default function VideoTimelineEditor() {// rename onBlur-vs-canonical comparison always-equal.const [nameDraft, setNameDraft] = useState('');+ useEffect(() => {+ const updateLayout = () => setIsDesktop(window.innerWidth >= 1024);+ window.addEventListener('resize', updateLayout);+ return () => window.removeEventListener('resize', updateLayout);+ }, []);+const videoRef = useRef(null);const lastSrcRef = useRef('');// The video.onloadedmetadata callback fires async after a src swap. Reading@@ -688,6 +697,60 @@ export default function VideoTimelineEditor() {const laneWidth = Math.max(240, total * pxPerSec);const playheadSec = Math.min(t, total);+ const libraryPanel = (+ <div className="bg-port-card/50 border border-port-border rounded-lg p-2 max-h-[600px] overflow-y-auto">+ <div className="flex gap-1 mb-2" role="tablist" aria-label="Clip library">+ {LIBRARY_TABS.map(({ id, label, Icon }) => (+ <button+ key={id}+ type="button"+ role="tab"+ aria-selected={libraryTab === id}+ onClick={() => setLibraryTab(id)}+ className={`flex-1 flex items-center justify-center gap-1 px-1.5 py-1 text-[10px] rounded ${+ libraryTab === id+ ? 'bg-port-accent/20 text-port-accent'+ : 'text-gray-400 hover:text-white border border-port-border'+ }`}+ >+ <Icon className="w-3 h-3" aria-hidden="true" /> {label}+ </button>+ ))}+ </div>++ {libraryTab === 'clips' && (libraryClips.length === 0 ? (+ <div className="text-xs text-gray-500 px-1 py-4">No clips. Generate some on the Video page.</div>+ ) : (+ <div className="grid grid-cols-1 gap-2">+ {libraryClips.map((clip) => (+ <div key={clip.id} className={usedClipIds.has(clip.id) ? 'ring-1 ring-port-accent/40 rounded-md' : ''}>+ <LibraryTile clip={clip} onAdd={addClip} />+ </div>+ ))}+ </div>+ ))}++ {libraryTab === 'stills' && (images.length === 0 ? (+ <div className="text-xs text-gray-500 px-1 py-4">No images. Generate some on the Image page.</div>+ ) : (+ <div className="grid grid-cols-1 gap-2">+ {images.map((image) => (+ <StillTile key={image.filename} image={image} onAddStill={addStill} onAddOverlay={addOverlay} />+ ))}+ </div>+ ))}++ {libraryTab === 'audio' && (musicTracks.length === 0 ? (+ <div className="text-xs text-gray-500 px-1 py-4">No audio in the shared music library.</div>+ ) : (+ <div className="grid grid-cols-1 gap-1.5">+ {musicTracks.map((track) => (+ <AudioRow key={track.filename} track={track} onAdd={addBed} />+ ))}+ </div>+ ))}+ </div>+ );return (<div className="space-y-3">@@ -758,63 +821,10 @@ export default function VideoTimelineEditor() {showLibrary ? 'lg:grid-cols-[260px_1fr_240px]' : 'lg:grid-cols-[1fr_240px]'} gap-3 min-h-[400px]`}>{/* Left rail — library */}- {showLibrary && (- <div className="order-2 lg:order-1 bg-port-card/50 border border-port-border rounded-lg p-2 max-h-[600px] overflow-y-auto">- <div className="flex gap-1 mb-2" role="tablist" aria-label="Clip library">- {LIBRARY_TABS.map(({ id, label, Icon }) => (- <button- key={id}- type="button"- role="tab"- aria-selected={libraryTab === id}- onClick={() => setLibraryTab(id)}- className={`flex-1 flex items-center justify-center gap-1 px-1.5 py-1 text-[10px] rounded ${- libraryTab === id- ? 'bg-port-accent/20 text-port-accent'- : 'text-gray-400 hover:text-white border border-port-border'- }`}- >- <Icon className="w-3 h-3" aria-hidden="true" /> {label}- </button>- ))}- </div>-- {libraryTab === 'clips' && (libraryClips.length === 0 ? (- <div className="text-xs text-gray-500 px-1 py-4">No clips. Generate some on the Video page.</div>- ) : (- <div className="grid grid-cols-1 gap-2">- {libraryClips.map((clip) => (- <div key={clip.id} className={usedClipIds.has(clip.id) ? 'ring-1 ring-port-accent/40 rounded-md' : ''}>- <LibraryTile clip={clip} onAdd={addClip} />- </div>- ))}- </div>- ))}-- {libraryTab === 'stills' && (images.length === 0 ? (- <div className="text-xs text-gray-500 px-1 py-4">No images. Generate some on the Image page.</div>- ) : (- <div className="grid grid-cols-1 gap-2">- {images.map((image) => (- <StillTile key={image.filename} image={image} onAddStill={addStill} onAddOverlay={addOverlay} />- ))}- </div>- ))}-- {libraryTab === 'audio' && (musicTracks.length === 0 ? (- <div className="text-xs text-gray-500 px-1 py-4">No audio in the shared music library.</div>- ) : (- <div className="grid grid-cols-1 gap-1.5">- {musicTracks.map((track) => (- <AudioRow key={track.filename} track={track} onAdd={addBed} />- ))}- </div>- ))}- </div>- )}+ {showLibrary && isDesktop && libraryPanel}{/* Center — preview + tracks */}- <div className="order-1 lg:order-2 space-y-3 min-w-0">+ <div className="space-y-3 min-w-0">{/* The preview adopts the CANONICAL render canvas, not a fixed 16:9box — overlay x/y/width are normalized against that canvas, so aportrait or square project would otherwise place them somewhere@@ -988,8 +998,11 @@ export default function VideoTimelineEditor() {</div></div>+ {/* On mobile the library follows the workspace in both visual and focus order. */}+ {showLibrary && !isDesktop && libraryPanel}+{/* Right rail — inspector */}- <div className="order-3 bg-port-card/50 border border-port-border rounded-lg p-3 space-y-3">+ <div className="bg-port-card/50 border border-port-border rounded-lg p-3 space-y-3"><div className="text-xs uppercase text-gray-500 tracking-wide">Inspector</div>{!selected && (diff --git a/client/src/pages/VideoTimelineEditor.test.jsx b/client/src/pages/VideoTimelineEditor.test.jsxindex b224af6043..39f77e948e 100644--- a/client/src/pages/VideoTimelineEditor.test.jsx+++ b/client/src/pages/VideoTimelineEditor.test.jsx@@ -161,21 +161,27 @@ describe('workspace layout — mobile library regression (#5424)', () => {const workspace = screen.getByRole('button', { name: 'Play' }).parentElement?.parentElement;const inspector = screen.getByText('Inspector').parentElement;expect(screen.queryByRole('tablist', { name: 'Clip library' })).not.toBeInTheDocument();- expect(workspace).toHaveClass('order-1', 'lg:order-2');- expect(inspector).toHaveClass('order-3');expect(workspace?.parentElement).toHaveClass('lg:grid-cols-[1fr_240px]');+ expect(workspace?.compareDocumentPosition(inspector) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();fireEvent.click(showLibrary);const library = screen.getByRole('tablist', { name: 'Clip library' }).parentElement;expect(screen.getByRole('button', { name: 'Hide library' })).toBeInTheDocument();- expect(library).toHaveClass('order-2', 'lg:order-1');expect(workspace?.parentElement).toHaveClass('lg:grid-cols-[260px_1fr_240px]');+ expect(workspace?.compareDocumentPosition(library) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();fireEvent.click(screen.getByRole('button', { name: 'Add to timeline' }));await waitFor(() => expect(screen.getByRole('button', { name: 'Remove A dramatic sunrise from timeline' }),).toBeInTheDocument());++ Object.defineProperty(window, 'innerWidth', { configurable: true, value: 1024 });+ fireEvent(window, new Event('resize'));+ await waitFor(() => {+ const desktopLibrary = screen.getByRole('tablist', { name: 'Clip library' }).parentElement;+ expect(desktopLibrary?.compareDocumentPosition(workspace) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();+ });});it('keeps the desktop library visible in the original left-rail order', async () => {@@ -184,9 +190,8 @@ describe('workspace layout — mobile library regression (#5424)', () => {const library = screen.getByRole('tablist', { name: 'Clip library' }).parentElement;const workspace = screen.getByRole('button', { name: 'Play' }).parentElement?.parentElement;expect(screen.getByRole('button', { name: 'Hide library' })).toBeInTheDocument();- expect(library).toHaveClass('order-2', 'lg:order-1');- expect(workspace).toHaveClass('order-1', 'lg:order-2');expect(workspace?.parentElement).toHaveClass('lg:grid-cols-[260px_1fr_240px]');+ expect(library?.compareDocumentPosition(workspace) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();fireEvent.click(screen.getByRole('button', { name: 'Hide library' }));expect(workspace?.parentElement).toHaveClass('lg:grid-cols-[1fr_240px]');